Author: aandrejevic Date: Sat Feb 1 19:05:54 2014 New Revision: 61904
URL: http://svn.reactos.org/svn/reactos?rev=61904&view=rev Log: [KERNEL32] Enable the BaseVDM functions, even though they're not yet implemented in basesrv. Implement ExitVDM.
Modified: branches/ntvdm/dll/win32/kernel32/client/vdm.c
Modified: branches/ntvdm/dll/win32/kernel32/client/vdm.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/dll/win32/kernel32/client/... ============================================================================== --- branches/ntvdm/dll/win32/kernel32/client/vdm.c [iso-8859-1] (original) +++ branches/ntvdm/dll/win32/kernel32/client/vdm.c [iso-8859-1] Sat Feb 1 19:05:54 2014 @@ -89,10 +89,9 @@ IN ULONG IndexInfo, IN ULONG BinaryType) { -#if 0 // Unimplemented in BASESRV NTSTATUS Status; BASE_API_MESSAGE ApiMessage; - PBASE_UPDATE_VDM_ENTRY UpdateVdmEntry = &ApiMessage.Data.UpdateVdmEntry; + PBASE_UPDATE_VDM_ENTRY UpdateVdmEntry = &ApiMessage.Data.UpdateVDMEntryRequest;
/* Check what update is being sent */ switch (UpdateIndex) @@ -155,7 +154,7 @@ /* Return it to the caller */ *WaitHandle = UpdateVdmEntry->WaitObjectForParent; } -#endif + /* We made it */ return TRUE; } @@ -165,11 +164,10 @@ BaseCheckForVDM(IN HANDLE ProcessHandle, OUT LPDWORD ExitCode) { -#if 0 // Unimplemented in BASESRV NTSTATUS Status; EVENT_BASIC_INFORMATION EventBasicInfo; BASE_API_MESSAGE ApiMessage; - PBASE_GET_VDM_EXIT_CODE GetVdmExitCode = &ApiMessage.Data.GetVdmExitCode; + PBASE_GET_VDM_EXIT_CODE GetVdmExitCode = &ApiMessage.Data.GetVDMExitCodeRequest;
/* It's VDM if the process is actually a wait handle (an event) */ Status = NtQueryEvent(ProcessHandle, @@ -192,7 +190,6 @@
/* Get the exit code from the reply */ *ExitCode = GetVdmExitCode->ExitCode; -#endif return TRUE; }
@@ -755,17 +752,31 @@ }
/* - * @unimplemented - */ -DWORD -WINAPI -ExitVDM ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; + * @implemented + */ +VOID +WINAPI +ExitVDM(BOOL IsWow, ULONG iWowTask) +{ + BASE_API_MESSAGE ApiMessage; + PBASE_EXIT_VDM ExitVdm = &ApiMessage.Data.ExitVDMRequest; + + /* Setup the input parameters */ + ExitVdm->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + ExitVdm->iWowTask = IsWow ? iWowTask : 0; /* Always zero for DOS tasks */ + ExitVdm->WaitObjectForVDM = NULL; + + /* Call CSRSS */ + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepExitVDM), + sizeof(BASE_EXIT_VDM)); + + /* Close the returned wait object handle, if any */ + if (NT_SUCCESS(ApiMessage.Status) && (ExitVdm->WaitObjectForVDM != NULL)) + { + CloseHandle(ExitVdm->WaitObjectForVDM); + } }