Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45455
-- v5: setupapi: Add stub for DriverStoreFindDriverPackageW
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45455 --- dlls/setupapi/query.c | 10 ++++++ dlls/setupapi/setupapi.spec | 1 + dlls/setupapi/tests/query.c | 67 +++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+)
diff --git a/dlls/setupapi/query.c b/dlls/setupapi/query.c index 88efea17473..24f0537fe9c 100644 --- a/dlls/setupapi/query.c +++ b/dlls/setupapi/query.c @@ -732,6 +732,16 @@ BOOL WINAPI SetupGetInfDriverStoreLocationW( return FALSE; }
+HRESULT WINAPI DriverStoreFindDriverPackageW(const WCHAR *path_in, void *unk2, void *unk3, DWORD flags, void *unk5, WCHAR *path_out, DWORD *path_size) +{ + FIXME("%s, %p, %p, %lu, %p, %p, %p, %lu stub!\n", debugstr_w(path_in), unk2, unk3, flags, unk5, path_out, path_size, path_size ? *path_size : 0); + if (!path_in || !path_out || !path_size || *path_size < MAX_PATH) + return E_INVALIDARG; + + wcscpy(path_out, path_in); + return S_OK; +} + BOOL WINAPI SetupQueryInfVersionInformationA(SP_INF_INFORMATION *info, UINT index, const char *key, char *buff, DWORD size, DWORD *req_size) { diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec index 7578fb25c9c..f80d389daac 100644 --- a/dlls/setupapi/setupapi.spec +++ b/dlls/setupapi/setupapi.spec @@ -208,6 +208,7 @@ @ stub DelimStringToMultiSz @ stub DestroyTextFileReadBuffer @ stdcall DoesUserHavePrivilege(wstr) +@ stdcall DriverStoreFindDriverPackageW(ptr ptr ptr long ptr ptr ptr) @ stdcall DuplicateString(wstr) @ stdcall EnablePrivilege(wstr long) @ stub ExtensionPropSheetPageProc diff --git a/dlls/setupapi/tests/query.c b/dlls/setupapi/tests/query.c index f7aeba41153..ed49dcdba5d 100644 --- a/dlls/setupapi/tests/query.c +++ b/dlls/setupapi/tests/query.c @@ -513,6 +513,72 @@ static void test_SetupGetTargetPath(void) DeleteFileA(inf_filename); }
+static void test_DriverStoreFindDriverPackageW(void) +{ + HMODULE library; + HRESULT result; + WCHAR buffer[500]; + DWORD len; + HRESULT (WINAPI *pDriverStoreFindDriverPackageW)(const WCHAR*, void*, void*, DWORD, void*, WCHAR*, DWORD*); + + library = LoadLibraryA("setupapi.dll"); + ok(library != NULL, "Failed to load setupapi.dll\n"); + if (!library) return; + + pDriverStoreFindDriverPackageW = (void *)GetProcAddress(library, "DriverStoreFindDriverPackageW"); + if (!pDriverStoreFindDriverPackageW) + { + win_skip("Can't find DriverStoreFindDriverPackageW\n"); + return; + } + + len = ARRAY_SIZE(buffer); + + /* No invalid parameters, with flags */ + result = pDriverStoreFindDriverPackageW(L"c:\nonexistant.inf", 0, 0, 9, 0, buffer, &len); + todo_wine + ok(result == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got %lx\n", result); + + /* No invalid parameters, no flags */ + result = pDriverStoreFindDriverPackageW(L"c:\nonexistant.inf", 0, 0, 0, 0, buffer, &len); + if (sizeof(void *) == 4) + todo_wine + ok(result == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got %lx\n", result); + else + todo_wine + ok(result == E_INVALIDARG, "Got %lx\n", result); /* Win64 needs flags 0x9, or it gives invalid parameter */ + + /* Invalid parameter tests */ + + result = pDriverStoreFindDriverPackageW(L"c:\nonexistant.inf", 0, 0, 9, 0, 0, &len); + ok(result == E_INVALIDARG, "Got %lx\n", result); + + result = pDriverStoreFindDriverPackageW(0, 0, 0, 9, 0, buffer, &len); + ok(result == E_INVALIDARG, "Got %lx\n", result); + + result = pDriverStoreFindDriverPackageW(L"", 0, 0, 9, 0, buffer, &len); + todo_wine + ok(result == HRESULT_FROM_WIN32(ERROR_INVALID_NAME) /* win7 */ || result == E_INVALIDARG /* win10 */, "Got %lx\n", result); + + result = pDriverStoreFindDriverPackageW(L"c:\nonexistant.inf", 0, 0, 9, 0, buffer, 0); + ok(result == E_INVALIDARG, "Got %lx\n", result); + + /* Tests with different length parameter */ + + len = 0; + result = pDriverStoreFindDriverPackageW(L"c:\nonexistant.inf", 0, 0, 9, 0, buffer, &len); + ok(result == E_INVALIDARG, "Got %lx\n", result); + + len = 259; + result = pDriverStoreFindDriverPackageW(L"c:\nonexistant.inf", 0, 0, 9, 0, buffer, &len); + ok(result == E_INVALIDARG, "Got %lx\n", result); + + len = 260; + result = pDriverStoreFindDriverPackageW(L"c:\nonexistant.inf", 0, 0, 9, 0, buffer, &len); + todo_wine + ok(result == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got %lx\n", result); +} + START_TEST(query) { get_directories(); @@ -521,4 +587,5 @@ START_TEST(query) test_SetupGetSourceFileLocation(); test_SetupGetSourceInfo(); test_SetupGetTargetPath(); + test_DriverStoreFindDriverPackageW(); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=139922
Your paranoid android.
=== w7pro64 (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w864 (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w1064v1507 (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w1064v1809 (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w1064_2qxl (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w1064_adm (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w1064_tsign (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w10pro64 (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w10pro64_ar (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w10pro64_ja (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w10pro64_zh_CN (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
=== w11pro64_amd (64 bit report) ===
setupapi: query.c:549: Test failed: Got 80070002
On Thu Nov 16 04:36:56 2023 +0000, Alex Henrie wrote:
You mean that Windows 10 returns E_INVALIDARG, right? To clarify what returns what, instead of putting a comment at the end of the line, could you please write `ok(result == HRESULT_FROM_WIN32(ERROR_INVALID_NAME) /* win7 */ || result == E_INVALIDARG /* win10 */, ...`?
Yeah, that's it. I pushed an update to make it clearer
I should have noticed this earlier: You misspelled "nonexistent" (but you misspelled it the same way every time, so I have to give you credit for consistency haha)