You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If we tried spitting out escape codes in a terminal that doesn't support it, it would look like unreadable garbage,
69
73
// and that's probably not very pleasant to the user. This is very rare and I have yet to encounter a terminal that doesn't support it,
70
74
// but I'm sure there's someone out there using some ANCIENT old version of Windows that doesn't support it, and we want to support this for all versions.
71
-
// Who knows, I might even test this on windows XP hahahahahaha...
75
+
/**
76
+
* @brief Enables the SeDebugPrivilege (debug privilege) on the current process token.
77
+
*
78
+
* Tries to adjust the calling process token to include the SE_DEBUG_NAME privilege so the process can perform debug-level operations on other processes.
79
+
*
80
+
* @return true if the privilege was successfully enabled, false if any step (opening the token, looking up the privilege, or adjusting token privileges) failed.
81
+
*/
72
82
73
83
boolEnableDebugPrivilege() {
74
84
HANDLE hToken;
@@ -133,7 +143,16 @@ BOOL IsProcessElevated()
133
143
}
134
144
// The above function is taken from https://vimalshekar.github.io/codesamples/Checking-If-Admin , modified to use C++
135
145
// style I/O instead of printf like the original code.
136
-
// Thanks!
146
+
/**
147
+
* @brief Converts a UTF-16 wide string to a UTF-8 encoded std::string.
148
+
*
149
+
* Converts the given Windows-style wide string (UTF-16) into a UTF-8 encoded
150
+
* std::string suitable for use with standard C++ and UTF-8 APIs. Returns an
151
+
* empty string when the input is empty.
152
+
*
153
+
* @param wstr Wide string (UTF-16) to convert.
154
+
* @return std::string UTF-8 encoded representation of `wstr`.
// The above stupid function is to convert wide strings (used by Windows API) to normal strings (used by C++ standard library) because cout chokes on wide strings.
164
+
/**
165
+
* @brief Retrieve a process's creation timestamp as a raw Windows FILETIME value.
166
+
*
167
+
* Obtains the creation time for the process identified by `pid` and returns it as
168
+
* a 64-bit FILETIME value (number of 100-nanosecond intervals since January 1, 1601 UTC).
169
+
*
170
+
* @param pid Process identifier (PID) of the target process.
171
+
* @return ULONGLONG The process creation time as a FILETIME quad-part value, or `0` if the time cannot be obtained (e.g., process cannot be opened or the API call fails).
0 commit comments