toptensoftware/nvpatch

Windows 7 support

Opened this issue · 4 comments

Commit: c710d2a
electron: 22.3.27
electron-builder: 25.0.5

I use nvpatch for my x64 build with Electron 22 which supports Windows 7. The resulting exe file can run on Windows 8 and more modern systems but doesn't start on Windows 7 64-bit. If I do not patch the exe file, it works on Windows 7.

Not sure why that would be off hand. Do you get an error messages (either directly on screen or in Windows event logs?)

Unfortunately, exe just won't start without any errors. I didn't find anything in the logs. There is nothing in Windows Events regarding my exe file.

Perhaps try running dumpbin /headers on Windows 7 on the original and patched exe and see if it shows up anything odd?

Unfortunately, I don't have much time right now to dig deeper but I'll take a look when I get a chance.

I installed MSVC Build Tools 2019 to get dumpbin. It's the latest version available on Windows 7.
There are results:

Non-patched (working) exe

Dump of file Program.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
8664 machine (x64)
F number of sections
652438A7 time date stamp Mon Oct 9 20:30:15 2023
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
22 characteristics
Executable
Application can handle large (>2GB) addresses

OPTIONAL HEADER VALUES
20B magic # (PE32+)
14.00 linker version
7A67200 size of code
1C33200 size of initialized data
0 size of uninitialized data
4045F50 entry point (0000000144045F50)
1000 base of code
140000000 image base (0000000140000000 to 0000000149A51FFF)
1000 section alignment
200 file alignment
5.02 operating system version
0.00 image version
5.02 subsystem version
0 Win32 version
9A52000 size of image
400 size of headers
0 checksum
2 subsystem (Windows GUI)
C160 DLL characteristics
High Entropy Virtual Addresses
Dynamic base
NX compatible
Control Flow Guard
Terminal Server Aware
800000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
903A52A [ 35819] RVA [size] of Export Directory
906FD43 [ 168] RVA [size] of Import Directory
98F9000 [ 671AC] RVA [size] of Resource Directory
9503000 [ 3E72F4] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
9961000 [ F0DCC] RVA [size] of Base Relocation Directory
8F9BB88 [ 1C] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
8F9B678 [ 28] RVA [size] of Thread Storage Directory
7A6A020 [ 138] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
9071360 [ 14B0] RVA [size] of Import Address Table Directory
9035C88 [ 480] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory

SECTION HEADER #1
.text name
7A671E0 virtual size
1000 virtual address (0000000140001000 to 0000000147A681DF)
7A67200 size of raw data
400 file pointer to raw data (00000400 to 07A675FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

SECTION HEADER #2
.rdata name
1646538 virtual size
7A69000 virtual address (0000000147A69000 to 00000001490AF537)
1646600 size of raw data
7A67600 file pointer to raw data (07A67600 to 090ADBFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

Debug Directories

    Time Type        Size      RVA  Pointer
-------- ------- -------- -------- --------
652438A7 cv            45 08F9BBA4  8F9A1A4    Format: RSDS, {8BC5E17A-7D32-51DB-4C4C-44205044422E}, 1, C:\projects\src\out\Default\electron.exe.pdb

SECTION HEADER #3
.data name
45209C virtual size
90B0000 virtual address (00000001490B0000 to 000000014950209B)
A8C00 size of raw data
90ADC00 file pointer to raw data (090ADC00 to 091567FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

SECTION HEADER #4
.pdata name
3E72F4 virtual size
9503000 virtual address (0000000149503000 to 00000001498EA2F3)
3E7400 size of raw data
9156800 file pointer to raw data (09156800 to 0953DBFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #5
.00cfg name
28 virtual size
98EB000 virtual address (00000001498EB000 to 00000001498EB027)
200 size of raw data
953DC00 file pointer to raw data (0953DC00 to 0953DDFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #6
.gxfg name
4200 virtual size
98EC000 virtual address (00000001498EC000 to 00000001498F01FF)
4200 size of raw data
953DE00 file pointer to raw data (0953DE00 to 09541FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #7
.retplne name
C0 virtual size
98F1000 virtual address (00000001498F1000 to 00000001498F10BF)
200 size of raw data
9542000 file pointer to raw data (09542000 to 095421FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
0 flags

SECTION HEADER #8
.rodata name
11C0 virtual size
98F2000 virtual address (00000001498F2000 to 00000001498F31BF)
1200 size of raw data
9542200 file pointer to raw data (09542200 to 095433FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

SECTION HEADER #9
.tls name
289 virtual size
98F4000 virtual address (00000001498F4000 to 00000001498F4288)
400 size of raw data
9543400 file pointer to raw data (09543400 to 095437FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

SECTION HEADER #A
.voltbl name
52 virtual size
98F5000 virtual address (00000001498F5000 to 00000001498F5051)
200 size of raw data
9543800 file pointer to raw data (09543800 to 095439FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
0 flags

SECTION HEADER #B
CPADinfo name
38 virtual size
98F6000 virtual address (00000001498F6000 to 00000001498F6037)
200 size of raw data
9543A00 file pointer to raw data (09543A00 to 09543BFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

SECTION HEADER #C
_RDATA name
F4 virtual size
98F7000 virtual address (00000001498F7000 to 00000001498F70F3)
200 size of raw data
9543C00 file pointer to raw data (09543C00 to 09543DFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #D
malloc_h name
EA virtual size
98F8000 virtual address (00000001498F8000 to 00000001498F80E9)
200 size of raw data
9543E00 file pointer to raw data (09543E00 to 09543FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

SECTION HEADER #E
.rsrc name
671AC virtual size
98F9000 virtual address (00000001498F9000 to 00000001499601AB)
67200 size of raw data
9544000 file pointer to raw data (09544000 to 095AB1FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #F
.reloc name
F0DCC virtual size
9961000 virtual address (0000000149961000 to 0000000149A51DCB)
F0E00 size of raw data
95AB200 file pointer to raw data (095AB200 to 0969BFFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42000040 flags
Initialized Data
Discardable
Read Only

Summary

    1000 .00cfg
  453000 .data
    5000 .gxfg
  3E8000 .pdata
 1647000 .rdata
   F1000 .reloc
    1000 .retplne
    2000 .rodata
   68000 .rsrc
 7A68000 .text
    1000 .tls
    1000 .voltbl
    1000 CPADinfo
    1000 _RDATA
    1000 malloc_h
Patched (not working) exe

Dump of file Program.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
8664 machine (x64)
10 number of sections
652438A7 time date stamp Mon Oct 9 20:30:15 2023
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
22 characteristics
Executable
Application can handle large (>2GB) addresses

OPTIONAL HEADER VALUES
20B magic # (PE32+)
14.00 linker version
7A67200 size of code
1C68C00 size of initialized data
0 size of uninitialized data
4045F50 entry point (0000000144045F50)
1000 base of code
140000000 image base (0000000140000000 to 0000000149A87FFF)
1000 section alignment
200 file alignment
5.02 operating system version
0.00 image version
5.02 subsystem version
0 Win32 version
9A88000 size of image
400 size of headers
0 checksum
2 subsystem (Windows GUI)
C160 DLL characteristics
High Entropy Virtual Addresses
Dynamic base
NX compatible
Control Flow Guard
Terminal Server Aware
800000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
9A03008 [ 35862] RVA [size] of Export Directory
906FD43 [ 168] RVA [size] of Import Directory
98F9000 [ 671AC] RVA [size] of Resource Directory
9503000 [ 3E72F4] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
9961000 [ F0DCC] RVA [size] of Base Relocation Directory
8F9BB88 [ 1C] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
8F9B678 [ 28] RVA [size] of Thread Storage Directory
7A6A020 [ 138] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
9071360 [ 14B0] RVA [size] of Import Address Table Directory
9035C88 [ 480] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory

SECTION HEADER #1
.text name
7A671E0 virtual size
1000 virtual address (0000000140001000 to 0000000147A681DF)
7A67200 size of raw data
400 file pointer to raw data (00000400 to 07A675FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

SECTION HEADER #2
.rdata name
1646538 virtual size
7A69000 virtual address (0000000147A69000 to 00000001490AF537)
1646600 size of raw data
7A67600 file pointer to raw data (07A67600 to 090ADBFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

Debug Directories

    Time Type        Size      RVA  Pointer
-------- ------- -------- -------- --------
652438A7 cv            45 08F9BBA4  8F9A1A4    Format: RSDS, {8BC5E17A-7D32-51DB-4C4C-44205044422E}, 1, C:\projects\src\out\Default\electron.exe.pdb

SECTION HEADER #3
.data name
45209C virtual size
90B0000 virtual address (00000001490B0000 to 000000014950209B)
A8C00 size of raw data
90ADC00 file pointer to raw data (090ADC00 to 091567FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

SECTION HEADER #4
.pdata name
3E72F4 virtual size
9503000 virtual address (0000000149503000 to 00000001498EA2F3)
3E7400 size of raw data
9156800 file pointer to raw data (09156800 to 0953DBFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #5
.00cfg name
28 virtual size
98EB000 virtual address (00000001498EB000 to 00000001498EB027)
200 size of raw data
953DC00 file pointer to raw data (0953DC00 to 0953DDFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #6
.gxfg name
4200 virtual size
98EC000 virtual address (00000001498EC000 to 00000001498F01FF)
4200 size of raw data
953DE00 file pointer to raw data (0953DE00 to 09541FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #7
.retplne name
C0 virtual size
98F1000 virtual address (00000001498F1000 to 00000001498F10BF)
200 size of raw data
9542000 file pointer to raw data (09542000 to 095421FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
0 flags

SECTION HEADER #8
.rodata name
11C0 virtual size
98F2000 virtual address (00000001498F2000 to 00000001498F31BF)
1200 size of raw data
9542200 file pointer to raw data (09542200 to 095433FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

SECTION HEADER #9
.tls name
289 virtual size
98F4000 virtual address (00000001498F4000 to 00000001498F4288)
400 size of raw data
9543400 file pointer to raw data (09543400 to 095437FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

SECTION HEADER #A
.voltbl name
52 virtual size
98F5000 virtual address (00000001498F5000 to 00000001498F5051)
200 size of raw data
9543800 file pointer to raw data (09543800 to 095439FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
0 flags

SECTION HEADER #B
CPADinfo name
38 virtual size
98F6000 virtual address (00000001498F6000 to 00000001498F6037)
200 size of raw data
9543A00 file pointer to raw data (09543A00 to 09543BFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

SECTION HEADER #C
_RDATA name
F4 virtual size
98F7000 virtual address (00000001498F7000 to 00000001498F70F3)
200 size of raw data
9543C00 file pointer to raw data (09543C00 to 09543DFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #D
malloc_h name
EA virtual size
98F8000 virtual address (00000001498F8000 to 00000001498F80E9)
200 size of raw data
9543E00 file pointer to raw data (09543E00 to 09543FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

SECTION HEADER #E
.rsrc name
671AC virtual size
98F9000 virtual address (00000001498F9000 to 00000001499601AB)
67200 size of raw data
9544000 file pointer to raw data (09544000 to 095AB1FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #F
.reloc name
F0DCC virtual size
9961000 virtual address (0000000149961000 to 0000000149A51DCB)
F0E00 size of raw data
95AB200 file pointer to raw data (095AB200 to 0969BFFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42000040 flags
Initialized Data
Discardable
Read Only

SECTION HEADER #10
.nvpatch name
3586A virtual size
9A52000 virtual address (0000000149A52000 to 0000000149A87869)
35A00 size of raw data
969C000 file pointer to raw data (0969C000 to 096D19FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

Summary

    1000 .00cfg
  453000 .data
    5000 .gxfg
   36000 .nvpatch
  3E8000 .pdata
 1647000 .rdata
   F1000 .reloc
    1000 .retplne
    2000 .rodata
   68000 .rsrc
 7A68000 .text
    1000 .tls
    1000 .voltbl
    1000 CPADinfo
    1000 _RDATA
    1000 malloc_h