VOID ConsoleCleanup(VOID)
{
SMALL_RECT ConRect;
- CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo;
/* Restore the old screen buffer */
SetConsoleActiveScreenBuffer(ConsoleOutput);
/* Restore the original console size */
- GetConsoleScreenBufferInfo(ConsoleOutput, &ConsoleInfo);
- ConRect.Left = 0; // OrgConsoleBufferInfo.srWindow.Left;
- // ConRect.Top = ConsoleInfo.dwCursorPosition.Y / (OrgConsoleBufferInfo.srWindow.Bottom - OrgConsoleBufferInfo.srWindow.Top + 1);
- // ConRect.Top *= (OrgConsoleBufferInfo.srWindow.Bottom - OrgConsoleBufferInfo.srWindow.Top + 1);
- ConRect.Top = ConsoleInfo.dwCursorPosition.Y;
+ ConRect.Left = 0;
+ ConRect.Top = 0;
ConRect.Right = ConRect.Left + OrgConsoleBufferInfo.srWindow.Right - OrgConsoleBufferInfo.srWindow.Left;
ConRect.Bottom = ConRect.Top + OrgConsoleBufferInfo.srWindow.Bottom - OrgConsoleBufferInfo.srWindow.Top ;
- /* See the following trick explanation in vga.c:VgaEnterTextMode() */
+ /*
+ * See the following trick explanation in vga.c:VgaEnterTextMode() .
+ */
SetConsoleScreenBufferSize(ConsoleOutput, OrgConsoleBufferInfo.dwSize);
SetConsoleWindowInfo(ConsoleOutput, TRUE, &ConRect);
- // SetConsoleWindowInfo(ConsoleOutput, TRUE, &OrgConsoleBufferInfo.srWindow);
SetConsoleScreenBufferSize(ConsoleOutput, OrgConsoleBufferInfo.dwSize);
/* Restore the original cursor shape */
INT wmain(INT argc, WCHAR *argv[])
{
#ifndef STANDALONE
- wprintf(L"\nReactOS Virtual DOS Machine\n\n"
- L"OS integration (BaseVDM) unimplemented\n");
- return 0;
+
+ VDM_COMMAND_INFO CommandInfo;
+ CHAR CmdLine[MAX_PATH];
+ CHAR AppName[MAX_PATH];
+ CHAR PifFile[MAX_PATH];
+ CHAR Desktop[MAX_PATH];
+ CHAR Title[MAX_PATH];
+
#else
CHAR CommandLine[DOS_CMDLINE_LENGTH];
DPRINT1("\n\n\nNTVDM - Starting '%s'...\n\n\n", CommandLine);
+#endif
+
/* Initialize the console */
if (!ConsoleInit())
{
goto Cleanup;
}
+#ifndef STANDALONE
+
+ while (TRUE)
+ {
+ /* Clear the structure */
+ ZeroMemory(&CommandInfo, sizeof(CommandInfo));
+
+ /* Initialize the structure members */
+ CommandInfo.VDMState = VDM_NOT_LOADED;
+ CommandInfo.CmdLine = CmdLine;
+ CommandInfo.CmdLen = sizeof(CmdLine);
+ CommandInfo.AppName = AppName;
+ CommandInfo.AppLen = sizeof(AppName);
+ CommandInfo.PifFile = PifFile;
+ CommandInfo.PifLen = sizeof(PifFile);
+ CommandInfo.Desktop = Desktop;
+ CommandInfo.DesktopLen = sizeof(Desktop);
+ CommandInfo.Title = Title;
+ CommandInfo.TitleLen = sizeof(Title);
+
+ if (!GetNextVDMCommand(&CommandInfo)) break;
+
+ /* Start the process from the command line */
+ if (!DosCreateProcess(AppName, 0))
+ {
+ DisplayMessage(L"Could not start program: %S", AppName);
+ goto Cleanup;
+ }
+
+ /* Start simulation */
+ EmulatorSimulate();
+
+ /* Perform another screen refresh */
+ VgaRefreshDisplay();
+ }
+
+#else
+
/* Start the process from the command line */
if (!DosCreateProcess(CommandLine, 0))
{
/* Start simulation */
EmulatorSimulate();
+#endif
+
/* Perform another screen refresh */
VgaRefreshDisplay();
EmulatorCleanup();
ConsoleCleanup();
+ /* Quit the VDM */
DPRINT1("\n\n\nNTVDM - Exiting...\n\n\n");
+ ExitVDM(FALSE, 0);
return 0;
-
-#endif
}
/* EOF */