[NTVDM] Add otya128's WineVDM integration code into ReactOS (#4113)

This is an interim solution until a more integrated solution with NTVDM is developed.
CORE-17852
This commit is contained in:
Doug Lyons 2021-11-23 16:50:05 -06:00 committed by GitHub
parent db810d8e44
commit 0f05abec82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -796,10 +796,49 @@ WORD DosCreateProcess(IN LPCSTR ProgramName,
/* Those are handled by NTVDM */ /* Those are handled by NTVDM */
case SCS_WOW_BINARY: case SCS_WOW_BINARY:
{ {
static const PCSTR AppName = "\"%ProgramFiles%\\otvdm\\otvdmw.exe\" ";
STARTUPINFOA si;
PROCESS_INFORMATION pi;
CHAR ExpName[MAX_PATH];
ExpandEnvironmentStringsA(AppName, ExpName, ARRAYSIZE(ExpName) - 1);
strcat(ExpName, "\""); // Add double-quote before ProgramName
strcat(ExpName, ProgramName); // Append Program name
strcat(ExpName, "\""); // Add double-quote after ProgramName
ZeroMemory(&pi, sizeof(pi));
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
/* Create the process */
if (CreateProcessA(NULL, // No Application Name
ExpName, // Just our Command Line
NULL, // Cannot inherit Process Handle
NULL, // Cannot inherit Thread Handle
FALSE, // No handle inheritance
0, // No extra creation flags
NULL, // No environment block
NULL, // No starting directory
&si,
&pi))
{
/* Close the handles */
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
break;
}
else
{
/* Retrieve the actual path to the "Program Files" directory for displaying the error */
ExpandEnvironmentStringsA("%ProgramFiles%", ExpName, ARRAYSIZE(ExpName) - 1);
DisplayMessage(L"Trying to load '%S'.\n" DisplayMessage(L"Trying to load '%S'.\n"
L"WOW16 applications are not supported internally by NTVDM at the moment.\n" L"WOW16 applications are not supported internally by NTVDM at the moment.\n"
L"Press 'OK' to continue.", L"Consider installing WineVDM from the ReactOS Applications Manager in\n'%S'.\n\n"
ProgramName); L"Click on OK to continue.",
ProgramName, ExpName);
}
// Fall through // Fall through
} }
case SCS_DOS_BINARY: case SCS_DOS_BINARY: