user32: Implement GetWindowModuleFileName
Dmitry Timoshkov
dmitry at codeweavers.com
Mon May 12 23:15:20 CDT 2008
Hello,
the tests under XP SP3 show that GetWindowModuleFileName fails for other
process windows, so that's not the case to worry about.
Changelog:
user32: Implement GetWindowModuleFileName.
---
dlls/user32/user32.spec | 2 +-
dlls/user32/win.c | 34 ++++++++++++++++++++++++++--------
2 files changed, 27 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..cebac14 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3162,21 +3162,39 @@ 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;
+ HINSTANCE hinst;
+
+ TRACE( "%p, %p, %u\n", hwnd, module, size );
+
+ if (!IsWindow( hwnd ))
+ {
+ SetLastError( ERROR_INVALID_WINDOW_HANDLE );
+ return 0;
+ }
+
+ hinst = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
+ 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;
+ HINSTANCE hinst;
+
+ TRACE( "%p, %p, %u\n", hwnd, module, size );
+
+ if (!IsWindow( hwnd ))
+ {
+ SetLastError( ERROR_INVALID_WINDOW_HANDLE );
+ return 0;
+ }
+
+ hinst = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
+ return GetModuleFileNameW( hinst, module, size );
}
/******************************************************************************
--
1.5.5.1
More information about the wine-patches
mailing list