From e3dcfcaa3eeb261a317fdc5c476b8793129edbd1 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 1 Apr 1999 10:05:40 +0000 Subject: [PATCH] Made Universal Thunk list per-process, not system global. --- include/process.h | 3 ++- relay32/utthunk.c | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/process.h b/include/process.h index 18098e1f43d..e8d55c4c138 100644 --- a/include/process.h +++ b/include/process.h @@ -12,6 +12,7 @@ struct _NE_MODULE; struct _THREAD_ENTRY; +struct _UTINFO; /* Current Process pseudo-handle - Returned by GetCurrentProcess*/ #define CURRENT_PROCESS_PSEUDOHANDLE ((HANDLE)0x7fffffff) @@ -85,7 +86,7 @@ typedef struct _PDB WORD env_selector; /* b4 Selector to process environment */ WORD error_mode; /* b6 Error mode */ HANDLE load_done_evt; /* b8 Event for process loading done */ - DWORD unknown7; /* bc Unknown */ + struct _UTINFO *UTState; /* bc Head of Univeral Thunk list */ DWORD unknown8; /* c0 Unknown (NT) */ LCID locale; /* c4 Locale to be queried by GetThreadLocale (NT) */ /* The following are Wine-specific fields */ diff --git a/relay32/utthunk.c b/relay32/utthunk.c index 18b0ed01ed7..9be4261dcd3 100644 --- a/relay32/utthunk.c +++ b/relay32/utthunk.c @@ -9,6 +9,7 @@ #include "module.h" #include "selectors.h" #include "callback.h" +#include "process.h" #include "debug.h" #include "debugstr.h" @@ -38,9 +39,9 @@ typedef struct #pragma pack(4) -typedef struct tagUTINFO +typedef struct _UTINFO { - struct tagUTINFO *next; + struct _UTINFO *next; HMODULE hModule; HMODULE16 hModule16; @@ -49,8 +50,6 @@ typedef struct tagUTINFO } UTINFO; -static UTINFO *utAnchor; - BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, LPSTR lpszInitName, LPSTR lpszProcName, FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, @@ -158,8 +157,8 @@ static UTINFO *UTAlloc( HMODULE hModule, HMODULE16 hModule16, ut->ut32.jmp = 0xe9; ut->ut32.utglue32 = (DWORD)UTGlue32 - ((DWORD)&ut->ut32.utglue32 + sizeof(DWORD)); - ut->next = utAnchor; - utAnchor = ut; + ut->next = PROCESS_Current()->UTState; + PROCESS_Current()->UTState = ut; return ut; } @@ -171,7 +170,7 @@ static void UTFree( UTINFO *ut ) { UTINFO **ptr; - for ( ptr = &utAnchor; *ptr; ptr = &(*ptr)->next ) + for ( ptr = &PROCESS_Current()->UTState; *ptr; ptr = &(*ptr)->next ) if ( *ptr == ut ) { *ptr = ut->next; @@ -188,7 +187,7 @@ static UTINFO *UTFind( HMODULE hModule ) { UTINFO *ut; - for ( ut = utAnchor; ut; ut =ut->next ) + for ( ut = PROCESS_Current()->UTState; ut; ut =ut->next ) if ( ut->hModule == hModule ) break; @@ -216,12 +215,12 @@ BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, /* Allocate UTINFO struct */ - HeapLock( SegptrHeap ); /* FIXME: a bit overkill */ + EnterCriticalSection( &PROCESS_Current()->crit_section ); if ( (ut = UTFind( hModule )) != NULL ) ut = NULL; else ut = UTAlloc( hModule, hModule16, target16, pfnUT32CallBack ); - HeapUnlock( SegptrHeap ); + LeaveCriticalSection( &PROCESS_Current()->crit_section ); if ( !ut ) { @@ -261,14 +260,14 @@ VOID WINAPI UTUnRegister( HMODULE hModule ) UTINFO *ut; HMODULE16 hModule16 = 0; - HeapLock( SegptrHeap ); /* FIXME: a bit overkill */ + EnterCriticalSection( &PROCESS_Current()->crit_section ); ut = UTFind( hModule ); if ( !ut ) { hModule16 = ut->hModule16; UTFree( ut ); } - HeapUnlock( SegptrHeap ); + LeaveCriticalSection( &PROCESS_Current()->crit_section ); if ( hModule16 ) FreeLibrary16( hModule16 );