Made Universal Thunk list per-process, not system global.

oldstable
Ulrich Weigand 1999-04-01 10:05:40 +00:00 committed by Alexandre Julliard
parent 6f57fe7b30
commit e3dcfcaa3e
2 changed files with 13 additions and 13 deletions

View File

@ -12,6 +12,7 @@
struct _NE_MODULE; struct _NE_MODULE;
struct _THREAD_ENTRY; struct _THREAD_ENTRY;
struct _UTINFO;
/* Current Process pseudo-handle - Returned by GetCurrentProcess*/ /* Current Process pseudo-handle - Returned by GetCurrentProcess*/
#define CURRENT_PROCESS_PSEUDOHANDLE ((HANDLE)0x7fffffff) #define CURRENT_PROCESS_PSEUDOHANDLE ((HANDLE)0x7fffffff)
@ -85,7 +86,7 @@ typedef struct _PDB
WORD env_selector; /* b4 Selector to process environment */ WORD env_selector; /* b4 Selector to process environment */
WORD error_mode; /* b6 Error mode */ WORD error_mode; /* b6 Error mode */
HANDLE load_done_evt; /* b8 Event for process loading done */ 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) */ DWORD unknown8; /* c0 Unknown (NT) */
LCID locale; /* c4 Locale to be queried by GetThreadLocale (NT) */ LCID locale; /* c4 Locale to be queried by GetThreadLocale (NT) */
/* The following are Wine-specific fields */ /* The following are Wine-specific fields */

View File

@ -9,6 +9,7 @@
#include "module.h" #include "module.h"
#include "selectors.h" #include "selectors.h"
#include "callback.h" #include "callback.h"
#include "process.h"
#include "debug.h" #include "debug.h"
#include "debugstr.h" #include "debugstr.h"
@ -38,9 +39,9 @@ typedef struct
#pragma pack(4) #pragma pack(4)
typedef struct tagUTINFO typedef struct _UTINFO
{ {
struct tagUTINFO *next; struct _UTINFO *next;
HMODULE hModule; HMODULE hModule;
HMODULE16 hModule16; HMODULE16 hModule16;
@ -49,8 +50,6 @@ typedef struct tagUTINFO
} UTINFO; } UTINFO;
static UTINFO *utAnchor;
BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL,
LPSTR lpszInitName, LPSTR lpszProcName, LPSTR lpszInitName, LPSTR lpszProcName,
FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack,
@ -158,8 +157,8 @@ static UTINFO *UTAlloc( HMODULE hModule, HMODULE16 hModule16,
ut->ut32.jmp = 0xe9; ut->ut32.jmp = 0xe9;
ut->ut32.utglue32 = (DWORD)UTGlue32 - ((DWORD)&ut->ut32.utglue32 + sizeof(DWORD)); ut->ut32.utglue32 = (DWORD)UTGlue32 - ((DWORD)&ut->ut32.utglue32 + sizeof(DWORD));
ut->next = utAnchor; ut->next = PROCESS_Current()->UTState;
utAnchor = ut; PROCESS_Current()->UTState = ut;
return ut; return ut;
} }
@ -171,7 +170,7 @@ static void UTFree( UTINFO *ut )
{ {
UTINFO **ptr; UTINFO **ptr;
for ( ptr = &utAnchor; *ptr; ptr = &(*ptr)->next ) for ( ptr = &PROCESS_Current()->UTState; *ptr; ptr = &(*ptr)->next )
if ( *ptr == ut ) if ( *ptr == ut )
{ {
*ptr = ut->next; *ptr = ut->next;
@ -188,7 +187,7 @@ static UTINFO *UTFind( HMODULE hModule )
{ {
UTINFO *ut; UTINFO *ut;
for ( ut = utAnchor; ut; ut =ut->next ) for ( ut = PROCESS_Current()->UTState; ut; ut =ut->next )
if ( ut->hModule == hModule ) if ( ut->hModule == hModule )
break; break;
@ -216,12 +215,12 @@ BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL,
/* Allocate UTINFO struct */ /* Allocate UTINFO struct */
HeapLock( SegptrHeap ); /* FIXME: a bit overkill */ EnterCriticalSection( &PROCESS_Current()->crit_section );
if ( (ut = UTFind( hModule )) != NULL ) if ( (ut = UTFind( hModule )) != NULL )
ut = NULL; ut = NULL;
else else
ut = UTAlloc( hModule, hModule16, target16, pfnUT32CallBack ); ut = UTAlloc( hModule, hModule16, target16, pfnUT32CallBack );
HeapUnlock( SegptrHeap ); LeaveCriticalSection( &PROCESS_Current()->crit_section );
if ( !ut ) if ( !ut )
{ {
@ -261,14 +260,14 @@ VOID WINAPI UTUnRegister( HMODULE hModule )
UTINFO *ut; UTINFO *ut;
HMODULE16 hModule16 = 0; HMODULE16 hModule16 = 0;
HeapLock( SegptrHeap ); /* FIXME: a bit overkill */ EnterCriticalSection( &PROCESS_Current()->crit_section );
ut = UTFind( hModule ); ut = UTFind( hModule );
if ( !ut ) if ( !ut )
{ {
hModule16 = ut->hModule16; hModule16 = ut->hModule16;
UTFree( ut ); UTFree( ut );
} }
HeapUnlock( SegptrHeap ); LeaveCriticalSection( &PROCESS_Current()->crit_section );
if ( hModule16 ) if ( hModule16 )
FreeLibrary16( hModule16 ); FreeLibrary16( hModule16 );