1. added irql checks to various rtl and security functions
2. RtlGetVersion needs to be implemented differently in ntoskrnl and
ntdll, ntoskrnl's version must not access the PEB (which might not be
present) while ntdlls gets most information from the PEB structure
3. can't use spinlocks to serialize access to the security descriptor
cache since it calls sd rtl functions which require to run < apc level
Modified: trunk/reactos/include/ddk/extypes.h
Modified: trunk/reactos/include/ntdll/ntdll.h
Modified: trunk/reactos/include/ntdll/rtl.h
Modified: trunk/reactos/lib/ntdll/makefile
Modified: trunk/reactos/lib/ntdll/rtl/libsupp.c
Modified: trunk/reactos/lib/ntdll/rtl/process.c
Modified: trunk/reactos/lib/rtl/acl.c
Modified: trunk/reactos/lib/rtl/luid.c
Modified: trunk/reactos/lib/rtl/makefile
Modified: trunk/reactos/lib/rtl/sd.c
Modified: trunk/reactos/lib/rtl/security.c
Modified: trunk/reactos/lib/rtl/sid.c
Modified: trunk/reactos/lib/rtl/timezone.c
Modified: trunk/reactos/lib/rtl/version.c
Modified: trunk/reactos/ntoskrnl/Makefile
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/ke/main.c
Modified: trunk/reactos/ntoskrnl/ob/sdcache.c
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
Modified: trunk/reactos/ntoskrnl/rtl/misc.c
Modified: trunk/reactos/ntoskrnl/se/access.c
Modified: trunk/reactos/ntoskrnl/se/acl.c
Modified: trunk/reactos/ntoskrnl/se/luid.c
Modified: trunk/reactos/ntoskrnl/se/priv.c
Modified: trunk/reactos/ntoskrnl/se/semgr.c
Modified: trunk/reactos/tools/mkconfig.c
_____
Modified: trunk/reactos/include/ddk/extypes.h
--- trunk/reactos/include/ddk/extypes.h 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/include/ddk/extypes.h 2005-02-22 17:58:19 UTC (rev
13712)
@@ -129,7 +129,7 @@
ULONGLONG Alignment;
struct
{
- SINGLE_LIST_ENTRY Next;
+ SLIST_ENTRY Next;
USHORT Depth;
USHORT Sequence;
}; /* now anonymous */
_____
Modified: trunk/reactos/include/ntdll/ntdll.h
--- trunk/reactos/include/ntdll/ntdll.h 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/include/ntdll/ntdll.h 2005-02-22 17:58:19 UTC (rev
13712)
@@ -42,3 +42,10 @@
#define MAGIC(c1,c2,c3,c4) ((c1) + ((c2)<<8) + ((c3)<<16) +
((c4)<<24))
#define MAGIC_HEAP MAGIC( 'H','E','A','P' )
+
+#ifdef DBG
+extern VOID FASTCALL CHECK_PAGED_CODE_RTL(char *file, int line);
+#define PAGED_CODE_RTL() CHECK_PAGED_CODE_RTL(__FILE__, __LINE__)
+#else
+#define PAGED_CODE_RTL()
+#endif
_____
Modified: trunk/reactos/include/ntdll/rtl.h
--- trunk/reactos/include/ntdll/rtl.h 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/include/ntdll/rtl.h 2005-02-22 17:58:19 UTC (rev
13712)
@@ -14,6 +14,12 @@
extern "C" {
#endif /* __cplusplus */
+#ifdef DBG
+extern VOID FASTCALL CHECK_PAGED_CODE_RTL(char *file, int line);
+#define PAGED_CODE_RTL() CHECK_PAGED_CODE_RTL(__FILE__, __LINE__)
+#else
+#define PAGED_CODE_RTL()
+#endif
#ifndef __USE_W32API
_____
Modified: trunk/reactos/lib/ntdll/makefile
--- trunk/reactos/lib/ntdll/makefile 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/lib/ntdll/makefile 2005-02-22 17:58:19 UTC (rev
13712)
@@ -13,6 +13,10 @@
# require os code to explicitly request A/W version of
structs/functions
TARGET_CFLAGS += -D_DISABLE_TIDENTS
+ifneq ($(DBG), 0)
+TARGET_CFLAGS += -DDBG
+endif
+
TARGET_ASFLAGS = -I $(PATH_TO_TOP)/include
TARGET_LFLAGS = -Wl,--file-alignment,0x1000 \
_____
Modified: trunk/reactos/lib/ntdll/rtl/libsupp.c
--- trunk/reactos/lib/ntdll/rtl/libsupp.c 2005-02-22 11:46:44 UTC
(rev 13711)
+++ trunk/reactos/lib/ntdll/rtl/libsupp.c 2005-02-22 17:58:19 UTC
(rev 13712)
@@ -55,3 +55,12 @@
0,
Mem);
}
+
+
+#ifdef DBG
+VOID FASTCALL
+CHECK_PAGED_CODE_RTL(char *file, int line)
+{
+ /* meaningless in user mode */
+}
+#endif
_____
Modified: trunk/reactos/lib/ntdll/rtl/process.c
--- trunk/reactos/lib/ntdll/rtl/process.c 2005-02-22 11:46:44 UTC
(rev 13711)
+++ trunk/reactos/lib/ntdll/rtl/process.c 2005-02-22 17:58:19 UTC
(rev 13712)
@@ -324,4 +324,47 @@
return(STATUS_SUCCESS);
}
+
+/*
+* @implemented
+*/
+NTSTATUS STDCALL
+RtlGetVersion(RTL_OSVERSIONINFOW *Info)
+{
+ if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) ||
+ Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
+ {
+ PPEB Peb = NtCurrentPeb();
+
+ Info->dwMajorVersion = Peb->OSMajorVersion;
+ Info->dwMinorVersion = Peb->OSMinorVersion;
+ Info->dwBuildNumber = Peb->OSBuildNumber;
+ Info->dwPlatformId = Peb->OSPlatformId;
+ if(((Peb->OSCSDVersion >> 8) & 0xFF) != 0)
+ {
+ int i = _snwprintf(Info->szCSDVersion,
+ (sizeof(Info->szCSDVersion) /
sizeof(Info->szCSDVersion[0])) - 1,
+ L"Service Pack %d",
+ ((Peb->OSCSDVersion >> 8) & 0xFF));
+ Info->szCSDVersion[i] = L'\0';
+ }
+ else
+ {
+ RtlZeroMemory(Info->szCSDVersion, sizeof(Info->szCSDVersion));
+ }
+ if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
+ {
+ RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)Info;
+ InfoEx->wServicePackMajor = (Peb->OSCSDVersion >> 8) & 0xFF;
+ InfoEx->wServicePackMinor = Peb->OSCSDVersion & 0xFF;
+ InfoEx->wSuiteMask = SharedUserData->SuiteMask;
+ InfoEx->wProductType = SharedUserData->NtProductType;
+ }
+
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_INVALID_PARAMETER;
+}
+
/* EOF */
_____
Modified: trunk/reactos/lib/rtl/acl.c
--- trunk/reactos/lib/rtl/acl.c 2005-02-22 11:46:44 UTC (rev 13711)
+++ trunk/reactos/lib/rtl/acl.c 2005-02-22 17:58:19 UTC (rev 13712)
@@ -12,7 +12,7 @@
/* INCLUDES
*****************************************************************/
#include <ddk/ntddk.h>
-#include <ntos/rtl.h>
+#include <ntdll/rtl.h>
#define NDEBUG
#include <debug.h>
@@ -26,6 +26,8 @@
PACE Current;
PVOID AclEnd;
ULONG i;
+
+ PAGED_CODE_RTL();
Current = (PACE)(Acl + 1);
*Ace = NULL;
@@ -70,6 +72,8 @@
PACE *Ace)
{
ULONG i;
+
+ PAGED_CODE_RTL();
*Ace = (PACE)(Acl + 1);
@@ -111,6 +115,8 @@
ULONG Type)
{
PACE Ace;
+
+ PAGED_CODE_RTL();
if (!RtlValidSid(Sid))
{
@@ -158,6 +164,8 @@
IN ACCESS_MASK AccessMask,
IN PSID Sid)
{
+ PAGED_CODE_RTL();
+
return RtlpAddKnownAce (Acl,
Revision,
0,
@@ -177,6 +185,8 @@
IN ACCESS_MASK AccessMask,
IN PSID Sid)
{
+ PAGED_CODE_RTL();
+
return RtlpAddKnownAce (Acl,
Revision,
Flags,
@@ -195,6 +205,8 @@
ACCESS_MASK AccessMask,
PSID Sid)
{
+ PAGED_CODE_RTL();
+
return RtlpAddKnownAce (Acl,
Revision,
0,
@@ -214,6 +226,8 @@
IN ACCESS_MASK AccessMask,
IN PSID Sid)
{
+ PAGED_CODE_RTL();
+
return RtlpAddKnownAce (Acl,
Revision,
Flags,
@@ -259,6 +273,8 @@
ULONG i;
PACE Current;
ULONG j;
+
+ PAGED_CODE_RTL();
if (Acl->AclRevision < MIN_ACL_REVISION ||
Acl->AclRevision > MAX_ACL_REVISION)
@@ -339,6 +355,8 @@
{
PACE Ace;
ULONG Flags = 0;
+
+ PAGED_CODE_RTL();
if (Success != FALSE)
{
@@ -408,6 +426,8 @@
BOOLEAN Failure)
{
PACE Ace;
+
+ PAGED_CODE_RTL();
if (Success != FALSE)
{
@@ -494,6 +514,8 @@
{
PACE Ace;
PACE Current;
+
+ PAGED_CODE_RTL();
if (Acl->AclRevision < MIN_ACL_REVISION ||
Acl->AclRevision > MAX_ACL_REVISION)
@@ -535,6 +557,8 @@
ULONG AclSize,
ULONG AclRevision)
{
+ PAGED_CODE_RTL();
+
if (AclSize < 8)
{
return(STATUS_BUFFER_TOO_SMALL);
@@ -572,6 +596,8 @@
ACL_INFORMATION_CLASS InformationClass)
{
PACE Ace;
+
+ PAGED_CODE_RTL();
if (Acl->AclRevision < MIN_ACL_REVISION ||
Acl->AclRevision > MAX_ACL_REVISION)
@@ -638,6 +664,8 @@
ULONG InformationLength,
ACL_INFORMATION_CLASS InformationClass)
{
+ PAGED_CODE_RTL();
+
if (Acl->AclRevision < MIN_ACL_REVISION ||
Acl->AclRevision > MAX_ACL_REVISION)
{
@@ -680,6 +708,8 @@
{
PACE Ace;
USHORT Size;
+
+ PAGED_CODE_RTL();
Size = ROUND_UP(Acl->AclSize, 4);
_____
Modified: trunk/reactos/lib/rtl/luid.c
--- trunk/reactos/lib/rtl/luid.c 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/lib/rtl/luid.c 2005-02-22 17:58:19 UTC (rev
13712)
@@ -12,6 +12,7 @@
/* INCLUDES
*****************************************************************/
#include <ddk/ntddk.h>
+#include <ntdll/rtl.h>
#define NDEBUG
#include <debug.h>
@@ -22,6 +23,8 @@
RtlCopyLuid(PLUID LuidDest,
PLUID LuidSrc)
{
+ PAGED_CODE_RTL();
+
LuidDest->LowPart = LuidSrc->LowPart;
LuidDest->HighPart = LuidSrc->HighPart;
}
@@ -36,6 +39,8 @@
PLUID_AND_ATTRIBUTES Dest)
{
ULONG i;
+
+ PAGED_CODE_RTL();
for (i = 0; i < Count; i++)
{
@@ -53,6 +58,8 @@
RtlEqualLuid(PLUID Luid1,
PLUID Luid2)
{
+ PAGED_CODE_RTL();
+
return (Luid1->LowPart == Luid2->LowPart &&
Luid1->HighPart == Luid2->HighPart);
}
_____
Modified: trunk/reactos/lib/rtl/makefile
--- trunk/reactos/lib/rtl/makefile 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/lib/rtl/makefile 2005-02-22 17:58:19 UTC (rev
13712)
@@ -12,6 +12,10 @@
# require os code to explicitly request A/W version of
structs/functions
TARGET_CFLAGS += -D_DISABLE_TIDENTS
+ifneq ($(DBG), 0)
+TARGET_CFLAGS += -DDBG
+endif
+
TARGET_OBJECTS = \
acl.o \
bit.o \
_____
Modified: trunk/reactos/lib/rtl/sd.c
--- trunk/reactos/lib/rtl/sd.c 2005-02-22 11:46:44 UTC (rev 13711)
+++ trunk/reactos/lib/rtl/sd.c 2005-02-22 17:58:19 UTC (rev 13712)
@@ -113,6 +113,8 @@
RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
ULONG Revision)
{
+ PAGED_CODE_RTL();
+
if (Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -134,6 +136,8 @@
RtlCreateSecurityDescriptorRelative (PSECURITY_DESCRIPTOR_RELATIVE
SecurityDescriptor,
ULONG Revision)
{
+ PAGED_CODE_RTL();
+
if (Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -161,6 +165,8 @@
PACL Sacl, Dacl;
ULONG Length = sizeof(SECURITY_DESCRIPTOR);
+ PAGED_CODE_RTL();
+
RtlpQuerySecurityDescriptorPointers(SecurityDescriptor,
&Owner,
&Group,
@@ -200,6 +206,8 @@
PACL* Dacl,
PBOOLEAN DaclDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -233,6 +241,8 @@
PACL Dacl,
BOOLEAN DaclDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -270,6 +280,8 @@
{
PSID Owner, Group;
PACL Sacl, Dacl;
+
+ PAGED_CODE_RTL();
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
@@ -302,6 +314,8 @@
PSID Owner,
BOOLEAN OwnerDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -332,6 +346,8 @@
PSID* Owner,
PBOOLEAN OwnerDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -357,6 +373,8 @@
PSID Group,
BOOLEAN GroupDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -386,6 +404,8 @@
PSID* Group,
PBOOLEAN GroupDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -421,6 +441,8 @@
ULONG DaclLength;
ULONG TotalLength;
ULONG_PTR Current;
+
+ PAGED_CODE_RTL();
RtlpQuerySecurityDescriptor(AbsSD,
&Owner,
@@ -494,6 +516,8 @@
PSECURITY_DESCRIPTOR_RELATIVE RelSD,
PULONG BufferLength)
{
+ PAGED_CODE_RTL();
+
if (AbsSD->Control & SE_SELF_RELATIVE)
{
return STATUS_BAD_DESCRIPTOR_FORMAT;
@@ -511,6 +535,8 @@
PSECURITY_DESCRIPTOR_CONTROL Control,
PULONG Revision)
{
+ PAGED_CODE_RTL();
+
*Revision = SecurityDescriptor->Revision;
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
@@ -532,6 +558,8 @@
IN SECURITY_DESCRIPTOR_CONTROL
ControlBitsOfInterest,
IN SECURITY_DESCRIPTOR_CONTROL
ControlBitsToSet)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -556,6 +584,8 @@
PACL *Sacl,
PBOOLEAN SaclDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -589,6 +619,8 @@
PACL Sacl,
BOOLEAN SaclDefaulted)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
return STATUS_UNKNOWN_REVISION;
@@ -642,6 +674,8 @@
PSID pGroup;
PACL pDacl;
PACL pSacl;
+
+ PAGED_CODE_RTL();
if (RelSD->Revision != SECURITY_DESCRIPTOR_REVISION1)
{
@@ -713,6 +747,8 @@
IN ULONG SecurityDescriptorLength,
IN SECURITY_INFORMATION
RequiredInformation)
{
+ PAGED_CODE_RTL();
+
if (SecurityDescriptorLength < sizeof(SECURITY_DESCRIPTOR_RELATIVE)
||
SecurityDescriptorInput->Revision !=
SECURITY_DESCRIPTOR_REVISION1 ||
!(SecurityDescriptorInput->Control & SE_SELF_RELATIVE))
@@ -783,6 +819,8 @@
RtlGetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR
SecurityDescriptor,
PUCHAR RMControl)
{
+ PAGED_CODE_RTL();
+
if (!(SecurityDescriptor->Control & SE_RM_CONTROL_VALID))
{
*RMControl = 0;
@@ -802,6 +840,8 @@
RtlSetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR
SecurityDescriptor,
PUCHAR RMControl)
{
+ PAGED_CODE_RTL();
+
if (RMControl == NULL)
{
SecurityDescriptor->Control &= ~SE_RM_CONTROL_VALID;
@@ -823,6 +863,8 @@
IN SECURITY_DESCRIPTOR_CONTROL
Control,
OUT PULONG Revision)
{
+ PAGED_CODE_RTL();
+
*Revision = SecurityDescriptor->Revision;
if (SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION1)
_____
Modified: trunk/reactos/lib/rtl/security.c
--- trunk/reactos/lib/rtl/security.c 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/lib/rtl/security.c 2005-02-22 17:58:19 UTC (rev
13712)
@@ -28,7 +28,9 @@
HANDLE ImpersonationToken;
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjAttr;
- SECURITY_QUALITY_OF_SERVICE Sqos;
+ SECURITY_QUALITY_OF_SERVICE Sqos;
+
+ PAGED_CODE_RTL();
Status = NtOpenProcessToken(NtCurrentProcess(),
TOKEN_DUPLICATE,
@@ -97,6 +99,8 @@
ULONG ReturnLength;
HANDLE TokenHandle;
NTSTATUS Status;
+
+ PAGED_CODE_RTL();
DPRINT ("RtlAdjustPrivilege() called\n");
_____
Modified: trunk/reactos/lib/rtl/sid.c
--- trunk/reactos/lib/rtl/sid.c 2005-02-22 11:46:44 UTC (rev 13711)
+++ trunk/reactos/lib/rtl/sid.c 2005-02-22 17:58:19 UTC (rev 13712)
@@ -13,6 +13,7 @@
#define __NTDRIVER__
#include <ddk/ntddk.h>
+#include <ntdll/rtl.h>
#include <string.h>
@@ -26,6 +27,8 @@
{
PISID Sid = Sid_;
+ PAGED_CODE_RTL();
+
if ((Sid->Revision != SID_REVISION) ||
(Sid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES))
{
@@ -42,6 +45,8 @@
ULONG STDCALL
RtlLengthRequiredSid(IN UCHAR SubAuthorityCount)
{
+ PAGED_CODE_RTL();
+
return (sizeof(SID) + (SubAuthorityCount - 1) * sizeof(ULONG));
}
@@ -56,6 +61,8 @@
{
PISID Sid = Sid_;
+ PAGED_CODE_RTL();
+
Sid->Revision = SID_REVISION;
Sid->SubAuthorityCount = SubAuthorityCount;
memcpy(&Sid->IdentifierAuthority,
@@ -75,6 +82,8 @@
{
PISID Sid = Sid_;
+ PAGED_CODE_RTL();
+
return &Sid->SubAuthority[SubAuthority];
}
@@ -87,6 +96,8 @@
{
PISID Sid = Sid_;
+ PAGED_CODE_RTL();
+
return &Sid->SubAuthorityCount;
}
@@ -100,6 +111,8 @@
{
PISID Sid1 = Sid1_;
PISID Sid2 = Sid2_;
+
+ PAGED_CODE_RTL();
if (Sid1->Revision != Sid2->Revision)
{
@@ -125,6 +138,8 @@
{
PISID Sid = Sid_;
+ PAGED_CODE_RTL();
+
return (sizeof(SID) + (Sid->SubAuthorityCount-1) * sizeof(ULONG));
}
@@ -137,6 +152,8 @@
PSID Dest,
PSID Src)
{
+ PAGED_CODE_RTL();
+
if (BufferLength < RtlLengthSid(Src))
{
return STATUS_UNSUCCESSFUL;
@@ -165,6 +182,8 @@
ULONG SidLength;
ULONG Length;
ULONG i;
+
+ PAGED_CODE_RTL();
Length = SidAreaSize;
@@ -197,6 +216,8 @@
{
PISID Sid = Sid_;
+ PAGED_CODE_RTL();
+
return &Sid->IdentifierAuthority;
}
@@ -218,6 +239,8 @@
PSID *Sid)
{
PISID pSid;
+
+ PAGED_CODE_RTL();
if (SubAuthorityCount > 8)
return STATUS_INVALID_SID;
@@ -273,6 +296,8 @@
PVOID STDCALL
RtlFreeSid(IN PSID Sid)
{
+ PAGED_CODE_RTL();
+
ExFreePool(Sid);
return NULL;
}
@@ -287,6 +312,8 @@
{
PISID Sid1 = Sid1_;
PISID Sid2 = Sid2_;
+
+ PAGED_CODE_RTL();
return(Sid1->SubAuthorityCount == Sid2->SubAuthorityCount &&
!RtlCompareMemory(Sid1, Sid2,
@@ -307,6 +334,8 @@
ULONG Length;
ULONG i;
PISID Sid = Sid_;
+
+ PAGED_CODE_RTL();
if (RtlValidSid (Sid) == FALSE)
return STATUS_INVALID_SID;
_____
Modified: trunk/reactos/lib/rtl/timezone.c
--- trunk/reactos/lib/rtl/timezone.c 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/lib/rtl/timezone.c 2005-02-22 17:58:19 UTC (rev
13712)
@@ -14,6 +14,7 @@
#include <ddk/ntddk.h>
#include <ntos/registry.h>
#include <ntos/time.h>
+#include <ntdll/rtl.h>
#define NDEBUG
#include <debug.h>
@@ -33,6 +34,8 @@
NTSTATUS Status;
DPRINT("RtlQueryTimeZoneInformation()\n");
+
+ PAGED_CODE_RTL();
RtlZeroMemory(QueryTable,
sizeof(QueryTable));
@@ -93,6 +96,8 @@
NTSTATUS Status;
DPRINT("RtlSetTimeZoneInformation()\n");
+
+ PAGED_CODE_RTL();
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
L"TimeZoneInformation",
_____
Modified: trunk/reactos/lib/rtl/version.c
--- trunk/reactos/lib/rtl/version.c 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/lib/rtl/version.c 2005-02-22 17:58:19 UTC (rev
13712)
@@ -40,37 +40,6 @@
/* FUNCTIONS
****************************************************************/
/*
-* @implemented
-*/
-NTSTATUS STDCALL
-RtlGetVersion(RTL_OSVERSIONINFOW *Info)
-{
- WCHAR CSDString[] = L"Service Pack 6";
-
- if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) ||
- Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
- {
- Info->dwMajorVersion = 4;
- Info->dwMinorVersion = 0;
- Info->dwBuildNumber = 1381;
- Info->dwPlatformId = VER_PLATFORM_WIN32_NT;
- RtlCopyMemory(Info->szCSDVersion, CSDString, sizeof(CSDString));
- if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
- {
- RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)Info;
- InfoEx->wServicePackMajor = 6;
- InfoEx->wServicePackMinor = 0;
- InfoEx->wSuiteMask = 0;
- InfoEx->wProductType = VER_NT_WORKSTATION;
- }
-
- return STATUS_SUCCESS;
- }
-
- return STATUS_INVALID_PARAMETER;
-}
-
-/*
* @unimplemented
*/
/*
@@ -114,39 +83,37 @@
/*
* @implemented
*/
-ULONGLONG NTAPI VerSetConditionMask
-(
- IN ULONGLONG dwlConditionMask,
- IN DWORD dwTypeBitMask,
- IN BYTE dwConditionMask
-)
+ULONGLONG NTAPI
+VerSetConditionMask(IN ULONGLONG dwlConditionMask,
+ IN DWORD dwTypeBitMask,
+ IN BYTE dwConditionMask)
{
- if(dwTypeBitMask == 0)
- return dwlConditionMask;
+ if(dwTypeBitMask == 0)
+ return dwlConditionMask;
- dwConditionMask &= VER_CONDITION_MASK;
+ dwConditionMask &= VER_CONDITION_MASK;
- if(dwConditionMask == 0)
- return dwlConditionMask;
+ if(dwConditionMask == 0)
+ return dwlConditionMask;
- if(dwTypeBitMask & VER_PRODUCT_TYPE)
- dwlConditionMask |= dwConditionMask << 7 *
VER_NUM_BITS_PER_CONDITION_MASK;
- else if(dwTypeBitMask & VER_SUITENAME)
- dwlConditionMask |= dwConditionMask << 6 *
VER_NUM_BITS_PER_CONDITION_MASK;
- else if(dwTypeBitMask & VER_SERVICEPACKMAJOR)
- dwlConditionMask |= dwConditionMask << 5 *
VER_NUM_BITS_PER_CONDITION_MASK;
- else if(dwTypeBitMask & VER_SERVICEPACKMINOR)
- dwlConditionMask |= dwConditionMask << 4 *
VER_NUM_BITS_PER_CONDITION_MASK;
- else if(dwTypeBitMask & VER_PLATFORMID)
- dwlConditionMask |= dwConditionMask << 3 *
VER_NUM_BITS_PER_CONDITION_MASK;
- else if(dwTypeBitMask & VER_BUILDNUMBER)
- dwlConditionMask |= dwConditionMask << 2 *
VER_NUM_BITS_PER_CONDITION_MASK;
- else if(dwTypeBitMask & VER_MAJORVERSION)
- dwlConditionMask |= dwConditionMask << 1 *
VER_NUM_BITS_PER_CONDITION_MASK;
- else if(dwTypeBitMask & VER_MINORVERSION)
- dwlConditionMask |= dwConditionMask << 0 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ if(dwTypeBitMask & VER_PRODUCT_TYPE)
+ dwlConditionMask |= dwConditionMask << 7 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ else if(dwTypeBitMask & VER_SUITENAME)
+ dwlConditionMask |= dwConditionMask << 6 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ else if(dwTypeBitMask & VER_SERVICEPACKMAJOR)
+ dwlConditionMask |= dwConditionMask << 5 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ else if(dwTypeBitMask & VER_SERVICEPACKMINOR)
+ dwlConditionMask |= dwConditionMask << 4 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ else if(dwTypeBitMask & VER_PLATFORMID)
+ dwlConditionMask |= dwConditionMask << 3 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ else if(dwTypeBitMask & VER_BUILDNUMBER)
+ dwlConditionMask |= dwConditionMask << 2 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ else if(dwTypeBitMask & VER_MAJORVERSION)
+ dwlConditionMask |= dwConditionMask << 1 *
VER_NUM_BITS_PER_CONDITION_MASK;
+ else if(dwTypeBitMask & VER_MINORVERSION)
+ dwlConditionMask |= dwConditionMask << 0 *
VER_NUM_BITS_PER_CONDITION_MASK;
- return dwlConditionMask;
+ return dwlConditionMask;
}
/* EOF */
_____
Modified: trunk/reactos/ntoskrnl/Makefile
--- trunk/reactos/ntoskrnl/Makefile 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/ntoskrnl/Makefile 2005-02-22 17:58:19 UTC (rev
13712)
@@ -54,6 +54,10 @@
TARGET_BASE = 0x80000000
endif
+ifneq ($(DBG), 0)
+TARGET_CFLAGS += -DDBG
+endif
+
# enable thread event pair features (NT4 only!)
# TARGET_CFLAGS += -D_ENABLE_THRDEVTPAIR
_____
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
--- trunk/reactos/ntoskrnl/include/ntoskrnl.h 2005-02-22 11:46:44 UTC
(rev 13711)
+++ trunk/reactos/ntoskrnl/include/ntoskrnl.h 2005-02-22 17:58:19 UTC
(rev 13712)
@@ -65,4 +65,23 @@
#include <pseh.h>
+#ifdef DBG
+#ifndef PAGED_CODE
+#define PAGED_CODE()
\
+ do {
\
+ if(KeGetCurrentIrql() > APC_LEVEL) {
\
+ DbgPrint("%s:%i: Pagable code called at IRQL > APC_LEVEL (%d)\n",
\
+ __FILE__, __LINE__, KeGetCurrentIrql());
\
+ KEBUGCHECK(0);
\
+ }
\
+ } while(0)
+#endif
+#define PAGED_CODE_RTL PAGED_CODE
+#else
+#ifndef PAGED_CODE
+#define PAGED_CODE()
+#endif
+#define PAGED_CODE_RTL()
+#endif
+
#endif /* INCLUDE_NTOSKRNL_H */
_____
Modified: trunk/reactos/ntoskrnl/ke/main.c
--- trunk/reactos/ntoskrnl/ke/main.c 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/ntoskrnl/ke/main.c 2005-02-22 17:58:19 UTC (rev
13712)
@@ -31,6 +31,10 @@
/* GLOBALS
*******************************************************************/
+#define BUILD_OSCSDVERSION(major, minor) (((major & 0xFF) << 8) |
(minor & 0xFF))
+ULONG NtMajorVersion = 4;
+ULONG NtMinorVersion = 0;
+ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(6, 0);
#ifdef __GNUC__
ULONG EXPORTED NtBuildNumber = KERNEL_VERSION_BUILD;
ULONG EXPORTED NtGlobalFlag = 0;
_____
Modified: trunk/reactos/ntoskrnl/ob/sdcache.c
--- trunk/reactos/ntoskrnl/ob/sdcache.c 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/ntoskrnl/ob/sdcache.c 2005-02-22 17:58:19 UTC (rev
13712)
@@ -28,13 +28,11 @@
/* GLOBALS
******************************************************************/
-PLIST_ENTRY ObpSdCache;
-KSPIN_LOCK ObpSdCacheSpinLock;
-KIRQL ObpSdCacheIrql;
-
-
#define SD_CACHE_ENTRIES 0x100
+LIST_ENTRY ObpSdCache[SD_CACHE_ENTRIES];
+FAST_MUTEX ObpSdCacheMutex;
+
/* FUNCTIONS
****************************************************************/
NTSTATUS
@@ -42,37 +40,36 @@
{
ULONG i;
- ObpSdCache = ExAllocatePool(NonPagedPool,
- SD_CACHE_ENTRIES * sizeof(LIST_ENTRY));
- if (ObpSdCache == NULL)
+ for (i = 0; i < (sizeof(ObpSdCache) / sizeof(ObpSdCache[0])); i++)
{
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- for (i = 0; i < SD_CACHE_ENTRIES; i++)
- {
InitializeListHead(&ObpSdCache[i]);
}
- KeInitializeSpinLock(&ObpSdCacheSpinLock);
+ ExInitializeFastMutex(&ObpSdCacheMutex);
return STATUS_SUCCESS;
}
-static VOID
+static inline VOID
ObpSdCacheLock(VOID)
{
- KeAcquireSpinLock(&ObpSdCacheSpinLock,
- &ObpSdCacheIrql);
+ /* can't acquire a fast mutex in the early boot process... */
+ if(KeGetCurrentThread() != NULL)
+ {
+ ExAcquireFastMutex(&ObpSdCacheMutex);
+ }
}
-static VOID
+static inline VOID
ObpSdCacheUnlock(VOID)
{
- KeReleaseSpinLock(&ObpSdCacheSpinLock,
- ObpSdCacheIrql);
+ /* can't acquire a fast mutex in the early boot process... */
+ if(KeGetCurrentThread() != NULL)
+ {
+ ExReleaseFastMutex(&ObpSdCacheMutex);
+ }
}
_____
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
--- trunk/reactos/ntoskrnl/rtl/libsupp.c 2005-02-22 11:46:44 UTC
(rev 13711)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c 2005-02-22 17:58:19 UTC
(rev 13712)
@@ -1,4 +1,4 @@
-/* $Id:$
+/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -109,4 +109,17 @@
return STATUS_SUCCESS;
}
+
+#ifdef DBG
+VOID FASTCALL
+CHECK_PAGED_CODE_RTL(char *file, int line)
+{
+ if(KeGetCurrentIrql() > APC_LEVEL)
+ {
+ DbgPrint("%s:%i: Pagable code called at IRQL > APC_LEVEL (%d)\n",
file, line, KeGetCurrentIrql());
+ KEBUGCHECK(0);
+ }
+}
+#endif
+
/* EOF */
_____
Modified: trunk/reactos/ntoskrnl/rtl/misc.c
--- trunk/reactos/ntoskrnl/rtl/misc.c 2005-02-22 11:46:44 UTC (rev
13711)
+++ trunk/reactos/ntoskrnl/rtl/misc.c 2005-02-22 17:58:19 UTC (rev
13712)
@@ -17,7 +17,38 @@
/* GLOBALS
*******************************************************************/
extern ULONG NtGlobalFlag;
+extern ULONG NtMajorVersion;
+extern ULONG NtMinorVersion;
+extern ULONG NtOSCSDVersion;
+/* header hell made me do this...sorry */
+typedef struct _OSVERSIONINFOW {
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
[truncated at 1000 lines; 304 more skipped]