[HH] Check LoadLibrary and GetProcAddress return value (#6082)

Handle failure cases.
This commit is contained in:
Thamatip Chitpong 2023-12-03 08:15:08 +07:00 committed by GitHub
parent d795021a75
commit 9ea2222967
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,11 +15,14 @@ WinMain(HINSTANCE hInst,
int ret = -1;
hModule = LoadLibraryA("hhctrl.ocx");
doWinMain = (DOWINMAIN*) GetProcAddress(hModule, "doWinMain");
if (hModule)
{
doWinMain = (DOWINMAIN*)GetProcAddress(hModule, "doWinMain");
if (doWinMain)
ret = doWinMain(hInst, cmdline);
ret = doWinMain(hInst, cmdline);
FreeLibrary(hModule);
FreeLibrary(hModule);
}
return ret;
}