setupapi: Handle the INFINFO_INF_NAME_IS_ABSOLUTE and
INFINFO_DEFAULT_SEARCH search flags.
This commit is contained in:
parent
f29d4af34b
commit
202942de61
@ -98,12 +98,13 @@ BOOL WINAPI SetupGetInfInformationW(LPCVOID InfSpec, DWORD SearchControl,
|
||||
PSP_INF_INFORMATION ReturnBuffer,
|
||||
DWORD ReturnBufferSize, PDWORD RequiredSize)
|
||||
{
|
||||
HINF inf = (HINF)InfSpec;
|
||||
HINF inf;
|
||||
BOOL ret;
|
||||
|
||||
TRACE("(%p, %ld, %p, %ld, %p)\n", InfSpec, SearchControl, ReturnBuffer,
|
||||
ReturnBufferSize, RequiredSize);
|
||||
|
||||
if (!inf)
|
||||
if (!InfSpec)
|
||||
{
|
||||
if (SearchControl == INFINFO_INF_SPEC_IS_HINF)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
@ -113,30 +114,47 @@ BOOL WINAPI SetupGetInfInformationW(LPCVOID InfSpec, DWORD SearchControl,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ReturnBuffer && ReturnBufferSize)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (SearchControl)
|
||||
{
|
||||
case INFINFO_INF_SPEC_IS_HINF:
|
||||
inf = (HINF)InfSpec;
|
||||
break;
|
||||
case INFINFO_INF_NAME_IS_ABSOLUTE:
|
||||
case INFINFO_DEFAULT_SEARCH:
|
||||
inf = SetupOpenInfFileW(InfSpec, NULL,
|
||||
INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
|
||||
break;
|
||||
case INFINFO_REVERSE_DEFAULT_SEARCH:
|
||||
case INFINFO_INF_PATH_LIST_SEARCH:
|
||||
FIXME("Unhandled search control: %ld\n", SearchControl);
|
||||
|
||||
if (RequiredSize)
|
||||
*RequiredSize = 0;
|
||||
|
||||
return FALSE;
|
||||
default:
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (inf == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (SearchControl < INFINFO_INF_SPEC_IS_HINF ||
|
||||
SearchControl > INFINFO_INF_PATH_LIST_SEARCH)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
ret = fill_inf_info(inf, ReturnBuffer, ReturnBufferSize, RequiredSize);
|
||||
|
||||
if (SearchControl != INFINFO_INF_SPEC_IS_HINF)
|
||||
{
|
||||
FIXME("Unhandled search control: %ld\n", SearchControl);
|
||||
if (SearchControl >= INFINFO_INF_NAME_IS_ABSOLUTE)
|
||||
SetupCloseInfFile(inf);
|
||||
|
||||
if (RequiredSize)
|
||||
*RequiredSize = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return fill_inf_info(inf, ReturnBuffer, ReturnBufferSize, RequiredSize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -167,31 +167,22 @@ static void test_SetupGetInfInformation(void)
|
||||
SetLastError(0xbeefcafe);
|
||||
ret = pSetupGetInfInformationA("idontexist", INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
|
||||
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
|
||||
todo_wine
|
||||
{
|
||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
|
||||
ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
|
||||
}
|
||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
|
||||
ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
|
||||
|
||||
/* successfully open the inf file */
|
||||
size = 0xdeadbeef;
|
||||
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
|
||||
todo_wine
|
||||
{
|
||||
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
|
||||
}
|
||||
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
|
||||
ok(size != 0xdeadbeef, "Expected a valid size on return\n");
|
||||
|
||||
/* set ReturnBuffer to NULL and ReturnBufferSize to non-zero */
|
||||
SetLastError(0xbeefcafe);
|
||||
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, &size);
|
||||
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
|
||||
todo_wine
|
||||
{
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
}
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
info = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
|
||||
@ -199,19 +190,13 @@ static void test_SetupGetInfInformation(void)
|
||||
SetLastError(0xbeefcafe);
|
||||
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size - 1, &size);
|
||||
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
|
||||
todo_wine
|
||||
{
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
|
||||
}
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
|
||||
|
||||
/* successfully get the inf information */
|
||||
ret = pSetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size, &size);
|
||||
todo_wine
|
||||
{
|
||||
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
|
||||
ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n");
|
||||
}
|
||||
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
|
||||
ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n");
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, info);
|
||||
|
||||
@ -238,11 +223,8 @@ static void test_SetupGetInfInformation(void)
|
||||
|
||||
/* test the INFINFO_DEFAULT_SEARCH search flag */
|
||||
ret = pSetupGetInfInformationA("test.inf", INFINFO_DEFAULT_SEARCH, info, size, &size);
|
||||
todo_wine
|
||||
{
|
||||
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
|
||||
ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n");
|
||||
}
|
||||
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
|
||||
ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n");
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, info);
|
||||
info = alloc_inf_info("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, &size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user