Avoid a few more GetModuleHandle calls.
This commit is contained in:
parent
560a756790
commit
a2e2e18586
|
@ -3688,7 +3688,7 @@ static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND control)
|
||||||
*/
|
*/
|
||||||
static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
|
static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
|
||||||
{
|
{
|
||||||
HMENU menu = LoadMenuA(GetModuleHandleA("USER32"), "EDITMENU");
|
HMENU menu = LoadMenuA(user32_module, "EDITMENU");
|
||||||
HMENU popup = GetSubMenu(menu, 0);
|
HMENU popup = GetSubMenu(menu, 0);
|
||||||
UINT start = es->selection_start;
|
UINT start = es->selection_start;
|
||||||
UINT end = es->selection_end;
|
UINT end = es->selection_end;
|
||||||
|
|
|
@ -328,9 +328,8 @@ static HMENU get_win_sys_menu( HWND hwnd )
|
||||||
*/
|
*/
|
||||||
static HMENU MENU_CopySysPopup(void)
|
static HMENU MENU_CopySysPopup(void)
|
||||||
{
|
{
|
||||||
static const WCHAR user32W[] = {'U','S','E','R','3','2',0};
|
|
||||||
static const WCHAR sysmenuW[] = {'S','Y','S','M','E','N','U',0};
|
static const WCHAR sysmenuW[] = {'S','Y','S','M','E','N','U',0};
|
||||||
HMENU hMenu = LoadMenuW(GetModuleHandleW(user32W), sysmenuW);
|
HMENU hMenu = LoadMenuW(user32_module, sysmenuW);
|
||||||
|
|
||||||
if( hMenu ) {
|
if( hMenu ) {
|
||||||
POPUPMENU* menu = MENU_GetMenu(hMenu);
|
POPUPMENU* menu = MENU_GetMenu(hMenu);
|
||||||
|
|
|
@ -442,7 +442,7 @@ BOOL16 WINAPI ChooseColor16( LPCHOOSECOLOR16 lpChCol )
|
||||||
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo);
|
size = SizeofResource(COMDLG32_hInstance, hResInfo);
|
||||||
hGlobal16 = GlobalAlloc16(0, size);
|
hGlobal16 = GlobalAlloc16(0, size);
|
||||||
if (!hGlobal16)
|
if (!hGlobal16)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,18 +95,12 @@ static BOOL FileDlg_Init(void)
|
||||||
static BOOL initialized = 0;
|
static BOOL initialized = 0;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
HINSTANCE inst = GetModuleHandleA( "comdlg32.dll" );
|
hFolder = LoadImageA( COMDLG32_hInstance, "FOLDER", IMAGE_ICON, 16, 16, LR_SHARED );
|
||||||
if (!inst)
|
hFolder2 = LoadImageA( COMDLG32_hInstance, "FOLDER2", IMAGE_ICON, 16, 16, LR_SHARED );
|
||||||
{
|
hFloppy = LoadImageA( COMDLG32_hInstance, "FLOPPY", IMAGE_ICON, 16, 16, LR_SHARED );
|
||||||
ERR( "cannot get comdlg32.dll instance\n" );
|
hHDisk = LoadImageA( COMDLG32_hInstance, "HDISK", IMAGE_ICON, 16, 16, LR_SHARED );
|
||||||
return FALSE;
|
hCDRom = LoadImageA( COMDLG32_hInstance, "CDROM", IMAGE_ICON, 16, 16, LR_SHARED );
|
||||||
}
|
hNet = LoadImageA( COMDLG32_hInstance, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED );
|
||||||
hFolder = LoadImageA( inst, "FOLDER", IMAGE_ICON, 16, 16, LR_SHARED );
|
|
||||||
hFolder2 = LoadImageA( inst, "FOLDER2", IMAGE_ICON, 16, 16, LR_SHARED );
|
|
||||||
hFloppy = LoadImageA( inst, "FLOPPY", IMAGE_ICON, 16, 16, LR_SHARED );
|
|
||||||
hHDisk = LoadImageA( inst, "HDISK", IMAGE_ICON, 16, 16, LR_SHARED );
|
|
||||||
hCDRom = LoadImageA( inst, "CDROM", IMAGE_ICON, 16, 16, LR_SHARED );
|
|
||||||
hNet = LoadImageA( inst, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED );
|
|
||||||
if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
|
if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
|
||||||
hHDisk == 0 || hCDRom == 0 || hNet == 0)
|
hHDisk == 0 || hCDRom == 0 || hNet == 0)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +224,7 @@ BOOL Get16BitsTemplate(LFSPRIVATE lfs)
|
||||||
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo);
|
size = SizeofResource(COMDLG32_hInstance, hResInfo);
|
||||||
hGlobal16 = GlobalAlloc16(0, size);
|
hGlobal16 = GlobalAlloc16(0, size);
|
||||||
if (!hGlobal16)
|
if (!hGlobal16)
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,7 +121,7 @@ BOOL FINDDLG_Get16BitsTemplate(LFRPRIVATE lfr)
|
||||||
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo);
|
size = SizeofResource(COMDLG32_hInstance, hResInfo);
|
||||||
hGlobal16 = GlobalAlloc16(0, size);
|
hGlobal16 = GlobalAlloc16(0, size);
|
||||||
if (!hGlobal16)
|
if (!hGlobal16)
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,7 +205,7 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
|
||||||
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo);
|
size = SizeofResource(COMDLG32_hInstance, hResInfo);
|
||||||
hGlobal16 = GlobalAlloc16(0, size);
|
hGlobal16 = GlobalAlloc16(0, size);
|
||||||
if (!hGlobal16)
|
if (!hGlobal16)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,8 @@ void (*wine_tsx11_unlock_ptr)(void) = NULL;
|
||||||
static GLXContext default_cx = NULL;
|
static GLXContext default_cx = NULL;
|
||||||
static Display *default_display; /* display to use for default context */
|
static Display *default_display; /* display to use for default context */
|
||||||
|
|
||||||
|
static HMODULE opengl32_handle;
|
||||||
|
|
||||||
static void *(*p_glXGetProcAddressARB)(const GLubyte *);
|
static void *(*p_glXGetProcAddressARB)(const GLubyte *);
|
||||||
|
|
||||||
typedef struct wine_glcontext {
|
typedef struct wine_glcontext {
|
||||||
|
@ -310,18 +312,13 @@ static int wgl_compar(const void *elt_a, const void *elt_b) {
|
||||||
|
|
||||||
void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
||||||
void *local_func;
|
void *local_func;
|
||||||
static HMODULE hm = 0;
|
|
||||||
OpenGL_extension ext;
|
OpenGL_extension ext;
|
||||||
OpenGL_extension *ext_ret;
|
OpenGL_extension *ext_ret;
|
||||||
|
|
||||||
|
|
||||||
TRACE("(%s)\n", lpszProc);
|
TRACE("(%s)\n", lpszProc);
|
||||||
|
|
||||||
if (hm == 0)
|
|
||||||
hm = GetModuleHandleA("opengl32");
|
|
||||||
|
|
||||||
/* First, look if it's not already defined in the 'standard' OpenGL functions */
|
/* First, look if it's not already defined in the 'standard' OpenGL functions */
|
||||||
if ((local_func = GetProcAddress(hm, lpszProc)) != NULL) {
|
if ((local_func = GetProcAddress(opengl32_handle, lpszProc)) != NULL) {
|
||||||
TRACE(" found function in 'standard' OpenGL functions (%p)\n", local_func);
|
TRACE(" found function in 'standard' OpenGL functions (%p)\n", local_func);
|
||||||
return local_func;
|
return local_func;
|
||||||
}
|
}
|
||||||
|
@ -397,7 +394,7 @@ void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
|
||||||
buf[strlen(ext_ret->glx_name) - 3] = '\0';
|
buf[strlen(ext_ret->glx_name) - 3] = '\0';
|
||||||
TRACE(" extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
|
TRACE(" extension not found in the Linux OpenGL library, checking against libGL bug with %s..\n", buf);
|
||||||
|
|
||||||
ret = GetProcAddress(hm, buf);
|
ret = GetProcAddress(opengl32_handle, buf);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
TRACE(" found function in main OpenGL library (%p) !\n", ret);
|
TRACE(" found function in main OpenGL library (%p) !\n", ret);
|
||||||
} else {
|
} else {
|
||||||
|
@ -775,6 +772,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||||
switch(reason)
|
switch(reason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
|
opengl32_handle = hinst;
|
||||||
DisableThreadLibraryCalls(hinst);
|
DisableThreadLibraryCalls(hinst);
|
||||||
return process_attach();
|
return process_attach();
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
|
|
|
@ -42,6 +42,7 @@ USER_DRIVER USER_Driver;
|
||||||
WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
|
WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
|
||||||
|
|
||||||
WORD USER_HeapSel = 0; /* USER heap selector */
|
WORD USER_HeapSel = 0; /* USER heap selector */
|
||||||
|
HMODULE user32_module = 0;
|
||||||
|
|
||||||
extern HPALETTE (WINAPI *pfnGDISelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd );
|
extern HPALETTE (WINAPI *pfnGDISelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd );
|
||||||
extern UINT (WINAPI *pfnGDIRealizePalette)(HDC hdc);
|
extern UINT (WINAPI *pfnGDIRealizePalette)(HDC hdc);
|
||||||
|
@ -183,7 +184,7 @@ static void tweak_init(void)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* USER initialisation routine
|
* USER initialisation routine
|
||||||
*/
|
*/
|
||||||
static BOOL process_attach( HINSTANCE inst )
|
static BOOL process_attach(void)
|
||||||
{
|
{
|
||||||
HINSTANCE16 instance;
|
HINSTANCE16 instance;
|
||||||
|
|
||||||
|
@ -207,7 +208,7 @@ static BOOL process_attach( HINSTANCE inst )
|
||||||
palette_init();
|
palette_init();
|
||||||
|
|
||||||
/* Initialize built-in window classes */
|
/* Initialize built-in window classes */
|
||||||
CLASS_RegisterBuiltinClasses( inst );
|
CLASS_RegisterBuiltinClasses();
|
||||||
|
|
||||||
/* Initialize menus */
|
/* Initialize menus */
|
||||||
if (!MENU_Init()) return FALSE;
|
if (!MENU_Init()) return FALSE;
|
||||||
|
@ -268,7 +269,8 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
|
||||||
switch(reason)
|
switch(reason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
ret = process_attach( inst );
|
user32_module = inst;
|
||||||
|
ret = process_attach();
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
thread_detach();
|
thread_detach();
|
||||||
|
|
|
@ -138,7 +138,7 @@ inline static void unmap_str_16_to_32W( LPCWSTR str )
|
||||||
/* Class functions */
|
/* Class functions */
|
||||||
struct tagCLASS; /* opaque structure */
|
struct tagCLASS; /* opaque structure */
|
||||||
struct tagWND;
|
struct tagWND;
|
||||||
extern void CLASS_RegisterBuiltinClasses( HINSTANCE inst );
|
extern void CLASS_RegisterBuiltinClasses(void);
|
||||||
extern void CLASS_AddWindow( struct tagCLASS *class, struct tagWND *win, WINDOWPROCTYPE type );
|
extern void CLASS_AddWindow( struct tagCLASS *class, struct tagWND *win, WINDOWPROCTYPE type );
|
||||||
extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
|
extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,8 @@ typedef struct tagUSER_DRIVER {
|
||||||
|
|
||||||
extern USER_DRIVER USER_Driver;
|
extern USER_DRIVER USER_Driver;
|
||||||
|
|
||||||
|
extern HMODULE user32_module;
|
||||||
|
|
||||||
/* user lock */
|
/* user lock */
|
||||||
extern void USER_Lock(void);
|
extern void USER_Lock(void);
|
||||||
extern void USER_Unlock(void);
|
extern void USER_Unlock(void);
|
||||||
|
|
|
@ -68,7 +68,6 @@ typedef struct tagCLASS
|
||||||
|
|
||||||
static struct list class_list = LIST_INIT( class_list );
|
static struct list class_list = LIST_INIT( class_list );
|
||||||
static CLASS *desktop_class;
|
static CLASS *desktop_class;
|
||||||
static HMODULE user32_module;
|
|
||||||
|
|
||||||
#define CLASS_OTHER_PROCESS ((CLASS *)1)
|
#define CLASS_OTHER_PROCESS ((CLASS *)1)
|
||||||
|
|
||||||
|
@ -471,7 +470,7 @@ static CLASS *register_builtin( const struct builtin_class_descr *descr )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* CLASS_RegisterBuiltinClasses
|
* CLASS_RegisterBuiltinClasses
|
||||||
*/
|
*/
|
||||||
void CLASS_RegisterBuiltinClasses( HMODULE user32 )
|
void CLASS_RegisterBuiltinClasses(void)
|
||||||
{
|
{
|
||||||
extern const struct builtin_class_descr BUTTON_builtin_class;
|
extern const struct builtin_class_descr BUTTON_builtin_class;
|
||||||
extern const struct builtin_class_descr COMBO_builtin_class;
|
extern const struct builtin_class_descr COMBO_builtin_class;
|
||||||
|
@ -486,7 +485,6 @@ void CLASS_RegisterBuiltinClasses( HMODULE user32 )
|
||||||
extern const struct builtin_class_descr SCROLL_builtin_class;
|
extern const struct builtin_class_descr SCROLL_builtin_class;
|
||||||
extern const struct builtin_class_descr STATIC_builtin_class;
|
extern const struct builtin_class_descr STATIC_builtin_class;
|
||||||
|
|
||||||
user32_module = user32;
|
|
||||||
desktop_class = register_builtin( &DESKTOP_builtin_class );
|
desktop_class = register_builtin( &DESKTOP_builtin_class );
|
||||||
register_builtin( &BUTTON_builtin_class );
|
register_builtin( &BUTTON_builtin_class );
|
||||||
register_builtin( &COMBO_builtin_class );
|
register_builtin( &COMBO_builtin_class );
|
||||||
|
|
|
@ -814,10 +814,7 @@ static HICON CURSORICON_Load(HINSTANCE hInstance, LPCWSTR name,
|
||||||
WORD wResId;
|
WORD wResId;
|
||||||
DWORD dwBytesInRes;
|
DWORD dwBytesInRes;
|
||||||
|
|
||||||
if (!hInstance) /* Load OEM cursor/icon */
|
if (!hInstance) hInstance = user32_module; /* Load OEM cursor/icon */
|
||||||
{
|
|
||||||
if (!(hInstance = GetModuleHandleA( "user32.dll" ))) return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Normalize hInstance (must be uniquely represented for icon cache) */
|
/* Normalize hInstance (must be uniquely represented for icon cache) */
|
||||||
|
|
||||||
|
@ -1996,7 +1993,7 @@ static HBITMAP BITMAP_Load( HINSTANCE instance,LPCWSTR name, UINT loadflags )
|
||||||
{
|
{
|
||||||
/* OEM bitmap: try to load the resource from user32.dll */
|
/* OEM bitmap: try to load the resource from user32.dll */
|
||||||
if (HIWORD(name)) return 0;
|
if (HIWORD(name)) return 0;
|
||||||
if (!(instance = GetModuleHandleA("user32.dll"))) return 0;
|
instance = user32_module;
|
||||||
}
|
}
|
||||||
if (!(hRsrc = FindResourceW( instance, name, (LPWSTR)RT_BITMAP ))) return 0;
|
if (!(hRsrc = FindResourceW( instance, name, (LPWSTR)RT_BITMAP ))) return 0;
|
||||||
if (!(handle = LoadResource( instance, hRsrc ))) return 0;
|
if (!(handle = LoadResource( instance, hRsrc ))) return 0;
|
||||||
|
|
|
@ -397,7 +397,7 @@ static LRESULT MDI_RefreshMenu(MDICLIENTINFO *ci)
|
||||||
|
|
||||||
if (visible == MDI_MOREWINDOWSLIMIT)
|
if (visible == MDI_MOREWINDOWSLIMIT)
|
||||||
{
|
{
|
||||||
LoadStringW(GetModuleHandleA("USER32"), IDS_MDI_MOREWINDOWS, buf, sizeof(buf)/sizeof(WCHAR));
|
LoadStringW(user32_module, IDS_MDI_MOREWINDOWS, buf, sizeof(buf)/sizeof(WCHAR));
|
||||||
AppendMenuW(ci->hWindowMenu, MF_STRING, id, buf);
|
AppendMenuW(ci->hWindowMenu, MF_STRING, id, buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1917,12 +1917,12 @@ static HWND MDI_MoreWindowsDialog(HWND hwnd)
|
||||||
HRSRC hRes;
|
HRSRC hRes;
|
||||||
HANDLE hDlgTmpl;
|
HANDLE hDlgTmpl;
|
||||||
|
|
||||||
hRes = FindResourceA(GetModuleHandleA("USER32"), "MDI_MOREWINDOWS", (LPSTR)RT_DIALOG);
|
hRes = FindResourceA(user32_module, "MDI_MOREWINDOWS", (LPSTR)RT_DIALOG);
|
||||||
|
|
||||||
if (hRes == 0)
|
if (hRes == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hDlgTmpl = LoadResource(GetModuleHandleA("USER32"), hRes );
|
hDlgTmpl = LoadResource(user32_module, hRes );
|
||||||
|
|
||||||
if (hDlgTmpl == 0)
|
if (hDlgTmpl == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1932,7 +1932,7 @@ static HWND MDI_MoreWindowsDialog(HWND hwnd)
|
||||||
if (template == 0)
|
if (template == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (HWND) DialogBoxIndirectParamA(GetModuleHandleA("USER32"),
|
return (HWND) DialogBoxIndirectParamA(user32_module,
|
||||||
(LPDLGTEMPLATEA) template,
|
(LPDLGTEMPLATEA) template,
|
||||||
hwnd, MDI_MoreWindowsDlgProc, (LPARAM) hwnd);
|
hwnd, MDI_MoreWindowsDlgProc, (LPARAM) hwnd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (LoadStringW(GetModuleHandleA("user32.dll"), IDS_ERROR, buf, 256))
|
if (LoadStringW(user32_module, IDS_ERROR, buf, 256))
|
||||||
SetWindowTextW(hwnd, buf);
|
SetWindowTextW(hwnd, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -443,14 +443,12 @@ INT WINAPI MessageBoxIndirectW( LPMSGBOXPARAMSW msgbox )
|
||||||
{
|
{
|
||||||
LPVOID tmplate;
|
LPVOID tmplate;
|
||||||
HRSRC hRes;
|
HRSRC hRes;
|
||||||
HMODULE hUser32;
|
|
||||||
static const WCHAR user32_res_nameW[] = { 'u','s','e','r','3','2','.','d','l','l',0 };
|
|
||||||
static const WCHAR msg_box_res_nameW[] = { 'M','S','G','B','O','X',0 };
|
static const WCHAR msg_box_res_nameW[] = { 'M','S','G','B','O','X',0 };
|
||||||
|
|
||||||
hUser32 = GetModuleHandleW(user32_res_nameW);
|
if (!(hRes = FindResourceExW(user32_module, (LPWSTR)RT_DIALOG,
|
||||||
if (!(hRes = FindResourceExW(hUser32, (LPWSTR)RT_DIALOG, msg_box_res_nameW, msgbox->dwLanguageId)))
|
msg_box_res_nameW, msgbox->dwLanguageId)))
|
||||||
return 0;
|
return 0;
|
||||||
if (!(tmplate = (LPVOID)LoadResource(hUser32, hRes)))
|
if (!(tmplate = (LPVOID)LoadResource(user32_module, hRes)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return DialogBoxIndirectParamW(msgbox->hInstance, tmplate, msgbox->hwndOwner,
|
return DialogBoxIndirectParamW(msgbox->hInstance, tmplate, msgbox->hwndOwner,
|
||||||
|
|
Loading…
Reference in New Issue