Commit 3cfb018e authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

setupapi: Don't require a valid version section for INF_STYLE_OLDNT files.

parent 5058fabf
......@@ -925,7 +925,7 @@ static void append_inf_file( struct inf_file *parent, struct inf_file *child )
*
* parse an INF file.
*/
static struct inf_file *parse_file( HANDLE handle, const WCHAR *class, UINT *error_line )
static struct inf_file *parse_file( HANDLE handle, const WCHAR *class, DWORD style, UINT *error_line )
{
void *buffer;
DWORD err = 0;
......@@ -1002,7 +1002,7 @@ static struct inf_file *parse_file( HANDLE handle, const WCHAR *class, UINT *err
}
}
if (error_line) *error_line = 0;
err = ERROR_WRONG_INF_STYLE;
if (style & INF_STYLE_WIN4) err = ERROR_WRONG_INF_STYLE;
}
done:
......@@ -1145,7 +1145,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
if (handle != INVALID_HANDLE_VALUE)
{
file = parse_file( handle, class, error );
file = parse_file( handle, class, style, error );
CloseHandle( handle );
}
if (!file)
......
......@@ -101,6 +101,27 @@ static void create_inf_file(LPSTR filename)
CloseHandle(hf);
}
static void create_inf_file2(LPSTR filename)
{
char data[1024];
char *ptr = data;
DWORD dwNumberOfBytesWritten;
HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
append_str(&ptr, "[SourceFileInfo]\n");
append_str(&ptr, "sp1qfe\\bitsinst.exe=250B3702C7CCD7C2F9E4DAA1555C933E,000600060A28062C,27136,SP1QFE\n");
append_str(&ptr, "sp1qfe\\bitsprx2.dll=4EBEA67F4BB4EB402E725CA7CA2857AE,000600060A280621,7680,SP1QFE\n");
append_str(&ptr, "sp1qfe\\bitsprx3.dll=C788A1D9330DA011EF25E95D3BC7BDE5,000600060A280621,7168,SP1QFE\n");
append_str(&ptr, "sp1qfe\\qmgr.dll=696AC82FB290A03F205901442E0E9589,000600060A280621,361984,SP1QFE\n");
append_str(&ptr, "sp1qfe\\qmgrprxy.dll=8B5848144829E1BC985EA4C3D8CA7E3F,000600060A280621,17408,SP1QFE\n");
append_str(&ptr, "sp1qfe\\winhttp.dll=3EC6F518114606CA59D4160322077437,000500010A280615,331776,SP1QFE\n");
append_str(&ptr, "sp1qfe\\xpob2res.dll=DB83156B9F496F20D1EA70E4ABEC0166,000500010A280622,158720,SP1QFE\n");
WriteFile(hf, data, ptr - data, &dwNumberOfBytesWritten, NULL);
CloseHandle(hf);
}
static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test)
{
LPSTR filename;
......@@ -271,7 +292,7 @@ static void test_SetupGetSourceFileLocation(void)
{
char buffer[MAX_PATH] = "not empty", inf_filename[MAX_PATH];
UINT source_id;
DWORD required;
DWORD required, error;
HINF hinf;
BOOL ret;
......@@ -296,6 +317,23 @@ static void test_SetupGetSourceFileLocation(void)
pSetupCloseInfFile(hinf);
DeleteFileA(inf_filename);
create_inf_file2(inf_filename);
SetLastError(0xdeadbeef);
hinf = pSetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
error = GetLastError();
ok(hinf == INVALID_HANDLE_VALUE, "could open inf file\n");
ok(error == ERROR_WRONG_INF_STYLE, "got wrong error: %d\n", error);
hinf = pSetupOpenInfFileA(inf_filename, NULL, INF_STYLE_OLDNT, NULL);
ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
ret = pSetupGetSourceFileLocationA(hinf, NULL, "", &source_id, buffer, sizeof(buffer), &required);
ok(!ret, "SetupGetSourceFileLocation succeeded\n");
pSetupCloseInfFile(hinf);
DeleteFileA(inf_filename);
}
static void test_SetupGetSourceInfo(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment