--- /dev/null
+/* $Id: ntvdm.c,v 1.1 2002/10/28 13:59:59 robd Exp $
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: subsys/ntvdm/ntvdm.c
+ * PURPOSE: Virtual DOS Machine
+ * PROGRAMMER: Robert Dickenson (robd@mok.lvcm.com)
+ * UPDATE HISTORY:
+ * Created 23/10/2002
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include <ntos.h>
+#include <windows.h>
+#include <stdio.h>
+#include <wchar.h>
+
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ******************************************************************/
+
+
+/* FUNCTIONS *****************************************************************/
+
+void PrintString(char* fmt,...)
+{
+ char buffer[512];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buffer, fmt, ap);
+ va_end(ap);
+
+ OutputDebugString(buffer);
+}
+
+/*
+GetVersion
+GetVolumeInformationW
+GetWindowsDirectoryA
+GlobalMemoryStatus
+HeapAlloc
+HeapCreate
+HeapDestroy
+HeapFree
+HeapReAlloc
+
+GetNextVDMCommand
+ExitVDM
+RegisterConsoleVDM
+SetVDMCurrentDirectories
+VDMConsoleOperation
+WriteConsoleInputVDMW
+
+NtSetLdtEntries
+NtTerminateProcess
+
+NtMapViewOfSection
+NtUnmapViewOfSection
+
+NtVdmControl
+ */
+
+BOOLEAN
+StartVirtualMachine(VOID)
+{
+ BOOLEAN Result;
+ STARTUPINFO StartupInfo;
+ PROCESS_INFORMATION ProcessInformation;
+ CHAR CommandLine[MAX_PATH];
+ CHAR CurrentDirectory[MAX_PATH];
+
+ GetSystemDirectory(CommandLine, MAX_PATH);
+ strcat(CommandLine, "\\hello.exe");
+ GetWindowsDirectory(CurrentDirectory, MAX_PATH);
+
+ StartupInfo.cb = sizeof(StartupInfo);
+ StartupInfo.lpReserved = NULL;
+ StartupInfo.lpDesktop = NULL;
+ StartupInfo.lpTitle = NULL;
+ StartupInfo.dwFlags = 0;
+ StartupInfo.cbReserved2 = 0;
+ StartupInfo.lpReserved2 = 0;
+
+ Result = CreateProcess(CommandLine,
+ NULL,
+ NULL,
+ NULL,
+ FALSE,
+ DETACHED_PROCESS,
+ NULL,
+ NULL,
+ &StartupInfo,
+ &ProcessInformation);
+ if (!Result) {
+ PrintString("WL: Failed to execute target process\n");
+ return FALSE;
+ }
+ WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
+ CloseHandle(ProcessInformation.hProcess);
+ CloseHandle(ProcessInformation.hThread);
+ return TRUE;
+}
+
+int STDCALL
+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
+{
+ DWORD Result;
+ BOOL Success;
+ ULONG i;
+ NTSTATUS Status;
+
+ CHAR WelcomeMsg[] = "ReactOS Virtual DOS Machine support.\nType q<cr> to quit.";
+ CHAR InputBuffer[255];
+
+ AllocConsole();
+ SetConsoleTitle("ntvdm");
+ StartVirtualMachine();
+
+ for (;;) {
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
+ WelcomeMsg, strlen(WelcomeMsg), // wcslen(WelcomeMsg),
+ &Result, NULL);
+ i = 0;
+ do {
+ ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
+ &InputBuffer[i], 1,
+ &Result, NULL);
+ if (++i >= (sizeof(InputBuffer) - 1)) {
+ break;
+ }
+ } while (InputBuffer[i - 1] != '\n');
+ InputBuffer[i - 1] = '\0';
+
+ if (InputBuffer[0] == 'q' || InputBuffer[0] == 'Q') {
+ break;
+ }
+ }
+
+ ExitProcess(0);
+ return 0;
+}
--- /dev/null
+#include <defines.h>
+#include <reactos/resource.h>
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
+ PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", RES_STR_COMPANY_NAME
+ VALUE "FileDescription", "ReactOS Virtual DOS Machine\0"
+ VALUE "FileVersion", RES_STR_FILE_VERSION
+ VALUE "InternalName", "ntvdm\0"
+ VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
+ VALUE "OriginalFilename", "ntvdm.exe\0"
+ VALUE "ProductName", RES_STR_PRODUCT_NAME
+ VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+