Commit fcf4d071 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Use GetWindowLongPtr for GetWindowModuleFileName implementation.

parent 11657aab
...@@ -1413,20 +1413,17 @@ BOOL WINAPI DragDetect( HWND hwnd, POINT pt ) ...@@ -1413,20 +1413,17 @@ BOOL WINAPI DragDetect( HWND hwnd, POINT pt )
*/ */
UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR module, UINT size ) UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR module, UINT size )
{ {
WND *win;
HINSTANCE hinst; HINSTANCE hinst;
TRACE( "%p, %p, %u\n", hwnd, module, size ); TRACE( "%p, %p, %u\n", hwnd, module, size );
win = WIN_GetPtr( hwnd ); if (!WIN_IsCurrentProcess( hwnd ))
if (!win || win == WND_OTHER_PROCESS || win == WND_DESKTOP)
{ {
SetLastError( ERROR_INVALID_WINDOW_HANDLE ); SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0; return 0;
} }
hinst = win->hInstance;
WIN_ReleasePtr( win );
hinst = (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE );
return GetModuleFileNameA( hinst, module, size ); return GetModuleFileNameA( hinst, module, size );
} }
...@@ -1435,20 +1432,17 @@ UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR module, UINT size ) ...@@ -1435,20 +1432,17 @@ UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR module, UINT size )
*/ */
UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size ) UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size )
{ {
WND *win;
HINSTANCE hinst; HINSTANCE hinst;
TRACE( "%p, %p, %u\n", hwnd, module, size ); TRACE( "%p, %p, %u\n", hwnd, module, size );
win = WIN_GetPtr( hwnd ); if (!WIN_IsCurrentProcess( hwnd ))
if (!win || win == WND_OTHER_PROCESS || win == WND_DESKTOP)
{ {
SetLastError( ERROR_INVALID_WINDOW_HANDLE ); SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0; return 0;
} }
hinst = win->hInstance;
WIN_ReleasePtr( win );
hinst = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
return GetModuleFileNameW( hinst, module, size ); return GetModuleFileNameW( hinst, module, size );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment