From bcc0a11ca4751555899ea333c05d1c5b695f379e Mon Sep 17 00:00:00 2001 From: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com> Date: Fri, 6 Feb 2026 09:54:04 -0500 Subject: [PATCH 1/5] feat: Add RAM Usage entry using psapi.h windows API --- main.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/main.cpp b/main.cpp index b82d8d1..d43e0c7 100644 --- a/main.cpp +++ b/main.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #define windows_time_to_unix_epoch(x) ((x) - 116444736000000000LL) / 10000000LL // The above macro converts Windows FILETIME to Unix epoch time in seconds. @@ -1794,6 +1795,7 @@ void PIDinspect(DWORD pid) { // ooh guys look i'm in the void std::cout << "Command: " << command << std::endl; } std::string workdir = GetWorkingDir(hProcess); + if (IsVirtualTerminalModeEnabled()) { @@ -1801,6 +1803,31 @@ void PIDinspect(DWORD pid) { // ooh guys look i'm in the void } else { std::cout << "Working Directory: " << workdir << std::endl; } + + // to get memory usage, + // we have to use psapi.h + // the metric we want is WorkingSetSize because the api spits out a bunch of other metrics we don't need + // hopefully this doesn't tank performance for yet another api call + // the command and working dir don't affect it because PEB walks take like 5 ms idk + // reference: https://learn.microsoft.com/en-us/windows/win32/psapi/collecting-memory-usage-information-for-a-process + + PROCESS_MEMORY_COUNTERS pmc;' + if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) ) { + // in the original snippet from windows + // THE BRACKET IS AFTER THE IF IN THE LINE DOWN + // i can't be talking about code organization but MICROSOFT WHAT + + if (IsVirtualTerminalModeEnabled()) { + std::cout << "\033[1;32mRAM Usage\033[0m: " << pmc.WorkingSetSize << std::endl; + // I know RAM is technically a "nerdy tech term" or whatever and it'd be more logical + // to say "memory" but I feel like at this point everyone knows what RAM means + // especially with the RAM shortage, it should be ingrained in their brains + + } else { + std::cout << "RAM Usage: " << pmc.WorkingSetSize << std::endl; + } + + @@ -1817,6 +1844,7 @@ void PIDinspect(DWORD pid) { // ooh guys look i'm in the void std::cout << "\nWhy It Exists:\n"; } PrintAncestry(pid); + if (IsVirtualTerminalModeEnabled()) { std::cout << "\n\033[1;35mStarted:\033[0m " << GetReadableFileTime(pid) << std::endl; From 267924bf6c59442aa1f9c817eb7a0dfa652bc0f5 Mon Sep 17 00:00:00 2001 From: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com> Date: Fri, 6 Feb 2026 09:55:19 -0500 Subject: [PATCH 2/5] fix: Fix syntax error due to misplaced apostrophe --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index d43e0c7..1491b41 100644 --- a/main.cpp +++ b/main.cpp @@ -1811,7 +1811,7 @@ void PIDinspect(DWORD pid) { // ooh guys look i'm in the void // the command and working dir don't affect it because PEB walks take like 5 ms idk // reference: https://learn.microsoft.com/en-us/windows/win32/psapi/collecting-memory-usage-information-for-a-process - PROCESS_MEMORY_COUNTERS pmc;' + PROCESS_MEMORY_COUNTERS pmc; if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) ) { // in the original snippet from windows // THE BRACKET IS AFTER THE IF IN THE LINE DOWN From db284d3ab93594cfe619e2b92958e5a0351a8d88 Mon Sep 17 00:00:00 2001 From: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com> Date: Fri, 6 Feb 2026 09:56:23 -0500 Subject: [PATCH 3/5] fix: Add missing bracket to RAM usage if --- main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cpp b/main.cpp index 1491b41..a388caa 100644 --- a/main.cpp +++ b/main.cpp @@ -1826,6 +1826,7 @@ void PIDinspect(DWORD pid) { // ooh guys look i'm in the void } else { std::cout << "RAM Usage: " << pmc.WorkingSetSize << std::endl; } + } From 063d4da2a76ba013cea2ead20e07e0aa1e96e92c Mon Sep 17 00:00:00 2001 From: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:24:20 -0500 Subject: [PATCH 4/5] feat: add byte formatting b kb mb gb tb --- main.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index a388caa..a941471 100644 --- a/main.cpp +++ b/main.cpp @@ -1816,9 +1816,34 @@ void PIDinspect(DWORD pid) { // ooh guys look i'm in the void // in the original snippet from windows // THE BRACKET IS AFTER THE IF IN THE LINE DOWN // i can't be talking about code organization but MICROSOFT WHAT - + size_t RAM = pmc.WorkingSetSize; //should be fine for this, unless you have like 10 exabytes of RAM for a single process somehow + +std::string FRAM = ""; // fram means formatted ram, i'm so creative at var naming + if (RAM < 1000) { + // if less than 1000 bytes (which is a kilobyte) then just return bytes + FRAM = std::to_string(RAM) + " B"; + } + else if (RAM < 1000 * 1000) { + + FRAM = std::to_string(RAM / 1000) + " KB"; + } + else if (RAM < 1000 * 1000 * 1000) { + + FRAM = std::to_string(RAM /( 1000 * 1000)) + " MB"; + } + else if (RAM < 1000 * 1000 * 1000 * 1000) { + FRAM = std::to_string(RAM /( 1000 * 1000 * 1000)) + " GB"; + } + else { + FRAM = std::to_string(RAM /( 1000 * 1000 * 1000 * 1000)) + " TB"; + // if someone actually reaches this i'm concerned + } + + + + if (IsVirtualTerminalModeEnabled()) { - std::cout << "\033[1;32mRAM Usage\033[0m: " << pmc.WorkingSetSize << std::endl; + std::cout << "\033[1;32mRAM Usage\033[0m: " << FRAM << std::endl; // I know RAM is technically a "nerdy tech term" or whatever and it'd be more logical // to say "memory" but I feel like at this point everyone knows what RAM means // especially with the RAM shortage, it should be ingrained in their brains From b17f34fd898203161e6c35ef25418bbe14bb542d Mon Sep 17 00:00:00 2001 From: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:46:18 -0500 Subject: [PATCH 5/5] Fix: Make non-ansi path display correctly and fix int overflow error by using unsigned long long --- main.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index a941471..627c3f2 100644 --- a/main.cpp +++ b/main.cpp @@ -1823,19 +1823,19 @@ std::string FRAM = ""; // fram means formatted ram, i'm so creative at var namin // if less than 1000 bytes (which is a kilobyte) then just return bytes FRAM = std::to_string(RAM) + " B"; } - else if (RAM < 1000 * 1000) { + else if (RAM < 1000ULL * 1000) { FRAM = std::to_string(RAM / 1000) + " KB"; } - else if (RAM < 1000 * 1000 * 1000) { + else if (RAM < 1000ULL * 1000 * 1000) { - FRAM = std::to_string(RAM /( 1000 * 1000)) + " MB"; + FRAM = std::to_string(RAM /( 1000ULL * 1000)) + " MB"; } - else if (RAM < 1000 * 1000 * 1000 * 1000) { - FRAM = std::to_string(RAM /( 1000 * 1000 * 1000)) + " GB"; + else if (RAM < 1000ULL * 1000 * 1000 * 1000) { + FRAM = std::to_string(RAM /( 1000ULL * 1000 * 1000)) + " GB"; } else { - FRAM = std::to_string(RAM /( 1000 * 1000 * 1000 * 1000)) + " TB"; + FRAM = std::to_string(RAM /( 1000ULL * 1000 * 1000 * 1000)) + " TB"; // if someone actually reaches this i'm concerned } @@ -1849,7 +1849,7 @@ std::string FRAM = ""; // fram means formatted ram, i'm so creative at var namin // especially with the RAM shortage, it should be ingrained in their brains } else { - std::cout << "RAM Usage: " << pmc.WorkingSetSize << std::endl; + std::cout << "RAM Usage: " << FRAM << std::endl; } }