mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +00:00
[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. svn path=/branches/ntvdm/; revision=62367
This commit is contained in:
parent
f488f7003e
commit
d01148ac9b
|
@ -166,6 +166,27 @@ BOOLEAN NTAPI BaseSrvIsVdmAllowed(VOID)
|
||||||
return VdmAllowed;
|
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)
|
VOID NTAPI BaseInitializeVDM(VOID)
|
||||||
{
|
{
|
||||||
/* Initialize the list head */
|
/* Initialize the list head */
|
||||||
|
@ -276,6 +297,9 @@ CSR_API(BaseSrvCheckVDM)
|
||||||
DosRecord->ExitCode = 0;
|
DosRecord->ExitCode = 0;
|
||||||
// TODO: The DOS record structure is incomplete
|
// TODO: The DOS record structure is incomplete
|
||||||
|
|
||||||
|
Status = BaseSrvCreatePairWaitHandles(&DosRecord->ServerEvent, &DosRecord->ClientEvent);
|
||||||
|
if (!NT_SUCCESS(Status)) goto Cleanup;
|
||||||
|
|
||||||
/* Add the DOS record */
|
/* Add the DOS record */
|
||||||
InsertHeadList(&ConsoleRecord->DosListHead, &DosRecord->Entry);
|
InsertHeadList(&ConsoleRecord->DosListHead, &DosRecord->Entry);
|
||||||
|
|
||||||
|
@ -423,7 +447,7 @@ CSR_API(BaseSrvGetVDMExitCode)
|
||||||
for (i = ConsoleRecord->DosListHead.Flink; i != &ConsoleRecord->DosListHead; i = i->Flink)
|
for (i = ConsoleRecord->DosListHead.Flink; i != &ConsoleRecord->DosListHead; i = i->Flink)
|
||||||
{
|
{
|
||||||
DosRecord = CONTAINING_RECORD(i, VDM_DOS_RECORD, Entry);
|
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 */
|
/* Check if no DOS record was found */
|
||||||
|
|
|
@ -32,7 +32,8 @@ typedef struct _VDM_DOS_RECORD
|
||||||
LIST_ENTRY Entry;
|
LIST_ENTRY Entry;
|
||||||
USHORT State;
|
USHORT State;
|
||||||
ULONG ExitCode;
|
ULONG ExitCode;
|
||||||
HANDLE ParentProcess;
|
HANDLE ServerEvent;
|
||||||
|
HANDLE ClientEvent;
|
||||||
// TODO: Structure incomplete!!!
|
// TODO: Structure incomplete!!!
|
||||||
} VDM_DOS_RECORD, *PVDM_DOS_RECORD;
|
} VDM_DOS_RECORD, *PVDM_DOS_RECORD;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue