From bb7b8e638e33cc2a0c90a76267eb4a5f7aaab861 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Fri, 2 Apr 2004 22:16:09 +0000 Subject: [PATCH] implemented GetWindowModuleFileName() svn path=/trunk/; revision=8955 --- reactos/include/win32k/ntuser.h | 1 + reactos/lib/user32/include/user32.h | 3 +++ reactos/lib/user32/user32.edf | 2 +- reactos/lib/user32/windows/window.c | 40 ++++++++++++++--------------- reactos/subsys/win32k/ntuser/misc.c | 13 +++++++++- 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/reactos/include/win32k/ntuser.h b/reactos/include/win32k/ntuser.h index 7276838bc7d..9be873fbc9e 100644 --- a/reactos/include/win32k/ntuser.h +++ b/reactos/include/win32k/ntuser.h @@ -171,6 +171,7 @@ NtUserCallNoParam( #define ONEPARAM_ROUTINE_GETCARETINFO 0x07 #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING 0x08 #define ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS 0x09 +#define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10 #define ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO 0x0a DWORD STDCALL diff --git a/reactos/lib/user32/include/user32.h b/reactos/lib/user32/include/user32.h index d33fb9010e6..a3cbc55ac5a 100644 --- a/reactos/lib/user32/include/user32.h +++ b/reactos/lib/user32/include/user32.h @@ -85,6 +85,9 @@ void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo); #define NtUserGetWindowContextHelpId(hwnd) \ NtUserCallOneParam((DWORD)hwnd, ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID) +#define NtUserGetWindowInstance(hwnd) \ + (HINSTANCE)NtUserCallOneParam((DWORD)hwnd, ONEPARAM_ROUTINE_GETWINDOWINSTANCE) + LONG WINAPI RegCloseKey(HKEY); LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY); LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); diff --git a/reactos/lib/user32/user32.edf b/reactos/lib/user32/user32.edf index 2ecd55b4208..84e875d2ebc 100644 --- a/reactos/lib/user32/user32.edf +++ b/reactos/lib/user32/user32.edf @@ -372,7 +372,7 @@ GetWindowDC=GetWindowDC@4 GetWindowInfo=GetWindowInfo@8 GetWindowLongA=GetWindowLongA@8 GetWindowLongW=GetWindowLongW@8 -GetWindowModuleFileName=GetWindowModuleFileName@12 +GetWindowModuleFileName=GetWindowModuleFileNameA@12 GetWindowModuleFileNameA=GetWindowModuleFileNameA@12 GetWindowModuleFileNameW=GetWindowModuleFileNameW@12 GetWindowPlacement=GetWindowPlacement@8 diff --git a/reactos/lib/user32/windows/window.c b/reactos/lib/user32/windows/window.c index 9b84f1f1002..a91fbb580c0 100644 --- a/reactos/lib/user32/windows/window.c +++ b/reactos/lib/user32/windows/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.103 2004/04/02 20:51:07 weiden Exp $ +/* $Id: window.c,v 1.104 2004/04/02 22:16:09 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -901,41 +902,40 @@ GetWindowInfo(HWND hwnd, /* - * @unimplemented - */ -UINT STDCALL -GetWindowModuleFileName(HWND hwnd, - LPSTR lpszFileName, - UINT cchFileNameMax) -{ - UNIMPLEMENTED; - return 0; -} - - -/* - * @unimplemented + * @implemented */ UINT STDCALL GetWindowModuleFileNameA(HWND hwnd, LPSTR lpszFileName, UINT cchFileNameMax) { - UNIMPLEMENTED; - return 0; + HINSTANCE hWndInst; + + if(!(hWndInst = NtUserGetWindowInstance(hwnd))) + { + return 0; + } + + return GetModuleFileNameA(hWndInst, lpszFileName, cchFileNameMax); } /* - * @unimplemented + * @implemented */ UINT STDCALL GetWindowModuleFileNameW(HWND hwnd, LPWSTR lpszFileName, UINT cchFileNameMax) { - UNIMPLEMENTED; - return 0; + HINSTANCE hWndInst; + + if(!(hWndInst = NtUserGetWindowInstance(hwnd))) + { + return 0; + } + + return GetModuleFileNameW(hWndInst, lpszFileName, cchFileNameMax); } diff --git a/reactos/subsys/win32k/ntuser/misc.c b/reactos/subsys/win32k/ntuser/misc.c index 385670048d6..f78f4e1c8ab 100644 --- a/reactos/subsys/win32k/ntuser/misc.c +++ b/reactos/subsys/win32k/ntuser/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.57 2004/04/02 21:03:25 weiden Exp $ +/* $Id: misc.c,v 1.58 2004/04/02 22:16:09 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -169,6 +169,17 @@ NtUserCallOneParam( case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS: return (DWORD)IntEnumClipboardFormats((UINT)Param); + case ONEPARAM_ROUTINE_GETWINDOWINSTANCE: + if(!(WindowObject = IntGetWindowObject((HWND)Param))) + { + SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); + return FALSE; + } + + Result = (DWORD)WindowObject->Instance; + IntReleaseWindowObject(WindowObject); + return Result; + case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO: return (DWORD)MsqSetMessageExtraInfo((LPARAM)Param); }