- Removed the 'shadow' NtGlobalFlag from ntdll.dll. - Initialized NumberOfProcessors from the PEB structure. Modified: trunk/reactos/include/ntdll/ntdll.h Modified: trunk/reactos/lib/ntdll/ldr/startup.c Modified: trunk/reactos/lib/ntdll/ldr/utils.c Modified: trunk/reactos/lib/ntdll/rtl/misc.c Modified: trunk/reactos/lib/rtl/version.c Modified: trunk/reactos/ntoskrnl/Makefile Added: trunk/reactos/ntoskrnl/rtl/misc.c _____
Modified: trunk/reactos/include/ntdll/ntdll.h --- trunk/reactos/include/ntdll/ntdll.h 2005-01-04 14:46:06 UTC (rev 12789) +++ trunk/reactos/include/ntdll/ntdll.h 2005-01-04 16:23:29 UTC (rev 12790) @@ -17,7 +17,7 @@
#ifdef NDEBUG #if defined(__GNUC__) -#define TRACE_LDR(args...) if (NtGlobalFlag & FLG_SHOW_LDR_SNAPS) { DbgPrint("(LDR:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } +#define TRACE_LDR(args...) if (RtlGetNtGlobalFlags() & FLG_SHOW_LDR_SNAPS) { DbgPrint("(LDR:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } #define DPRINT(args...) #else #define DPRINT _____
Modified: trunk/reactos/lib/ntdll/ldr/startup.c --- trunk/reactos/lib/ntdll/ldr/startup.c 2005-01-04 14:46:06 UTC (rev 12789) +++ trunk/reactos/lib/ntdll/ldr/startup.c 2005-01-04 16:23:29 UTC (rev 12790) @@ -37,8 +37,6 @@
static RTL_BITMAP TlsBitMap; PLDR_MODULE ExeModule;
-ULONG NtGlobalFlag = 0; - NTSTATUS LdrpAttachThread (VOID);
@@ -102,7 +100,6 @@ * read more options */ } - NtGlobalFlag = Peb->NtGlobalFlag; }
@@ -242,6 +239,8 @@ PLDR_MODULE NtModule; // ntdll NLSTABLEINFO NlsTable; WCHAR FullNtDllPath[MAX_PATH]; + SYSTEM_BASIC_INFORMATION SystemInformation; + NTSTATUS Status;
DPRINT("LdrInitializeThunk()\n"); if (NtCurrentPeb()->Ldr == NULL || NtCurrentPeb()->Ldr->Initialized == FALSE) @@ -280,6 +279,18 @@
NTHeaders = (PIMAGE_NT_HEADERS)(ImageBase + PEDosHeader->e_lfanew);
+ + /* Get number of processors */ + Status = ZwQuerySystemInformation(SystemBasicInformation, + &SystemInformation, + sizeof(SYSTEM_BASIC_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + { + ZwTerminateProcess(NtCurrentProcess(), Status); + } + + Peb->NumberOfProcessors = SystemInformation.NumberProcessors; /* create process heap */ RtlInitializeHeapManager(); Peb->ProcessHeap = RtlCreateHeap(HEAP_GROWABLE, _____
Modified: trunk/reactos/lib/ntdll/ldr/utils.c --- trunk/reactos/lib/ntdll/ldr/utils.c 2005-01-04 14:46:06 UTC (rev 12789) +++ trunk/reactos/lib/ntdll/ldr/utils.c 2005-01-04 16:23:29 UTC (rev 12790) @@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.104 2004/12/25 11:18:51 navaraf Exp $ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -51,7 +51,6 @@ static HANDLE LdrpKnownDllsDirHandle = NULL; static UNICODE_STRING LdrpKnownDllPath = {0, 0, NULL}; static PLDR_MODULE LdrpLastModule = NULL; -extern ULONG NtGlobalFlag; extern PLDR_MODULE ExeModule;
/* PROTOTYPES ****************************************************************/ _____
Modified: trunk/reactos/lib/ntdll/rtl/misc.c --- trunk/reactos/lib/ntdll/rtl/misc.c 2005-01-04 14:46:06 UTC (rev 12789) +++ trunk/reactos/lib/ntdll/rtl/misc.c 2005-01-04 16:23:29 UTC (rev 12790) @@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.11 2004/12/13 23:11:13 navaraf Exp $ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -96,3 +96,14 @@ *build = (0xF0000000 | pPeb->OSBuildNumber); } } + +/* +* @implemented +*/ +ULONG +STDCALL +RtlGetNtGlobalFlags(VOID) +{ + PPEB pPeb = NtCurrentPeb(); + return pPeb->NtGlobalFlag; +} _____
Modified: trunk/reactos/lib/rtl/version.c --- trunk/reactos/lib/rtl/version.c 2005-01-04 14:46:06 UTC (rev 12789) +++ trunk/reactos/lib/rtl/version.c 2005-01-04 16:23:29 UTC (rev 12790) @@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: version.c,v 1.4 2004/11/07 18:45:52 hyperion Exp $ +/* $Id$ * * PROJECT: ReactOS kernel * PURPOSE: Runtime code @@ -36,7 +36,6 @@
/* GLOBALS ******************************************************************/
-extern ULONG NtGlobalFlag;
/* FUNCTIONS ****************************************************************/
@@ -72,16 +71,6 @@ }
/* -* @implemented -*/ -ULONG -STDCALL -RtlGetNtGlobalFlags(VOID) -{ - return(NtGlobalFlag); -} - -/* * @unimplemented */ /* _____
Modified: trunk/reactos/ntoskrnl/Makefile --- trunk/reactos/ntoskrnl/Makefile 2005-01-04 14:46:06 UTC (rev 12789) +++ trunk/reactos/ntoskrnl/Makefile 2005-01-04 16:23:29 UTC (rev 12790) @@ -100,6 +100,7 @@
rtl/ctype.o \ rtl/handle.o \ rtl/message.o \ + rtl/misc.o \ rtl/purecall.o \ rtl/regio.o \ rtl/sprintf.o \ _____
Added: trunk/reactos/ntoskrnl/rtl/misc.c --- trunk/reactos/ntoskrnl/rtl/misc.c 2005-01-04 14:46:06 UTC (rev 12789) +++ trunk/reactos/ntoskrnl/rtl/misc.c 2005-01-04 16:23:29 UTC (rev 12790) @@ -0,0 +1,32 @@
+/* $Id$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Various functions + * FILE: lib/ntoskrnl/rtl/misc.c + * PROGRAMER: Hartmut Birr + * REVISION HISTORY: + * 01/03/2005: Created + */ + +/* INCLUDES *****************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <internal/debug.h> + +/* GLOBALS *******************************************************************/ + +extern ULONG NtGlobalFlag; + +/* FUNCTIONS *****************************************************************/ + +/* +* @implemented +*/ +ULONG +STDCALL +RtlGetNtGlobalFlags(VOID) +{ + return(NtGlobalFlag); +}