[misc] fix various Coverity issues

* update DLL load/unload
* fix resources not being freed and potentially unsafe calls
* add extra checks
This commit is contained in:
Pete Batard 2014-05-09 22:05:25 +01:00
parent 9aa308213d
commit 266599e6fd
12 changed files with 68 additions and 36 deletions

View file

@ -39,7 +39,7 @@ BOOL is_x64(void)
// Detect if we're running a 32 or 64 bit system
if (sizeof(uintptr_t) < 8) {
pIsWow64Process = (BOOL (__stdcall *)(HANDLE, PBOOL))
GetProcAddress(GetModuleHandleA("KERNEL32"), "IsWow64Process");
GetProcAddress(GetDLLHandle("KERNEL32"), "IsWow64Process");
if (pIsWow64Process != NULL) {
(*pIsWow64Process)(GetCurrentProcess(), &ret);
}