Jacek Caban : user32: Use GetWindowLongPtr for GetWindowModuleFileName implementation.
Module: wine Branch: master Commit: fcf4d07161478ec8ea0707a50af02acc7fe6df6a URL: https://gitlab.winehq.org/wine/wine/-/commit/fcf4d07161478ec8ea0707a50af02ac... Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Jul 26 18:23:30 2022 +0200 user32: Use GetWindowLongPtr for GetWindowModuleFileName implementation. --- dlls/user32/win.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index b149a202433..23263166eeb 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -1413,20 +1413,17 @@ BOOL WINAPI DragDetect( HWND hwnd, POINT pt ) */ UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR module, UINT size ) { - WND *win; HINSTANCE hinst; TRACE( "%p, %p, %u\n", hwnd, module, size ); - win = WIN_GetPtr( hwnd ); - if (!win || win == WND_OTHER_PROCESS || win == WND_DESKTOP) + if (!WIN_IsCurrentProcess( hwnd )) { SetLastError( ERROR_INVALID_WINDOW_HANDLE ); return 0; } - hinst = win->hInstance; - WIN_ReleasePtr( win ); + hinst = (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ); return GetModuleFileNameA( hinst, module, size ); } @@ -1435,20 +1432,17 @@ UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR module, UINT size ) */ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size ) { - WND *win; HINSTANCE hinst; TRACE( "%p, %p, %u\n", hwnd, module, size ); - win = WIN_GetPtr( hwnd ); - if (!win || win == WND_OTHER_PROCESS || win == WND_DESKTOP) + if (!WIN_IsCurrentProcess( hwnd )) { SetLastError( ERROR_INVALID_WINDOW_HANDLE ); return 0; } - hinst = win->hInstance; - WIN_ReleasePtr( win ); + hinst = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); return GetModuleFileNameW( hinst, module, size ); }
participants (1)
-
Alexandre Julliard