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>
This commit is contained in:
Esme Povirk 2021-07-06 16:31:47 -05:00 committed by Alexandre Julliard
parent adffa11609
commit 53ec99daeb

View file

@ -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)
{