Skip to content

Commit

Permalink
Adding missing OLE2 thunks for Windows versions >7, as they seem to h…
Browse files Browse the repository at this point in the history
…ave been replaced by stubs with Windows 8.1

This unfortunately adds a new dependency for build process (Windows 7 x86 ISO)  #133
  • Loading branch information
leecher1337 committed Jun 19, 2021
1 parent 2604f9e commit dd2517a
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 10 deletions.
34 changes: 34 additions & 0 deletions autobuild/autobuild-ccpu-chk.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rem WKDIR Working directory for build process, default is %CD%\w
rem HAXBLD If set to -haxm then HAXM build is built, otherwise normal build
rem DBGSTP If set, pause is issued after every step, useful for testing build
rem SIZ_NTBLD [chk, fre] Checked of free build, default is checked (debug)
rem NOWIN7 Ignore missing Windows 7 ISO (i.e. build only for Win < 8 or no OLE2)
rem

echo ----------------------------------------------------
Expand Down Expand Up @@ -130,6 +131,38 @@ exit /B
call :dlprq GRMWDK_EN_7600_1.ISO https://download.microsoft.com/download/4/A/2/4A25C7D5-EFBE-4182-B6A9-AE6850409A78/GRMWDK_EN_7600_1.ISO
call :dlprq GRMSDK_EN_DVD.iso https://download.microsoft.com/download/F/1/0/F10113F5-B750-4969-A255-274341AC6BCE/GRMSDK_EN_DVD.iso
call :dlprq NTOSBE-master.zip https://github.com/stephanosio/NTOSBE/archive/master.zip

rem Windows 7 x86:
rem This one would be direct download of en version, but it's very big and therefore slows us down, so better ask for user intervention
rem to download smaller ISO.
rem https://download.microsoft.com/download/C/0/6/C067D0CD-3785-4727-898E-60DC3120BB14/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_PROFESSIONAL_x86FRE_en-us.iso
rem
if not exist %PREREQ%\de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso (
echo On Windows Versions ^>= 8 when using WOW32, OLE2 support has been removed
echo from OS. Therefore it is recommended to download Windows 7 ISO as a prereq
echo to restore OLE2 support in these Windows versions.
echo If you plan to use NTVDMx64 only on lower versions of Windows, or not use
echo WOW32, you can continue without it.
echo.
echo By pressing a key, you will be redirected to the Windows 7 ISO download page.
echo You need to download the Windows 7 Professional 32bit ISO
echo de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso from there and
echo place it in this directory.
echo If you want to continue without it, just press a key afterwards again.
pause
start https://winfuture.de/downloadvorschalt,3291.html
echo.
echo Now please either download the ISO and put it here and afterwards continue
echo or continue now to go without it
pause
if not exist %PREREQ%\de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso (
if not exist %PREREQ%\de_windows_7_professional_with_sp1_x64_dvd_u_676919.iso (
echo OK, Continuing without OLE2 then
set NOWIN7=1
)
)
)

if exist old-src-sr687.7z ren old-src-sr687.7z old-src.trunk.r687.20150728.7z
exit /b

Expand All @@ -154,6 +187,7 @@ if "%SRCDIR%"=="" (
call :cpyprq GRMSDK_EN_DVD.iso
call :cpyprq GRMWDK_EN_7600_1.ISO
call :cpyprq old-src.trunk.r687.20150728.7z
copy /y %PREREQ%\de_windows_7_professional_with_sp1*.iso ntvdmpatch\minnt\work\
echo Build environment ready
exit /b

Expand Down
2 changes: 1 addition & 1 deletion ntvdmpatch/doc/autobuild.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Requirements
The other requirements (as outlined in minnt.txt) are also still required,
but can be downlaoded by the autobuild script automatically.

You need approx. 5GB of free disk space.
You need approx. 8GB of free disk space.

Setup MINNT build environment
=============================
Expand Down
7 changes: 6 additions & 1 deletion ntvdmpatch/doc/minnt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Requirements
https://www.microsoft.com/en-us/download/details.aspx?id=8442
* NTOSBE-master build environment
https://github.com/stephanosio/NTOSBE
* Recommended: Windows 7 x86 ISO named
de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso
https://winfuture.de/downloadvorschalt,3291.html
* An installed version of 7-zip file manager
https://www.7-zip.de

Expand Down Expand Up @@ -65,17 +68,19 @@ You now have:
experimental
...

2) Download required SDK ISOs and old-src.trunk.r687.20150728.7z and place them in
2) Download required SDK and Windows ISOs and old-src.trunk.r687.20150728.7z and place them in
ntvdmpatch\minnt\work

* https://www.microsoft.com/en-us/download/details.aspx?id=11800
* https://www.microsoft.com/en-us/download/details.aspx?id=8442
* https://winfuture.de/downloadvorschalt,3291.html
* Google old-src.trunk.r687.20150728.7z or old-src-sr687.7z

You now have in ntvdmpatch\minnt\work:

GRMSDK_EN_DVD.iso
GRMWDK_EN_7600_1.ISO
de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso
old-src.trunk.r687.20150728.7z

3) Run ntvdmpatch\minnt\prepare.cmd
Expand Down
43 changes: 43 additions & 0 deletions ntvdmpatch/minnt/prepare.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,49 @@ rem Copy Video for Windows to release template folder
xcopy /e /y %workdir%\old-src\nt\private\windows\media\avi\mciavi32\vfw16 ..\release\vfw16\

:oldsrcok
rem -- Windows 7 ISO
rem
rem We could use old-src\nt\private\ole32\olethunk\ and compile it ourselves, but it's not up-to-date
rem so it's better to take up-to-date binaries from Win7 ISO
rem
set W7ISO=none
if exist %workdir%\de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso (
set W7ISO=%workdir%\de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso
set W7SYSDIR=system32
) else (
if exist %workdir%\de_windows_7_professional_with_sp1_x64_dvd_u_676919.iso (
set W7ISO=%workdir%\de_windows_7_professional_with_sp1_x64_dvd_u_676919.iso
set W7SYSDIR=SysWOW64
) else (
if exist %workdir%\7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_PROFESSIONAL_x86FRE_en-us.iso (
set W7ISO=%workdir%\7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_PROFESSIONAL_x86FRE_en-us.iso
set W7SYSDIR=system32
)
)
)
if exist %W7ISO% (
echo Expanding working 16bit OLE DLLs from Win 7 ISO
7z x -y %W7ISO% sources\install.wim -o%workdir%
if exist %workdir%\sources\install.wim (
7z x -y %workdir%\sources\install.wim 1\Windows\%W7SYSDIR%\olethk32.dll 1\Windows\%W7SYSDIR%\compobj.dll 1\Windows\%W7SYSDIR%\ole2.dll 1\Windows\%W7SYSDIR%\ole2disp.dll 1\Windows\%W7SYSDIR%\ole2nls.dll 1\Windows\%W7SYSDIR%\storage.dll 1\Windows\%W7SYSDIR%\typelib.dll -o%workdir%
xcopy /e /y %workdir%\1\Windows\%W7SYSDIR% ..\release\ole2\
)
)
if not exist %workdir%\1\Windows\%W7SYSDIR%\olethk32.dll (
if "%NOWIN7%"=="" (
echo Windows 7 ISO was not found / OLE2 components could not be extracted
echo This may lead to problems on Windows Versions ^>= 8 when using OLE2 WOW32
echo applications. However, basic functionality is not affected.
echo If you want to continue without OLE2 support, press any key now, otherwise
echo abort with CTRL+C, download the Windows 7 Professional 32bit ISO
echo de_windows_7_professional_with_sp1_x86_dvd_u_677093.iso and start over again.
start https://winfuture.de/downloadvorschalt,3291.html
pause
)
)
:prepared


echo The patch directory is now prepared. You may delete the contents of the
echo of the %workdir% directory now.
if not "%1"=="batch" pause
Expand Down
53 changes: 53 additions & 0 deletions ntvdmpatch/minnt/release/ole2.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[Version]
Signature=$Windows NT$
AdvancedINF= 2.5,"advpack.dll"

[SourceDisksNames.amd64]
1="OLE2",,,"\ole2"

[SourceDisksFiles.amd64]
olethk32.dll=1
compobj.dll=1
ole2.dll=1
ole2disp.dll=1
ole2nls.dll=1
storage.dll=1
typelib.dll=1

[Ntvdmx64.amd64.System.Files]
olethk32.dll,,,0x4006
compobj.dll,,,0x4006
ole2.dll,,,0x4006
ole2disp.dll,,,0x4006
ole2nls.dll,,,0x4006
storage.dll,,,0x4006
typelib.dll,,,0x4006

[Ntvdmx64.amd64.Inf.Files.Add]
ole2.inf

[Ntvdmx64.amd64.Inf.Files.Del]
ole2.inf
ole2.PNF

[DestinationDirs]
Ntvdmx64.amd64.System.Files = 16425
Ntvdmx64.amd64.Inf.Files.Add = 17
Ntvdmx64.amd64.Inf.Files.Del = 17

[InstallCmdsPre]
%10%\Symbols\instntvdmx64.bat instole "%16425%" "%10%\Symbols\Backup"


[UninstallCmds]
%10%\Symbols\instntvdmx64.bat delole "%16425%" "%10%\Symbols\Backup"

[DefaultInstall.ntamd64]
SmartReboot = N
CopyFiles = Ntvdmx64.amd64.System.Files, Ntvdmx64.amd64.Inf.Files.Add
RunPreSetupCommands = InstallCmdsPre

[DefaultUninstall.ntamd64]
RunPostSetupCommands = UninstallCmds
CleanUp = 1
DelFiles = Ntvdmx64.amd64.System.Files, Ntvdmx64.amd64.Inf.Files.Del
48 changes: 40 additions & 8 deletions ntvdmpatch/release/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if "%1"=="install" goto addappinit
if "%1"=="uninstall" goto delappinit
if "%1"=="instwow" goto instwow
if "%1"=="delwow" goto delwow
if "%1"=="instole" goto instole
if "%1"=="delole" goto delole
if "%1"=="link" goto hardlink

rem Ensure that we are run from 64bit prompt
Expand Down Expand Up @@ -38,6 +40,7 @@ if not errorlevel 1 (
echo This NTVDMx64 is only meant to be used on an x64 machine, please use
echo NTVDM shipped with your windows installation instead.
echo Installation aborted
pause
goto fini
)

Expand All @@ -47,6 +50,15 @@ for /F "skip=2 tokens=3" %%r in ('reg query HKLM\SYSTEM\CurrentControlSet\Contro
echo therefore prevents start of NTVDM.
echo Please disabe secure boot in BIOS, reboot and try again
start https://msdn.microsoft.com/en-us/windows/hardware/commercialize/manufacture/desktop/disabling-secure-boot
pause
goto fini
)

if exist %SYSTEMROOT%\syswow64\ntvdm.exe (
echo It seems that you have ntvdm.exe already on your system.
echo I assume that it's NTVDMx64. Before reinstalling ntvdmx64, you should
echo uninstall the old version via control panel first.
pause
goto fini
)

Expand Down Expand Up @@ -130,17 +142,29 @@ goto fini
rem Windows XP SFP
for %%I in (gdi.exe user.exe wow32.dll wowexec.exe comm.drv keyboard.drv lanman.drv mouse.drv sound.drv system.drv timer.drv vga.drv wfwnet.drv) do util\wfpreplace %2\%%I
md %3
takeown /f %2\wow32.dll
cacls %2\wow32.dll /e /p %USERNAME%:F
move %2\wow32.dll %3\
takeown /f %2\user.exe
cacls %2\user.exe /e /p %USERNAME%:F
move %2\user.exe %3\
for %%F in (wow32.dll user.exe) do call :replsysfil %%F %2 %3
if exist %CD%\ole2\olethk32.dll (
for /f "tokens=4-5 delims=[.XP " %%i in ('ver') do (
if %%i GEQ 6 (
rem only on Win 8 or above
if %%i EQU 6 if %%j LSS 3 goto fini
rundll32.exe advpack.dll,LaunchINFSection %CD%\ole2.inf
)
)
)
goto fini

:delwow
if exist %3\wow32.dll move %3\wow32.dll %2\
if exist %3\user.exe move %3\user.exe %2\
for %%F in (wow32.dll user.exe) do if exist %3\%%I move /y %3\%%I %2\
if exist %windir%\inf\ole2.inf RunDll32 advpack.dll,LaunchINFSection %windir%\inf\ole2.inf,DefaultUninstall
goto fini

:instole
for %%F in (olethk32.dll compobj.dll ole2.dll ole2disp.dll ole2nls.dll storage.dll typelib.dll) do call :replsysfil %%F %2 %3
goto fini

:delole
for %%F in (olethk32.dll compobj.dll ole2.dll ole2disp.dll ole2nls.dll storage.dll typelib.dll) do if exist %3\%%I move /y %3\%%I %2\
goto fini

:hardlink
Expand All @@ -149,5 +173,13 @@ if exist %2\%4 echo %2\%4 is in use, please delete manually and then install aga
fsutil hardlink create %2\%4 %3\%4
goto fini

:replsysfil
if not exist %3\%1 (
takeown /f %2\%1
cacls %2\%1 /e /p %USERNAME%:F
move %2\%1 %3\
)
exit /B

:fini
exit /b

0 comments on commit dd2517a

Please sign in to comment.