diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 73af8aa0bbe..1c3b53832c6 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -378,7 +378,7 @@ @ stdcall GetWindowLongPtrA(long long) @ stdcall GetWindowLongPtrW(long long) @ stdcall GetWindowLongW(long long) -# @ stub GetWindowModuleFileName +@ stdcall GetWindowModuleFileName(long ptr long) GetWindowModuleFileNameA @ stdcall GetWindowModuleFileNameA(long ptr long) @ stdcall GetWindowModuleFileNameW(long ptr long) @ stdcall GetWindowPlacement(long ptr) diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 8214fd50e36..71f6b5567ed 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -3162,21 +3162,45 @@ BOOL WINAPI DragDetect( HWND hWnd, POINT pt ) /****************************************************************************** * GetWindowModuleFileNameA (USER32.@) */ -UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR lpszFileName, UINT cchFileNameMax) +UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR module, UINT size ) { - FIXME("GetWindowModuleFileNameA(hwnd %p, lpszFileName %p, cchFileNameMax %u) stub!\n", - hwnd, lpszFileName, cchFileNameMax); - return 0; + 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) + { + SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + return 0; + } + hinst = win->hInstance; + WIN_ReleasePtr( win ); + + return GetModuleFileNameA( hinst, module, size ); } /****************************************************************************** * GetWindowModuleFileNameW (USER32.@) */ -UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR lpszFileName, UINT cchFileNameMax) +UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size ) { - FIXME("GetWindowModuleFileNameW(hwnd %p, lpszFileName %p, cchFileNameMax %u) stub!\n", - hwnd, lpszFileName, cchFileNameMax); - return 0; + 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) + { + SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + return 0; + } + hinst = win->hInstance; + WIN_ReleasePtr( win ); + + return GetModuleFileNameW( hinst, module, size ); } /******************************************************************************