Module: wine Branch: master Commit: 53ec99daeb0551fb2f7dd48c03c63951b8ff6824 URL: https://source.winehq.org/git/wine.git/?a=commit;h=53ec99daeb0551fb2f7dd48c0...
Author: Esme Povirk esme@codeweavers.com Date: Tue Jul 6 16:31:47 2021 -0500
rundll32: Only call LoadLibrary16 on x86.
These are imported by ordinal, so on other architectures we end up calling whatever ends up on that ordinal, which is currently Beep on x86_64.
Signed-off-by: Esme Povirk esme@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/rundll32/rundll32.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/programs/rundll32/rundll32.c b/programs/rundll32/rundll32.c index eb7713518a9..fe9d17f0f48 100644 --- a/programs/rundll32/rundll32.c +++ b/programs/rundll32/rundll32.c @@ -83,8 +83,6 @@ static void call_entry_point( void *func, HWND hwnd, HINSTANCE inst, void *cmdli } #endif
-static HINSTANCE16 (WINAPI *pLoadLibrary16)(LPCSTR libname); -static FARPROC16 (WINAPI *pGetProcAddress16)(HMODULE16 hModule, LPCSTR name); static void (WINAPI *pRunDLL_CallEntry16)( FARPROC proc, HWND hwnd, HINSTANCE inst, LPCSTR cmdline, INT cmdshow );
@@ -112,8 +110,11 @@ static ATOM register_class(void) return RegisterClassExW(&wcex); }
+#ifdef __i386__ + static HINSTANCE16 load_dll16( LPCWSTR dll ) { + HINSTANCE16 (WINAPI *pLoadLibrary16)(LPCSTR libname); HINSTANCE16 ret = 0; DWORD len = WideCharToMultiByte( CP_ACP, 0, dll, -1, NULL, 0, NULL, NULL ); char *dllA = HeapAlloc( GetProcessHeap(), 0, len ); @@ -130,6 +131,7 @@ static HINSTANCE16 load_dll16( LPCWSTR dll )
static FARPROC16 get_entry_point16( HINSTANCE16 inst, LPCWSTR entry ) { + FARPROC16 (WINAPI *pGetProcAddress16)(HMODULE16 hModule, LPCSTR name); FARPROC16 ret = 0; DWORD len = WideCharToMultiByte( CP_ACP, 0, entry, -1, NULL, 0, NULL, NULL ); char *entryA = HeapAlloc( GetProcessHeap(), 0, len ); @@ -143,6 +145,7 @@ static FARPROC16 get_entry_point16( HINSTANCE16 inst, LPCWSTR entry ) } return ret; } +#endif
static void *get_entry_point32( HMODULE module, LPCWSTR entry, BOOL *unicode ) { @@ -272,8 +275,8 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE hOldInstance, LPWSTR szCmdLine { HWND hWnd; LPWSTR szDllName,szEntryPoint; - void *entry_point; - BOOL unicode = FALSE, win16; + void *entry_point = NULL; + BOOL unicode = FALSE, win16 = FALSE; STARTUPINFOW info; HMODULE hDll;
@@ -300,11 +303,8 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE hOldInstance, LPWSTR szCmdLine
/* Load the library */ hDll=LoadLibraryW(szDllName); - if (hDll) - { - win16 = FALSE; - entry_point = get_entry_point32( hDll, szEntryPoint, &unicode ); - } + if (hDll) entry_point = get_entry_point32( hDll, szEntryPoint, &unicode ); +#ifdef __i386__ else { HINSTANCE16 dll = load_dll16( szDllName ); @@ -315,9 +315,9 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE hOldInstance, LPWSTR szCmdLine goto CLEANUP; } win16 = TRUE; - unicode = FALSE; entry_point = get_entry_point16( dll, szEntryPoint ); } +#endif
if (!entry_point) {