convert DefaultSetInfoBufferCheck and DefaultQueryInfoBufferCheck to inlined functions
authorThomas Bluemel <thomas@reactsoft.com>
Mon, 10 Oct 2005 13:03:55 +0000 (13:03 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Mon, 10 Oct 2005 13:03:55 +0000 (13:03 +0000)
svn path=/trunk/; revision=18394

reactos/ntoskrnl/ex/event.c
reactos/ntoskrnl/ex/mutant.c
reactos/ntoskrnl/ex/sem.c
reactos/ntoskrnl/ex/timer.c
reactos/ntoskrnl/include/internal/ntoskrnl.h
reactos/ntoskrnl/include/internal/ob.h
reactos/ntoskrnl/io/iocomp.c
reactos/ntoskrnl/mm/section.c
reactos/ntoskrnl/ps/query.c
reactos/ntoskrnl/se/token.c

index 7fbfb37..2eb0ac1 100644 (file)
@@ -311,13 +311,13 @@ NtQueryEvent(IN HANDLE EventHandle,
     DPRINT("NtQueryEvent(0x%p, 0x%x)\n", EventHandle, EventInformationClass);
 
     /* Check buffers and class validity */
     DPRINT("NtQueryEvent(0x%p, 0x%x)\n", EventHandle, EventInformationClass);
 
     /* Check buffers and class validity */
-    DefaultQueryInfoBufferCheck(EventInformationClass,
-                                ExEventInfoClass,
-                                EventInformation,
-                                EventInformationLength,
-                                ReturnLength,
-                                PreviousMode,
-                                &Status);
+    Status = DefaultQueryInfoBufferCheck(EventInformationClass,
+                                         ExEventInfoClass,
+                                         sizeof(ExEventInfoClass) / sizeof(ExEventInfoClass[0]),
+                                         EventInformation,
+                                         EventInformationLength,
+                                         ReturnLength,
+                                         PreviousMode);
     if(!NT_SUCCESS(Status)) {
 
         /* Invalid buffers */
     if(!NT_SUCCESS(Status)) {
 
         /* Invalid buffers */
index 62391e4..b2c0f88 100644 (file)
@@ -227,13 +227,13 @@ NtQueryMutant(IN HANDLE MutantHandle,
     PAGED_CODE();
 
     /* Check buffers and parameters */
     PAGED_CODE();
 
     /* Check buffers and parameters */
-    DefaultQueryInfoBufferCheck(MutantInformationClass,
-                                ExMutantInfoClass,
-                                MutantInformation,
-                                MutantInformationLength,
-                                ResultLength,
-                                PreviousMode,
-                                &Status);
+    Status = DefaultQueryInfoBufferCheck(MutantInformationClass,
+                                         ExMutantInfoClass,
+                                         sizeof(ExMutantInfoClass) / sizeof(ExMutantInfoClass[0]),
+                                         MutantInformation,
+                                         MutantInformationLength,
+                                         ResultLength,
+                                         PreviousMode);
     if(!NT_SUCCESS(Status)) {
 
         DPRINT("NtQueryMutant() failed, Status: 0x%x\n", Status);
     if(!NT_SUCCESS(Status)) {
 
         DPRINT("NtQueryMutant() failed, Status: 0x%x\n", Status);
index bb4614e..427f4d5 100644 (file)
@@ -215,13 +215,13 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
     PAGED_CODE();
 
     /* Check buffers and class validity */
     PAGED_CODE();
 
     /* Check buffers and class validity */
-    DefaultQueryInfoBufferCheck(SemaphoreInformationClass,
-                                ExSemaphoreInfoClass,
-                                SemaphoreInformation,
-                                SemaphoreInformationLength,
-                                ReturnLength,
-                                PreviousMode,
-                                &Status);
+    Status = DefaultQueryInfoBufferCheck(SemaphoreInformationClass,
+                                         ExSemaphoreInfoClass,
+                                         sizeof(ExSemaphoreInfoClass) / sizeof(ExSemaphoreInfoClass[0]),
+                                         SemaphoreInformation,
+                                         SemaphoreInformationLength,
+                                         ReturnLength,
+                                         PreviousMode);
     if(!NT_SUCCESS(Status))
     {
         /* Invalid buffers */
     if(!NT_SUCCESS(Status))
     {
         /* Invalid buffers */
index 7fa5200..d89cc50 100644 (file)
@@ -545,13 +545,13 @@ NtQueryTimer(IN HANDLE TimerHandle,
     DPRINT("NtQueryTimer(TimerHandle: 0x%p, Class: %d)\n", TimerHandle, TimerInformationClass);
 
     /* Check Validity */
     DPRINT("NtQueryTimer(TimerHandle: 0x%p, Class: %d)\n", TimerHandle, TimerInformationClass);
 
     /* Check Validity */
-    DefaultQueryInfoBufferCheck(TimerInformationClass,
-                                ExTimerInfoClass,
-                                TimerInformation,
-                                TimerInformationLength,
-                                ReturnLength,
-                                PreviousMode,
-                                &Status);
+    Status = DefaultQueryInfoBufferCheck(TimerInformationClass,
+                                         ExTimerInfoClass,
+                                         sizeof(ExTimerInfoClass) / sizeof(ExTimerInfoClass[0]),
+                                         TimerInformation,
+                                         TimerInformationLength,
+                                         ReturnLength,
+                                         PreviousMode);
     if(!NT_SUCCESS(Status))
     {
         DPRINT1("NtQueryTimer() failed, Status: 0x%x\n", Status);
     if(!NT_SUCCESS(Status))
     {
         DPRINT1("NtQueryTimer() failed, Status: 0x%x\n", Status);
index 0d2c38a..dcec0c8 100644 (file)
@@ -207,6 +207,138 @@ ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString,
 #define ProbeForReadLargeInteger(Ptr) ((LARGE_INTEGER)ProbeForReadGenericType(&(Ptr)->QuadPart, LONGLONG, 0))
 #define ProbeForReadUlargeInteger(Ptr) ((ULARGE_INTEGER)ProbeForReadGenericType(&(Ptr)->QuadPart, ULONGLONG, 0))
 
 #define ProbeForReadLargeInteger(Ptr) ((LARGE_INTEGER)ProbeForReadGenericType(&(Ptr)->QuadPart, LONGLONG, 0))
 #define ProbeForReadUlargeInteger(Ptr) ((ULARGE_INTEGER)ProbeForReadGenericType(&(Ptr)->QuadPart, ULONGLONG, 0))
 
+/*
+ * generic information class probing code
+ */
+
+#define ICIF_QUERY               0x1
+#define ICIF_SET                 0x2
+#define ICIF_QUERY_SIZE_VARIABLE 0x4
+#define ICIF_SET_SIZE_VARIABLE   0x8
+#define ICIF_SIZE_VARIABLE (ICIF_QUERY_SIZE_VARIABLE | ICIF_SET_SIZE_VARIABLE)
+
+typedef struct _INFORMATION_CLASS_INFO
+{
+  ULONG RequiredSizeQUERY;
+  ULONG RequiredSizeSET;
+  ULONG AlignmentSET;
+  ULONG AlignmentQUERY;
+  ULONG Flags;
+} INFORMATION_CLASS_INFO, *PINFORMATION_CLASS_INFO;
+
+#define ICI_SQ_SAME(Size, Alignment, Flags)                                    \
+  { Size, Size, Alignment, Alignment, Flags }
+
+#define ICI_SQ(SizeQuery, SizeSet, AlignmentQuery, AlignmentSet, Flags)        \
+  { SizeQuery, SizeSet, AlignmentQuery, AlignmentSet, Flags }
+
+static inline NTSTATUS
+DefaultSetInfoBufferCheck(UINT Class,
+                          const INFORMATION_CLASS_INFO *ClassList,
+                          UINT ClassListEntries,
+                          PVOID Buffer,
+                          ULONG BufferLength,
+                          KPROCESSOR_MODE PreviousMode)
+{
+    NTSTATUS Status = STATUS_SUCCESS;
+
+    if (Class >= 0 && Class < ClassListEntries)
+    {
+        if (!(ClassList[Class].Flags & ICIF_SET))
+        {
+            Status = STATUS_INVALID_INFO_CLASS;
+        }
+        else if (ClassList[Class].RequiredSizeSET > 0 &&
+                 BufferLength != ClassList[Class].RequiredSizeSET)
+        {
+            if (!(ClassList[Class].Flags & ICIF_SET_SIZE_VARIABLE))
+            {
+                Status = STATUS_INFO_LENGTH_MISMATCH;
+            }
+        }
+
+        if (NT_SUCCESS(Status))
+        {
+            if (PreviousMode != KernelMode)
+            {
+                _SEH_TRY
+                {
+                    ProbeForRead(Buffer,
+                                 BufferLength,
+                                 ClassList[Class].AlignmentSET);
+                }
+                _SEH_HANDLE
+                {
+                    Status = _SEH_GetExceptionCode();
+                }
+                _SEH_END;
+            }
+        }
+    }
+    else
+        Status = STATUS_INVALID_INFO_CLASS;
+
+    return Status;
+}
+
+static inline NTSTATUS
+DefaultQueryInfoBufferCheck(UINT Class,
+                            const INFORMATION_CLASS_INFO *ClassList,
+                            UINT ClassListEntries,
+                            PVOID Buffer,
+                            ULONG BufferLength,
+                            PULONG ReturnLength,
+                            KPROCESSOR_MODE PreviousMode)
+{
+    NTSTATUS Status = STATUS_SUCCESS;
+
+    if (Class >= 0 && Class < ClassListEntries)
+    {
+        if (!(ClassList[Class].Flags & ICIF_QUERY))
+        {
+            Status = STATUS_INVALID_INFO_CLASS;
+        }
+        else if (ClassList[Class].RequiredSizeQUERY > 0 &&
+                 BufferLength != ClassList[Class].RequiredSizeQUERY)
+        {
+            if (!(ClassList[Class].Flags & ICIF_QUERY_SIZE_VARIABLE))
+            {
+                Status = STATUS_INFO_LENGTH_MISMATCH;
+            }
+        }
+
+        if (NT_SUCCESS(Status))
+        {
+            if (PreviousMode != KernelMode)
+            {
+                _SEH_TRY
+                {
+                    if (Buffer != NULL)
+                    {
+                        ProbeForWrite(Buffer,
+                                      BufferLength,
+                                      ClassList[Class].AlignmentQUERY);
+                    }
+
+                    if (ReturnLength != NULL)
+                    {
+                        ProbeForWriteUlong(ReturnLength);
+                    }
+                }
+                _SEH_HANDLE
+                {
+                    Status = _SEH_GetExceptionCode();
+                }
+                _SEH_END;
+            }
+        }
+    }
+    else
+        Status = STATUS_INVALID_INFO_CLASS;
+
+    return Status;
+}
+
 /*
  * Use IsPointerOffset to test whether a pointer should be interpreted as an offset
  * or as a pointer
 /*
  * Use IsPointerOffset to test whether a pointer should be interpreted as an offset
  * or as a pointer
index ae3c5a7..c05fd9b 100644 (file)
 
 struct _EPROCESS;
 
 
 struct _EPROCESS;
 
-#define ICIF_QUERY               0x1
-#define ICIF_SET                 0x2
-#define ICIF_QUERY_SIZE_VARIABLE 0x4
-#define ICIF_SET_SIZE_VARIABLE   0x8
-#define ICIF_SIZE_VARIABLE (ICIF_QUERY_SIZE_VARIABLE | ICIF_SET_SIZE_VARIABLE)
-
 typedef struct _DIRECTORY_OBJECT
 {
     CSHORT Type;
 typedef struct _DIRECTORY_OBJECT
 {
     CSHORT Type;
@@ -37,15 +31,6 @@ typedef struct _SYMLINK_OBJECT
     LARGE_INTEGER CreateTime;
 } SYMLINK_OBJECT, *PSYMLINK_OBJECT;
 
     LARGE_INTEGER CreateTime;
 } SYMLINK_OBJECT, *PSYMLINK_OBJECT;
 
-typedef struct _INFORMATION_CLASS_INFO
-{
-  ULONG RequiredSizeQUERY;
-  ULONG RequiredSizeSET;
-  ULONG AlignmentSET;
-  ULONG AlignmentQUERY;
-  ULONG Flags;
-} INFORMATION_CLASS_INFO, *PINFORMATION_CLASS_INFO;
-
 #define BODY_TO_HEADER(objbdy)                                                 \
   CONTAINING_RECORD((objbdy), OBJECT_HEADER, Body)
   
 #define BODY_TO_HEADER(objbdy)                                                 \
   CONTAINING_RECORD((objbdy), OBJECT_HEADER, Body)
   
@@ -251,152 +236,6 @@ ObpReleaseCapturedAttributes(IN POBJECT_CREATE_INFORMATION ObjectCreateInfo);
 
 /* object information classes */
 
 
 /* object information classes */
 
-#define ICI_SQ_SAME(Size, Alignment, Flags)                                    \
-  { Size, Size, Alignment, Alignment, Flags }
-
-#define ICI_SQ(SizeQuery, SizeSet, AlignmentQuery, AlignmentSet, Flags)        \
-  { SizeQuery, SizeSet, AlignmentQuery, AlignmentSet, Flags }
-
-#define CheckInfoClass(Class, BufferLen, ClassList, StatusVar, Mode)           \
-  do {                                                                         \
-  if((Class) >= 0 && (Class) < sizeof(ClassList) / sizeof(ClassList[0]))       \
-  {                                                                            \
-    if(!(ClassList[Class].Flags & ICIF_##Mode))                                \
-    {                                                                          \
-      *(StatusVar) = STATUS_INVALID_INFO_CLASS;                                \
-    }                                                                          \
-    else if(ClassList[Class].RequiredSize##Mode > 0 &&                         \
-            (BufferLen) != ClassList[Class].RequiredSize##Mode)                \
-    {                                                                          \
-      if(!(ClassList[Class].Flags & ICIF_##Mode##_SIZE_VARIABLE) &&            \
-           (BufferLen) != ClassList[Class].RequiredSize##Mode)                 \
-      {                                                                        \
-        *(StatusVar) = STATUS_INFO_LENGTH_MISMATCH;                            \
-      }                                                                        \
-    }                                                                          \
-  }                                                                            \
-  else                                                                         \
-  {                                                                            \
-    *(StatusVar) = STATUS_INVALID_INFO_CLASS;                                  \
-  }                                                                            \
-  } while(0)
-
-
-#define GetInfoClassAlignment(Class, ClassList, AlignmentVar, Mode)            \
-  do {                                                                         \
-  if((Class) >= 0 && (Class) < sizeof(ClassList) / sizeof(ClassList[0]))       \
-  {                                                                            \
-    *(AlignmentVar) = ClassList[Class].Alignment##Mode;                        \
-  }                                                                            \
-  else                                                                         \
-  {                                                                            \
-    *(AlignmentVar) = sizeof(ULONG);                                           \
-  }                                                                            \
-  } while(0)
-
-#define ProbeQueryInfoBuffer(Buffer, BufferLen, Alignment, RetLen, PrevMode, StatusVar) \
-  do {                                                                         \
-  if(PrevMode != KernelMode)                                                     \
-  {                                                                            \
-    _SEH_TRY                                                                   \
-    {                                                                          \
-      ProbeForWrite(Buffer,                                                    \
-                    BufferLen,                                                 \
-                    Alignment);                                                \
-      if(RetLen != NULL)                                                       \
-      {                                                                        \
-        ProbeForWrite(RetLen,                                                  \
-                      sizeof(ULONG),                                           \
-                      1);                                                      \
-      }                                                                        \
-    }                                                                          \
-    _SEH_HANDLE                                                                \
-    {                                                                          \
-      *(StatusVar) = _SEH_GetExceptionCode();                                  \
-    }                                                                          \
-    _SEH_END;                                                                  \
-                                                                               \
-    if(!NT_SUCCESS(*(StatusVar)))                                              \
-    {                                                                          \
-      DPRINT1("ProbeQueryInfoBuffer failed: 0x%x\n", *(StatusVar));            \
-      return *(StatusVar);                                                     \
-    }                                                                          \
-  }                                                                            \
-  } while(0)
-
-#define ProbeSetInfoBuffer(Buffer, BufferLen, Alignment, PrevMode, StatusVar) \
-  do {                                                                         \
-  if(PrevMode != KernelMode)                                                     \
-  {                                                                            \
-    _SEH_TRY                                                                   \
-    {                                                                          \
-      ProbeForRead(Buffer,                                                     \
-                   BufferLen,                                                  \
-                   Alignment);                                                 \
-    }                                                                          \
-    _SEH_HANDLE                                                                \
-    {                                                                          \
-      *(StatusVar) = _SEH_GetExceptionCode();                                  \
-    }                                                                          \
-    _SEH_END;                                                                  \
-                                                                               \
-    if(!NT_SUCCESS(*(StatusVar)))                                              \
-    {                                                                          \
-      DPRINT1("ProbeAllInfoBuffer failed: 0x%x\n", *(StatusVar));              \
-      return *(StatusVar);                                                     \
-    }                                                                          \
-  }                                                                            \
-  } while(0)
-
-#define DefaultSetInfoBufferCheck(Class, ClassList, Buffer, BufferLen, PrevMode, StatusVar) \
-  do {                                                                         \
-  ULONG _Alignment;                                                            \
-  /* get the preferred alignment for the information class or return */        \
-  /* default alignment in case the class doesn't exist */                      \
-  GetInfoClassAlignment(Class,                                                 \
-                        ClassList,                                             \
-                        &_Alignment,                                           \
-                        SET);                                                  \
-                                                                               \
-  /* probe the ENTIRE buffers and return on failure */                         \
-  ProbeSetInfoBuffer(Buffer,                                                   \
-                     BufferLen,                                                \
-                     _Alignment,                                               \
-                     PrevMode,                                                 \
-                     StatusVar);                                               \
-                                                                               \
-  /* validate information class index and check buffer size */                 \
-  CheckInfoClass(Class,                                                        \
-                 BufferLen,                                                    \
-                 ClassList,                                                    \
-                 StatusVar,                                                    \
-                 SET);                                                         \
-  } while(0)
-
-#define DefaultQueryInfoBufferCheck(Class, ClassList, Buffer, BufferLen, RetLen, PrevMode, StatusVar) \
-  do {                                                                         \
-    ULONG _Alignment;                                                          \
-   /* get the preferred alignment for the information class or return */       \
-   /* alignment in case the class doesn't exist */                             \
-   GetInfoClassAlignment(Class,                                                \
-                         ClassList,                                            \
-                         &_Alignment,                                          \
-                         QUERY);                                               \
-                                                                               \
-   /* probe the ENTIRE buffers and return on failure */                        \
-   ProbeQueryInfoBuffer(Buffer,                                                \
-                        BufferLen,                                             \
-                        _Alignment,                                            \
-                        RetLen,                                                \
-                        PrevMode,                                              \
-                        StatusVar);                                            \
-                                                                               \
-   /* validate information class index and check buffer size */                \
-   CheckInfoClass(Class,                                                       \
-                  BufferLen,                                                   \
-                  ClassList,                                                   \
-                  StatusVar,                                                   \
-                  QUERY);                                                      \
-  } while(0)
+
 
 #endif /* __INCLUDE_INTERNAL_OBJMGR_H */
 
 #endif /* __INCLUDE_INTERNAL_OBJMGR_H */
index 7e3c810..946dfb4 100644 (file)
@@ -359,13 +359,13 @@ NtQueryIoCompletion(IN  HANDLE IoCompletionHandle,
     PAGED_CODE();
 
     /* Check buffers and parameters */
     PAGED_CODE();
 
     /* Check buffers and parameters */
-    DefaultQueryInfoBufferCheck(IoCompletionInformationClass,
-                                IoCompletionInfoClass,
-                                IoCompletionInformation,
-                                IoCompletionInformationLength,
-                                ResultLength,
-                                PreviousMode,
-                                &Status);
+    Status = DefaultQueryInfoBufferCheck(IoCompletionInformationClass,
+                                         IoCompletionInfoClass,
+                                         sizeof(IoCompletionInfoClass) / sizeof(IoCompletionInfoClass[0]),
+                                         IoCompletionInformation,
+                                         IoCompletionInformationLength,
+                                         ResultLength,
+                                         PreviousMode);
     if(!NT_SUCCESS(Status)) {
 
         DPRINT1("NtQueryMutant() failed, Status: 0x%x\n", Status);
     if(!NT_SUCCESS(Status)) {
 
         DPRINT1("NtQueryMutant() failed, Status: 0x%x\n", Status);
index d0eec8f..373d351 100644 (file)
@@ -4012,13 +4012,13 @@ NtQuerySection(IN HANDLE SectionHandle,
 
    PreviousMode = ExGetPreviousMode();
 
 
    PreviousMode = ExGetPreviousMode();
 
-   DefaultQueryInfoBufferCheck(SectionInformationClass,
-                               ExSectionInfoClass,
-                               SectionInformation,
-                               SectionInformationLength,
-                               ResultLength,
-                               PreviousMode,
-                               &Status);
+   Status = DefaultQueryInfoBufferCheck(SectionInformationClass,
+                                        ExSectionInfoClass,
+                                        sizeof(ExSectionInfoClass) / sizeof(ExSectionInfoClass[0]),
+                                        SectionInformation,
+                                        SectionInformationLength,
+                                        ResultLength,
+                                        PreviousMode);
 
    if(!NT_SUCCESS(Status))
    {
 
    if(!NT_SUCCESS(Status))
    {
index f32c017..9641831 100644 (file)
@@ -143,13 +143,13 @@ NtQueryInformationProcess(IN  HANDLE ProcessHandle,
 
    PreviousMode = ExGetPreviousMode();
 
 
    PreviousMode = ExGetPreviousMode();
 
-   DefaultQueryInfoBufferCheck(ProcessInformationClass,
-                               PsProcessInfoClass,
-                               ProcessInformation,
-                               ProcessInformationLength,
-                               ReturnLength,
-                               PreviousMode,
-                               &Status);
+   Status = DefaultQueryInfoBufferCheck(ProcessInformationClass,
+                                        PsProcessInfoClass,
+                                        sizeof(PsProcessInfoClass) / sizeof(PsProcessInfoClass[0]),
+                                        ProcessInformation,
+                                        ProcessInformationLength,
+                                        ReturnLength,
+                                        PreviousMode);
    if(!NT_SUCCESS(Status))
    {
      DPRINT1("NtQueryInformationProcess() failed, Status: 0x%x\n", Status);
    if(!NT_SUCCESS(Status))
    {
      DPRINT1("NtQueryInformationProcess() failed, Status: 0x%x\n", Status);
@@ -654,12 +654,12 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
 
    PreviousMode = ExGetPreviousMode();
 
 
    PreviousMode = ExGetPreviousMode();
 
-   DefaultSetInfoBufferCheck(ProcessInformationClass,
-                             PsProcessInfoClass,
-                             ProcessInformation,
-                             ProcessInformationLength,
-                             PreviousMode,
-                             &Status);
+   Status = DefaultSetInfoBufferCheck(ProcessInformationClass,
+                                      PsProcessInfoClass,
+                                      sizeof(PsProcessInfoClass) / sizeof(PsProcessInfoClass[0]),
+                                      ProcessInformation,
+                                      ProcessInformationLength,
+                                      PreviousMode);
    if(!NT_SUCCESS(Status))
    {
      DPRINT1("NtSetInformationProcess() %d %x  %x called\n", ProcessInformationClass, ProcessInformation, ProcessInformationLength);
    if(!NT_SUCCESS(Status))
    {
      DPRINT1("NtSetInformationProcess() %d %x  %x called\n", ProcessInformationClass, ProcessInformation, ProcessInformationLength);
index fd2066a..009fa98 100644 (file)
@@ -615,13 +615,13 @@ NtQueryInformationToken(IN HANDLE TokenHandle,
   PreviousMode = ExGetPreviousMode();
 
   /* Check buffers and class validity */
   PreviousMode = ExGetPreviousMode();
 
   /* Check buffers and class validity */
-  DefaultQueryInfoBufferCheck(TokenInformationClass,
-                              SeTokenInformationClass,
-                              TokenInformation,
-                              TokenInformationLength,
-                              ReturnLength,
-                              PreviousMode,
-                              &Status);
+  Status = DefaultQueryInfoBufferCheck(TokenInformationClass,
+                                       SeTokenInformationClass,
+                                       sizeof(SeTokenInformationClass) / sizeof(SeTokenInformationClass[0]),
+                                       TokenInformation,
+                                       TokenInformationLength,
+                                       ReturnLength,
+                                       PreviousMode);
 
   if(!NT_SUCCESS(Status))
   {
 
   if(!NT_SUCCESS(Status))
   {
@@ -1198,12 +1198,12 @@ NtSetInformationToken(IN HANDLE TokenHandle,
 
   PreviousMode = ExGetPreviousMode();
 
 
   PreviousMode = ExGetPreviousMode();
 
-  DefaultSetInfoBufferCheck(TokenInformationClass,
-                            SeTokenInformationClass,
-                            TokenInformation,
-                            TokenInformationLength,
-                            PreviousMode,
-                            &Status);
+  Status = DefaultSetInfoBufferCheck(TokenInformationClass,
+                                     SeTokenInformationClass,
+                                     sizeof(SeTokenInformationClass) / sizeof(SeTokenInformationClass[0]),
+                                     TokenInformation,
+                                     TokenInformationLength,
+                                     PreviousMode);
 
   if(!NT_SUCCESS(Status))
   {
 
   if(!NT_SUCCESS(Status))
   {