diff --git a/patches/setupapi-DriverStoreFindDriverPackageW/0001-setupapi-Add-stub-for-DriverStoreFindDriverPackageW.patch b/patches/setupapi-DriverStoreFindDriverPackageW/0001-setupapi-Add-stub-for-DriverStoreFindDriverPackageW.patch new file mode 100644 index 00000000..7d88742e --- /dev/null +++ b/patches/setupapi-DriverStoreFindDriverPackageW/0001-setupapi-Add-stub-for-DriverStoreFindDriverPackageW.patch @@ -0,0 +1,131 @@ +From 49f12af6d899f3a44f0619c059c59bf8b57be59f Mon Sep 17 00:00:00 2001 +From: Fabian Maurer +Date: Wed, 8 Nov 2023 22:01:59 +0100 +Subject: [PATCH] setupapi: Add stub for DriverStoreFindDriverPackageW + +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 74f430a415f..6a392f687f8 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..864c8d6939b 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:\\nonexistent.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:\\nonexistent.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:\\nonexistent.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:\\nonexistent.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:\\nonexistent.inf", 0, 0, 9, 0, buffer, &len); ++ ok(result == E_INVALIDARG, "Got %lx\n", result); ++ ++ len = 259; ++ result = pDriverStoreFindDriverPackageW(L"c:\\nonexistent.inf", 0, 0, 9, 0, buffer, &len); ++ ok(result == E_INVALIDARG, "Got %lx\n", result); ++ ++ len = 260; ++ result = pDriverStoreFindDriverPackageW(L"c:\\nonexistent.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(); + } +-- +2.43.0 + diff --git a/patches/setupapi-DriverStoreFindDriverPackageW/definition b/patches/setupapi-DriverStoreFindDriverPackageW/definition new file mode 100644 index 00000000..60b72203 --- /dev/null +++ b/patches/setupapi-DriverStoreFindDriverPackageW/definition @@ -0,0 +1,3 @@ +Fixes: [45455] setupapi: Add stub for DriverStoreFindDriverPackageW + +# https://gitlab.winehq.org/wine/wine/-/merge_requests/4343