Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48229 Signed-off-by: Paul Gofman gofmanp@gmail.com --- v2: - added missing newline in win_skip().
dlls/kernel32/kernel32.spec | 1 + dlls/kernel32/tests/loader.c | 19 +++++++++++++++++++ dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/loader.c | 8 ++++++++ include/winbase.h | 1 + 5 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 47c7d63761..f07a2ee9ff 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1048,6 +1048,7 @@ @ stdcall -import LoadLibraryExA( str long long) @ stdcall -import LoadLibraryExW(wstr long long) @ stdcall -import LoadLibraryW(wstr) +@ stdcall -import LoadPackagedLibrary(wstr long) @ stdcall LoadModule(str ptr) @ stdcall -import LoadResource(long long) # @ stub LoadStringBaseExW diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 6f143f5efd..1f6b3818dc 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -86,6 +86,7 @@ static BOOL (WINAPI *pFlsFree)(DWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL); static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **); static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *); +static HMODULE (WINAPI *pLoadPackagedLibrary)(LPCWSTR lpwLibFileName, DWORD Reserved);
static PVOID RVAToAddr(DWORD_PTR rva, HMODULE module) { @@ -3917,6 +3918,22 @@ static void test_dll_file( const char *name ) #undef OK_FIELD }
+static void test_LoadPackagedLibrary(void) +{ + static const WCHAR kernel32_nameW[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0}; + HMODULE h; + + if (!pLoadPackagedLibrary) + { + win_skip("LoadPackagedLibrary is not available.\n"); + return; + } + + h = pLoadPackagedLibrary(kernel32_nameW, 0); + ok(!h && GetLastError() == APPMODEL_ERROR_NO_PACKAGE, "Got unexpected handle %p, GetLastError() %u.\n", + h, GetLastError()); +} + START_TEST(loader) { int argc; @@ -3954,6 +3971,7 @@ START_TEST(loader) pWow64DisableWow64FsRedirection = (void *)GetProcAddress(kernel32, "Wow64DisableWow64FsRedirection"); pWow64RevertWow64FsRedirection = (void *)GetProcAddress(kernel32, "Wow64RevertWow64FsRedirection"); pResolveDelayLoadedAPI = (void *)GetProcAddress(kernel32, "ResolveDelayLoadedAPI"); + pLoadPackagedLibrary = (void *)GetProcAddress(kernel32, "LoadPackagedLibrary");
if (pIsWow64Process) pIsWow64Process( GetCurrentProcess(), &is_wow64 ); GetSystemInfo( &si ); @@ -3993,4 +4011,5 @@ START_TEST(loader) test_dll_file( "user32.dll" ); /* loader test must be last, it can corrupt the internal loader state on Windows */ test_Loader(); + test_LoadPackagedLibrary(); } diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index caa6de1d51..49fb4a7ff1 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -926,7 +926,7 @@ @ stdcall LoadLibraryExA( str long long) @ stdcall LoadLibraryExW(wstr long long) @ stdcall LoadLibraryW(wstr) -# @ stub LoadPackagedLibrary +@ stdcall LoadPackagedLibrary(wstr long) @ stdcall LoadResource(long long) @ stdcall LoadStringA(long long ptr long) @ stub LoadStringBaseExW diff --git a/dlls/kernelbase/loader.c b/dlls/kernelbase/loader.c index 456a9f2da4..0f114bb315 100644 --- a/dlls/kernelbase/loader.c +++ b/dlls/kernelbase/loader.c @@ -1209,3 +1209,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH ZombifyActCtx( HANDLE context ) { return set_ntstatus( RtlZombifyActivationContext( context )); } + +HMODULE WINAPI LoadPackagedLibrary( LPCWSTR name, DWORD reserved ) +{ + FIXME("semi-stub, name %s, reserved %#x.\n", debugstr_w(name), reserved); + + SetLastError(APPMODEL_ERROR_NO_PACKAGE); + return NULL; +} diff --git a/include/winbase.h b/include/winbase.h index 3062d3b6ad..23a782a6dc 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -2417,6 +2417,7 @@ WINBASEAPI HMODULE WINAPI LoadLibraryW(LPCWSTR); WINBASEAPI HMODULE WINAPI LoadLibraryExA(LPCSTR,HANDLE,DWORD); WINBASEAPI HMODULE WINAPI LoadLibraryExW(LPCWSTR,HANDLE,DWORD); #define LoadLibraryEx WINELIB_NAME_AW(LoadLibraryEx) +WINBASEAPI HMODULE WINAPI LoadPackagedLibrary(LPCWSTR,DWORD); WINBASEAPI DWORD WINAPI LoadModule(LPCSTR,LPVOID); WINBASEAPI HGLOBAL WINAPI LoadResource(HMODULE,HRSRC); WINBASEAPI HLOCAL WINAPI LocalAlloc(UINT,SIZE_T) __WINE_ALLOC_SIZE(2);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=64791
Your paranoid android.
=== w1064v1809_ar (32 bit report) ===
kernel32: loader.c:3215: Test failed: child process failed to terminate
=== w1064v1809_he (32 bit report) ===
kernel32: loader.c:3187: Test failed: child process failed to terminate
=== w1064v1809_ja (32 bit report) ===
kernel32: loader.c:3187: Test failed: child process failed to terminate
=== w1064v1809 (64 bit report) ===
kernel32: loader.c:692: Test failed: 1392: got test dll but expected fallback loader.c:692: Test failed: 1398: got test dll but expected fallback loader.c:692: Test failed: 1404: got test dll but expected fallback loader.c:692: Test failed: 1411: got test dll but expected fallback loader.c:692: Test failed: 1438: got test dll but expected fallback
=== debian10 (32 bit report) ===
kernel32: comm.c:918: Test failed: OutQueue should not be empty
=== debian10 (32 bit WoW report) ===
kernel32: debugger.c:305: Test failed: GetThreadContext failed: 5