- Implement RtlGetLastNtStatus, RtlGetLastWin32Error, RtlRestoreLastWin32Error, RtlSe...
[reactos.git] / reactos / include / ntos / rtl.h
index 179622b..6623ea5 100755 (executable)
@@ -1,4 +1,4 @@
-/* $Id: rtl.h,v 1.40 2004/12/16 15:10:00 gdalsnes Exp $
+/* $Id$
  * 
  */
 #ifndef __DDK_RTL_H
@@ -112,7 +112,7 @@ static __inline VOID
 InsertHeadList(
        IN PLIST_ENTRY  ListHead,
        IN PLIST_ENTRY  Entry)
-{ 
+{
        PLIST_ENTRY OldFlink;
        OldFlink = ListHead->Flink;
        Entry->Flink = OldFlink;
@@ -140,7 +140,7 @@ static __inline VOID
 InsertTailList(
        IN PLIST_ENTRY  ListHead,
        IN PLIST_ENTRY  Entry)
-{ 
+{
        PLIST_ENTRY OldBlink;
        OldBlink = ListHead->Blink;
        Entry->Flink = ListHead;
@@ -375,12 +375,13 @@ RemoveTailList(
   
 #define IsLastEntry(ListHead, Entry) ((ListHead)->Blink == Entry)
   
+#define RtlEqualMemory(Destination,Source,Length)   (!memcmp((Destination), (Source), (Length)))
 
 NTSTATUS
 STDCALL
 RtlAppendUnicodeToString (
        PUNICODE_STRING Destination,
-       PWSTR           Source
+       PCWSTR          Source
        );
 
 SIZE_T STDCALL
@@ -457,8 +458,7 @@ RtlZeroMemory (PVOID Destination, ULONG Length);
 #define RTL_REGISTRY_WINDOWS_NT 3
 #define RTL_REGISTRY_DEVICEMAP  4
 #define RTL_REGISTRY_USER       5
-#define RTL_REGISTRY_ENUM       6   /* ReactOS specific: Used internally in kernel only */
-#define RTL_REGISTRY_MAXIMUM    7
+#define RTL_REGISTRY_MAXIMUM    6
 
 #define RTL_REGISTRY_HANDLE     0x40000000
 #define RTL_REGISTRY_OPTIONAL   0x80000000
@@ -521,7 +521,7 @@ PushEntryList (
 
 NTSTATUS STDCALL
 RtlAbsoluteToSelfRelativeSD (PSECURITY_DESCRIPTOR AbsSD,
-                            PSECURITY_DESCRIPTOR RelSD,
+                            PSECURITY_DESCRIPTOR_RELATIVE RelSD,
                             PULONG BufferLength);
 
 NTSTATUS STDCALL
@@ -852,6 +852,10 @@ NTSTATUS STDCALL
 RtlCreateSecurityDescriptor (PSECURITY_DESCRIPTOR SecurityDescriptor,
                             ULONG Revision);
 
+NTSTATUS STDCALL
+RtlCreateSecurityDescriptorRelative (PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
+                                    ULONG Revision);
+
 NTSTATUS
 STDCALL
 RtlCreateSystemVolumeInformationFolder(
@@ -860,7 +864,7 @@ RtlCreateSystemVolumeInformationFolder(
 
 BOOLEAN STDCALL
 RtlCreateUnicodeString (OUT PUNICODE_STRING Destination,
-                       IN PWSTR Source);
+                       IN PCWSTR Source);
 
 BOOLEAN STDCALL
 RtlCreateUnicodeStringFromAsciiz (OUT PUNICODE_STRING Destination,
@@ -877,6 +881,12 @@ RtlCustomCPToUnicodeN (
        ULONG           CustomSize
        );
 
+BOOLEAN STDCALL
+RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
+                           OUT PLARGE_INTEGER SystemTime,
+                           IN PLARGE_INTEGER CurrentTime,
+                           IN BOOLEAN ThisYearsCutoverOnly);
+
 NTSTATUS STDCALL
 RtlDecompressBuffer(IN USHORT CompressionFormat,
                    OUT PUCHAR UncompressedBuffer,
@@ -1309,6 +1319,12 @@ RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR SecurityDescriptor,
                               PSID* Group,
                               PBOOLEAN GroupDefaulted);
 
+NTSTATUS STDCALL
+RtlGetLastNtStatus(VOID);
+
+ULONG STDCALL
+RtlGetLastWin32Error(VOID);
+
 NTSTATUS STDCALL
 RtlGetNextRange (IN OUT PRTL_RANGE_LIST_ITERATOR Iterator,
                 OUT PRTL_RANGE *Range,
@@ -1331,6 +1347,10 @@ RtlGetSaclSecurityDescriptor (PSECURITY_DESCRIPTOR SecurityDescriptor,
                              PACL* Sacl,
                              PBOOLEAN SaclDefaulted);
 
+BOOLEAN STDCALL
+RtlGetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,
+                                 PUCHAR RMControl);
+
 NTSTATUS
 STDCALL
 RtlGetSetBootStatusData(
@@ -1989,7 +2009,7 @@ RtlLookupElementGenericTableFullAvl (
 
 NTSTATUS STDCALL
 RtlMakeSelfRelativeSD (PSECURITY_DESCRIPTOR AbsSD,
-                      PSECURITY_DESCRIPTOR RelSD,
+                      PSECURITY_DESCRIPTOR_RELATIVE RelSD,
                       PULONG BufferLength);
 
 VOID STDCALL
@@ -2204,6 +2224,9 @@ RtlReserveChunk (
 VOID STDCALL
 RtlResetRtlTranslations (IN PNLSTABLEINFO NlsTable);
 
+VOID STDCALL
+RtlRestoreLastWin32Error(IN ULONG Error);
+
 /*
  * VOID
  * RtlRetrieveUlong (
@@ -2212,7 +2235,7 @@ RtlResetRtlTranslations (IN PNLSTABLEINFO NlsTable);
  *     );
  */
 #define RtlRetrieveUlong(DestAddress,SrcAddress) \
-       if ((ULONG)(SrcAddress) & LONG_MASK) \
+       if ((ULONG_PTR)(SrcAddress) & LONG_MASK) \
        { \
                ((PUCHAR)(DestAddress))[0]=((PUCHAR)(SrcAddress))[0]; \
                ((PUCHAR)(DestAddress))[1]=((PUCHAR)(SrcAddress))[1]; \
@@ -2232,7 +2255,7 @@ RtlResetRtlTranslations (IN PNLSTABLEINFO NlsTable);
  *     );
  */
 #define RtlRetrieveUshort(DestAddress,SrcAddress) \
-       if ((ULONG)(SrcAddress) & SHORT_MASK) \
+       if ((ULONG_PTR)(SrcAddress) & SHORT_MASK) \
        { \
                ((PUCHAR)(DestAddress))[0]=((PUCHAR)(SrcAddress))[0]; \
                ((PUCHAR)(DestAddress))[1]=((PUCHAR)(SrcAddress))[1]; \
@@ -2251,7 +2274,7 @@ RtlSecondsSince1980ToTime (ULONG SecondsSince1980,
                           PLARGE_INTEGER Time);
 
 NTSTATUS STDCALL
-RtlSelfRelativeToAbsoluteSD (PSECURITY_DESCRIPTOR RelSD,
+RtlSelfRelativeToAbsoluteSD (PSECURITY_DESCRIPTOR_RELATIVE RelSD,
                             PSECURITY_DESCRIPTOR AbsSD,
                             PULONG AbsSDSize,
                             PACL Dacl,
@@ -2266,13 +2289,18 @@ RtlSelfRelativeToAbsoluteSD (PSECURITY_DESCRIPTOR RelSD,
 NTSTATUS
 STDCALL
 RtlSelfRelativeToAbsoluteSD2(
-       PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
+       PSECURITY_DESCRIPTOR_RELATIVE SelfRelativeSecurityDescriptor,
        PULONG BufferSize
        );
 
 VOID STDCALL
 RtlSetAllBits (IN PRTL_BITMAP BitMapHeader);
 
+NTSTATUS STDCALL
+RtlSetAttributesSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+                                  IN SECURITY_DESCRIPTOR_CONTROL Control,
+                                  OUT PULONG Revision);
+
 VOID
 STDCALL
 RtlSetBit (
@@ -2288,6 +2316,11 @@ RtlSetBits (
        ULONG           NumberToSet
        );
 
+NTSTATUS STDCALL
+RtlSetControlSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+                               IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
+                               IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet);
+
 NTSTATUS STDCALL
 RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR SecurityDescriptor,
                              BOOLEAN DaclPresent,
@@ -2299,6 +2332,18 @@ RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR SecurityDescriptor,
                               PSID Group,
                               BOOLEAN GroupDefaulted);
 
+NTSTATUS STDCALL
+RtlSetInformationAcl (PACL Acl,
+                     PVOID Information,
+                     ULONG InformationLength,
+                     ACL_INFORMATION_CLASS InformationClass);
+
+VOID STDCALL
+RtlSetLastWin32Error(IN ULONG Error);
+
+VOID STDCALL
+RtlSetLastWin32ErrorAndNtStatusFromNtStatus(IN NTSTATUS Status);
+
 NTSTATUS STDCALL
 RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR SecurityDescriptor,
                               PSID Owner,
@@ -2310,11 +2355,9 @@ RtlSetSaclSecurityDescriptor (PSECURITY_DESCRIPTOR SecurityDescriptor,
                              PACL Sacl,
                              BOOLEAN SaclDefaulted);
 
-NTSTATUS STDCALL
-RtlSetInformationAcl (PACL Acl,
-                     PVOID Information,
-                     ULONG InformationLength,
-                     ACL_INFORMATION_CLASS InformationClass);
+VOID STDCALL
+RtlSetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,
+                                 PUCHAR RMControl);
 
 NTSTATUS STDCALL
 RtlSetTimeZoneInformation (IN OUT PTIME_ZONE_INFORMATION TimeZoneInformation);
@@ -2340,10 +2383,10 @@ RtlSplay (
  *     );
  */
 #define RtlStoreUlong(Address,Value) \
-       if ((ULONG)(Address) & LONG_MASK) \
+       if ((ULONG_PTR)(Address) & LONG_MASK) \
        { \
                ((PUCHAR)(Address))[LONG_LEAST_SIGNIFICANT_BIT]=(UCHAR)(FIRSTBYTE(Value)); \
-               ((PUCHAR)(Address))[LONG_3RD_MOST_SIGNIFICANT_BIT]=(UCHAR)(FIRSTBYTE(Value)); \
+               ((PUCHAR)(Address))[LONG_3RD_MOST_SIGNIFICANT_BIT]=(UCHAR)(SECONDBYTE(Value)); \
                ((PUCHAR)(Address))[LONG_2ND_MOST_SIGNIFICANT_BIT]=(UCHAR)(THIRDBYTE(Value)); \
                ((PUCHAR)(Address))[LONG_MOST_SIGNIFICANT_BIT]=(UCHAR)(FOURTHBYTE(Value)); \
        } \
@@ -2360,7 +2403,7 @@ RtlSplay (
  *     );
  */
 #define RtlStoreUshort(Address,Value) \
-       if ((ULONG)(Address) & SHORT_MASK) \
+       if ((ULONG_PTR)(Address) & SHORT_MASK) \
        { \
                ((PUCHAR)(Address))[SHORT_LEAST_SIGNIFICANT_BIT]=(UCHAR)(FIRSTBYTE(Value)); \
                ((PUCHAR)(Address))[SHORT_MOST_SIGNIFICANT_BIT]=(UCHAR)(SECONDBYTE(Value)); \
@@ -2640,7 +2683,7 @@ RtlValidateHeap (
 BOOLEAN
 STDCALL
 RtlValidRelativeSecurityDescriptor (
-       IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
+       IN PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptorInput,
        IN ULONG SecurityDescriptorLength,
        IN SECURITY_INFORMATION RequiredInformation
        );
@@ -2790,7 +2833,7 @@ BOOLEAN
 FASTCALL
 RtlpCreateUnicodeString(
    IN OUT PUNICODE_STRING UniDest,
-   IN PWSTR  Source,
+   IN PCWSTR  Source,
    IN POOL_TYPE PoolType);   
 
 NTSTATUS