[SETUPAPI] Add missing NULL parameter checks in SetupOpenInfFileW and SetupDiGetINFClassW (#7573)

Based on PR #5673, ROSTESTS-388

Co-authored-by: Katayama Hirofumi MZ <[email protected]>
This commit is contained in:
Hermès Bélusca-Maïto
2025-03-25 17:41:23 +01:00
co-authored by Katayama Hirofumi MZ
parent 5ec739bf2e
commit 48beb0433e
+13
View File
@@ -1235,11 +1235,18 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
TRACE("%s %s %lx %p\n", debugstr_w(name), debugstr_w(class), style, error);
#ifdef __REACTOS__
if (style & ~(INF_STYLE_OLDNT | INF_STYLE_WIN4))
{
SetLastError(ERROR_INVALID_PARAMETER);
return (HINF)INVALID_HANDLE_VALUE;
}
if (!name)
{
SetLastError(ERROR_INVALID_PARAMETER);
return (HINF)INVALID_HANDLE_VALUE;
}
#endif // __REACTOS__
if (strchrW( name, '\\' ) || strchrW( name, '/' ))
{
@@ -2326,6 +2333,12 @@ SetupDiGetINFClassW(
TRACE("%s %p %p %ld %p\n", debugstr_w(InfName), ClassGuid,
ClassName, ClassNameSize, RequiredSize);
if (!InfName || !ClassGuid || !ClassName || ClassNameSize == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Open .inf file */
hInf = SetupOpenInfFileW(InfName, NULL, INF_STYLE_WIN4, NULL);
if (hInf == INVALID_HANDLE_VALUE)