Author: hbelusca
Date: Wed Dec 24 15:48:37 2014
New Revision: 65820
URL:
http://svn.reactos.org/svn/reactos?rev=65820&view=rev
Log:
[WIN32K]
Fix NtUserProcessConnect to use the process handle we give to it, instead of the
"current process"... This should fix the user32 CSR connection that I was
failing to fix in previous revisions...
CORE-8949
Modified:
trunk/reactos/win32ss/include/ntuser.h
trunk/reactos/win32ss/user/ntuser/ntstubs.c
Modified: trunk/reactos/win32ss/include/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?r…
==============================================================================
--- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Wed Dec 24 15:48:37 2014
@@ -2607,9 +2607,9 @@
NTSTATUS
NTAPI
NtUserProcessConnect(
- IN HANDLE Process,
+ IN HANDLE ProcessHandle,
OUT PUSERCONNECT pUserConnect,
- IN DWORD dwSize); // sizeof(USERCONNECT)
+ IN ULONG Size); // sizeof(USERCONNECT)
NTSTATUS
NTAPI
Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstub…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] Wed Dec 24 15:48:37 2014
@@ -720,11 +720,12 @@
NTSTATUS
APIENTRY
NtUserProcessConnect(
- HANDLE Process,
- PUSERCONNECT pUserConnect,
- DWORD Size)
-{
- NTSTATUS Status = STATUS_SUCCESS;
+ IN HANDLE ProcessHandle,
+ OUT PUSERCONNECT pUserConnect,
+ IN ULONG Size)
+{
+ NTSTATUS Status;
+ PEPROCESS Process = NULL;
PPROCESSINFO W32Process;
TRACE("NtUserProcessConnect\n");
@@ -735,9 +736,20 @@
return STATUS_UNSUCCESSFUL;
}
+ /* Get the process object the user handle was referencing */
+ Status = ObReferenceObjectByHandle(ProcessHandle,
+ PROCESS_VM_OPERATION,
+ *PsProcessType,
+ UserMode,
+ (PVOID*)&Process,
+ NULL);
+ if (!NT_SUCCESS(Status)) return Status;
+
UserEnterShared();
- W32Process = PsGetCurrentProcessWin32Process();
+ /* Get Win32 process information */
+ W32Process = PsGetProcessWin32Process(Process);
+
_SEH2_TRY
{
// FIXME: Check that pUserConnect->ulVersion == USER_VERSION;
@@ -755,11 +767,13 @@
_SEH2_END;
if (!NT_SUCCESS(Status))
- {
SetLastNtError(Status);
- }
UserLeave();
+
+ /* Dereference the process object */
+ ObDereferenceObject(Process);
+
return Status;
}