Commit 7f826665 authored by Alexandre Julliard's avatar Alexandre Julliard

Do not call THUNK_Init at startup, only do it when the app actually

requires thunks.
parent 8eeed94f
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "callback.h"
#include "global.h" #include "global.h"
#include "miscemu.h" #include "miscemu.h"
#include "module.h" #include "module.h"
...@@ -19,7 +18,6 @@ ...@@ -19,7 +18,6 @@
extern void CODEPAGE_Init(void); extern void CODEPAGE_Init(void);
extern BOOL RELAY_Init(void); extern BOOL RELAY_Init(void);
extern BOOL THUNK_Init(void);
/*********************************************************************** /***********************************************************************
...@@ -35,9 +33,6 @@ static BOOL process_attach(void) ...@@ -35,9 +33,6 @@ static BOOL process_attach(void)
/* Initialize relay entry points */ /* Initialize relay entry points */
if (!RELAY_Init()) return FALSE; if (!RELAY_Init()) return FALSE;
/* Initialize thunking */
if (!THUNK_Init()) return FALSE;
/* Initialize DOS memory */ /* Initialize DOS memory */
if (!DOSMEM_Init(0)) return FALSE; if (!DOSMEM_Init(0)) return FALSE;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "winerror.h" #include "winerror.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "callback.h"
#include "debugtools.h" #include "debugtools.h"
#include "flatthunk.h" #include "flatthunk.h"
#include "heap.h" #include "heap.h"
...@@ -1463,13 +1462,14 @@ static SEGPTR ThunkletCallbackGlueSL = 0; ...@@ -1463,13 +1462,14 @@ static SEGPTR ThunkletCallbackGlueSL = 0;
/* map a thunk allocated on ThunkletHeap to a 16-bit pointer */ /* map a thunk allocated on ThunkletHeap to a 16-bit pointer */
inline static SEGPTR get_segptr( void *thunk ) inline static SEGPTR get_segptr( void *thunk )
{ {
if (!thunk) return 0;
return MAKESEGPTR( ThunkletCodeSel, (char *)thunk - (char *)ThunkletHeap ); return MAKESEGPTR( ThunkletCodeSel, (char *)thunk - (char *)ThunkletHeap );
} }
/*********************************************************************** /***********************************************************************
* THUNK_Init * THUNK_Init
*/ */
BOOL THUNK_Init(void) static BOOL THUNK_Init(void)
{ {
LPBYTE thunk; LPBYTE thunk;
...@@ -1534,6 +1534,7 @@ FARPROC THUNK_AllocLSThunklet( SEGPTR target, DWORD relay, ...@@ -1534,6 +1534,7 @@ FARPROC THUNK_AllocLSThunklet( SEGPTR target, DWORD relay,
{ {
TDB *pTask = TASK_GetPtr( owner ); TDB *pTask = TASK_GetPtr( owner );
if (!ThunkletHeap) THUNK_Init();
if ( !(thunk = HeapAlloc( ThunkletHeap, 0, sizeof(THUNKLET) )) ) if ( !(thunk = HeapAlloc( ThunkletHeap, 0, sizeof(THUNKLET) )) )
return 0; return 0;
...@@ -1567,6 +1568,7 @@ SEGPTR THUNK_AllocSLThunklet( FARPROC target, DWORD relay, ...@@ -1567,6 +1568,7 @@ SEGPTR THUNK_AllocSLThunklet( FARPROC target, DWORD relay,
{ {
TDB *pTask = TASK_GetPtr( owner ); TDB *pTask = TASK_GetPtr( owner );
if (!ThunkletHeap) THUNK_Init();
if ( !(thunk = HeapAlloc( ThunkletHeap, 0, sizeof(THUNKLET) )) ) if ( !(thunk = HeapAlloc( ThunkletHeap, 0, sizeof(THUNKLET) )) )
return 0; return 0;
...@@ -1616,6 +1618,7 @@ BOOL16 WINAPI IsSLThunklet16( THUNKLET *thunk ) ...@@ -1616,6 +1618,7 @@ BOOL16 WINAPI IsSLThunklet16( THUNKLET *thunk )
FARPROC WINAPI AllocLSThunkletSysthunk16( SEGPTR target, FARPROC WINAPI AllocLSThunkletSysthunk16( SEGPTR target,
FARPROC relay, DWORD dummy ) FARPROC relay, DWORD dummy )
{ {
if (!ThunkletSysthunkGlueLS) THUNK_Init();
return THUNK_AllocLSThunklet( (SEGPTR)relay, (DWORD)target, return THUNK_AllocLSThunklet( (SEGPTR)relay, (DWORD)target,
ThunkletSysthunkGlueLS, GetCurrentTask() ); ThunkletSysthunkGlueLS, GetCurrentTask() );
} }
...@@ -1626,6 +1629,7 @@ FARPROC WINAPI AllocLSThunkletSysthunk16( SEGPTR target, ...@@ -1626,6 +1629,7 @@ FARPROC WINAPI AllocLSThunkletSysthunk16( SEGPTR target,
SEGPTR WINAPI AllocSLThunkletSysthunk16( FARPROC target, SEGPTR WINAPI AllocSLThunkletSysthunk16( FARPROC target,
SEGPTR relay, DWORD dummy ) SEGPTR relay, DWORD dummy )
{ {
if (!ThunkletSysthunkGlueSL) THUNK_Init();
return THUNK_AllocSLThunklet( (FARPROC)relay, (DWORD)target, return THUNK_AllocSLThunklet( (FARPROC)relay, (DWORD)target,
ThunkletSysthunkGlueSL, GetCurrentTask() ); ThunkletSysthunkGlueSL, GetCurrentTask() );
} }
...@@ -1877,6 +1881,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE handle, LPSTR func_name) ...@@ -1877,6 +1881,7 @@ SEGPTR WINAPI Get16DLLAddress(HMODULE handle, LPSTR func_name)
if (!code_sel32) if (!code_sel32)
{ {
if (!ThunkletHeap) THUNK_Init();
code_sel32 = SELECTOR_AllocBlock( (void *)ThunkletHeap, 0x10000, code_sel32 = SELECTOR_AllocBlock( (void *)ThunkletHeap, 0x10000,
WINE_LDT_FLAGS_CODE | WINE_LDT_FLAGS_32BIT ); WINE_LDT_FLAGS_CODE | WINE_LDT_FLAGS_32BIT );
if (!code_sel32) return 0; if (!code_sel32) return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment