setupapi: Handle the INFINFO_REVERSE_DEFAULT_SEARCH search flag.

This commit is contained in:
James Hawkins 2006-02-14 12:23:58 +01:00 committed by Alexandre Julliard
parent 202942de61
commit 94515450fa
2 changed files with 34 additions and 5 deletions

View File

@ -60,6 +60,36 @@ static BOOL fill_inf_info(HINF inf, PSP_INF_INFORMATION buffer, DWORD size, DWOR
return TRUE; return TRUE;
} }
static HINF search_for_inf(LPCVOID InfSpec, DWORD SearchControl)
{
HINF hInf = INVALID_HANDLE_VALUE;
WCHAR inf_path[MAX_PATH];
static const WCHAR infW[] = {'\\','i','n','f','\\',0};
static const WCHAR system32W[] = {'\\','s','y','s','t','e','m','3','2','\\',0};
if (SearchControl == INFINFO_REVERSE_DEFAULT_SEARCH)
{
GetWindowsDirectoryW(inf_path, MAX_PATH);
lstrcatW(inf_path, system32W);
lstrcatW(inf_path, InfSpec);
hInf = SetupOpenInfFileW(inf_path, NULL,
INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
if (hInf != INVALID_HANDLE_VALUE)
return hInf;
GetWindowsDirectoryW(inf_path, MAX_PATH);
lstrcpyW(inf_path, infW);
lstrcatW(inf_path, InfSpec);
return SetupOpenInfFileW(inf_path, NULL,
INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
}
return INVALID_HANDLE_VALUE;
}
/*********************************************************************** /***********************************************************************
* SetupGetInfInformationA (SETUPAPI.@) * SetupGetInfInformationA (SETUPAPI.@)
* *
@ -131,6 +161,8 @@ BOOL WINAPI SetupGetInfInformationW(LPCVOID InfSpec, DWORD SearchControl,
INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL); INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
break; break;
case INFINFO_REVERSE_DEFAULT_SEARCH: case INFINFO_REVERSE_DEFAULT_SEARCH:
inf = search_for_inf(InfSpec, SearchControl);
break;
case INFINFO_INF_PATH_LIST_SEARCH: case INFINFO_INF_PATH_LIST_SEARCH:
FIXME("Unhandled search control: %ld\n", SearchControl); FIXME("Unhandled search control: %ld\n", SearchControl);

View File

@ -231,11 +231,8 @@ static void test_SetupGetInfInformation(void)
/* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */ /* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */
ret = pSetupGetInfInformationA("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, info, size, &size); ret = pSetupGetInfInformationA("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, info, size, &size);
todo_wine
{
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
ok(check_info_filename(info, inf_two), "Expected returned filename to be equal\n"); ok(check_info_filename(info, inf_two), "Expected returned filename to be equal\n");
}
DeleteFileA(inf_filename); DeleteFileA(inf_filename);
DeleteFileA(inf_one); DeleteFileA(inf_one);