Skip to content

Commit

Permalink
When targeting Win32, make sure the heap reserve size is nonzero to f…
Browse files Browse the repository at this point in the history
…ix LocalAlloc() issues with Windows 95
  • Loading branch information
joncampbell123 authored and jmalak committed Dec 31, 2023
1 parent 8c55e7a commit eafccce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bld/wl/c/loadpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,11 @@ void FiniPELoadFile( void )
}
PE32( pehdr ).heap_commit_size = size;

/* Heap reserve must be nonzero for the executable to run properly under Windows 95.
* A zero reserve will cause a crash when any code calls LocalAlloc(). [Issue #852] */
size = 0x00100000; /* Microsoft C++ Win32 compiler default (1MB) (TODO: Linker option to set this?) */
PE32( pehdr ).heap_reserve_size = size;

PE32( pehdr ).num_tables = PE_TBL_NUMBER;
CurrSect = Root;
SeekLoad( 0 );
Expand Down

0 comments on commit eafccce

Please sign in to comment.