Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
ed1e4236
Commit
ed1e4236
authored
Dec 30, 2022
by
Luca Bacci
Committed by
Jehan
Jan 24, 2023
Browse files
Use GetModuleHandleW ()
Also fix an unwanted ref-count increment on a module HANDLE
parent
f7be0cf6
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/gui/gui-unique.c
View file @
ed1e4236
...
...
@@ -221,7 +221,7 @@ gui_unique_win32_init (Gimp *gimp)
/* register window class for proxy window */
memset
(
&
wc
,
0
,
sizeof
(
wc
));
wc
.
hInstance
=
GetModuleHandle
(
NULL
);
wc
.
hInstance
=
GetModuleHandle
W
(
NULL
);
wc
.
lpfnWndProc
=
gui_unique_win32_message_handler
;
wc
.
lpszClassName
=
GIMP_UNIQUE_WIN32_WINDOW_CLASS
;
...
...
app/main.c
View file @
ed1e4236
...
...
@@ -613,7 +613,7 @@ main (int argc,
t_SetDllDirectoryA
p_SetDllDirectoryA
;
p_SetDllDirectoryA
=
(
t_SetDllDirectoryA
)
GetProcAddress
(
GetModuleHandle
(
"kernel32.dll"
),
(
t_SetDllDirectoryA
)
GetProcAddress
(
GetModuleHandle
W
(
L
"kernel32.dll"
),
"SetDllDirectoryA"
);
if
(
p_SetDllDirectoryA
)
(
*
p_SetDllDirectoryA
)
(
""
);
...
...
@@ -647,7 +647,7 @@ main (int argc,
t_SetProcessDEPPolicy
p_SetProcessDEPPolicy
;
p_SetProcessDEPPolicy
=
(
t_SetProcessDEPPolicy
)
GetProcAddress
(
GetModuleHandle
(
"kernel32.dll"
),
(
t_SetProcessDEPPolicy
)
GetProcAddress
(
GetModuleHandle
W
(
L
"kernel32.dll"
),
"SetProcessDEPPolicy"
);
if
(
p_SetProcessDEPPolicy
)
(
*
p_SetProcessDEPPolicy
)
(
PROCESS_DEP_ENABLE
|
PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
);
...
...
@@ -660,7 +660,7 @@ main (int argc,
t_SetCurrentProcessExplicitAppUserModelID
p_SetCurrentProcessExplicitAppUserModelID
;
p_SetCurrentProcessExplicitAppUserModelID
=
(
t_SetCurrentProcessExplicitAppUserModelID
)
GetProcAddress
(
GetModuleHandle
(
"shell32.dll"
),
(
t_SetCurrentProcessExplicitAppUserModelID
)
GetProcAddress
(
GetModuleHandle
W
(
L
"shell32.dll"
),
"SetCurrentProcessExplicitAppUserModelID"
);
if
(
p_SetCurrentProcessExplicitAppUserModelID
)
(
*
p_SetCurrentProcessExplicitAppUserModelID
)
(
L"gimp.GimpApplication"
);
...
...
libgimp/gimp.c
View file @
ed1e4236
...
...
@@ -200,7 +200,7 @@ gimp_main (GType plug_in_type,
typedef
BOOL
(
WINAPI
*
t_SetDllDirectoryA
)
(
LPCSTR
lpPathName
);
t_SetDllDirectoryA
p_SetDllDirectoryA
;
p_SetDllDirectoryA
=
(
t_SetDllDirectoryA
)
GetProcAddress
(
GetModuleHandle
(
"kernel32.dll"
),
p_SetDllDirectoryA
=
(
t_SetDllDirectoryA
)
GetProcAddress
(
GetModuleHandle
W
(
L
"kernel32.dll"
),
"SetDllDirectoryA"
);
if
(
p_SetDllDirectoryA
)
(
*
p_SetDllDirectoryA
)
(
""
);
...
...
@@ -269,7 +269,7 @@ gimp_main (GType plug_in_type,
typedef
BOOL
(
WINAPI
*
t_SetProcessDEPPolicy
)
(
DWORD
dwFlags
);
t_SetProcessDEPPolicy
p_SetProcessDEPPolicy
;
p_SetProcessDEPPolicy
=
GetProcAddress
(
GetModuleHandle
(
"kernel32.dll"
),
p_SetProcessDEPPolicy
=
GetProcAddress
(
GetModuleHandle
W
(
L
"kernel32.dll"
),
"SetProcessDEPPolicy"
);
if
(
p_SetProcessDEPPolicy
)
(
*
p_SetProcessDEPPolicy
)
(
PROCESS_DEP_ENABLE
|
PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
);
...
...
@@ -281,7 +281,7 @@ gimp_main (GType plug_in_type,
typedef
HRESULT
(
WINAPI
*
t_SetCurrentProcessExplicitAppUserModelID
)
(
PCWSTR
lpPathName
);
t_SetCurrentProcessExplicitAppUserModelID
p_SetCurrentProcessExplicitAppUserModelID
;
p_SetCurrentProcessExplicitAppUserModelID
=
(
t_SetCurrentProcessExplicitAppUserModelID
)
GetProcAddress
(
GetModuleHandle
(
"shell32.dll"
),
p_SetCurrentProcessExplicitAppUserModelID
=
(
t_SetCurrentProcessExplicitAppUserModelID
)
GetProcAddress
(
GetModuleHandle
W
(
L
"shell32.dll"
),
"SetCurrentProcessExplicitAppUserModelID"
);
if
(
p_SetCurrentProcessExplicitAppUserModelID
)
(
*
p_SetCurrentProcessExplicitAppUserModelID
)
(
L"gimp.GimpApplication"
);
...
...
modules/gimpinputdevicestore-dx.c
View file @
ed1e4236
...
...
@@ -204,9 +204,10 @@ gimp_input_device_store_init (GimpInputDeviceStore *store)
gtk_list_store_set_column_types
(
GTK_LIST_STORE
(
store
),
G_N_ELEMENTS
(
types
),
types
);
if
(
!
GetModuleHandleEx
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
(
LPCTSTR
)
&
gimp_input_device_store_init
,
&
thismodule
))
if
(
!
GetModuleHandleExW
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
,
(
LPCTSTR
)
&
gimp_input_device_store_init
,
&
thismodule
))
return
;
if
((
store
->
window
=
create_aux_window
(
store
))
==
NULL
)
...
...
plug-ins/screenshot/screenshot-win32.c
View file @
ed1e4236
...
...
@@ -790,7 +790,7 @@ doCaptureMagnificationAPI (HWND selectedHwnd,
/* Create the host window that will store the mag child window */
hwndHost
=
CreateWindowEx
(
0x08000000
|
0x080000
|
0x80
|
0x20
,
APP_NAME
,
NULL
,
0x80000000
,
0
,
0
,
0
,
0
,
NULL
,
NULL
,
GetModuleHandle
(
NULL
),
NULL
);
0
,
0
,
0
,
0
,
NULL
,
NULL
,
GetModuleHandle
W
(
NULL
),
NULL
);
if
(
!
hwndHost
)
{
...
...
@@ -808,7 +808,7 @@ doCaptureMagnificationAPI (HWND selectedHwnd,
hwndMag
=
CreateWindow
(
WC_MAGNIFIER
,
TEXT
(
"MagnifierWindow"
),
magStyles
,
0
,
0
,
round4Rect
.
right
-
round4Rect
.
left
,
round4Rect
.
bottom
-
round4Rect
.
top
,
hwndHost
,
NULL
,
GetModuleHandle
(
NULL
),
NULL
);
hwndHost
,
NULL
,
GetModuleHandle
W
(
NULL
),
NULL
);
/* Set the callback function that will be called by the api to get the pixels */
if
(
!
MagSetImageScalingCallback
(
hwndMag
,
(
MagImageScalingCallback
)
doCaptureMagnificationAPI_callback
))
...
...
plug-ins/twain/tw_win.c
View file @
ed1e4236
...
...
@@ -346,9 +346,9 @@ twainMain (void)
pTW_SESSION
twSession
=
initializeTwain
();
/* Since we are not using our own WinMain anymore where we
could get hInst we get it here using GetModuleHandle. */
could get hInst we get it here using GetModuleHandle
W
. */
if
(
!
hInst
)
hInst
=
GetModuleHandle
(
NULL
);
hInst
=
GetModuleHandle
W
(
NULL
);
/* Perform instance initialization */
if
(
!
InitApplication
(
hInst
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment