Author: aandrejevic
Date: Sun Apr 27 22:38:54 2014
New Revision: 63024
URL:
http://svn.reactos.org/svn/reactos?rev=63024&view=rev
Log:
[NTVDM]
Don't define STANDALONE by default.
Don't quit ntvdm after it becomes the last process on the console if a DOS app is
still running.
Modified:
branches/ntvdm/subsystems/ntvdm/ntvdm.c
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Sun Apr 27 22:38:54 2014
@@ -25,7 +25,7 @@
* Activate this line if you want to run NTVDM in standalone mode with:
* ntvdm.exe <program>
*/
-#define STANDALONE
+// #define STANDALONE
/* VARIABLES ******************************************************************/
@@ -34,6 +34,7 @@
static DWORD OrgConsoleInputMode, OrgConsoleOutputMode;
static CONSOLE_CURSOR_INFO OrgConsoleCursorInfo;
static CONSOLE_SCREEN_BUFFER_INFO OrgConsoleBufferInfo;
+static BOOLEAN AcceptCommands = TRUE;
static HANDLE CommandThread = NULL;
static HMENU hConsoleMenu = NULL;
@@ -199,7 +200,17 @@
}
case CTRL_LAST_CLOSE_EVENT:
{
- if (CommandThread) TerminateThread(CommandThread, 0);
+ if (!VdmRunning)
+ {
+ /* Exit immediately */
+ if (CommandThread) TerminateThread(CommandThread, 0);
+ }
+ else
+ {
+ /* Stop accepting new commands */
+ AcceptCommands = FALSE;
+ }
+
break;
}
default:
@@ -390,7 +401,7 @@
UNREFERENCED_PARAMETER(Parameter);
- while (TRUE)
+ while (AcceptCommands)
{
/* Clear the structure */
ZeroMemory(&CommandInfo, sizeof(CommandInfo));
@@ -435,9 +446,9 @@
INT wmain(INT argc, WCHAR *argv[])
{
+#ifdef STANDALONE
+
DWORD Result;
-
-#ifdef STANDALONE
CHAR ApplicationName[MAX_PATH];
CHAR CommandLine[DOS_CMDLINE_LENGTH];