From d507549038f7e0555e077ab9374eb16b8f7b06db Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 19 Dec 2018 15:41:13 -0600 Subject: [PATCH] dinput: Use the global module instance handle to load resources. This fixes a regression introduced by 56345c8757887431ada9f2347b43fc372d72872a. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46323 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/dinput/config.c | 8 ++++---- dlls/dinput/dinput_main.c | 2 +- dlls/dinput/dinput_private.h | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/dinput/config.c b/dlls/dinput/config.c index bb36db02d5c..885f1f4b8ee 100644 --- a/dlls/dinput/config.c +++ b/dlls/dinput/config.c @@ -86,7 +86,6 @@ static BOOL CALLBACK collect_devices(LPCDIDEVICEINSTANCEW lpddi, IDirectInputDev */ static void init_listview_columns(HWND dialog) { - HINSTANCE hinstance = (HINSTANCE) GetWindowLongPtrW(dialog, GWLP_HINSTANCE); LVCOLUMNW listColumn; RECT viewRect; int width; @@ -95,7 +94,7 @@ static void init_listview_columns(HWND dialog) GetClientRect(GetDlgItem(dialog, IDC_DEVICEOBJECTSLIST), &viewRect); width = (viewRect.right - viewRect.left)/2; - LoadStringW(hinstance, IDS_OBJECTCOLUMN, column, ARRAY_SIZE(column)); + LoadStringW(DINPUT_instance, IDS_OBJECTCOLUMN, column, ARRAY_SIZE(column)); listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; listColumn.pszText = column; listColumn.cchTextMax = lstrlenW(listColumn.pszText); @@ -103,7 +102,7 @@ static void init_listview_columns(HWND dialog) SendDlgItemMessageW (dialog, IDC_DEVICEOBJECTSLIST, LVM_INSERTCOLUMNW, 0, (LPARAM) &listColumn); - LoadStringW(hinstance, IDS_ACTIONCOLUMN, column, ARRAY_SIZE(column)); + LoadStringW(DINPUT_instance, IDS_ACTIONCOLUMN, column, ARRAY_SIZE(column)); listColumn.cx = width; listColumn.pszText = column; listColumn.cchTextMax = lstrlenW(listColumn.pszText); @@ -453,7 +452,8 @@ HRESULT _configure_devices(IDirectInput8W *iface, InitCommonControls(); - DialogBoxParamW(GetModuleHandleA("dinput.dll"), (LPCWSTR) MAKEINTRESOURCE(IDD_CONFIGUREDEVICES), lpdiCDParams->hwnd, ConfigureDevicesDlgProc, (LPARAM) &data); + DialogBoxParamW(DINPUT_instance, (const WCHAR *)MAKEINTRESOURCE(IDD_CONFIGUREDEVICES), + lpdiCDParams->hwnd, ConfigureDevicesDlgProc, (LPARAM)&data); return DI_OK; } diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 6ed764e7485..7074704d7ae 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -93,7 +93,7 @@ static const struct dinput_device *dinput_devices[] = &joystick_osx_device }; -static HINSTANCE DINPUT_instance = NULL; +HINSTANCE DINPUT_instance; static BOOL check_hook_thread(void); static CRITICAL_SECTION dinput_hook_crit; diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 6c93e16e9ee..abdfbeb2531 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -27,6 +27,8 @@ #include "dinputd.h" #include "wine/list.h" +extern HINSTANCE DINPUT_instance; + /* Implementation specification */ typedef struct IDirectInputImpl IDirectInputImpl; struct IDirectInputImpl