mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
NtUser-/W32kGetWindowThreadProcessId impl.
svn path=/trunk/; revision=5264
This commit is contained in:
parent
1e85120647
commit
a857d3b160
4 changed files with 44 additions and 1 deletions
|
@ -545,3 +545,4 @@ NtUserYieldTask 0
|
||||||
NtUserGetDesktopWindow 0
|
NtUserGetDesktopWindow 0
|
||||||
# ReactOS only system calls
|
# ReactOS only system calls
|
||||||
NtUserAcquireOrReleaseInputOwnership 1
|
NtUserAcquireOrReleaseInputOwnership 1
|
||||||
|
NtUserGetWindowThreadProcessId 2
|
||||||
|
|
|
@ -1741,6 +1741,9 @@ DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserYieldTask(VOID);
|
NtUserYieldTask(VOID);
|
||||||
|
|
||||||
|
DWORD STDCALL
|
||||||
|
NtUserGetWindowThreadProcessId(HWND hWnd, LPDWORD UnsafePid);
|
||||||
|
|
||||||
#endif /* __WIN32K_NTUSER_H */
|
#endif /* __WIN32K_NTUSER_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -83,6 +83,7 @@ typedef struct _WINDOW_OBJECT
|
||||||
PSCROLLBARINFO wExtra;
|
PSCROLLBARINFO wExtra;
|
||||||
LONG UserData;
|
LONG UserData;
|
||||||
WNDPROC WndProc;
|
WNDPROC WndProc;
|
||||||
|
PETHREAD OwnerThread;
|
||||||
} WINDOW_OBJECT, *PWINDOW_OBJECT;
|
} WINDOW_OBJECT, *PWINDOW_OBJECT;
|
||||||
|
|
||||||
/* Window flags. */
|
/* Window flags. */
|
||||||
|
@ -108,6 +109,10 @@ BOOL FASTCALL W32kIsChildWindow (HWND Parent, HWND Child);
|
||||||
HWND FASTCALL W32kGetDesktopWindow (VOID);
|
HWND FASTCALL W32kGetDesktopWindow (VOID);
|
||||||
HWND FASTCALL W32kGetFocusWindow (VOID);
|
HWND FASTCALL W32kGetFocusWindow (VOID);
|
||||||
HWND FASTCALL W32kSetFocusWindow (HWND hWnd);
|
HWND FASTCALL W32kSetFocusWindow (HWND hWnd);
|
||||||
|
|
||||||
|
DWORD FASTCALL
|
||||||
|
W32kGetWindowThreadProcessId(PWINDOW_OBJECT Wnd, PDWORD pid);
|
||||||
|
|
||||||
#endif /* __WIN32K_WINDOW_H */
|
#endif /* __WIN32K_WINDOW_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: window.c,v 1.66 2003/07/24 15:59:34 rcampbell Exp $
|
/* $Id: window.c,v 1.67 2003/07/25 19:35:51 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -490,6 +490,7 @@ W32kCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
|
||||||
WindowObject->ClientRect = WindowObject->WindowRect;
|
WindowObject->ClientRect = WindowObject->WindowRect;
|
||||||
WindowObject->UserData = 0;
|
WindowObject->UserData = 0;
|
||||||
WindowObject->WndProc = DesktopClass->Class.lpfnWndProc;
|
WindowObject->WndProc = DesktopClass->Class.lpfnWndProc;
|
||||||
|
WindowObject->OwnerThread = PsGetCurrentThread();
|
||||||
|
|
||||||
InitializeListHead(&WindowObject->ChildrenListHead);
|
InitializeListHead(&WindowObject->ChildrenListHead);
|
||||||
ExInitializeFastMutex(&WindowObject->ChildrenListLock);
|
ExInitializeFastMutex(&WindowObject->ChildrenListLock);
|
||||||
|
@ -631,6 +632,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
WindowObject->Parent = ParentWindow;
|
WindowObject->Parent = ParentWindow;
|
||||||
WindowObject->UserData = 0;
|
WindowObject->UserData = 0;
|
||||||
WindowObject->WndProc = ClassObject->Class.lpfnWndProc;
|
WindowObject->WndProc = ClassObject->Class.lpfnWndProc;
|
||||||
|
WindowObject->OwnerThread = PsGetCurrentThread();
|
||||||
|
|
||||||
ExAcquireFastMutexUnsafe(&ParentWindow->ChildrenListLock);
|
ExAcquireFastMutexUnsafe(&ParentWindow->ChildrenListLock);
|
||||||
InsertHeadList(&ParentWindow->ChildrenListHead,
|
InsertHeadList(&ParentWindow->ChildrenListHead,
|
||||||
|
@ -1964,4 +1966,36 @@ NtUserGetDesktopWindow()
|
||||||
return W32kGetDesktopWindow();
|
return W32kGetDesktopWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD FASTCALL
|
||||||
|
W32kGetWindowThreadProcessId(PWINDOW_OBJECT Wnd, PDWORD pid)
|
||||||
|
{
|
||||||
|
if (pid) *pid = (DWORD) Wnd->OwnerThread->Cid.UniqueThread;
|
||||||
|
return (DWORD) Wnd->OwnerThread->ThreadsProcess->UniqueProcessId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DWORD STDCALL
|
||||||
|
NtUserGetWindowThreadProcessId(HWND hWnd, LPDWORD UnsafePid)
|
||||||
|
{
|
||||||
|
PWINDOW_OBJECT Wnd;
|
||||||
|
DWORD tid, pid;
|
||||||
|
|
||||||
|
//W32kAcquireWindowsLockShared();
|
||||||
|
|
||||||
|
if (!(Wnd = W32kGetWindowObject(hWnd)))
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tid = W32kGetWindowThreadProcessId(Wnd, &pid);
|
||||||
|
W32kReleaseWindowObject(Wnd);
|
||||||
|
//W32kReleaseWindowsLock();
|
||||||
|
|
||||||
|
if (UnsafePid) MmCopyToCaller(UnsafePid, &pid, sizeof(DWORD));
|
||||||
|
|
||||||
|
return tid;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue