ntdll: Move the PEB initialization to LdrInitializeThunk().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
04762b3576
commit
beff5c56cd
|
@ -154,7 +154,14 @@ static RTL_CRITICAL_SECTION_DEBUG peb_critsect_debug =
|
|||
};
|
||||
static RTL_CRITICAL_SECTION peb_lock = { &peb_critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
static PEB_LDR_DATA ldr = { sizeof(ldr), TRUE };
|
||||
static PEB_LDR_DATA ldr =
|
||||
{
|
||||
sizeof(ldr), TRUE, NULL,
|
||||
{ &ldr.InLoadOrderModuleList, &ldr.InLoadOrderModuleList },
|
||||
{ &ldr.InMemoryOrderModuleList, &ldr.InMemoryOrderModuleList },
|
||||
{ &ldr.InInitializationOrderModuleList, &ldr.InInitializationOrderModuleList }
|
||||
};
|
||||
|
||||
static RTL_BITMAP tls_bitmap;
|
||||
static RTL_BITMAP tls_expansion_bitmap;
|
||||
|
||||
|
@ -3615,6 +3622,24 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
|
|||
{
|
||||
ANSI_STRING func_name;
|
||||
WINE_MODREF *kernel32;
|
||||
PEB *peb = NtCurrentTeb()->Peb;
|
||||
|
||||
peb->LdrData = &ldr;
|
||||
peb->FastPebLock = &peb_lock;
|
||||
peb->TlsBitmap = &tls_bitmap;
|
||||
peb->TlsExpansionBitmap = &tls_expansion_bitmap;
|
||||
peb->LoaderLock = &loader_section;
|
||||
peb->OSMajorVersion = 5;
|
||||
peb->OSMinorVersion = 1;
|
||||
peb->OSBuildNumber = 0xA28;
|
||||
peb->OSPlatformId = VER_PLATFORM_WIN32_NT;
|
||||
peb->SessionId = 1;
|
||||
peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL );
|
||||
|
||||
RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 );
|
||||
RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits,
|
||||
sizeof(peb->TlsExpansionBitmapBits) * 8 );
|
||||
RtlSetBits( peb->TlsBitmap, 0, 1 ); /* TLS index 0 is reserved and should be initialized to NULL. */
|
||||
|
||||
init_user_process_params();
|
||||
load_global_options();
|
||||
|
@ -4040,39 +4065,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* process_init
|
||||
*/
|
||||
static NTSTATUS process_init(void)
|
||||
{
|
||||
TEB *teb = NtCurrentTeb();
|
||||
PEB *peb = teb->Peb;
|
||||
|
||||
peb->LdrData = &ldr;
|
||||
peb->FastPebLock = &peb_lock;
|
||||
peb->TlsBitmap = &tls_bitmap;
|
||||
peb->TlsExpansionBitmap = &tls_expansion_bitmap;
|
||||
peb->LoaderLock = &loader_section;
|
||||
peb->OSMajorVersion = 5;
|
||||
peb->OSMinorVersion = 1;
|
||||
peb->OSBuildNumber = 0xA28;
|
||||
peb->OSPlatformId = VER_PLATFORM_WIN32_NT;
|
||||
peb->SessionId = 1;
|
||||
peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL );
|
||||
|
||||
RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 );
|
||||
RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits,
|
||||
sizeof(peb->TlsExpansionBitmapBits) * 8 );
|
||||
RtlSetBits( peb->TlsBitmap, 0, 1 ); /* TLS index 0 is reserved and should be initialized to NULL. */
|
||||
init_global_fls_data();
|
||||
|
||||
InitializeListHead( &ldr.InLoadOrderModuleList );
|
||||
InitializeListHead( &ldr.InMemoryOrderModuleList );
|
||||
InitializeListHead( &ldr.InInitializationOrderModuleList );
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_set_unix_funcs
|
||||
*/
|
||||
|
@ -4080,5 +4072,5 @@ NTSTATUS CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *func
|
|||
{
|
||||
if (version != NTDLL_UNIXLIB_VERSION) return STATUS_REVISION_MISMATCH;
|
||||
unix_funcs = funcs;
|
||||
return process_init();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
|
|||
}
|
||||
|
||||
/* FLS data */
|
||||
extern void init_global_fls_data(void) DECLSPEC_HIDDEN;
|
||||
extern TEB_FLS_DATA *fls_alloc_data(void) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -241,7 +241,7 @@ TEB_ACTIVE_FRAME * WINAPI RtlGetFrame(void)
|
|||
***********************************************************************/
|
||||
|
||||
|
||||
static GLOBAL_FLS_DATA fls_data;
|
||||
static GLOBAL_FLS_DATA fls_data = { { NULL }, { &fls_data.fls_list_head, &fls_data.fls_list_head } };
|
||||
|
||||
static RTL_CRITICAL_SECTION fls_section;
|
||||
static RTL_CRITICAL_SECTION_DEBUG fls_critsect_debug =
|
||||
|
@ -254,11 +254,6 @@ static RTL_CRITICAL_SECTION fls_section = { &fls_critsect_debug, -1, 0, 0, 0, 0
|
|||
|
||||
#define MAX_FLS_DATA_COUNT 0xff0
|
||||
|
||||
void init_global_fls_data(void)
|
||||
{
|
||||
InitializeListHead( &fls_data.fls_list_head );
|
||||
}
|
||||
|
||||
static void lock_fls_data(void)
|
||||
{
|
||||
RtlEnterCriticalSection( &fls_section );
|
||||
|
|
Loading…
Reference in New Issue