From e7810c8bc6ba41851e38e69baf133226188faa3b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 22 Jan 2010 12:32:40 +0100 Subject: [PATCH] ntdll: Make it possible to use RtlGetNtGlobalFlags before the TEB is initialized. --- dlls/ntdll/process.c | 9 --------- dlls/ntdll/thread.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index aaf8315513d..ba51df56445 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -73,15 +73,6 @@ PEB * WINAPI RtlGetCurrentPeb(void) return NtCurrentTeb()->Peb; } -/****************************************************************************** - * RtlGetNtGlobalFlags [NTDLL.@] - * - */ -ULONG WINAPI RtlGetNtGlobalFlags(void) -{ - return NtCurrentTeb()->Peb->NtGlobalFlag; -} - /*********************************************************************** * __wine_make_process_system (NTDLL.@) * diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index ef9183a9601..65fc7374b9b 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -57,6 +57,7 @@ struct startup_info void *entry_arg; }; +static PEB *peb; static PEB_LDR_DATA ldr; static RTL_USER_PROCESS_PARAMETERS params; /* default parameters if no parent */ static WCHAR current_dir[MAX_NT_PATH_LENGTH]; @@ -191,7 +192,6 @@ done: */ HANDLE thread_init(void) { - PEB *peb; TEB *teb; void *addr; SIZE_T size, info_size; @@ -522,6 +522,16 @@ error: } +/****************************************************************************** + * RtlGetNtGlobalFlags (NTDLL.@) + */ +ULONG WINAPI RtlGetNtGlobalFlags(void) +{ + if (!peb) return 0; /* init not done yet */ + return peb->NtGlobalFlag; +} + + /*********************************************************************** * NtOpenThread (NTDLL.@) * ZwOpenThread (NTDLL.@)