Dmitry Timoshkov : user32: Implement GetWindowModuleFileName.

Alexandre Julliard julliard at winehq.org
Tue May 27 06:03:44 CDT 2008


Module: wine
Branch: master
Commit: 90f07959718061b27fe219c1ecf6eea1d5ae9a51
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=90f07959718061b27fe219c1ecf6eea1d5ae9a51

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Tue May 13 15:49:35 2008 +0900

user32: Implement GetWindowModuleFileName.

---

 dlls/user32/user32.spec |    2 +-
 dlls/user32/win.c       |   40 ++++++++++++++++++++++++++++++++--------
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 73af8aa..1c3b538 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 8214fd5..71f6b55 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 );
 }
 
 /******************************************************************************




More information about the wine-cvs mailing list