- Removed NtUserGetWindowThreadProcessId, updated all related. Wanting to remove...
authorJames Tabor <james.tabor@reactos.org>
Wed, 9 Jul 2008 04:30:10 +0000 (04:30 +0000)
committerJames Tabor <james.tabor@reactos.org>
Wed, 9 Jul 2008 04:30:10 +0000 (04:30 +0000)
- Tested with all my test apps.

svn path=/trunk/; revision=34379

reactos/dll/win32/user32/windows/window.c
reactos/include/reactos/win32k/ntuser.h
reactos/subsystems/win32/win32k/ntuser/window.c
reactos/subsystems/win32/win32k/w32ksvc.db

index d6a265d..5f29d16 100644 (file)
@@ -1294,7 +1294,30 @@ DWORD STDCALL
 GetWindowThreadProcessId(HWND hWnd,
                         LPDWORD lpdwProcessId)
 {
-   return NtUserGetWindowThreadProcessId(hWnd, lpdwProcessId);
+  DWORD Ret = 0;
+  PW32THREADINFO ti;
+  PWINDOW pWnd = ValidateHwnd(hWnd);
+
+  if (!pWnd) return Ret;
+
+  ti = pWnd->ti;
+
+  if ( ti )
+  {
+    if ( ti == GetW32ThreadInfo() )
+    { // We are current.
+      if ( lpdwProcessId )
+        *lpdwProcessId = (DWORD)NtCurrentTeb()->Cid.UniqueProcess;
+      Ret = (DWORD)NtCurrentTeb()->Cid.UniqueThread;
+    }
+    else
+    { // Ask kernel for info.
+      if ( lpdwProcessId )
+        *lpdwProcessId = NtUserQueryWindow(hWnd, QUERY_WINDOW_UNIQUE_PROCESS_ID);
+      Ret = NtUserQueryWindow(hWnd, QUERY_WINDOW_UNIQUE_THREAD_ID);
+    }
+  }
+  return Ret;
 }
 
 
@@ -1604,7 +1627,7 @@ SetWindowTextA(HWND hWnd,
               LPCSTR lpString)
 {
   DWORD ProcessId;
-  if(!NtUserGetWindowThreadProcessId(hWnd, &ProcessId))
+  if(!GetWindowThreadProcessId(hWnd, &ProcessId))
   {
     return FALSE;
   }
@@ -1644,7 +1667,7 @@ SetWindowTextW(HWND hWnd,
               LPCWSTR lpString)
 {
   DWORD ProcessId;
-  if(!NtUserGetWindowThreadProcessId(hWnd, &ProcessId))
+  if(!GetWindowThreadProcessId(hWnd, &ProcessId))
   {
     return FALSE;
   }
index a8273f7..0efc979 100644 (file)
@@ -2725,11 +2725,6 @@ LONG
 NTAPI
 NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi);
 
-DWORD
-NTAPI
-NtUserGetWindowThreadProcessId(HWND hWnd, LPDWORD UnsafePid);
-
-
 
 /* (other FocusedItem values give the position of the focused item) */
 #define NO_SELECTED_ITEM  0xffff
index c664255..3c4b756 100644 (file)
@@ -3888,39 +3888,6 @@ CLEANUP:
 }
 
 
-/*
- * @implemented
- */
-DWORD STDCALL
-NtUserGetWindowThreadProcessId(HWND hWnd, LPDWORD UnsafePid)
-{
-   PWINDOW_OBJECT Wnd;
-   DWORD tid, pid;
-   DECLARE_RETURN(DWORD);
-
-   DPRINT("Enter NtUserGetWindowThreadProcessId\n");
-   UserEnterShared();
-
-   if (!(Wnd = UserGetWindowObject(hWnd)))
-   {
-      RETURN( 0);
-   }
-
-   tid = (DWORD)IntGetWndThreadId(Wnd);
-   pid = (DWORD)IntGetWndProcessId(Wnd);
-
-   if (UnsafePid)
-      MmCopyToCaller(UnsafePid, &pid, sizeof(DWORD));
-
-   RETURN( tid);
-
-CLEANUP:
-   DPRINT("Leave NtUserGetWindowThreadProcessId, ret=%i\n",_ret_);
-   UserLeave();
-   END_CLEANUP;
-}
-
-
 /*
  * @unimplemented
  */
index 2e8cd5a..6e7f317 100644 (file)
@@ -690,7 +690,6 @@ NtUserGetScrollInfo                     3
 NtUserGetShellWindow                    0
 NtUserGetWindow                         2
 NtUserGetWindowLong                     3
-NtUserGetWindowThreadProcessId          2
 NtUserMenuInfo                          3
 NtUserMenuItemInfo                      5
 NtUserMonitorFromPoint                  3