Author: aandrejevic
Date: Sat Mar 1 15:13:54 2014
New Revision: 62367
URL:
http://svn.reactos.org/svn/reactos?rev=62367&view=rev
Log:
[BASESRV]
Implement a function that creates a pair of event handles - BaseSrvCreatePairWaitHandles.
As already explained in the comments of BaseCheckForVDM (in kernel32), the hParent
parameter
is actually an event handle (or more precisely, the client event handle), not a process
handle.
Modified:
branches/ntvdm/subsystems/win/basesrv/vdm.c
branches/ntvdm/subsystems/win/basesrv/vdm.h
Modified: branches/ntvdm/subsystems/win/basesrv/vdm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/win/basesrv/vd…
==============================================================================
--- branches/ntvdm/subsystems/win/basesrv/vdm.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/win/basesrv/vdm.c [iso-8859-1] Sat Mar 1 15:13:54 2014
@@ -164,6 +164,27 @@
}
return VdmAllowed;
+}
+
+NTSTATUS NTAPI BaseSrvCreatePairWaitHandles(PHANDLE ServerEvent, PHANDLE ClientEvent)
+{
+ NTSTATUS Status;
+
+ /* Create the event */
+ Status = NtCreateEvent(ServerEvent, EVENT_ALL_ACCESS, NULL, NotificationEvent,
FALSE);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ /* Duplicate the event into the client process */
+ Status = NtDuplicateObject(NtCurrentProcess(),
+ *ServerEvent,
+ CsrGetClientThread()->Process->ProcessHandle,
+ ClientEvent,
+ 0,
+ 0,
+ DUPLICATE_SAME_ATTRIBUTES | DUPLICATE_SAME_ACCESS);
+
+ if (!NT_SUCCESS(Status)) NtClose(*ServerEvent);
+ return Status;
}
VOID NTAPI BaseInitializeVDM(VOID)
@@ -276,6 +297,9 @@
DosRecord->ExitCode = 0;
// TODO: The DOS record structure is incomplete
+ Status = BaseSrvCreatePairWaitHandles(&DosRecord->ServerEvent,
&DosRecord->ClientEvent);
+ if (!NT_SUCCESS(Status)) goto Cleanup;
+
/* Add the DOS record */
InsertHeadList(&ConsoleRecord->DosListHead, &DosRecord->Entry);
@@ -423,7 +447,7 @@
for (i = ConsoleRecord->DosListHead.Flink; i !=
&ConsoleRecord->DosListHead; i = i->Flink)
{
DosRecord = CONTAINING_RECORD(i, VDM_DOS_RECORD, Entry);
- if (DosRecord->ParentProcess == GetVDMExitCodeRequest->hParent) break;
+ if (DosRecord->ClientEvent == GetVDMExitCodeRequest->hParent) break;
}
/* Check if no DOS record was found */
Modified: branches/ntvdm/subsystems/win/basesrv/vdm.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/win/basesrv/vd…
==============================================================================
--- branches/ntvdm/subsystems/win/basesrv/vdm.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/win/basesrv/vdm.h [iso-8859-1] Sat Mar 1 15:13:54 2014
@@ -32,7 +32,8 @@
LIST_ENTRY Entry;
USHORT State;
ULONG ExitCode;
- HANDLE ParentProcess;
+ HANDLE ServerEvent;
+ HANDLE ClientEvent;
// TODO: Structure incomplete!!!
} VDM_DOS_RECORD, *PVDM_DOS_RECORD;