[MSVCRT20][MSVCRT40] Fix heap initialization (#6713) CORE-19505

Fixes CORE-19505 'game "Hover!" from rapps does not start anymore'
It failed showing a msgbox
"There was an error allocating memory in Hover!"

the regression was introduced by
0.4.15-dev-5602-g c47506a5f4

Add missing heap initialization in DllMain entrypoints of msvcrt20.dll and msvcrt40.dll,
similarly to as it is done in msvcrt.dll (CRT).
The msvcrt.dll (CRT) initialization code was updated properly
during the last winesync, accordingly to the new changes,
but msvcrt20.dll/msvcrt40.dll one was not. So update it too.
This fixes the crash of HOVER 1.0 game from Rapps when
it tries to allocate a dynamical memory from the
unitialized heap via malloc() function exported from our msvcrt20.dll.
This commit is contained in:
Oleg Dubinskiy 2024-04-06 17:46:11 +02:00 committed by GitHub
parent ea28951607
commit 91be8bf0a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -53,6 +53,8 @@ extern char** __initenv; /* pointer to initial environment block */
extern wchar_t** _wenviron; /* pointer to environment block */
extern wchar_t** __winitenv; /* pointer to initial environment block */
extern BOOL msvcrt_init_heap(void);
extern void CDECL __getmainargs(int *argc, char** *argv, char** *envp,
int expand_wildcards, int *new_mode);
extern void CDECL __wgetmainargs(int *argc, WCHAR** *wargv, WCHAR** *wenvp,
@ -82,6 +84,9 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
if (!msvcrt_init_tls())
return FALSE;
if (!msvcrt_init_heap())
return FALSE;
if (BlockEnvToEnvironA() < 0)
return FALSE;

View file

@ -54,6 +54,8 @@ extern char** __initenv; /* pointer to initial environment block */
extern wchar_t** _wenviron; /* pointer to environment block */
extern wchar_t** __winitenv; /* pointer to initial environment block */
extern BOOL msvcrt_init_heap(void);
/* LIBRARY ENTRY POINT ********************************************************/
BOOL
@ -78,6 +80,9 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
if (!msvcrt_init_tls())
return FALSE;
if (!msvcrt_init_heap())
return FALSE;
if (BlockEnvToEnvironA() < 0)
return FALSE;