mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-18 16:20:31 +01:00
Avoid potential call to GetProcAddress with 0 for HMODULE
Found by VS code analyser git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6394 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
c0f5b839a0
commit
3eee408cac
@ -1529,7 +1529,6 @@ typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
|
|||||||
void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
||||||
{
|
{
|
||||||
OSVERSIONINFOEX osvi;
|
OSVERSIONINFOEX osvi;
|
||||||
PGPI pGPI;
|
|
||||||
BOOL bOsVersionInfoEx;
|
BOOL bOsVersionInfoEx;
|
||||||
|
|
||||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||||
@ -1581,9 +1580,14 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
|||||||
{
|
{
|
||||||
if (osvi.dwMajorVersion == 6)
|
if (osvi.dwMajorVersion == 6)
|
||||||
{
|
{
|
||||||
DWORD dwType;
|
DWORD dwType = PRODUCT_UNDEFINED;
|
||||||
pGPI = (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo");
|
HMODULE hmKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
|
||||||
|
if ( hmKernel32 )
|
||||||
|
{
|
||||||
|
PGPI pGPI = (PGPI)GetProcAddress(hmKernel32, "GetProductInfo");
|
||||||
|
if ( pGPI )
|
||||||
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
|
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
|
||||||
|
}
|
||||||
|
|
||||||
switch (dwType)
|
switch (dwType)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user