setupapi: Improve parameter checking in SetupDiInstallClass.

This commit is contained in:
Juan Lang 2007-10-12 08:24:04 -07:00 committed by Alexandre Julliard
parent f2c85adbc3
commit 8cacf12fe5
2 changed files with 10 additions and 1 deletions

View File

@ -3181,6 +3181,11 @@ BOOL WINAPI SetupDiInstallClassA(
UNICODE_STRING FileNameW; UNICODE_STRING FileNameW;
BOOL Result; BOOL Result;
if (!InfFileName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!RtlCreateUnicodeStringFromAsciiz(&FileNameW, InfFileName)) if (!RtlCreateUnicodeStringFromAsciiz(&FileNameW, InfFileName))
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -3283,6 +3288,11 @@ BOOL WINAPI SetupDiInstallClassW(
FIXME("\n"); FIXME("\n");
if (!InfFileName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if ((Flags & DI_NOVCP) && (FileQueue == NULL || FileQueue == INVALID_HANDLE_VALUE)) if ((Flags & DI_NOVCP) && (FileQueue == NULL || FileQueue == INVALID_HANDLE_VALUE))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);

View File

@ -204,7 +204,6 @@ static void testInstallClass(void)
create_inf_file(tmpfile + 2); create_inf_file(tmpfile + 2);
ret = pSetupDiInstallClassA(NULL, NULL, 0, NULL); ret = pSetupDiInstallClassA(NULL, NULL, 0, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
ret = pSetupDiInstallClassA(NULL, NULL, DI_NOVCP, NULL); ret = pSetupDiInstallClassA(NULL, NULL, DI_NOVCP, NULL);