diff options
author | George Hazan <ghazan@miranda.im> | 2019-05-27 16:21:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-05-27 16:21:17 +0300 |
commit | 189f6be24f11066a3c711b783cf98f79f703e3a5 (patch) | |
tree | 3acf7a0cf990f574d9edb0f8045b605d8e3ec024 /plugins/Variables/src | |
parent | e3179c1ef509482ff9b4c7d4fb89d0b208e84000 (diff) |
as well as calls of GetVersionEx should be removed
Diffstat (limited to 'plugins/Variables/src')
-rw-r--r-- | plugins/Variables/src/enumprocs.cpp | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/plugins/Variables/src/enumprocs.cpp b/plugins/Variables/src/enumprocs.cpp index ebe665c817..52b9c0ad83 100644 --- a/plugins/Variables/src/enumprocs.cpp +++ b/plugins/Variables/src/enumprocs.cpp @@ -41,35 +41,26 @@ struct EnumInfoStruct BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam)
{
- // Retrieve the OS version
- OSVERSIONINFO osver;
- osver.dwOSVersionInfoSize = sizeof(osver);
- if (!GetVersionEx(&osver))
+ // Get a handle to a Toolhelp snapshot of all processes.
+ HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if (hSnapShot == INVALID_HANDLE_VALUE)
return FALSE;
- if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || (osver.dwPlatformId == VER_PLATFORM_WIN32_NT && osver.dwMajorVersion > 4)) {
- // Get a handle to a Toolhelp snapshot of all processes.
- HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
- if (hSnapShot == INVALID_HANDLE_VALUE)
- return FALSE;
+ // Get the first process' information.
+ PROCESSENTRY32 procentry;
+ procentry.dwSize = sizeof(PROCESSENTRY32);
+ BOOL bFlag = Process32First(hSnapShot, &procentry);
- // Get the first process' information.
- PROCESSENTRY32 procentry;
- procentry.dwSize = sizeof(PROCESSENTRY32);
- BOOL bFlag = Process32First(hSnapShot, &procentry);
+ // While there are processes, keep looping.
+ while (bFlag) {
+ // Call the enum func with the filename and ProcID.
+ if (lpProc(procentry.th32ProcessID, 0, (char *)procentry.szExeFile, lParam)) {
+ procentry.dwSize = sizeof(PROCESSENTRY32);
+ bFlag = Process32Next(hSnapShot, &procentry);
- // While there are processes, keep looping.
- while (bFlag) {
- // Call the enum func with the filename and ProcID.
- if (lpProc(procentry.th32ProcessID, 0, (char *)procentry.szExeFile, lParam)) {
- procentry.dwSize = sizeof(PROCESSENTRY32);
- bFlag = Process32Next(hSnapShot, &procentry);
-
- }
- else bFlag = FALSE;
}
+ else bFlag = FALSE;
}
- else return FALSE;
return TRUE;
}
|