diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-06 21:13:00 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-06 21:13:00 +0000 |
commit | a8deb4ad5586a2b6a90957a610ad64c8e10e95f1 (patch) | |
tree | a157d0d35c9cbca914923fa3cd3e73076c9ea4c7 /protocols/Xfire/src/tools.cpp | |
parent | 1b8647da361135909e3c8f459d8aaffc2475818f (diff) |
XFire:
- fix for a typo in r12294 (thx White-Tiger)
- fixed memory leaks
- minor other fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@14032 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire/src/tools.cpp')
-rw-r--r-- | protocols/Xfire/src/tools.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index ad982108b6..e499fab901 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -766,8 +766,9 @@ BOOL checkCommandLine(HANDLE hProcess, char * mustcontain, char * mustnotcontain char * buffer2; PPEB peb = NULL; PPROCESS_PARAMETERS proc_params = NULL; - PVOID UserPool = (PVOID)LocalAlloc(LPTR, 8192); + HLOCAL UserPool = LocalAlloc(LPTR, 8192); PROCESS_BASIC_INFORMATION ProcessInfo; + HMODULE hNt = GetModuleHandle(_T("ntdll.dll")); //strings leer abbruch if (!mustcontain&&!mustnotcontain) @@ -776,17 +777,19 @@ BOOL checkCommandLine(HANDLE hProcess, char * mustcontain, char * mustnotcontain //prüfe und lade nötige funktionen if (_ZwQueryInformationProcess == NULL) { - _ZwQueryInformationProcess = (pZwQueryInformationProcess)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "ZwQueryInformationProcess"); + _ZwQueryInformationProcess = (pZwQueryInformationProcess)GetProcAddress(hNt, "ZwQueryInformationProcess"); if (_ZwQueryInformationProcess == NULL) { + LocalFree(UserPool); return TRUE; } } if (_ZwReadVirtualMemory == NULL) { - _ZwReadVirtualMemory = (pZwReadVirtualMemory)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "ZwReadVirtualMemory"); + _ZwReadVirtualMemory = (pZwReadVirtualMemory)GetProcAddress(hNt, "ZwReadVirtualMemory"); if (_ZwReadVirtualMemory == NULL) { + LocalFree(UserPool); return TRUE; } } @@ -839,24 +842,21 @@ BOOL checkCommandLine(HANDLE hProcess, char * mustcontain, char * mustnotcontain //lowercase mustcontain/mustnotcontain if (mustcontain) for (unsigned int i = 0; i < mir_strlen(mustcontain); i++) - { - mustcontain[i] = tolower(mustcontain[i]); - } + mustcontain[i] = tolower(mustcontain[i]); + if (mustnotcontain) for (unsigned int i = 0; i < mir_strlen(mustnotcontain); i++) - { - mustnotcontain[i] = tolower(mustnotcontain[i]); - } + mustnotcontain[i] = tolower(mustnotcontain[i]); string cmdline = buffer2; if (mustcontain) if (cmdline.find(mustcontain) != string::npos) { - delete[] buffer; - delete[] buffer2; - LocalFree(UserPool); - return TRUE; + delete[] buffer; + delete[] buffer2; + LocalFree(UserPool); + return TRUE; } else { |