diff --git a/subsystems/mvdm/ntvdm/CMakeLists.txt b/subsystems/mvdm/ntvdm/CMakeLists.txt index ff102d8857..6350d12513 100644 --- a/subsystems/mvdm/ntvdm/CMakeLists.txt +++ b/subsystems/mvdm/ntvdm/CMakeLists.txt @@ -76,5 +76,5 @@ add_executable(ntvdm add_pch(ntvdm ntvdm.h SOURCE) set_module_type(ntvdm win32cui UNICODE IMAGEBASE 0x0F000000) target_link_libraries(ntvdm fast486 ${PSEH_LIB}) -add_importlibs(ntvdm user32 gdi32 advapi32 comdlg32 msvcrt kernel32 ntdll) +add_importlibs(ntvdm shell32 user32 gdi32 advapi32 comdlg32 msvcrt kernel32 ntdll) add_cd_file(TARGET ntvdm DESTINATION reactos/system32 FOR all) diff --git a/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c b/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c index 7f356b0912..e93dbeb6d5 100644 --- a/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c +++ b/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c @@ -23,6 +23,7 @@ #include "handle.h" #include "process.h" #include "memory.h" +#include "shellapi.h" #include "bios/bios.h" @@ -780,6 +781,21 @@ Cleanup: return Result; } +BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) +{ + char buffer[128]; + int size = GetWindowTextA(hwnd, buffer, 128); + if (size && strstr(buffer,"otvdm.exe") != NULL) + ShowWindow(hwnd, SW_HIDE); + return TRUE; +} + +BOOL MinimizeOtvdm() +{ + EnumWindows(EnumWindowsProc, (LPARAM)NULL); + return TRUE; +} + WORD DosCreateProcess(IN LPCSTR ProgramName, IN PDOS_EXEC_PARAM_BLOCK Parameters, IN DWORD ReturnAddress OPTIONAL) @@ -796,10 +812,28 @@ 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); + SHELLEXECUTEINFOA sei; + CHAR FullName[50] = "%programfiles%\\otvdm\\otvdm.exe"; + ZeroMemory(&sei, sizeof(sei)); + sei.cbSize = sizeof(sei); + sei.hwnd = GetDesktopWindow(); + sei.fMask = SEE_MASK_FLAG_NO_UI; + sei.nShow = SW_NORMAL; + sei.lpParameters = ProgramName; + sei.lpFile = FullName; + sei.lpDirectory = NULL; + if (ShellExecuteExA(&sei)) + { + /* Wait for Window to build and register */ + Sleep(500); + MinimizeOtvdm(); + break; + } + else + 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); // Fall through } case SCS_DOS_BINARY: