- Make the NDK compatible with the MSDDK again.
- Fix some w32api incompatibility cruft since w32api insists on including winnt.h from kernel-mode.
- Fix some stuff that was including both kernel-mode and user-mode headers together.
- Use PISECURITY_DESCRIPTOR, not PSECURITY_DESCRIPTOR.
Modified: trunk/reactos/drivers/multimedia/portcls/portcls.c
Modified: trunk/reactos/drivers/multimedia/portcls/portcls.h
Modified: trunk/reactos/drivers/net/afd/include/afd.h
Modified: trunk/reactos/drivers/net/wshtcpip/wshtcpip.h
Modified: trunk/reactos/drivers/video/displays/vga/vgaddi.h
Modified: trunk/reactos/include/arc/arc.h
Modified: trunk/reactos/include/ndk/cmfuncs.h
Modified: trunk/reactos/include/ndk/exfuncs.h
Modified: trunk/reactos/include/ndk/haltypes.h
Modified: trunk/reactos/include/ndk/i386/ketypes.h
Modified: trunk/reactos/include/ndk/ifssupp.h
Modified: trunk/reactos/include/ndk/iofuncs.h
Modified: trunk/reactos/include/ndk/ketypes.h
Modified: trunk/reactos/include/ndk/mmfuncs.h
Modified: trunk/reactos/include/ndk/obfuncs.h
Modified: trunk/reactos/include/ndk/obtypes.h
Modified: trunk/reactos/include/ndk/rtlfuncs.h
Modified: trunk/reactos/include/ndk/rtltypes.h
Modified: trunk/reactos/include/ndk/setypes.h
Modified: trunk/reactos/lib/hid/precomp.h
Modified: trunk/reactos/lib/rtl/bootdata.c
Modified: trunk/reactos/ntoskrnl/cm/regobj.c
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/ob/security.c
Modified: trunk/reactos/ntoskrnl/se/sd.c
Modified: trunk/reactos/ntoskrnl/se/semgr.c
Modified: trunk/reactos/w32api/include/ddk/ntifs.h
Modified: trunk/reactos/w32api/include/ddk/winddk.h
Modified: trunk/reactos/w32api/include/winnt.h

Modified: trunk/reactos/drivers/multimedia/portcls/portcls.c
--- trunk/reactos/drivers/multimedia/portcls/portcls.c	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/drivers/multimedia/portcls/portcls.c	2005-11-28 21:40:21 UTC (rev 19726)
@@ -25,8 +25,6 @@
  *  REVISION HISTORY:
  *       21 November 2005   Created James Tabor
  */
-#include <ddk/ntddk.h>
-#include <windows.h>
 #include "portcls.h"
 
 

Modified: trunk/reactos/drivers/multimedia/portcls/portcls.h
--- trunk/reactos/drivers/multimedia/portcls/portcls.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/drivers/multimedia/portcls/portcls.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -13,7 +13,6 @@
 extern "C" {
 #endif
 
-#include <windef.h>
 #include <ddk/ntddk.h>
 
 #define PORTCLASSAPI extern

Modified: trunk/reactos/drivers/net/afd/include/afd.h
--- trunk/reactos/drivers/net/afd/include/afd.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/drivers/net/afd/include/afd.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -17,6 +17,8 @@
 #include <tdikrnl.h>
 #include <tdiinfo.h>
 #include <string.h>
+#define _WINBASE_
+#define _WINDOWS_H
 #include <winsock2.h>
 #include <afd/shared.h>
 

Modified: trunk/reactos/drivers/net/wshtcpip/wshtcpip.h
--- trunk/reactos/drivers/net/wshtcpip/wshtcpip.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/drivers/net/wshtcpip/wshtcpip.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -7,7 +7,9 @@
 #ifndef __WSHTCPIP_H
 #define __WSHTCPIP_H
 
-#include <ddk/ntddk.h>
+#define WIN32_NO_STATUS
+#include <windows.h>
+#include <rtlfuncs.h>
 #include <wsahelp.h>
 
 #define EXPORT STDCALL

Modified: trunk/reactos/drivers/video/displays/vga/vgaddi.h
--- trunk/reactos/drivers/video/displays/vga/vgaddi.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/drivers/video/displays/vga/vgaddi.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -1,3 +1,5 @@
+#define _WINBASE_
+#define _WINDOWS_H
 #include <windef.h>
 #include <wingdi.h>
 #include <ddk/ntddk.h>

Modified: trunk/reactos/include/arc/arc.h
--- trunk/reactos/include/arc/arc.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/arc/arc.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -42,4 +42,17 @@
     LPSTR Identifier;
 } CONFIGURATION_COMPONENT, *PCONFIGURATION_COMPONENT;
 
+typedef struct _CONFIGURATION_COMPONENT_DATA
+{
+    struct _CONFIGURATION_COMPONENT_DATA *Parent;
+    struct _CONFIGURATION_COMPONENT_DATA *Child;
+    struct _CONFIGURATION_COMPONENT_DATA *Sibling;
+    CONFIGURATION_COMPONENT Component;
+} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
+
+typedef struct _ARC_DISK_INFORMATION
+{
+    LIST_ENTRY DiskSignatureListHead;
+} ARC_DISK_INFORMATION, *PARC_DISK_INFORMATION;
+
 #endif

Modified: trunk/reactos/include/ndk/cmfuncs.h
--- trunk/reactos/include/ndk/cmfuncs.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/cmfuncs.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -230,6 +230,7 @@
     IN POBJECT_ATTRIBUTES KeyObjectAttributes
 );
 
+#ifdef NTOS_MODE_USER
 NTSTATUS
 NTAPI
 ZwCreateKey(
@@ -242,6 +243,7 @@
     IN PULONG Disposition OPTIONAL
 );
 
+
 NTSTATUS
 NTAPI
 ZwDeleteKey(
@@ -426,6 +428,7 @@
     IN PVOID Data,
     IN ULONG DataSize
 );
+#endif
 
 NTSTATUS
 NTAPI

Modified: trunk/reactos/include/ndk/exfuncs.h
--- trunk/reactos/include/ndk/exfuncs.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/exfuncs.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -417,12 +417,14 @@
     IN OUT PRTL_ATOM Atom
 );
 
+#ifdef NTOS_MODE_USER
 NTSTATUS
 NTAPI
 ZwCancelTimer(
     IN HANDLE TimerHandle,
     OUT PBOOLEAN CurrentState OPTIONAL
 );
+#endif
 
 NTSTATUS
 NTAPI
@@ -467,6 +469,7 @@
     IN LONG MaximumCount
 );
 
+#ifdef NTOS_MODE_USER
 NTSTATUS
 NTAPI
 ZwCreateTimer(
@@ -475,6 +478,7 @@
     IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
     IN TIMER_TYPE TimerType
 );
+#endif
 
 NTSTATUS
 NTAPI
@@ -528,6 +532,7 @@
     IN POBJECT_ATTRIBUTES ObjectAttributes
 );
 
+#ifdef NTOS_MODE_USER
 NTSTATUS
 NTAPI
 ZwOpenTimer(
@@ -535,6 +540,7 @@
     IN ACCESS_MASK DesiredAccess,
     IN POBJECT_ATTRIBUTES ObjectAttributes
 );
+#endif
 
 NTSTATUS
 NTAPI
@@ -728,6 +734,7 @@
     IN ULONG SystemInformationLength
 );
 
+#ifdef NTOS_MODE_USER
 NTSTATUS
 NTAPI
 ZwSetTimer(
@@ -739,6 +746,7 @@
     IN LONG Period OPTIONAL,
     OUT PBOOLEAN PreviousState OPTIONAL
 );
+#endif
 
 NTSTATUS
 NTAPI

Modified: trunk/reactos/include/ndk/haltypes.h
--- trunk/reactos/include/ndk/haltypes.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/haltypes.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -87,8 +87,8 @@
     USHORT DockData1;
     USHORT DockData2;
     USHORT DockData3;
-    ULONG DockData3;
     ULONG DockData4;
+    ULONG DockData5;
 } PROFILE_PARAMETER_BLOCK, *PPROFILE_PARAMETER_BLOCK;
 
 typedef struct _HEADLESS_LOADER_BLOCK

Modified: trunk/reactos/include/ndk/i386/ketypes.h
--- trunk/reactos/include/ndk/i386/ketypes.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/i386/ketypes.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -86,7 +86,7 @@
 } FX_SAVE_AREA, *PFX_SAVE_AREA;
 
 //
-// FIXME: Trap Frame Definition
+// Trap Frame Definition
 //
 typedef struct _KTRAP_FRAME
 {

Modified: trunk/reactos/include/ndk/ifssupp.h
--- trunk/reactos/include/ndk/ifssupp.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/ifssupp.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -19,7 +19,16 @@
 #ifndef NTOS_MODE_USER
 #define _NTIFS_
 
+#define TOKEN_SOURCE_LENGTH               8
+
+typedef enum _TOKEN_TYPE
+{
+    TokenPrimary = 1,
+    TokenImpersonation
+} TOKEN_TYPE, *PTOKEN_TYPE;
+
 typedef PVOID PRTL_HEAP_PARAMETERS;
+typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
 
 typedef struct _RTL_SPLAY_LINKS
 {
@@ -93,7 +102,7 @@
 typedef struct _KAPC_STATE
 {
     LIST_ENTRY ApcListHead[2];
-    PKPROCESS Process;
+    struct _KPROCESS *Process;
     BOOLEAN KernelApcInProgress;
     BOOLEAN KernelApcPending;
     BOOLEAN UserApcPending;
@@ -108,9 +117,40 @@
     LIST_ENTRY ThreadListHead;
 } KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;
 
-typedef PVOID EX_RUNDOWN_REF;
 typedef PVOID EX_PUSH_LOCK;
 
+typedef enum _RTL_GENERIC_COMPARE_RESULTS
+{
+    GenericLessThan,
+    GenericGreaterThan,
+    GenericEqual
+} RTL_GENERIC_COMPARE_RESULTS;
+
+typedef struct _SID_IDENTIFIER_AUTHORITY
+{
+    UCHAR Value[6];
+} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
+
+typedef struct _SID_AND_ATTRIBUTES
+{
+    PSID Sid;
+    ULONG Attributes;
+} SID_AND_ATTRIBUTES, * PSID_AND_ATTRIBUTES;
+
+typedef struct _TOKEN_SOURCE
+{
+    CHAR SourceName[TOKEN_SOURCE_LENGTH];
+    LUID SourceIdentifier;
+} TOKEN_SOURCE, *PTOKEN_SOURCE;
+
+typedef struct _TOKEN_CONTROL
+{
+    LUID TokenId;
+    LUID AuthenticationId;
+    LUID ModifiedId;
+    TOKEN_SOURCE TokenSource;
+} TOKEN_CONTROL, *PTOKEN_CONTROL;
+
 typedef struct _SECURITY_CLIENT_CONTEXT
 {
     SECURITY_QUALITY_OF_SERVICE SecurityQos;
@@ -121,12 +161,79 @@
     TOKEN_CONTROL ClientTokenControl;
 } SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT;
 
-typedef enum _RTL_GENERIC_COMPARE_RESULTS
+typedef struct _SECURITY_DESCRIPTOR_RELATIVE
 {
-    GenericLessThan,
-    GenericGreaterThan,
-    GenericEqual
-} RTL_GENERIC_COMPARE_RESULTS;
+    UCHAR Revision;
+    UCHAR Sbz1;
+    SECURITY_DESCRIPTOR_CONTROL Control;
+    ULONG Owner;
+    ULONG Group;
+    ULONG Sacl;
+    ULONG Dacl;
+} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
 
+typedef struct _TOKEN_GROUPS
+{
+    ULONG GroupCount;
+    SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
+} TOKEN_GROUPS, *PTOKEN_GROUPS;
+
+typedef struct _TOKEN_PRIVILEGES
+{
+    ULONG PrivilegeCount;
+    LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
+} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
+
+typedef struct _TOKEN_USER
+{
+    SID_AND_ATTRIBUTES User;
+} TOKEN_USER, *PTOKEN_USER;
+
+typedef enum _TOKEN_INFORMATION_CLASS
+{
+    TokenUser = 1,
+    TokenGroups,
+    TokenPrivileges,
+    TokenOwner,
+    TokenPrimaryGroup,
+    TokenDefaultDacl,
+    TokenSource,
+    TokenType,
+    TokenImpersonationLevel,
+    TokenStatistics,
+    TokenRestrictedSids,
+    TokenSessionId,
+    TokenGroupsAndPrivileges,
+    TokenSessionReference,
+    TokenSandBoxInert,
+    TokenAuditPolicy,
+    TokenOrigin,
+    TokenElevationType,
+    TokenLinkedToken,
+    TokenElevation,
+    TokenIsRestricted,
+    TokenAccessInformation,
+    TokenVirtualization,
+    TokenIntegrityLevel,
+    TokenIntegrityLevelDesktop,
+    TokenMandatoryPolicy,
+    MaxTokenInfoClass
+} TOKEN_INFORMATION_CLASS, *PTOKEN_INFORMATION_CLASS;
+
+typedef struct _TOKEN_OWNER
+{
+    PSID Owner;
+} TOKEN_OWNER, *PTOKEN_OWNER;
+
+typedef struct _TOKEN_PRIMARY_GROUP
+{
+    PSID PrimaryGroup;
+} TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
+
+typedef struct _TOKEN_DEFAULT_DACL
+{
+    PACL DefaultDacl;
+} TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
+
 #endif // !NTOS_MODE_USER
 #endif // _NTIFS_

Modified: trunk/reactos/include/ndk/iofuncs.h
--- trunk/reactos/include/ndk/iofuncs.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/iofuncs.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -617,11 +617,13 @@
     IN ULONG OutputBufferSize
 );
 
+#ifdef NTOS_MODE_USER
 NTSTATUS
 NTAPI
 ZwLoadDriver(
     IN PUNICODE_STRING DriverServiceName
 );
+#endif
 
 NTSYSCALLAPI
 NTSTATUS
@@ -891,6 +893,7 @@
     ULONG Unknown3
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwUnloadDriver(

Modified: trunk/reactos/include/ndk/ketypes.h
--- trunk/reactos/include/ndk/ketypes.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/ketypes.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -339,17 +339,6 @@
 #include <arch/ketypes.h>
 
 //
-// ARC Component Data
-//
-typedef struct _CONFIGURATION_COMPONENT_DATA
-{
-    struct _CONFIGURATION_COMPONENT_DATA *Parent;
-    struct _CONFIGURATION_COMPONENT_DATA *Child;
-    struct _CONFIGURATION_COMPONENT_DATA *Sibling;
-    CONFIGURATION_COMPONENT Component;
-} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
-
-//
 // Kernel Memory Node
 //
 typedef struct _KNODE
@@ -374,7 +363,7 @@
     CSHORT Type;
     CSHORT Size;
     LIST_ENTRY ProfileListEntry;
-    PKPROCESS Process;
+    struct _KPROCESS *Process;
     PVOID RangeBase;
     PVOID RangeLimit;
     ULONG BucketShift;
@@ -696,7 +685,7 @@
     KEXECUTE_OPTIONS      Flags;                     /* 06B */
     ULONG                 StackCount;                /* 06C */
     LIST_ENTRY            ProcessListEntry;          /* 070 */
-} KPROCESS;
+} KPROCESS, *PKPROCESS;
 
 //
 // System Service Table Descriptor

Modified: trunk/reactos/include/ndk/mmfuncs.h
--- trunk/reactos/include/ndk/mmfuncs.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/mmfuncs.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -260,6 +260,7 @@
     PULONG NumberOfBytesLocked
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwMapViewOfSection(
@@ -275,6 +276,7 @@
     IN ULONG AccessProtection
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwOpenSection(
@@ -333,6 +335,7 @@
     OUT PULONG NumberOfBytesUnlocked OPTIONAL
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwUnmapViewOfSection(

Modified: trunk/reactos/include/ndk/obfuncs.h
--- trunk/reactos/include/ndk/obfuncs.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/obfuncs.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -269,6 +269,7 @@
     IN BOOLEAN GenerateOnClose
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwCreateDirectoryObject(
@@ -313,6 +314,7 @@
     IN HANDLE Object
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwMakeTemporaryObject(
@@ -335,6 +337,7 @@
     POBJECT_ATTRIBUTES ObjectAttributes
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwOpenSymbolicLinkObject(
@@ -376,6 +379,7 @@
     OUT PULONG ResultLength
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwQuerySymbolicLinkObject(

Modified: trunk/reactos/include/ndk/obtypes.h
--- trunk/reactos/include/ndk/obtypes.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/obtypes.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -120,11 +120,11 @@
 //
 // Dump Control Structure for Object Debugging
 //
-typedef struct _OBJECT_DUMP_CONTROL
+typedef struct _OB_DUMP_CONTROL
 {
     PVOID Stream;
     ULONG Detail;
-} OBJECT_DUMP_CONTROL, *POBJECT_DUMP_CONTROL;
+} OB_DUMP_CONTROL, *POB_DUMP_CONTROL;
 
 #ifndef NTOS_MODE_USER
 #ifndef _REACTOS_
@@ -196,6 +196,11 @@
     OUT PULONG ReturnLength
 );
 
+typedef NTSTATUS
+(NTAPI *OB_OKAYTOCLOSE_METHOD)(
+    VOID
+);
+
 #else
 
 //

Modified: trunk/reactos/include/ndk/rtlfuncs.h
--- trunk/reactos/include/ndk/rtlfuncs.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/rtlfuncs.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -1595,33 +1595,8 @@
     IN BOOLEAN IsWinlogon
 );
 
-static __inline
-struct _PEB*
-NtCurrentPeb(VOID)
-{
-    struct _PEB *pPeb;
+#define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
 
-#if defined(__GNUC__)
-
-    __asm__ __volatile__
-    (
-      "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
-      : "=r" (pPeb) /* can't have two memory operands */
-      : /* no inputs */
-    );
-
-#elif defined(_MSC_VER)
-
-    __asm mov eax, fs:0x30;
-    __asm mov pPeb, eax
-
-#else
-#error Unknown compiler for inline assembler
-#endif
-
-    return pPeb;
-}
-
 //
 // Environment/Path Functions
 //

Modified: trunk/reactos/include/ndk/rtltypes.h
--- trunk/reactos/include/ndk/rtltypes.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/rtltypes.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -537,11 +537,18 @@
     CSHORT Milliseconds;
     CSHORT Weekday;
 } TIME_FIELDS, *PTIME_FIELDS;
-#endif
 
+#else
 //
-// ACE Definition
+// ACE Definitions
 //
+typedef struct _ACE_HEADER
+{
+    UCHAR AceType;
+    UCHAR AceFlags;
+    USHORT AceSize;
+} ACE_HEADER, *PACE_HEADER;
+#endif
 typedef struct _ACE
 {
     ACE_HEADER Header;

Modified: trunk/reactos/include/ndk/setypes.h
--- trunk/reactos/include/ndk/setypes.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/include/ndk/setypes.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -24,10 +24,11 @@
 //
 #include <umtypes.h>
 
+#ifdef NTOS_MODE_USER
+
 //
 // Privilege constants
 //
-#ifdef NTOS_MODE_USER
 #define SE_MIN_WELL_KNOWN_PRIVILEGE       (2L)
 #define SE_CREATE_TOKEN_PRIVILEGE         (2L)
 #define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE   (3L)
@@ -54,12 +55,11 @@
 #define SE_CHANGE_NOTIFY_PRIVILEGE        (23L)
 #define SE_REMOTE_SHUTDOWN_PRIVILEGE      (24L)
 #define SE_MAX_WELL_KNOWN_PRIVILEGE       (SE_REMOTE_SHUTDOWN_PRIVILEGE)
-#endif
+#else
 
 //
-// Policy types
+// Audit and Policy Structures
 //
-#ifndef NTOS_MODE_USER
 typedef struct _SEP_AUDIT_POLICY_CATEGORIES
 {
     UCHAR System:4;

Modified: trunk/reactos/lib/hid/precomp.h
--- trunk/reactos/lib/hid/precomp.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/lib/hid/precomp.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -1,8 +1,16 @@
-#include <ddk/ntddk.h>
+#define WIN32_NO_STATUS
 #include <windows.h>
 
+#define DDKAPI __stdcall
 #define _HIDPI_
 #define _HIDPI_NO_FUNCTION_MACROS_
+typedef VOID
+(DDKAPI *PINTERFACE_REFERENCE)(
+  PVOID  Context);
+typedef VOID
+(DDKAPI *PINTERFACE_DEREFERENCE)(
+  PVOID  Context);
+#include <ntndk.h>
 #include <ddk/hidusage.h>
 #include <ddk/hidclass.h>
 #include <ddk/hidpi.h>

Modified: trunk/reactos/lib/rtl/bootdata.c
--- trunk/reactos/lib/rtl/bootdata.c	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/lib/rtl/bootdata.c	2005-11-28 21:40:21 UTC (rev 19726)
@@ -126,7 +126,7 @@
 
 static NTSTATUS
 RtlpSysVolCheckOwnerAndSecurity(IN HANDLE DirectoryHandle,
-                                IN PSECURITY_DESCRIPTOR SecurityDescriptor)
+                                IN PISECURITY_DESCRIPTOR SecurityDescriptor)
 {
     PSECURITY_DESCRIPTOR RelSD = NULL;
     PSECURITY_DESCRIPTOR NewRelSD = NULL;
@@ -549,7 +549,7 @@
     HANDLE hDirectory;
     UNICODE_STRING DirectoryName, NewPath;
     ULONG PathLen;
-    PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
+    PISECURITY_DESCRIPTOR SecurityDescriptor = NULL;
     PSID SystemSid = NULL;
     BOOLEAN AddSep = FALSE;
     NTSTATUS Status;

Modified: trunk/reactos/ntoskrnl/cm/regobj.c
--- trunk/reactos/ntoskrnl/cm/regobj.c	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/ntoskrnl/cm/regobj.c	2005-11-28 21:40:21 UTC (rev 19726)
@@ -336,7 +336,7 @@
 static NTSTATUS
 CmiQuerySecurityDescriptor(PKEY_OBJECT KeyObject,
 			   SECURITY_INFORMATION SecurityInformation,
-			   PSECURITY_DESCRIPTOR SecurityDescriptor,
+			   PISECURITY_DESCRIPTOR SecurityDescriptor,
 			   PULONG BufferLength)
 {
   ULONG_PTR Current;

Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
--- trunk/reactos/ntoskrnl/include/ntoskrnl.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/ntoskrnl/include/ntoskrnl.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -13,8 +13,8 @@
 #define _NTSYSTEM_
 
 /* DDK/IFS/NDK Headers */
+#include <ddk/ntifs.h>
 #include <ddk/ntddk.h>
-#include <ddk/ntifs.h>
 #include <ddk/wdmguid.h>
 #include <ndk/ntndk.h>
 

Modified: trunk/reactos/ntoskrnl/ob/security.c
--- trunk/reactos/ntoskrnl/ob/security.c	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/ntoskrnl/ob/security.c	2005-11-28 21:40:21 UTC (rev 19726)
@@ -263,7 +263,7 @@
                         IN ULONG RefBias)
 {
     /* HACK: Return the same descriptor back */
-    PSECURITY_DESCRIPTOR SdCopy;
+    PISECURITY_DESCRIPTOR SdCopy;
     DPRINT1("ObLogSecurityDescriptor is not implemented!\n", InputSecurityDescriptor);
 
     SdCopy = ExAllocatePool(PagedPool, sizeof(*SdCopy));

Modified: trunk/reactos/ntoskrnl/se/sd.c
--- trunk/reactos/ntoskrnl/se/sd.c	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/ntoskrnl/se/sd.c	2005-11-28 21:40:21 UTC (rev 19726)
@@ -113,7 +113,7 @@
 NTSTATUS
 STDCALL
 SeSetWorldSecurityDescriptor(SECURITY_INFORMATION SecurityInformation,
-                             PSECURITY_DESCRIPTOR SecurityDescriptor,
+                             PISECURITY_DESCRIPTOR SecurityDescriptor,
                              PULONG BufferLength)
 {
   ULONG_PTR Current;
@@ -356,15 +356,16 @@
 NTSTATUS
 STDCALL
 SeCaptureSecurityDescriptor(
-	IN PSECURITY_DESCRIPTOR OriginalSecurityDescriptor,
+	IN PSECURITY_DESCRIPTOR _OriginalSecurityDescriptor,
 	IN KPROCESSOR_MODE CurrentMode,
 	IN POOL_TYPE PoolType,
 	IN BOOLEAN CaptureIfKernel,
 	OUT PSECURITY_DESCRIPTOR *CapturedSecurityDescriptor
 	)
 {
+  PISECURITY_DESCRIPTOR OriginalSecurityDescriptor = _OriginalSecurityDescriptor;
   SECURITY_DESCRIPTOR DescriptorCopy;
-  PSECURITY_DESCRIPTOR NewDescriptor;
+  PISECURITY_DESCRIPTOR NewDescriptor;
   ULONG OwnerSAC = 0, GroupSAC = 0;
   ULONG OwnerSize = 0, GroupSize = 0;
   ULONG SaclSize = 0, DaclSize = 0;
@@ -678,7 +679,7 @@
 			      IN OUT PULONG Length,
 			      IN PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor OPTIONAL)
 {
-  PSECURITY_DESCRIPTOR ObjectSd;
+  PISECURITY_DESCRIPTOR ObjectSd;
   PISECURITY_DESCRIPTOR_RELATIVE RelSD;
   PSID Owner = NULL;
   PSID Group = NULL;
@@ -873,11 +874,12 @@
  */
 BOOLEAN STDCALL
 SeValidSecurityDescriptor(IN ULONG Length,
-			  IN PSECURITY_DESCRIPTOR SecurityDescriptor)
+			  IN PSECURITY_DESCRIPTOR _SecurityDescriptor)
 {
   ULONG SdLength;
   PISID Sid;
   PACL Acl;
+  PISECURITY_DESCRIPTOR SecurityDescriptor = _SecurityDescriptor;
 
   if (Length < SECURITY_DESCRIPTOR_MIN_LENGTH)
     {

Modified: trunk/reactos/ntoskrnl/se/semgr.c
--- trunk/reactos/ntoskrnl/se/semgr.c	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/ntoskrnl/se/semgr.c	2005-11-28 21:40:21 UTC (rev 19726)
@@ -196,16 +196,17 @@
 NTSTATUS
 STDCALL
 SeDefaultObjectMethod(PVOID Object,
-                      SECURITY_OPERATION_CODE OperationType,                         
+                      SECURITY_OPERATION_CODE OperationType,
                       SECURITY_INFORMATION SecurityInformation,
-                      PSECURITY_DESCRIPTOR SecurityDescriptor,
+                      PSECURITY_DESCRIPTOR _SecurityDescriptor,
                       PULONG ReturnLength,
                       PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
                       POOL_TYPE PoolType,
                       PGENERIC_MAPPING GenericMapping)
 {
-  PSECURITY_DESCRIPTOR ObjectSd;
-  PSECURITY_DESCRIPTOR NewSd;
+  PISECURITY_DESCRIPTOR ObjectSd;
+  PISECURITY_DESCRIPTOR NewSd;
+  PISECURITY_DESCRIPTOR SecurityDescriptor = _SecurityDescriptor;
   POBJECT_HEADER Header = BODY_TO_HEADER(Object);
   PSID Owner = 0;
   PSID Group = 0;
@@ -541,15 +542,17 @@
  * @implemented
  */
 NTSTATUS STDCALL
-SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL,
-		 PSECURITY_DESCRIPTOR ExplicitDescriptor OPTIONAL,
+SeAssignSecurity(PSECURITY_DESCRIPTOR _ParentDescriptor OPTIONAL,
+		 PSECURITY_DESCRIPTOR _ExplicitDescriptor OPTIONAL,
 		 PSECURITY_DESCRIPTOR *NewDescriptor,
 		 BOOLEAN IsDirectoryObject,
 		 PSECURITY_SUBJECT_CONTEXT SubjectContext,
 		 PGENERIC_MAPPING GenericMapping,
 		 POOL_TYPE PoolType)
 {
-  PSECURITY_DESCRIPTOR Descriptor;
+  PISECURITY_DESCRIPTOR ParentDescriptor = _ParentDescriptor;
+  PISECURITY_DESCRIPTOR ExplicitDescriptor = _ExplicitDescriptor;
+  PISECURITY_DESCRIPTOR Descriptor;
   PTOKEN Token;
   ULONG OwnerLength = 0;
   ULONG GroupLength = 0;

Modified: trunk/reactos/w32api/include/ddk/ntifs.h
--- trunk/reactos/w32api/include/ddk/ntifs.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/w32api/include/ddk/ntifs.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -619,17 +619,6 @@
     ULONG   CompressedChunkSizes[ANYSIZE_ARRAY];
 } COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
 
-#define EX_RUNDOWN_ACTIVE               0x1
-#define EX_RUNDOWN_COUNT_SHIFT          0x1
-#define EX_RUNDOWN_COUNT_INC            (1 << EX_RUNDOWN_COUNT_SHIFT)
-
-typedef struct _EX_RUNDOWN_REF {
-    _ANONYMOUS_UNION union {
-        ULONG Count;
-        PVOID Ptr;
-    } DUMMYUNIONNAME;
-} EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
-
 #define EX_PUSH_LOCK_LOCK_V          ((ULONG_PTR)0x0)
 #define EX_PUSH_LOCK_LOCK            ((ULONG_PTR)0x1)
 #define EX_PUSH_LOCK_WAITING         ((ULONG_PTR)0x2)
@@ -655,6 +644,111 @@
     };
 } EX_PUSH_LOCK, *PEX_PUSH_LOCK;
 
+typedef struct _SID_IDENTIFIER_AUTHORITY {
+	BYTE Value[6];
+} SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
+typedef PVOID PSID;
+typedef struct _SID {
+   BYTE  Revision;
+   BYTE  SubAuthorityCount;
+   SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
+   DWORD SubAuthority[ANYSIZE_ARRAY];
+} SID, *PISID;
+typedef struct _SID_AND_ATTRIBUTES {
+	PSID Sid;
+	DWORD Attributes;
+} SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
+typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
+typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
+typedef struct _TOKEN_SOURCE {
+	CHAR SourceName[TOKEN_SOURCE_LENGTH];
+	LUID SourceIdentifier;
+} TOKEN_SOURCE,*PTOKEN_SOURCE;
+typedef struct _TOKEN_CONTROL {
+	LUID TokenId;
+	LUID AuthenticationId;
+	LUID ModifiedId;
+	TOKEN_SOURCE TokenSource;
+} TOKEN_CONTROL,*PTOKEN_CONTROL;
+typedef struct _TOKEN_DEFAULT_DACL {
+	PACL DefaultDacl;
+} TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
+typedef struct _TOKEN_GROUPS {
+	DWORD GroupCount;
+	SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
+} TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
+typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
+	ULONG SidCount;
+	ULONG SidLength;
+	PSID_AND_ATTRIBUTES Sids;
+	ULONG RestrictedSidCount;
+	ULONG RestrictedSidLength;
+	PSID_AND_ATTRIBUTES RestrictedSids;
+	ULONG PrivilegeCount;
+	ULONG PrivilegeLength;
+	PLUID_AND_ATTRIBUTES Privileges;
+	LUID AuthenticationId;
+} TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
+typedef struct _TOKEN_ORIGIN {
+	LUID OriginatingLogonSession;
+} TOKEN_ORIGIN, *PTOKEN_ORIGIN;
+typedef struct _TOKEN_OWNER {
+	PSID Owner;
+} TOKEN_OWNER,*PTOKEN_OWNER;
+typedef struct _TOKEN_PRIMARY_GROUP {
+	PSID PrimaryGroup;
+} TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
+typedef struct _TOKEN_PRIVILEGES {
+	DWORD PrivilegeCount;
+	LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
+} TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
+typedef enum tagTOKEN_TYPE {
+	TokenPrimary = 1,
+	TokenImpersonation
+} TOKEN_TYPE,*PTOKEN_TYPE;
+typedef struct _TOKEN_STATISTICS {
+	LUID TokenId;
+	LUID AuthenticationId;
+	LARGE_INTEGER ExpirationTime;
+	TOKEN_TYPE TokenType;
+	SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+	DWORD DynamicCharged;
+	DWORD DynamicAvailable;
+	DWORD GroupCount;
+	DWORD PrivilegeCount;
+	LUID ModifiedId;
+} TOKEN_STATISTICS, *PTOKEN_STATISTICS;
+typedef struct _TOKEN_USER {
+	SID_AND_ATTRIBUTES User;
+} TOKEN_USER, *PTOKEN_USER;
+typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
+typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
+typedef struct _SECURITY_DESCRIPTOR {
+	BYTE Revision;
+	BYTE Sbz1;
+	SECURITY_DESCRIPTOR_CONTROL Control;
+	PSID Owner;
+	PSID Group;
+	PACL Sacl;
+	PACL Dacl;
+} SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
+typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
+    BYTE Revision;
+    BYTE Sbz1;
+    SECURITY_DESCRIPTOR_CONTROL Control;
+    DWORD Owner;
+    DWORD Group;
+    DWORD Sacl;
+    DWORD Dacl;
+} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
+typedef enum _TOKEN_INFORMATION_CLASS {
+	TokenUser=1,TokenGroups,TokenPrivileges,TokenOwner,
+	TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,
+	TokenImpersonationLevel,TokenStatistics,TokenRestrictedSids,
+	TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,
+	TokenSandBoxInert,TokenAuditPolicy,TokenOrigin,
+} TOKEN_INFORMATION_CLASS;
+
 typedef struct _FILE_ACCESS_INFORMATION {
     ACCESS_MASK AccessFlags;
 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
@@ -831,6 +925,17 @@
     SID     Sid;
 } FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION;
 
+typedef struct _FILE_QUOTA_INFORMATION
+{
+    ULONG NextEntryOffset;
+    ULONG SidLength;
+    LARGE_INTEGER ChangeTime;
+    LARGE_INTEGER QuotaUsed;
+    LARGE_INTEGER QuotaThreshold;
+    LARGE_INTEGER QuotaLimit;
+    SID Sid;
+} FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
+
 typedef struct _FILE_INTERNAL_INFORMATION {
     LARGE_INTEGER IndexNumber;
 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;

Modified: trunk/reactos/w32api/include/ddk/winddk.h
--- trunk/reactos/w32api/include/ddk/winddk.h	2005-11-28 21:28:12 UTC (rev 19725)
+++ trunk/reactos/w32api/include/ddk/winddk.h	2005-11-28 21:40:21 UTC (rev 19726)
@@ -134,6 +134,10 @@
 struct _DRIVE_LAYOUT_INFORMATION;
 struct _DRIVE_LAYOUT_INFORMATION_EX;
 
+typedef PVOID PSECURITY_DESCRIPTOR;
+typedef ULONG SECURITY_INFORMATION, *PSECURITY_INFORMATION;
+typedef PVOID PSID;
+
 DECLARE_INTERNAL_OBJECT(ADAPTER_OBJECT)
 DECLARE_INTERNAL_OBJECT(DMA_ADAPTER)
 DECLARE_INTERNAL_OBJECT(IO_STATUS_BLOCK)
@@ -212,6 +216,10 @@
 
 #define MAXIMUM_WAIT_OBJECTS              64
 
+#define EX_RUNDOWN_ACTIVE                 0x1
+#define EX_RUNDOWN_COUNT_SHIFT            0x1
+#define EX_RUNDOWN_COUNT_INC              (1 << EX_RUNDOWN_COUNT_SHIFT)
+
 #define METHOD_BUFFERED                   0
 #define METHOD_IN_DIRECT                  1
 #define METHOD_OUT_DIRECT                 2
@@ -1114,6 +1122,15 @@
     ULONG OldIrql;
 } FAST_MUTEX, *PFAST_MUTEX;
 
+typedef struct _EX_RUNDOWN_REF
+{
+    union
+    {
+        ULONG_PTR Count;
+        PVOID Ptr;
+    };
+} EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
+
 typedef struct _KGATE
 {
     DISPATCHER_HEADER Header;
[truncated at 1000 lines; 96 more skipped]