From 2420e2ff0de08c72f392b26807b8ffec9be8ff2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 1 Nov 2014 17:51:39 +0000 Subject: [PATCH] [BASESRV] - Correctly set the VdmPower flag when the process being started is a NT VDM - Return a correct status code if VDM access is forbidden. svn path=/trunk/; revision=65170 --- reactos/subsystems/win/basesrv/proc.c | 12 +++++++++--- reactos/subsystems/win/basesrv/vdm.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/reactos/subsystems/win/basesrv/proc.c b/reactos/subsystems/win/basesrv/proc.c index 53113f7edda..707c549df03 100644 --- a/reactos/subsystems/win/basesrv/proc.c +++ b/reactos/subsystems/win/basesrv/proc.c @@ -71,7 +71,7 @@ CSR_API(BaseSrvCreateProcess) HANDLE ProcessHandle, ThreadHandle; PCSR_THREAD CsrThread; PCSR_PROCESS Process; - ULONG Flags = 0, VdmPower = 0, DebugFlags = 0; + ULONG Flags = 0, DebugFlags = 0, VdmPower = 0; /* Get the current client thread */ CsrThread = CsrGetClientThread(); @@ -83,6 +83,13 @@ CSR_API(BaseSrvCreateProcess) Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3; CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3); + /* Some things should be done if this is a VDM process */ + if (CreateProcessRequest->VdmBinaryType) + { + /* We need to set the VDM power later on */ + VdmPower = 1; + } + /* Duplicate the process handle */ Status = NtDuplicateObject(Process->ProcessHandle, CreateProcessRequest->ProcessHandle, @@ -112,10 +119,9 @@ CSR_API(BaseSrvCreateProcess) return Status; } - /* See if this is a VDM process */ + /* If this is a VDM process, request VDM power */ if (VdmPower) { - /* Request VDM powers */ Status = NtSetInformationProcess(ProcessHandle, ProcessWx86Information, &VdmPower, diff --git a/reactos/subsystems/win/basesrv/vdm.c b/reactos/subsystems/win/basesrv/vdm.c index 81873a138c2..09bf071efe8 100644 --- a/reactos/subsystems/win/basesrv/vdm.c +++ b/reactos/subsystems/win/basesrv/vdm.c @@ -576,7 +576,7 @@ CSR_API(BaseSrvCheckVDM) BOOLEAN NewConsoleRecord = FALSE; /* Don't do anything if the VDM has been disabled in the registry */ - if (!BaseSrvIsVdmAllowed()) return STATUS_ACCESS_DENIED; + if (!BaseSrvIsVdmAllowed()) return STATUS_VDM_DISALLOWED; /* Validate the message buffers */ if (!CsrValidateMessageBuffer(ApiMessage, -- 2.17.1