|
9 | 9 | #define MAX_CHARACTERS 12024 |
10 | 10 | static char char_pool[MAX_CHARACTERS]; |
11 | 11 | static int pool_offset; |
| 12 | +static int show_used_space = 1; |
12 | 13 |
|
13 | 14 | typedef struct _PCI_SLOT_NUMBER |
14 | 15 | { |
@@ -53,6 +54,14 @@ static void callback_stub(void) |
53 | 54 | { |
54 | 55 | } |
55 | 56 |
|
| 57 | +static void toggle_space_display(void) |
| 58 | +{ |
| 59 | + show_used_space = !show_used_space; |
| 60 | + WaitForSingleObject(text_render_mutex, INFINITE); |
| 61 | + update_system_info(); |
| 62 | + ReleaseMutex(text_render_mutex); |
| 63 | +} |
| 64 | + |
56 | 65 | static void update_system_info(void) |
57 | 66 | { |
58 | 67 | int line = 0; |
@@ -82,11 +91,20 @@ static void update_system_info(void) |
82 | 91 | if (GetDiskFreeSpaceEx(drive_letters[i], &bytes_available, &total_bytes, NULL)) { |
83 | 92 | ULONGLONG total_mib = total_bytes.QuadPart / 1024ULL; |
84 | 93 | ULONGLONG mib_available = bytes_available.QuadPart / 1024ULL; |
| 94 | + ULONGLONG mib_used = total_mib - mib_available; |
85 | 95 | ULONGLONG percent_free = (mib_available * 100ULL) / total_mib; |
86 | | - push_line(line++, callback_stub, " %c: %llu / %llu MiB (%llu%%)", drive_letters[i][0], mib_available, total_mib, percent_free); |
| 96 | + ULONGLONG percent_used = 100 - percent_free; |
| 97 | + |
| 98 | + if (show_used_space) { |
| 99 | + push_line(line++, callback_stub, " %c: %llu / %llu MiB (%llu%% used)", drive_letters[i][0], mib_used, total_mib, percent_used); |
| 100 | + } else { |
| 101 | + push_line(line++, callback_stub, " %c: %llu / %llu MiB (%llu%% available)", drive_letters[i][0], mib_available, total_mib, percent_free); |
| 102 | + } |
87 | 103 | } |
88 | 104 | } |
89 | 105 |
|
| 106 | + push_line(line++, toggle_space_display, show_used_space ? "Press A to show Available Space" : "Press A to show Used Space"); |
| 107 | + |
90 | 108 | // Active encoder |
91 | 109 | static const char *encoder_string = NULL; |
92 | 110 | ULONG encoder_check; |
|
0 commit comments