- Various Microsoft DDK/PSDK compatibility fixes and some MSVC stuff too.
 - Fix PSECURITY_DESCRIPTOR_RELATIVE names.c
 - Don't use rtltypes.h as a replacement for normal stdlib headers.
 - Fix a HAL header fixme.
Modified: trunk/reactos/drivers/video/videoprt/videoprt.h
Modified: trunk/reactos/hal/halx86/include/hal.h
Modified: trunk/reactos/include/ndk/mmtypes.h
Modified: trunk/reactos/include/ndk/ntndk.h
Modified: trunk/reactos/include/ndk/pstypes.h
Modified: trunk/reactos/include/ndk/rtlfuncs.h
Modified: trunk/reactos/include/ndk/rtltypes.h
Modified: trunk/reactos/include/ndk/umtypes.h
Modified: trunk/reactos/include/ndk/zwfuncs.h
Modified: trunk/reactos/include/ndk/zwtypes.h
Modified: trunk/reactos/include/reactos/debug.h
Modified: trunk/reactos/include/reactos/helper.h
Modified: trunk/reactos/include/subsys/csrss/csrss.h
Modified: trunk/reactos/include/wine/debug.h
Modified: trunk/reactos/include/wine/unicode.h
Modified: trunk/reactos/lib/advapi32/advapi32.h
Modified: trunk/reactos/lib/advapi32/sec/sec.c
Modified: trunk/reactos/lib/dnsapi/dnsapi/names.c
Modified: trunk/reactos/lib/kernel32/debug/break.c
Modified: trunk/reactos/lib/kernel32/file/cnotify.c
Modified: trunk/reactos/lib/kernel32/file/curdir.c
Modified: trunk/reactos/lib/kernel32/file/iocompl.c
Modified: trunk/reactos/lib/kernel32/include/debug.h
Modified: trunk/reactos/lib/kernel32/k32.h
Modified: trunk/reactos/lib/kernel32/kernel32.rc
Modified: trunk/reactos/lib/kernel32/misc/comm.c
Modified: trunk/reactos/lib/kernel32/misc/console.c
Modified: trunk/reactos/lib/kernel32/misc/errormsg.c
Modified: trunk/reactos/lib/kernel32/misc/lang.c
Modified: trunk/reactos/lib/kernel32/misc/muldiv.c
Modified: trunk/reactos/lib/kernel32/misc/nls.c
Modified: trunk/reactos/lib/kernel32/misc/profile.c
Modified: trunk/reactos/lib/kernel32/misc/utils.c
Modified: trunk/reactos/lib/kernel32/misc/version.c
Modified: trunk/reactos/lib/kernel32/tests/setup.c
Modified: trunk/reactos/lib/kernel32/tests/tests/CreateFile.c
Modified: trunk/reactos/lib/ntdll/inc/ntdll.h
Modified: trunk/reactos/lib/rtl/rtl.h
Modified: trunk/reactos/lib/rtl/sd.c
Modified: trunk/reactos/lib/userenv/precomp.h
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/se/sd.c
Modified: trunk/reactos/services/rpcss/rpcss.c
Modified: trunk/reactos/subsys/csrss/csrss.h
Modified: trunk/reactos/subsys/smss/smss.h
Modified: trunk/reactos/subsys/system/autochk/autochk.c
Modified: trunk/reactos/subsys/system/services/services.h
Modified: trunk/reactos/w32api/include/ddk/ntifs.h
Modified: trunk/reactos/w32api/include/ddk/winddk.h
Modified: trunk/reactos/w32api/include/ntdef.h
Modified: trunk/reactos/w32api/include/winbase.h
Modified: trunk/reactos/w32api/include/windows.h
Modified: trunk/reactos/w32api/include/winnt.h

Modified: trunk/reactos/drivers/video/videoprt/videoprt.h
--- trunk/reactos/drivers/video/videoprt/videoprt.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/drivers/video/videoprt/videoprt.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -24,6 +24,7 @@
 #ifndef VIDEOPRT_H
 #define VIDEOPRT_H
 
+#include <stdio.h>
 #include <ddk/ntddk.h>
 #include <ddk/miniport.h>
 #include <ddk/video.h>

Modified: trunk/reactos/hal/halx86/include/hal.h
--- trunk/reactos/hal/halx86/include/hal.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/hal/halx86/include/hal.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -8,25 +8,20 @@
 
 /* INCLUDES ******************************************************************/
 
+/* C Headers */
+#include <stdio.h>
+
 /* IFS/DDK/NDK Headers */
 #include <ddk/ntddk.h>
 #include <ddk/ntifs.h>
 #include <ndk/ntndk.h>
 
 /* Internal Kernel Headers */
-//#include <internal/mm.h>
+#include <internal/mm.h>
 #include <internal/ke.h>
 
 #define KPCR_BASE 0xFF000000 // HACK!
 
-//Temporary hack below until ntoskrnl is on NDK
-PVOID STDCALL
-MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
-				  IN PHYSICAL_ADDRESS LowestAcceptableAddress,
-				  IN PHYSICAL_ADDRESS HighestAcceptableAddress,
-				  IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
-				  IN MEMORY_CACHING_TYPE CacheType OPTIONAL,
-				  IN ULONG Alignment);
 /* Internal HAL Headers */
 #include "apic.h"
 #include "bus.h"

Modified: trunk/reactos/include/ndk/mmtypes.h
--- trunk/reactos/include/ndk/mmtypes.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/include/ndk/mmtypes.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -33,17 +33,15 @@
 /* TYPES *********************************************************************/
 
 /* FIXME: Forced to do this for now, because of EPROCESS, will go away before 0.3.0 */
-#ifndef __NTOSKRNL__
 typedef struct _MADDRESS_SPACE
 {
-    PVOID MemoryAreaRoot;
+    struct _MEMORY_AREA *MemoryAreaRoot;
     FAST_MUTEX Lock;
     PVOID LowestAddress;
     struct _EPROCESS* Process;
     PUSHORT PageTableRefCountTable;
     ULONG PageTableRefCountTableSize;
 } MADDRESS_SPACE, *PMADDRESS_SPACE;
-#endif
 
 typedef struct _PP_LOOKASIDE_LIST
 {

Modified: trunk/reactos/include/ndk/ntndk.h
--- trunk/reactos/include/ndk/ntndk.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/include/ndk/ntndk.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -9,8 +9,12 @@
 #ifndef _NTNDK_
 #define _NTNDK_
 
+/* C Standard Headers */
+#include <stdarg.h>
+#include <excpt.h>
+
+/* Kernel-Mode NDK */
 #ifndef NTOS_MODE_USER
-    /* Kernel-Mode NDK */
     #include "kdtypes.h"    /* Kernel Debugger Types */
     #include "kdfuncs.h"    /* Kernel Debugger Functions */
     #include "cctypes.h"    /* Cache Manager Types */

Modified: trunk/reactos/include/ndk/pstypes.h
--- trunk/reactos/include/ndk/pstypes.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/include/ndk/pstypes.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -22,13 +22,13 @@
 /* CONSTANTS *****************************************************************/
 
 /* These are not exposed to drivers normally */
-#ifndef _NTOS_MODE_USER
-    #define JOB_OBJECT_ASSIGN_PROCESS    (1)
-    #define JOB_OBJECT_SET_ATTRIBUTES    (2)
-    #define JOB_OBJECT_QUERY    (4)
-    #define JOB_OBJECT_TERMINATE    (8)
-    #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES    (16)
-    #define JOB_OBJECT_ALL_ACCESS    (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|31)
+#ifndef NTOS_MODE_USER
+    #define JOB_OBJECT_ASSIGN_PROCESS           1
+    #define JOB_OBJECT_SET_ATTRIBUTES           2
+    #define JOB_OBJECT_QUERY                    4
+    #define JOB_OBJECT_TERMINATE                8
+    #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES  16
+    #define JOB_OBJECT_ALL_ACCESS               (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|31)
 #endif
 
 #define THREAD_ALERT 0x4
@@ -36,12 +36,12 @@
 #define USER_SHARED_DATA (0x7FFE0000)
 
 /* Process priority classes */
-#define PROCESS_PRIORITY_CLASS_HIGH	(4) /* FIXME */
-#define PROCESS_PRIORITY_CLASS_IDLE	(0) /* FIXME */
-#define PROCESS_PRIORITY_CLASS_NORMAL	(2) /* FIXME */
-#define PROCESS_PRIORITY_CLASS_REALTIME	(5) /* FIXME */
-#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL (1) /* FIXME */
-#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL (3) /* FIXME */
+#define PROCESS_PRIORITY_CLASS_IDLE	            0
+#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL     1
+#define PROCESS_PRIORITY_CLASS_NORMAL	        2
+#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL     3
+#define PROCESS_PRIORITY_CLASS_HIGH	            4
+#define PROCESS_PRIORITY_CLASS_REALTIME	        5
 
 /* Global Flags */
 #define FLG_STOP_ON_EXCEPTION          0x00000001
@@ -75,16 +75,16 @@
 /* ENUMERATIONS **************************************************************/
 
 /* FUNCTION TYPES ************************************************************/
-typedef VOID (STDCALL *PPEBLOCKROUTINE)(PVOID);
+typedef VOID (NTAPI *PPEBLOCKROUTINE)(PVOID);
 
 typedef NTSTATUS
-(STDCALL *PW32_PROCESS_CALLBACK)(
+(NTAPI *PW32_PROCESS_CALLBACK)(
     struct _EPROCESS *Process,
     BOOLEAN Create
 );
 
 typedef NTSTATUS
-(STDCALL *PW32_THREAD_CALLBACK)(
+(NTAPI *PW32_THREAD_CALLBACK)(
     struct _ETHREAD *Thread,
     BOOLEAN Create
 );

Modified: trunk/reactos/include/ndk/rtlfuncs.h
--- trunk/reactos/include/ndk/rtlfuncs.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/include/ndk/rtlfuncs.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -12,7 +12,7 @@
 /* DEPENDENCIES **************************************************************/
 #include "rtltypes.h"
 #include "pstypes.h"
-#include <ddk/ntnls.h>
+#include <ntnls.h>
 
 /* PROTOTYPES ****************************************************************/
 
@@ -156,7 +156,7 @@
 STDCALL
 RtlAbsoluteToSelfRelativeSD(
     IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
-    IN OUT PSECURITY_DESCRIPTOR_RELATIVE SelfRelativeSecurityDescriptor,
+    IN OUT PISECURITY_DESCRIPTOR_RELATIVE SelfRelativeSecurityDescriptor,
     IN PULONG BufferLength
 );
 
@@ -322,7 +322,7 @@
 NTSTATUS
 STDCALL
 RtlCreateSecurityDescriptorRelative(
-    PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
+    PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
     ULONG Revision
 );
 
@@ -460,7 +460,7 @@
 NTSTATUS
 STDCALL
 RtlSelfRelativeToAbsoluteSD(
-    IN PSECURITY_DESCRIPTOR_RELATIVE SelfRelativeSD,
+    IN PISECURITY_DESCRIPTOR_RELATIVE SelfRelativeSD,
     OUT PSECURITY_DESCRIPTOR AbsoluteSD,
     IN PULONG AbsoluteSDSize,
     IN PACL Dacl,
@@ -547,7 +547,7 @@
 BOOLEAN
 STDCALL
 RtlValidRelativeSecurityDescriptor(
-    IN PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptorInput,
+    IN PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptorInput,
     IN ULONG SecurityDescriptorLength,
     IN SECURITY_INFORMATION RequiredInformation
 );
@@ -1016,14 +1016,6 @@
 /*
  * Memory Functions
  */
-SIZE_T
-STDCALL
-RtlCompareMemory(
-    IN const VOID *Source1,
-    IN const VOID *Source2,
-    IN SIZE_T Length
-);
-
 VOID
 STDCALL
 RtlFillMemoryUlong(
@@ -1727,75 +1719,4 @@
 STDCALL
 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
 
-/*
- * C Runtime Library Functions
- */
-char *_itoa (int value, char *string, int radix);
-wchar_t *_itow (int value, wchar_t *string, int radix);
-int _snprintf(char * buf, size_t cnt, const char *fmt, ...);
-int _snwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, ...);
-int _stricmp(const char *s1, const char *s2);
-char * _strlwr(char *x);
-int _strnicmp(const char *s1, const char *s2, size_t n);
-char * _strnset(char* szToFill, int szFill, size_t sizeMaxFill);
-char * _strrev(char *s);
-char * _strset(char* szToFill, int szFill);
-char * _strupr(char *x);
-int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args);
-int _wcsicmp (const wchar_t* cs, const wchar_t* ct);
-wchar_t * _wcslwr (wchar_t *x);
-int _wcsnicmp (const wchar_t * cs,const wchar_t * ct,size_t count);
-wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
-wchar_t * _wcsrev(wchar_t *s);
-wchar_t *_wcsupr(wchar_t *x);
-int atoi(const char *str);
-long atol(const char *str);
-int isdigit(int c);
-int isalpha(int c);
-int islower(int c);
-int isprint(int c);
-int isspace(int c);
-int isupper(int c);
-int isxdigit(int c);
-size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count);
-int mbtowc (wchar_t *wchar, const char *mbchar, size_t count);
-void * memchr(const void *s, int c, size_t n);
-void * memcpy(void *to, const void *from, size_t count);
-void * memmove(void *dest,const void *src, size_t count);
-void * memset(void *src, int val, size_t count);
-int rand(void);
-int sprintf(char * buf, const char *fmt, ...);
-void srand(unsigned seed);
-char * strcat(char *s, const char *append);
-char * strchr(const char *s, int c);
-int strcmp(const char *s1, const char *s2);
-char * strcpy(char *to, const char *from);
-size_t strlen(const char *str);
-char * strncat(char *dst, const char *src, size_t n);
-int strncmp(const char *s1, const char *s2, size_t n);
-char *strncpy(char *dst, const char *src, size_t n);
-char *strrchr(const char *s, int c);
-size_t strspn(const char *s1, const char *s2);
-char *strstr(const char *s, const char *find);
-int swprintf(wchar_t *buf, const wchar_t *fmt, ...);
-int tolower(int c);
-int toupper(int c);
-wchar_t towlower(wchar_t c);
-wchar_t towupper(wchar_t c);
-int vsprintf(char *buf, const char *fmt, va_list args);
-wchar_t * wcscat(wchar_t *dest, const wchar_t *src);
-wchar_t * wcschr(const wchar_t *str, wchar_t ch);
-int wcscmp(const wchar_t *cs, const wchar_t *ct);
-wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2);
-size_t wcscspn(const wchar_t *str,const wchar_t *reject);
-size_t wcslen(const wchar_t *s);
-wchar_t * wcsncat(wchar_t *dest, const wchar_t *src, size_t count);
-int wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t count);
-wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t count);
-wchar_t * wcsrchr(const wchar_t *str, wchar_t ch);
-size_t wcsspn(const wchar_t *str,const wchar_t *accept);
-wchar_t *wcsstr(const wchar_t *s,const wchar_t *b);
-size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count);
-int wctomb (char *mbchar, wchar_t wchar);
-
 #endif

Modified: trunk/reactos/include/ndk/rtltypes.h
--- trunk/reactos/include/ndk/rtltypes.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/include/ndk/rtltypes.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -11,6 +11,7 @@
 
 /* DEPENDENCIES **************************************************************/
 #include "zwtypes.h"
+#include "excpt.h"
 
 /* EXPORTED DATA *************************************************************/
 
@@ -69,14 +70,6 @@
 
 typedef enum
 {
-    ExceptionContinueExecution,
-    ExceptionContinueSearch,
-    ExceptionNestedException,
-    ExceptionCollidedUnwind
-} EXCEPTION_DISPOSITION;
-
-typedef enum
-{
     INVALID_PATH = 0,
     UNC_PATH,              /* "//foo" */
     ABSOLUTE_DRIVE_PATH,   /* "c:/foo" */
@@ -102,16 +95,16 @@
     PVOID
 );
 
-typedef LONG (STDCALL *PVECTORED_EXCEPTION_HANDLER)(
+typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
     PEXCEPTION_POINTERS ExceptionPointers
 );
 
-typedef DWORD (STDCALL *PTHREAD_START_ROUTINE)(
+typedef DWORD (NTAPI *PTHREAD_START_ROUTINE)(
     LPVOID Parameter
 );
 
 typedef VOID
-(STDCALL *PRTL_BASE_PROCESS_START_ROUTINE)(
+(NTAPI *PRTL_BASE_PROCESS_START_ROUTINE)(
     PTHREAD_START_ROUTINE StartAddress,
     PVOID Parameter
 );
@@ -234,11 +227,13 @@
 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
 /* END REVIEW AREA */
 
+#ifdef _INC_EXCPT
 typedef struct _EXCEPTION_REGISTRATION
 {
     struct _EXCEPTION_REGISTRATION*    prev;
     PEXCEPTION_HANDLER        handler;
 } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
+#endif
 
 typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
 typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
@@ -276,7 +271,7 @@
 } RTL_RANGE, *PRTL_RANGE;
 
 typedef BOOLEAN
-(STDCALL *PRTL_CONFLICT_RANGE_CALLBACK) (
+(NTAPI *PRTL_CONFLICT_RANGE_CALLBACK) (
     PVOID Context,
     PRTL_RANGE Range
 );
@@ -357,7 +352,7 @@
     ULONG CountY;
     ULONG CountCharsX;
     ULONG CountCharsY;
-    ULONG FillAttribute;;
+    ULONG FillAttribute;
     ULONG WindowFlags;
     ULONG ShowWindowFlags;
     UNICODE_STRING WindowTitle;
@@ -405,7 +400,7 @@
 } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
 
 /* Let Kernel Drivers use this */
-#ifndef _WINBASE_H
+#ifndef _WINBASE_
     typedef struct _SYSTEMTIME
     {
         WORD wYear;

Modified: trunk/reactos/include/ndk/umtypes.h
--- trunk/reactos/include/ndk/umtypes.h	2005-07-26 13:50:18 UTC (rev 16743)
+++ trunk/reactos/include/ndk/umtypes.h	2005-07-26 14:00:45 UTC (rev 16744)
@@ -1,1394 +1,1427 @@
-/*
- * PROJECT:         ReactOS Native Headers
- * FILE:            include/ndk/umtypes.h
- * PURPOSE:         Definitions needed for Native Headers if target is not Kernel-Mode.
- * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
- * UPDATE HISTORY:
- *                  Created 06/10/04
- */
-
-#ifndef _UMTYPES_H
-#define _UMTYPES_H
-
-/* DEPENDENCIES **************************************************************/
-#include <winioctl.h>
-#include <ntstatus.h>
-#include <ddk/ntnls.h>
-#define STATIC static
-
-/* EXPORTED DATA *************************************************************/
-
-/* CONSTANTS *****************************************************************/
-
-/* NTAPI/NTOSAPI Define */
-#define NTAPI __stdcall
-#define NTOSAPI
-
-/* Definitions for Object Creation -- winternl.h */
-#define OBJ_INHERIT 2L
-#define OBJ_PERMANENT 16L
-#define OBJ_EXCLUSIVE 32L
-#define OBJ_CASE_INSENSITIVE 64L
-#define OBJ_OPENIF 128L
-#define OBJ_OPENLINK 256L
-#define OBJ_VALID_ATTRIBUTES 498L
-#define InitializeObjectAttributes(p,n,a,r,s) { \
-  (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
-  (p)->RootDirectory = (r); \
-  (p)->Attributes = (a); \
-  (p)->ObjectName = (n); \
-  (p)->SecurityDescriptor = (s); \
-  (p)->SecurityQualityOfService = NULL; \
-}
-
-/* Native API Return Value Macros */
-#define NT_SUCCESS(x) ((x)>=0)
-#define NT_WARNING(x) ((ULONG)(x)>>30==2)
-#define NT_ERROR(x) ((ULONG)(x)>>30==3)
-
-/* Object Access Rights FIXME: Some are in w32api's psdk..,is that normal ?*/
-#define DIRECTORY_QUERY (0x0001)
-#define DIRECTORY_TRAVERSE (0x0002)
-#define DIRECTORY_CREATE_OBJECT (0x0004)
-#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
-#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
-#define EVENT_QUERY_STATE (0x0001)
-#define SEMAPHORE_QUERY_STATE (0x0001)
-#define SYMBOLIC_LINK_QUERY 0x0001
-#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
-
-/* I/O Control Codes for communicating with Mailslots */
-#define FSCTL_MAILSLOT_PEEK             \
-    CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA)
-
-/* I/O Control Codes for communicating with Pipes */
-#define FSCTL_PIPE_ASSIGN_EVENT         \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_DISCONNECT           \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_LISTEN               \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_PEEK                 \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA)
-
-#define FSCTL_PIPE_QUERY_EVENT          \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_TRANSCEIVE           \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER,  FILE_READ_DATA | FILE_WRITE_DATA)
-
-#define FSCTL_PIPE_WAIT                 \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_IMPERSONATE          \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_SET_CLIENT_PROCESS   \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_QUERY_CLIENT_PROCESS \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-#define FSCTL_PIPE_INTERNAL_READ        \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA)
-
-#define FSCTL_PIPE_INTERNAL_WRITE       \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA)
-
-#define FSCTL_PIPE_INTERNAL_TRANSCEIVE  \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
-
-#define FSCTL_PIPE_INTERNAL_READ_OVFLOW \
-    CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA)
-
-/* Macros for current Process/Thread built-in 'special' ID */
-#define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 )
-#define ZwCurrentProcess() NtCurrentProcess()
-#define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 )
-#define ZwCurrentThread() NtCurrentThread()
-
-/* Kernel Shared Data Constants */
-#define PROCESSOR_FEATURE_MAX 64
-#define SharedUserData ((KUSER_SHARED_DATA * CONST) USER_SHARED_DATA)
-
-/* Paging Values on x86 */
-#define PAGE_SIZE                         0x1000
-#define PAGE_SHIFT                        12L
-
-/* Run-Time Library (RTL) Registry Constants */
-#define RTL_REGISTRY_ABSOLUTE       0
-#define RTL_REGISTRY_SERVICES       1
-#define RTL_REGISTRY_CONTROL        2
-#define RTL_REGISTRY_WINDOWS_NT     3
-#define RTL_REGISTRY_DEVICEMAP      4
-#define RTL_REGISTRY_USER           5
-#define RTL_REGISTRY_MAXIMUM        6
-#define RTL_REGISTRY_HANDLE         0x40000000
-#define RTL_REGISTRY_OPTIONAL       0x80000000
-#define RTL_QUERY_REGISTRY_SUBKEY   0x00000001
-#define RTL_QUERY_REGISTRY_TOPKEY   0x00000002
-#define RTL_QUERY_REGISTRY_REQUIRED 0x00000004
-#define RTL_QUERY_REGISTRY_NOVALUE  0x00000008
-#define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010
-#define RTL_QUERY_REGISTRY_DIRECT   0x00000020
-#define RTL_QUERY_REGISTRY_DELETE   0x00000040
-
-/* File Result Flags */
-#define FILE_SUPERSEDED                   0x00000000
-#define FILE_OPENED                       0x00000001
-#define FILE_CREATED                      0x00000002
-#define FILE_OVERWRITTEN                  0x00000003
-#define FILE_EXISTS                       0x00000004
-#define FILE_DOES_NOT_EXIST               0x00000005
-
-/* Pipe Flags */
-#define FILE_PIPE_BYTE_STREAM_MODE      0x00000000
-#define FILE_PIPE_MESSAGE_MODE          0x00000001
-#define FILE_PIPE_QUEUE_OPERATION       0x00000000
-#define FILE_PIPE_COMPLETE_OPERATION    0x00000001
-#define FILE_PIPE_INBOUND               0x00000000
-#define FILE_PIPE_OUTBOUND              0x00000001
-#define FILE_PIPE_FULL_DUPLEX           0x00000002
-#define FILE_PIPE_CLIENT_END            0x00000000
-#define FILE_PIPE_SERVER_END            0x00000001
-
-/* Device Charactertics */
-#define FILE_REMOVABLE_MEDIA            0x00000001
-#define FILE_REMOTE_DEVICE              0x00000010
-
-/* SID Constants */
-#define SID_MAX_SUB_AUTHORITIES     15
-
-/* Version Constants */
-#define VER_MINORVERSION                0x0000001
-#define VER_MAJORVERSION                0x0000002
-#define VER_BUILDNUMBER                 0x0000004
-#define VER_PLATFORMID                  0x0000008
-#define VER_SERVICEPACKMINOR            0x0000010
-#define VER_SERVICEPACKMAJOR            0x0000020
-#define VER_SUITENAME                   0x0000040
-#define VER_PRODUCT_TYPE                0x0000080
-#define VER_PLATFORM_WIN32s             0
-#define VER_PLATFORM_WIN32_WINDOWS      1
-#define VER_PLATFORM_WIN32_NT           2
-#define VER_EQUAL                       1
-#define VER_GREATER                     2
-#define VER_GREATER_EQUAL               3
-#define VER_LESS                        4
-#define VER_LESS_EQUAL                  5
-#define VER_AND                         6
-#define VER_OR                          7
-#define VER_CONDITION_MASK              7
-#define VER_NUM_BITS_PER_CONDITION_MASK 3
-
-/* RTL String Hash Algorithms */
-#define HASH_STRING_ALGORITHM_DEFAULT   0
-#define HASH_STRING_ALGORITHM_X65599    1
-#define HASH_STRING_ALGORITHM_INVALID   0xffffffff
-
-/* List Macros */
-static __inline
-VOID
-InitializeListHead(
-    IN PLIST_ENTRY  ListHead)
-{
-    ListHead->Flink = ListHead->Blink = ListHead;
-}
-
-static __inline
-VOID
-InsertHeadList(
-    IN PLIST_ENTRY  ListHead,
-    IN PLIST_ENTRY  Entry)
-{
-    PLIST_ENTRY OldFlink;
-    OldFlink = ListHead->Flink;
-    Entry->Flink = OldFlink;
-    Entry->Blink = ListHead;
-    OldFlink->Blink = Entry;
-    ListHead->Flink = Entry;
-}
-
-static __inline
-VOID
-InsertTailList(
-    IN PLIST_ENTRY  ListHead,
-    IN PLIST_ENTRY  Entry)
-{
-    PLIST_ENTRY OldBlink;
-    OldBlink = ListHead->Blink;
-    Entry->Flink = ListHead;
-    Entry->Blink = OldBlink;
-    OldBlink->Flink = Entry;
-    ListHead->Blink = Entry;
-}
-
-#define IsListEmpty(ListHead) \
-    ((ListHead)->Flink == (ListHead))
-
-#define PopEntryList(ListHead) \
-    (ListHead)->Next; \
-    { \
-        PSINGLE_LIST_ENTRY _FirstEntry; \
-        _FirstEntry = (ListHead)->Next; \
-        if (_FirstEntry != NULL) \
-            (ListHead)->Next = _FirstEntry->Next; \
-    }
-
-#define PushEntryList(_ListHead, _Entry) \
-    (_Entry)->Next = (_ListHead)->Next; \
-    (_ListHead)->Next = (_Entry); \
-
-static __inline
-BOOLEAN
-RemoveEntryList(
-    IN PLIST_ENTRY  Entry)
-{
-    PLIST_ENTRY OldFlink;
-    PLIST_ENTRY OldBlink;
-
-    OldFlink = Entry->Flink;
-    OldBlink = Entry->Blink;
-    OldFlink->Blink = OldBlink;
-    OldBlink->Flink = OldFlink;
-    return (OldFlink == OldBlink);
-}
-
-static __inline
-PLIST_ENTRY
-RemoveHeadList(
-    IN PLIST_ENTRY  ListHead)
-{
-    PLIST_ENTRY Flink;
-    PLIST_ENTRY Entry;
-
-    Entry = ListHead->Flink;
-    Flink = Entry->Flink;
-    ListHead->Flink = Flink;
-    Flink->Blink = ListHead;
-    return Entry;
-}
-
-static __inline
-PLIST_ENTRY
-RemoveTailList(
-    IN PLIST_ENTRY  ListHead)
-{
-    PLIST_ENTRY Blink;
-    PLIST_ENTRY Entry;
-
-    Entry = ListHead->Blink;
-    Blink = Entry->Blink;
-    ListHead->Blink = Blink;
-    Blink->Flink = ListHead;
-    return Entry;
-}
-
-#define IsFirstEntry(ListHead, Entry) \
-    ((ListHead)->Flink == Entry)
-
-#define IsLastEntry(ListHead, Entry) \
-    ((ListHead)->Blink == Entry)
-
-/*
- * Constant String Macro
- */
-#define RTL_CONSTANT_STRING(__SOURCE_STRING__) \
-{ \
- sizeof(__SOURCE_STRING__) - sizeof((__SOURCE_STRING__)[0]), \
- sizeof(__SOURCE_STRING__), \
- (__SOURCE_STRING__) \
-}
-
-/* ENUMERATIONS **************************************************************/
-
-/* Kernel Shared Data Values */
-typedef enum _NT_PRODUCT_TYPE
-{
-    NtProductWinNt = 1,
-    NtProductLanManNt,
-    NtProductServer
-} NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
-
-typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
-{
-    StandardDesign,
-    NEC98x86,
-    EndAlternatives
-} ALTERNATIVE_ARCHITECTURE_TYPE;
-
-/* Run-Time Library (RTL) Enumerations */
-typedef enum _TABLE_SEARCH_RESULT
-{
-    TableEmptyTree,
-    TableFoundNode,
-    TableInsertAsLeft,
-    TableInsertAsRight
-} TABLE_SEARCH_RESULT;
-
-typedef enum _RTL_GENERIC_COMPARE_RESULTS
-{
-    GenericLessThan,
-    GenericGreaterThan,
-    GenericEqual
-} RTL_GENERIC_COMPARE_RESULTS;
-
-/* Kernel or Native Enumerations used by Native API */
-typedef enum _SECTION_INHERIT
-{
-    ViewShare = 1,
-    ViewUnmap = 2
-} SECTION_INHERIT;
-
-typedef enum _POOL_TYPE
-{
-    NonPagedPool,
-    PagedPool,
-    NonPagedPoolMustSucceed,
-    DontUseThisType,
-    NonPagedPoolCacheAligned,
-    PagedPoolCacheAligned,
-    NonPagedPoolCacheAlignedMustS,
-    MaxPoolType,
-    NonPagedPoolSession = 32,
-    PagedPoolSession,
-    NonPagedPoolMustSucceedSession,
-    DontUseThisTypeSession,
-    NonPagedPoolCacheAlignedSession,
-    PagedPoolCacheAlignedSession,
-    NonPagedPoolCacheAlignedMustSSession
-} POOL_TYPE;
-
-typedef enum _EVENT_TYPE
-{
-    NotificationEvent,
-    SynchronizationEvent
-} EVENT_TYPE;
-
-typedef enum _TIMER_TYPE
-{
-    NotificationTimer,
-    SynchronizationTimer
-} TIMER_TYPE;
-
-typedef enum _WAIT_TYPE
-{
-    WaitAll,
-    WaitAny
-} WAIT_TYPE;
-
-typedef enum _INTERFACE_TYPE
-{
-    InterfaceTypeUndefined = -1,
-    Internal,
-    Isa,
-    Eisa,
-    MicroChannel,
-    TurboChannel,
-    PCIBus,
-    VMEBus,
-    NuBus,
-    PCMCIABus,
-    CBus,
-    MPIBus,
-    MPSABus,
-    ProcessorInternal,
-    InternalPowerBus,
-    PNPISABus,
-    PNPBus,
-    MaximumInterfaceType
-}INTERFACE_TYPE, *PINTERFACE_TYPE;
-
-typedef enum _MODE
-{
-    KernelMode,
-    UserMode,
-    MaximumMode
-} MODE;
-
-typedef enum _KWAIT_REASON
-{
-    Executive,
-    FreePage,
-    PageIn,
-    PoolAllocation,
-    DelayExecution,
-    Suspended,
-    UserRequest,
-    WrExecutive,
-    WrFreePage,
-    WrPageIn,
-    WrPoolAllocation,
-    WrDelayExecution,
-    WrSuspended,
-    WrUserRequest,
-    WrEventPair,
-    WrQueue,
-    WrLpcReceive,
-    WrLpcReply,
-    WrVirtualMemory,
-    WrPageOut,
-    WrRendezvous,
-    Spare2,
-    WrGuardedMutex,
-    Spare4,
-    Spare5,
-    Spare6,
-    WrKernel,
-    WrResource,
-    WrPushLock,
-    WrMutex,
-    WrQuantumEnd,
-    WrDispatchInt,
-    WrPreempted,
-    WrYieldExecution,
-    MaximumWaitReason
-} KWAIT_REASON;
-
-typedef enum _KPROFILE_SOURCE
-{
-    ProfileTime,
-    ProfileAlignmentFixup,
-    ProfileTotalIssues,
-    ProfilePipelineDry,
-    ProfileLoadInstructions,
-    ProfilePipelineFrozen,
-    ProfileBranchInstructions,
-    ProfileTotalNonissues,
-    ProfileDcacheMisses,
-    ProfileIcacheMisses,
-    ProfileCacheMisses,
-    ProfileBranchMispredictions,
-    ProfileStoreInstructions,
-    ProfileFpInstructions,
-    ProfileIntegerInstructions,
-    Profile2Issue,
-    Profile3Issue,
-    Profile4Issue,
-    ProfileSpecialInstructions,
-    ProfileTotalCycles,
-    ProfileIcacheIssues,
-    ProfileDcacheAccesses,
-    ProfileMemoryBarrierCycles,
-    ProfileLoadLinkedIssues,
-    ProfileMaximum
-} KPROFILE_SOURCE;
-
-/**** Information Classes ****/
-
-/*
- * File
- */
-typedef enum _FILE_INFORMATION_CLASS
-{
-    FileDirectoryInformation = 1,
-    FileFullDirectoryInformation,
-    FileBothDirectoryInformation,
-    FileBasicInformation,
-    FileStandardInformation,
-    FileInternalInformation,
-    FileEaInformation,
-    FileAccessInformation,
-    FileNameInformation,
-    FileRenameInformation,
-    FileLinkInformation,
-    FileNamesInformation,
-    FileDispositionInformation,
-    FilePositionInformation,
-    FileFullEaInformation,
-    FileModeInformation,
-    FileAlignmentInformation,
-    FileAllInformation,
-    FileAllocationInformation,
-    FileEndOfFileInformation,
-    FileAlternateNameInformation,
-    FileStreamInformation,
-    FilePipeInformation,
-    FilePipeLocalInformation,
-    FilePipeRemoteInformation,
-    FileMailslotQueryInformation,
-    FileMailslotSetInformation,
-    FileCompressionInformation,
-    FileObjectIdInformation,
-    FileCompletionInformation,
-    FileMoveClusterInformation,
-    FileQuotaInformation,
-    FileReparsePointInformation,
-    FileNetworkOpenInformation,
-    FileAttributeTagInformation,
-    FileTrackingInformation,
-    FileIdBothDirectoryInformation,
-    FileIdFullDirectoryInformation,
-    FileValidDataLengthInformation,
-    FileShortNameInformation,
-    FileMaximumInformation
-} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
-
-/*
- * File System
- */
-typedef enum _FSINFOCLASS
-{
-    FileFsVolumeInformation = 1,
-    FileFsLabelInformation,
-    FileFsSizeInformation,
-    FileFsDeviceInformation,
-    FileFsAttributeInformation,
-    FileFsControlInformation,
-    FileFsFullSizeInformation,
-    FileFsObjectIdInformation,
-    FileFsDriverPathInformation,
-    FileFsMaximumInformation
-} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
-
-/*
- * Registry Key
- */
-typedef enum _KEY_INFORMATION_CLASS
-{
-    KeyBasicInformation,
-    KeyNodeInformation,
-    KeyFullInformation,
-    KeyNameInformation,
-    KeyCachedInformation,
-    KeyFlagsInformation
-} KEY_INFORMATION_CLASS;
-
-/*
- * Registry Key Value
- */
-typedef enum _KEY_VALUE_INFORMATION_CLASS
-{
-    KeyValueBasicInformation,
-    KeyValueFullInformation,
-    KeyValuePartialInformation,
-    KeyValueFullInformationAlign64,
-    KeyValuePartialInformationAlign64
-} KEY_VALUE_INFORMATION_CLASS;
-
-/*
- * Registry Key Set
- */
-typedef enum _KEY_SET_INFORMATION_CLASS
-{
-    KeyWriteTimeInformation,
-    KeyUserFlagsInformation,
-    MaxKeySetInfoClass
-} KEY_SET_INFORMATION_CLASS;
-
-/*
- * Process
- */
-typedef enum _PROCESSINFOCLASS
-{
-    ProcessBasicInformation,
-    ProcessQuotaLimits,
-    ProcessIoCounters,
-    ProcessVmCounters,
-    ProcessTimes,
-    ProcessBasePriority,
-    ProcessRaisePriority,
-    ProcessDebugPort,
-    ProcessExceptionPort,
-    ProcessAccessToken,
-    ProcessLdtInformation,
-    ProcessLdtSize,
-    ProcessDefaultHardErrorMode,
-    ProcessIoPortHandlers,
-    ProcessPooledUsageAndLimits,
-    ProcessWorkingSetWatch,
-    ProcessUserModeIOPL,
-    ProcessEnableAlignmentFaultFixup,
-    ProcessPriorityClass,
-    ProcessWx86Information,
-    ProcessHandleCount,
-    ProcessAffinityMask,
-    ProcessPriorityBoost,
-    ProcessDeviceMap,
-    ProcessSessionInformation,
-    ProcessForegroundInformation,
-    ProcessWow64Information,
-    ProcessImageFileName,
-    ProcessLUIDDeviceMapsEnabled,
-    ProcessBreakOnTermination,
[truncated at 1000 lines; 3138 more skipped]