RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle);
#define CMD_STRING L"cmd /c "
+#define NTVDM_STRING L"\\ntvdm.exe"
/* FUNCTIONS ****************************************************************/
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
WINAPI
BasepIsProcessAllowed(IN PCHAR ApplicationName)
/*
* For GUI applications we turn on the 2nd bit. This also allows
- * us to know whether or not the application is a GUI or CUI app.
+ * us to know whether or not this is a GUI or a TUI application.
*/
if (IMAGE_SUBSYSTEM_WINDOWS_GUI == SectionImageInfo->SubSystemType)
{
ULONG Response;
NTSTATUS Status;
- /* Setup the stirng to print out */
+ /* Setup the string to print out */
RtlInitUnicodeString(&UnicodeString, lpMessageText);
/* Display the hard error no matter what */
WCHAR SaveChar = 0;
ULONG RetVal;
UINT Error = 0;
+ UINT Length;
BOOLEAN SearchDone = FALSE;
BOOLEAN Escape = FALSE;
CLIENT_ID ClientId;
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
}
}
+ /* Get the path to the VDM host */
+ Length = GetSystemDirectoryW(VdmPath, MAX_PATH - wcslen(NTVDM_STRING));
+ if ((Length == 0) || (Length >= MAX_PATH - wcslen(NTVDM_STRING)))
+ {
+ /* System path not found for some reason, fail */
+ SetLastError(ERROR_INVALID_NAME);
+ return FALSE;
+ }
+ wcscat(VdmPath, NTVDM_STRING);
+
/*
* According to some sites, ShellExecuteEx uses an undocumented flag to
* send private handle data (such as HMONITOR or HICON). See:
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,
&StartupInfo,
lpProcessInformation);
}
-#endif
/* It's a batch file */
Extension = &ApplicationName.Buffer[ApplicationName.Length /
sizeof(WCHAR) - 4];
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,