Author: aandrejevic
Date: Sun Jun 23 12:33:13 2013
New Revision: 59310
URL:
http://svn.reactos.org/svn/reactos?rev=59310&view=rev
Log:
[KERNEL32]
Implement BasepCheckDosApp.
Enable NTVDM in CreateProcessInternalW.
[NTVDM]
Remove the old command line parser code. The entire command line is for the DOS
application now.
Modified:
branches/ntvdm/dll/win32/kernel32/client/proc.c
branches/ntvdm/subsystems/ntvdm/ntvdm.c
Modified: branches/ntvdm/dll/win32/kernel32/client/proc.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/dll/win32/kernel32/client…
==============================================================================
--- branches/ntvdm/dll/win32/kernel32/client/proc.c [iso-8859-1] (original)
+++ branches/ntvdm/dll/win32/kernel32/client/proc.c [iso-8859-1] Sun Jun 23 12:33:13 2013
@@ -49,6 +49,7 @@
RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle);
#define CMD_STRING L"cmd /c "
+#define NTVDM_STRING L"\\ntvdm.exe"
/* FUNCTIONS ****************************************************************/
@@ -180,6 +181,22 @@
{
/* Add this to the certification list */
return BasepSaveAppCertRegistryValue(Context, ValueName, ValueData);
+}
+
+
+BOOLEAN
+NTAPI
+BasepCheckDosApp(IN PUNICODE_STRING ApplicationName)
+{
+ PWCHAR Extension;
+
+ /* Get the extension from the file name */
+ Extension = &ApplicationName->Buffer[ApplicationName->Length /
+ sizeof(WCHAR) - 4];
+
+ /* Check if the extension is .COM */
+ if (_wcsnicmp(Extension, L".com", 4) == 0) return TRUE;
+ else return FALSE;
}
NTSTATUS
@@ -2531,6 +2548,7 @@
PPEB RemotePeb;
SIZE_T EnvSize = 0;
BOOL Ret = FALSE;
+ WCHAR VdmPath[MAX_PATH];
/* FIXME should process
* HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
@@ -2610,6 +2628,10 @@
CREATE_SEPARATE_WOW_VDM;
}
}
+
+ /* Get the path to the VDM host */
+ ASSERT(GetSystemDirectoryW(VdmPath, MAX_PATH - wcslen(NTVDM_STRING)) != 0);
+ wcscat(VdmPath, NTVDM_STRING);
/*
* According to some sites, ShellExecuteEx uses an undocumented flag to
@@ -2847,14 +2869,13 @@
case STATUS_INVALID_IMAGE_PROTECT:
case STATUS_INVALID_IMAGE_NOT_MZ:
-#if 0
/* If it's a DOS app, use VDM */
if ((BasepCheckDosApp(&ApplicationName)))
{
DPRINT1("Launching VDM...\n");
RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
RtlFreeHeap(RtlGetProcessHeap(), 0, ApplicationName.Buffer);
- return CreateProcessW(L"ntvdm.exe",
+ return CreateProcessW(VdmPath,
(LPWSTR)((ULONG_PTR)lpApplicationName), /* FIXME:
Buffer must be writable!!! */
lpProcessAttributes,
lpThreadAttributes,
@@ -2865,7 +2886,6 @@
&StartupInfo,
lpProcessInformation);
}
-#endif
/* It's a batch file */
Extension = &ApplicationName.Buffer[ApplicationName.Length /
sizeof(WCHAR) - 4];
@@ -2925,7 +2945,7 @@
DPRINT1("Launching VDM...\n");
RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
RtlFreeHeap(RtlGetProcessHeap(), 0, ApplicationName.Buffer);
- return CreateProcessW(L"ntvdm.exe",
+ return CreateProcessW(VdmPath,
(LPWSTR)((ULONG_PTR)lpApplicationName), /* FIXME:
Buffer must be writable!!! */
lpProcessAttributes,
lpThreadAttributes,
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 Jun 23 12:33:13 2013
@@ -55,7 +55,6 @@
INT wmain(INT argc, WCHAR *argv[])
{
INT i;
- BOOLEAN PrintUsage = TRUE;
CHAR CommandLine[128];
DWORD CurrentTickCount, LastTickCount = 0, Cycles = 0, LastCyclePrintout = 0;
LARGE_INTEGER Frequency, LastTimerTick, Counter;
@@ -64,39 +63,8 @@
/* Set the handler routine */
SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE);
- /* Parse the command line arguments */
- for (i = 1; i < argc; i++)
- {
- if (argv[i][0] != L'-' && argv[i][0] != L'/') continue;
-
- switch (argv[i][1])
- {
- case L'f':
- case L'F':
- {
- if (argv[i+1] != NULL)
- {
- /* The DOS command line must be ASCII */
- WideCharToMultiByte(CP_ACP, 0, argv[i+1], -1, CommandLine, 128, NULL,
NULL);
-
- /* This is the only mandatory parameter */
- PrintUsage = FALSE;
- }
- break;
- }
- default:
- {
- wprintf(L"Unknown option: %s", argv[i]);
- }
- }
- }
-
- if (PrintUsage)
- {
- wprintf(L"ReactOS Virtual DOS Machine\n\n");
- wprintf(L"Usage: NTVDM /F <PROGRAM>\n");
- return 0;
- }
+ /* The DOS command line must be ASCII */
+ WideCharToMultiByte(CP_ACP, 0, GetCommandLine(), -1, CommandLine, 128, NULL, NULL);
if (!EmulatorInitialize()) return 1;