https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f05abec82a0fb8ccdde61e6127e8b728488861c

commit 0f05abec82a0fb8ccdde61e6127e8b728488861c
Author:     Doug Lyons <[email protected]>
AuthorDate: Tue Nov 23 16:50:05 2021 -0600
Commit:     GitHub <[email protected]>
CommitDate: Tue Nov 23 23:50:05 2021 +0100

    [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
---
 subsystems/mvdm/ntvdm/dos/dos32krnl/process.c | 47 ++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c 
b/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c
index 7f356b0912f..492467656c0 100644
--- a/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c
+++ b/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c
@@ -796,10 +796,49 @@ WORD DosCreateProcess(IN LPCSTR ProgramName,
         /* Those are handled by NTVDM */
         case SCS_WOW_BINARY:
         {
-            DisplayMessage(L"Trying to load '%S'.\n"
-                           L"WOW16 applications are not supported internally 
by NTVDM at the moment.\n"
-                           L"Press 'OK' to continue.",
-                           ProgramName);
+            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"
+                               L"WOW16 applications are not supported 
internally by NTVDM at the moment.\n"
+                               L"Consider installing WineVDM from the ReactOS 
Applications Manager in\n'%S'.\n\n"
+                               L"Click on OK to continue.",
+                               ProgramName, ExpName);
+            }
             // Fall through
         }
         case SCS_DOS_BINARY:

Reply via email to