Comment 58 for bug 1111610

Revision history for this message
In , Focht (focht) wrote :

Hello folks,

revisiting. Rejoice! Progress has been made.

* https://source.winehq.org/git/wine.git/commitdiff/2aa494686133bf4c4b6b054a45bf1d1d429acdc5 ("mspatcha: Add functions to API header file.")

* https://source.winehq.org/git/wine.git/commitdiff/8695a6986ef2b7cae7c1f3247fec8e8e14de1971 ("mspatcha: Partially implement ApplyPatchToFileW and related functions.")

--- quote ---
This can patch non-executables and 64-bit executable files, but patching of 32-bit executables is not supported. They are subject to special processing which alters PE relocations to match with those in the old file to improve compression. To reverse this, the meaning of the decoding data must be interpreted. Details, including where to find that data in the patch file, are
included in pa19.c. Interleaved decompression of large files is also not supported.
--- quote ---

* https://source.winehq.org/git/wine.git/commitdiff/f8c25628266f025e01332b780c793d96d97dad25 ("mspatcha: Add stubs for signature and normalization functions.")

Thanks Conor so far!

Adding stable download link from Internet Archive for one of the smallest installers (MS SQL Server Express):

https://web.archive.org/web/20130318195510/http://download.microsoft.com/download/6/C/7/6C7458CA-8B07-411E-9E3B-0DED20512696/SQLEXPR32.EXE

--- snip ---
$ WINEDEBUG=+seh,+relay,+mspatcha wine ./SQLEXPR32.EXE >>log.txt 2>&1
...
002a:Call KERNEL32.LoadLibraryA(0034f44c "C:\\windows\\system32\\mspatcha.dll") ret=010036a5
002a:Call PE DLL (proc=0x7cefc320,module=0x7cef0000 L"mspatcha.dll",reason=PROCESS_ATTACH,res=(nil))
002a:trace:mspatcha:DllMain (0x0x7cef0000, 1, (nil))
002a:Call KERNEL32.DisableThreadLibraryCalls(7cef0000) ret=7cefa489
002a:Ret KERNEL32.DisableThreadLibraryCalls() retval=00000001 ret=7cefa489
002a:Ret PE DLL (proc=0x7cefc320,module=0x7cef0000 L"mspatcha.dll",reason=PROCESS_ATTACH,res=(nil)) retval=1
002a:Ret KERNEL32.LoadLibraryA() retval=7cef0000 ret=010036a5
002a:Call KERNEL32.GetProcAddress(7cef0000,0100238c "GetFilePatchSignatureA") ret=010036bc
002a:Ret KERNEL32.GetProcAddress() retval=7cef8188 ret=010036bc
002a:Call KERNEL32.GetProcAddress(7cef0000,01002378 "ApplyPatchToFileA") ret=010036ce
002a:Ret KERNEL32.GetProcAddress() retval=7cef80ac ret=010036ce
002a:Call mspatcha.ApplyPatchToFileA(0034faa4 "c:\\ef244e8344c867a4618ba071ad7a67b6\\_sfx_0000._p",0034fba8 "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Install\\sqlagent90_msdb_upgrade.sql",0034fcac "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Install\\instmsdb.sql",00000000) ret=0100483a
...
002a:trace:mspatcha:read_header patched file size will be 1139896
002a:trace:mspatcha:read_header patch supports 1 old file(s)
...
002a:trace:mspatcha:read_header found 0 range(s) to ignore
002a:trace:mspatcha:read_header found 0 range(s) to retain
...
002a:trace:mspatcha:decode_lzxd_stream decoding stream of size 290 to size 1139896, starting at 1221164
...
002a:trace:mspatcha:decode_lzxd_stream setting window to 0x400000
...
002a:Ret mspatcha.ApplyPatchToFileA() retval=00000001 ret=0100483a
...
002b:Call winex11.drv.SetWindowText(0001007a,0019ff20 L"Setup\\Program Files\\Microsoft SQL Server\\x86\\Data\\msdbdata.mdf") ret=7e6e6ee9
002b:Ret winex11.drv.SetWindowText() retval=00000000 ret=7e6e6ee9
...
002a:Call mspatcha.ApplyPatchToFileA(0034faa4 "c:\\ef244e8344c867a4618ba071ad7a67b6\\_sfx_0001._p",0034fba8 "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Install\\instmsdb.sql",0034fcac "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Data\\msdbdata.mdf",00000000) ret=0100483a
...
002a:trace:mspatcha:read_header patched file size will be 4653056
002a:trace:mspatcha:read_header patch supports 1 old file(s)
...
002a:trace:mspatcha:read_header found 0 range(s) to ignore
002a:trace:mspatcha:read_header found 0 range(s) to retain
...
002a:trace:mspatcha:decode_lzxd_stream decoding stream of size 418322 to size 4653056, starting at 1139896
...
002a:trace:mspatcha:decode_lzxd_stream setting window to 0x800000
...
002a:Ret mspatcha.ApplyPatchToFileA() retval=00000001 ret=0100483a
...
--- snip ---

--- snip ---
...
002b:Call winex11.drv.SetWindowText(0001007a,001a0108 L"Setup\\Program Files\\Microsoft SQL Server\\x86\\Binn\\res\\1033\\XPStar90.RLL") ret=7e6e6ee9
002b:Ret winex11.drv.SetWindowText() retval=00000000 ret=7e6e6ee9
...
002a:trace:mspatcha:read_header skipping rebase field
002a:trace:mspatcha:read_header patched file size will be 8491603
002a:trace:mspatcha:read_header patch supports 28 old file(s)
...
002a:trace:mspatcha:read_header found 2 range(s) to ignore
...
002a:Call KERNEL32.DeleteFileW(001a0660 L"c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Binn\\res\\1033\\XPStar90.RLL") ret=7cefc2ef
002a:Ret KERNEL32.DeleteFileW() retval=00000001 ret=7cefc2ef
...
002a:Ret mspatcha.ApplyPatchToFileA() retval=00000000 ret=0100483a
...
002a:Call mspatcha.ApplyPatchToFileA(0034faa4 "c:\\ef244e8344c867a4618ba071ad7a67b6\\_sfx_0006._p",0034fba8 "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Binn\\res\\1033\\XPStar90.RLL",0034fcac "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\90\\Tools\\Binn\\Resources\\1033\\SQLCMD.rll",00000000) ret=0100483a
...
002a:Call KERNEL32.CreateFileW(001a0730 L"c:\\ef244e8344c867a4618ba071ad7a67b6\\_sfx_0006._p",80000000,00000001,00000000,00000003,00000000,00000000) ret=7cefc1a6
002a:Ret KERNEL32.CreateFileW() retval=00000078 ret=7cefc1a6
002a:Call KERNEL32.CreateFileW(001a07a0 L"c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Binn\\res\\1033\\XPStar90.RLL",80000000,00000001,00000000,00000003,00000000,00000000) ret=7cefc1d2
002a:Ret KERNEL32.CreateFileW() retval=ffffffff ret=7cefc1d2
002a:Call KERNEL32.CloseHandle(00000078) ret=7cefc230
002a:Ret KERNEL32.CloseHandle() retval=00000001 ret=7cefc230
...
002a:Ret mspatcha.ApplyPatchToFileA() retval=00000000 ret=0100483a
002a:Call KERNEL32.GetLastError() ret=0100484e
002a:Ret KERNEL32.GetLastError() retval=00000002 ret=0100484e
--- snip ---

--- snip ---
...
002a:Call mspatcha.ApplyPatchToFileA(0034faa4 "c:\\ef244e8344c867a4618ba071ad7a67b6\\_sfx_0009._p",0034fba8 "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Binn\\sqlservr.exe",0034fcac "c:\\ef244e8344c867a4618ba071ad7a67b6\\Setup\\Program Files\\Microsoft SQL Server\\x86\\Binn\\res\\1033\\sqlevn70.rll",00000000) ret=0100483a
...
002a:trace:mspatcha:read_header skipping rebase field
002a:trace:mspatcha:read_header patched file size will be 1737568
002a:trace:mspatcha:read_header patch supports 1 old file(s)
...
002a:trace:mspatcha:read_header found 0 range(s) to ignore
002a:trace:mspatcha:read_header found 0 range(s) to retain
002a:fixme:mspatcha:read_header special processing of 32-bit executables not implemented.
...
002a:Ret mspatcha.ApplyPatchToFileA() retval=00000000 ret=0100483a
--- snip ---

--- snip ---
002a:Call user32.MessageBoxA(0001006e,0034fb34 "File is corrupt",0034fd34 "Extraction Failed",00010010) ret=0100390f
--- snip ---

The majority of the installers referenced/duplicated here are 32-bit and the 64-bit ones also contain 32-bit components and have at least one 32-bit PE patched. I couldn't find a pure 64-bit one that works with the current mspatcha state, hence not deduplicating/resolving yet.

$ wine --version
wine-4.7-305-g9bcaf9769c

Regards