Fix code analysis warnings

This commit is contained in:
momo5502 2016-08-31 02:00:01 +02:00
parent 2d32d44da2
commit 8d2d825be6
4 changed files with 36 additions and 14 deletions

View File

@ -136,18 +136,25 @@ namespace Components
static uint8_t loadLibWStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xA8 }; // LoadLibraryW static uint8_t loadLibWStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xA8 }; // LoadLibraryW
HMODULE kernel32 = GetModuleHandleA(Utils::String::XOR(std::string(reinterpret_cast<char*>(kernel32Str), sizeof kernel32Str), -1).data()); HMODULE kernel32 = GetModuleHandleA(Utils::String::XOR(std::string(reinterpret_cast<char*>(kernel32Str), sizeof kernel32Str), -1).data());
FARPROC loadLibA = GetProcAddress(kernel32, Utils::String::XOR(std::string(reinterpret_cast<char*>(loadLibAStr), sizeof loadLibAStr), -1).data());
FARPROC loadLibW = GetProcAddress(kernel32, Utils::String::XOR(std::string(reinterpret_cast<char*>(loadLibWStr), sizeof loadLibWStr), -1).data());
if (kernel32)
{
FARPROC loadLibA = GetProcAddress(kernel32, Utils::String::XOR(std::string(reinterpret_cast<char*>(loadLibAStr), sizeof loadLibAStr), -1).data());
FARPROC loadLibW = GetProcAddress(kernel32, Utils::String::XOR(std::string(reinterpret_cast<char*>(loadLibWStr), sizeof loadLibWStr), -1).data());
if (loadLibA && loadLibW)
{
#ifdef DEBUG_LOAD_LIBRARY #ifdef DEBUG_LOAD_LIBRARY
AntiCheat::LoadLibHook[0].Initialize(loadLibA, LoadLibaryAStub, HOOK_JUMP); AntiCheat::LoadLibHook[0].Initialize(loadLibA, LoadLibaryAStub, HOOK_JUMP);
AntiCheat::LoadLibHook[1].Initialize(loadLibW, LoadLibaryWStub, HOOK_JUMP); AntiCheat::LoadLibHook[1].Initialize(loadLibW, LoadLibaryWStub, HOOK_JUMP);
#else #else
AntiCheat::LoadLibHook[0].Initialize(loadLibA, loadLibStub, HOOK_JUMP); AntiCheat::LoadLibHook[0].Initialize(loadLibA, loadLibStub, HOOK_JUMP);
AntiCheat::LoadLibHook[1].Initialize(loadLibW, loadLibStub, HOOK_JUMP); AntiCheat::LoadLibHook[1].Initialize(loadLibW, loadLibStub, HOOK_JUMP);
#endif #endif
//AntiCheat::LoadLibHook[2].Initialize(LoadLibraryExA, loadLibExStub, HOOK_JUMP); //AntiCheat::LoadLibHook[2].Initialize(LoadLibraryExA, loadLibExStub, HOOK_JUMP);
//AntiCheat::LoadLibHook[3].Initialize(LoadLibraryExW, loadLibExStub, HOOK_JUMP); //AntiCheat::LoadLibHook[3].Initialize(LoadLibraryExW, loadLibExStub, HOOK_JUMP);
}
}
} }
void AntiCheat::ReadIntegrityCheck() void AntiCheat::ReadIntegrityCheck()

View File

@ -53,6 +53,16 @@ namespace Components
CreateProcessA("updater.exe", NULL, NULL, NULL, false, CREATE_NO_WINDOW, NULL, NULL, &sInfo, &pInfo); CreateProcessA("updater.exe", NULL, NULL, NULL, false, CREATE_NO_WINDOW, NULL, NULL, &sInfo, &pInfo);
if (pInfo.hThread && pInfo.hThread != INVALID_HANDLE_VALUE)
{
CloseHandle(pInfo.hThread);
}
if (pInfo.hProcess && pInfo.hProcess != INVALID_HANDLE_VALUE)
{
CloseHandle(pInfo.hProcess);
}
TerminateProcess(GetCurrentProcess(), exitCode); TerminateProcess(GetCurrentProcess(), exitCode);
} }

View File

@ -20,7 +20,7 @@ namespace Utils
} }
else else
{ {
for (unsigned int i = (this->TokenString.size() - 1); i >= 0; i--) for (int i = static_cast<int>(this->TokenString.size() - 1); i >= 0; i--)
{ {
if (this->TokenString[i] == 0xFF) if (this->TokenString[i] == 0xFF)
{ {

View File

@ -159,12 +159,17 @@ namespace Utils
{ {
// Generate UUID data // Generate UUID data
UUID uuid; UUID uuid;
UuidCreate(&uuid); if (!UuidCreate(&uuid))
{
// Convert to string representation
char* strdata = nullptr;
if (!UuidToStringA(&uuid, reinterpret_cast<RPC_CSTR*>(&strdata)))
{
return std::string(strdata);
}
}
// Convert to string representation return "";
char* strdata = nullptr;
UuidToStringA(&uuid, reinterpret_cast<RPC_CSTR*>(&strdata));
return std::string(strdata);
} }
} }
} }