win-pvdrivers

changeset 354:d2ebc66da34c

merge with head
author James Harper <james.harper@bendigoit.com.au>
date Wed Jul 02 09:57:59 2008 +1000 (2008-07-02)
parents a7c4b65e754a 961762808bab
children 25166765975f 8c419cbee528
files xenpci/xenpci_fdo.c xenpci/xenpci_pdo.c
line diff
     1.1 --- a/common/include/public/io/ring.h	Wed Jul 02 09:54:40 2008 +1000
     1.2 +++ b/common/include/public/io/ring.h	Wed Jul 02 09:57:59 2008 +1000
     1.3 @@ -296,4 +296,5 @@ typedef struct __name##_back_ring __name
     1.4   * tab-width: 4
     1.5   * indent-tabs-mode: nil
     1.6   * End:
     1.7 - */
     1.8 \ No newline at end of file
     1.9 + */
    1.10 +
     2.1 --- a/common/include/xen_windows.h	Wed Jul 02 09:54:40 2008 +1000
     2.2 +++ b/common/include/xen_windows.h	Wed Jul 02 09:57:59 2008 +1000
     2.3 @@ -35,12 +35,6 @@ typedef UINT32 uint32_t;
     2.4  typedef UINT64 uint64_t;
     2.5  #endif
     2.6  
     2.7 -#ifdef __MINGW32__
     2.8 -#include <stdio.h>
     2.9 -#define RtlStringCbCopyA(dst, dst_len, src) strncpy(dst, src, dst_len)
    2.10 -#define RtlStringCbPrintfA(args...) snprintf(args)
    2.11 -#define RtlStringCbVPrintfA(args...) vsnprintf(args)
    2.12 -#endif
    2.13  #include <xen.h>
    2.14  
    2.15  #define _PAGE_PRESENT  0x001UL
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/doc/BUILDING_mingw.txt	Wed Jul 02 09:57:59 2008 +1000
     3.3 @@ -0,0 +1,32 @@
     3.4 +This driver is buildable using MinGW32. This may be preferable due to licensing
     3.5 +reasons to using the Microsoft WDK/DDK.
     3.6 +
     3.7 +These instructions are for building the driver on a Linux Ubuntu system, using
     3.8 +the mingw32msvc cross-compiler.
     3.9 +
    3.10 +1. sudo apt-get install mingw mingw-binutils mingw-runtime
    3.11 +
    3.12 +2. mingw-runtime headers need to be modified. Download the latest w32api-src.tar.gz
    3.13 +   package from mingw.sf.net.
    3.14 +
    3.15 +3. Untar, then edit lib/ddk/ntoskrnl.def. Remove ";" from line ~545, which says
    3.16 +   "KeNumberProcessors DATA". Add a line "KeFlushQueuedDpcs@0"
    3.17 +
    3.18 +4. Type: "./configure i586-mingw32-msvc;make"
    3.19 +
    3.20 +2. Use Mercurial and type:
    3.21 +   "hg clone http://xenbits.xensource.com/ext/win-pvdrivers.hg"
    3.22 +
    3.23 +4. Change to the win-pvdrivers.hg/xenpci dir.
    3.24 +
    3.25 +5. Modify the W32API_PATH at the top of makefile.mingw to point to the lib/ddk
    3.26 +   directory of the w32api package compiled above.
    3.27 +
    3.28 +6. Type: "make -f makefile.mingw"
    3.29 +
    3.30 +7. Building the shutdown monitor is not supported (maybe using Mono is an option
    3.31 +   here?)
    3.32 +
    3.33 +8. This is still an extremely alpha build method, so this will give you a
    3.34 +   .sys file but you're on your own for the rest!
    3.35 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/mingw/inc/ntddk.h	Wed Jul 02 09:57:59 2008 +1000
     4.3 @@ -0,0 +1,93 @@
     4.4 +/* Private copy because we needed tweak winddk.h */
     4.5 +
     4.6 +/*
     4.7 + * ntddk.h
     4.8 + *
     4.9 + * Windows Device Driver Kit
    4.10 + *
    4.11 + * This file is part of the w32api package.
    4.12 + *
    4.13 + * Contributors:
    4.14 + *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
    4.15 + *
    4.16 + * THIS SOFTWARE IS NOT COPYRIGHTED
    4.17 + *
    4.18 + * This source code is offered for use in the public domain. You may
    4.19 + * use, modify or distribute it freely.
    4.20 + *
    4.21 + * This code is distributed in the hope that it will be useful but
    4.22 + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
    4.23 + * DISCLAIMED. This includes but is not limited to warranties of
    4.24 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    4.25 + *
    4.26 + * DEFINES:
    4.27 + *    DBG             - Debugging enabled/disabled (0/1)
    4.28 + *    POOL_TAGGING    - Enable pool tagging
    4.29 + *    _X86_           - X86 environment
    4.30 + *   __USE_NTOSKRNL__ - Use ntoskrnl.exe exports instead of kernel32.dll
    4.31 + */
    4.32 +
    4.33 +#ifndef __NTDDK_H
    4.34 +#define __NTDDK_H
    4.35 +
    4.36 +#if __GNUC__ >= 3
    4.37 +#pragma GCC system_header
    4.38 +#endif
    4.39 +
    4.40 +#ifndef __USE_NTOSKRNL__
    4.41 +#define __USE_NTOSKRNL__ 1
    4.42 +#endif
    4.43 +
    4.44 +#ifdef __cplusplus
    4.45 +extern "C" {
    4.46 +#endif
    4.47 +
    4.48 +#include <stdarg.h>
    4.49 +#include <windef.h>
    4.50 +#include <ntdef.h>
    4.51 +#include <basetyps.h>
    4.52 +
    4.53 +/* Base types, structures and definitions */
    4.54 +typedef short CSHORT;
    4.55 +typedef CONST int CINT;
    4.56 +typedef CONST char *PCSZ;
    4.57 +
    4.58 +#ifndef STATIC
    4.59 +#define STATIC static
    4.60 +#endif
    4.61 +
    4.62 +#ifndef CALLBACK
    4.63 +#define CALLBACK
    4.64 +#endif
    4.65 +
    4.66 +#ifndef DECL_IMPORT
    4.67 +#define DECL_IMPORT __declspec(dllimport)
    4.68 +#endif
    4.69 +
    4.70 +#ifndef DECL_EXPORT
    4.71 +#define DECL_EXPORT __declspec(dllexport)
    4.72 +#endif
    4.73 +
    4.74 +/* Windows NT status codes */
    4.75 +#include "ntstatus.h"
    4.76 +
    4.77 +/* Windows NT definitions exported to user mode */
    4.78 +#include <winnt.h>
    4.79 +
    4.80 +/* Windows Device Driver Kit */
    4.81 +#include "winddk.h"
    4.82 +
    4.83 +/* Definitions only in Windows XP */
    4.84 +#include "winxp.h"
    4.85 +
    4.86 +/* Definitions only in Windows 2000 */
    4.87 +#include "win2k.h"
    4.88 +
    4.89 +/* Definitions only in Windows NT 4 */
    4.90 +#include "winnt4.h"
    4.91 +
    4.92 +#ifdef __cplusplus
    4.93 +}
    4.94 +#endif
    4.95 +
    4.96 +#endif /* __NTDDK_H */
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/mingw/inc/winddk.h	Wed Jul 02 09:57:59 2008 +1000
     5.3 @@ -0,0 +1,9252 @@
     5.4 +/* Private copy of header because Interlocked{Increment,Decrement} were wrong.
     5.5 +   Please check for corrected headers and ditch these when possible. */
     5.6 +
     5.7 +/*
     5.8 + * winddk.h
     5.9 + *
    5.10 + * Windows Device Driver Kit
    5.11 + *
    5.12 + * This file is part of the w32api package.
    5.13 + *
    5.14 + * Contributors:
    5.15 + *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
    5.16 + *
    5.17 + * THIS SOFTWARE IS NOT COPYRIGHTED
    5.18 + *
    5.19 + * This source code is offered for use in the public domain. You may
    5.20 + * use, modify or distribute it freely.
    5.21 + *
    5.22 + * This code is distributed in the hope that it will be useful but
    5.23 + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
    5.24 + * DISCLAIMED. This includes but is not limited to warranties of
    5.25 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    5.26 + *
    5.27 + */
    5.28 +
    5.29 +#ifndef __WINDDK_H
    5.30 +#define __WINDDK_H
    5.31 +
    5.32 +#if __GNUC__ >= 3
    5.33 +#pragma GCC system_header
    5.34 +#endif
    5.35 +
    5.36 +#ifdef __cplusplus
    5.37 +extern "C" {
    5.38 +#endif
    5.39 +
    5.40 +/*
    5.41 +** Definitions specific to this Device Driver Kit
    5.42 +*/
    5.43 +#define DDKAPI __stdcall
    5.44 +#define DDKFASTAPI __fastcall
    5.45 +#define DDKCDECLAPI __cdecl
    5.46 +
    5.47 +#if defined(_NTOSKRNL_)
    5.48 +#ifndef NTOSAPI
    5.49 +#define NTOSAPI DECL_EXPORT
    5.50 +#endif
    5.51 +#define DECLARE_INTERNAL_OBJECT(x) typedef struct _##x; typedef struct _##x *P##x;
    5.52 +#define DECLARE_INTERNAL_OBJECT2(x,y) typedef struct _##x; typedef struct _##x *P##y;
    5.53 +#else
    5.54 +#ifndef NTOSAPI
    5.55 +#define NTOSAPI DECL_IMPORT
    5.56 +#endif
    5.57 +#define DECLARE_INTERNAL_OBJECT(x) struct _##x; typedef struct _##x *P##x;
    5.58 +#define DECLARE_INTERNAL_OBJECT2(x,y) struct _##x; typedef struct _##x *P##y;
    5.59 +#endif
    5.60 +
    5.61 +/* Pseudo modifiers for parameters 
    5.62 +   We don't use these unnecessary defines in the w32api headers. Define
    5.63 +   them by default since that is what people expect, but allow users
    5.64 +   to avoid the pollution.  */
    5.65 +#ifndef _NO_W32_PSEUDO_MODIFIERS
    5.66 +#define IN
    5.67 +#define OUT
    5.68 +#define OPTIONAL
    5.69 +#define UNALLIGNED
    5.70 +#endif
    5.71 +
    5.72 +#define CONST const
    5.73 +#define VOLATILE volatile
    5.74 +
    5.75 +#define RESTRICTED_POINTER
    5.76 +#define POINTER_ALIGNMENT
    5.77 +
    5.78 +#ifdef NONAMELESSUNION
    5.79 +# define _DDK_DUMMYUNION_MEMBER(name) DUMMYUNIONNAME.name
    5.80 +# define _DDK_DUMMYUNION_N_MEMBER(n, name) DUMMYUNIONNAME##n.name
    5.81 +#else
    5.82 +# define _DDK_DUMMYUNION_MEMBER(name) name
    5.83 +# define _DDK_DUMMYUNION_N_MEMBER(n, name) name
    5.84 +#endif
    5.85 +
    5.86 +/*
    5.87 +** Forward declarations
    5.88 +*/
    5.89 +
    5.90 +struct _IRP;
    5.91 +struct _MDL;
    5.92 +struct _KAPC;
    5.93 +struct _KDPC;
    5.94 +struct _KPCR;
    5.95 +struct _KPRCB;
    5.96 +struct _KTSS;
    5.97 +struct _FILE_OBJECT;
    5.98 +struct _DMA_ADAPTER;
    5.99 +struct _DEVICE_OBJECT;
   5.100 +struct _DRIVER_OBJECT;
   5.101 +struct _SECTION_OBJECT;
   5.102 +struct _IO_STATUS_BLOCK;
   5.103 +struct _DEVICE_DESCRIPTION;
   5.104 +struct _SCATTER_GATHER_LIST;
   5.105 +
   5.106 +DECLARE_INTERNAL_OBJECT(ADAPTER_OBJECT)
   5.107 +DECLARE_INTERNAL_OBJECT(DMA_ADAPTER)
   5.108 +DECLARE_INTERNAL_OBJECT(IO_STATUS_BLOCK)
   5.109 +DECLARE_INTERNAL_OBJECT(SECTION_OBJECT)
   5.110 +
   5.111 +#if 1
   5.112 +/* FIXME: Unknown definitions */
   5.113 +struct _SET_PARTITION_INFORMATION_EX;
   5.114 +typedef ULONG WAIT_TYPE;
   5.115 +typedef HANDLE TRACEHANDLE;
   5.116 +typedef PVOID PWMILIB_CONTEXT;
   5.117 +typedef PVOID PSYSCTL_IRP_DISPOSITION;
   5.118 +typedef ULONG LOGICAL;
   5.119 +#endif
   5.120 +
   5.121 +/*
   5.122 +** Routines specific to this DDK
   5.123 +*/
   5.124 +
   5.125 +#define TAG(_a, _b, _c, _d) (ULONG) \
   5.126 +	(((_a) << 0) + ((_b) << 8) + ((_c) << 16) + ((_d) << 24))
   5.127 +
   5.128 +#ifdef __GNUC__
   5.129 +static __inline struct _KPCR * KeGetCurrentKPCR(
   5.130 +  VOID)
   5.131 +{
   5.132 +  ULONG Value;
   5.133 +
   5.134 +  __asm__ __volatile__ (
   5.135 +#if (__GNUC__ >= 3)
   5.136 +    /* support -masm=intel */
   5.137 +    "mov{l} {%%fs:0x18, %0|%0, %%fs:0x18}\n\t"
   5.138 +#else
   5.139 +    "movl %%fs:0x18, %0\n\t"
   5.140 +#endif
   5.141 +     : "=r" (Value)
   5.142 +     : /* no inputs */
   5.143 +  );
   5.144 +  return (struct _KPCR *) Value;
   5.145 +}
   5.146 +
   5.147 +#elif defined( __WATCOMC__ )
   5.148 +
   5.149 +extern struct _KPCR * KeGetCurrentKPCR( void );
   5.150 +#pragma aux KeGetCurrentKPCR = \
   5.151 +  "mov eax, fs:[0x18]" \
   5.152 +  value [ eax ];
   5.153 +
   5.154 +#endif
   5.155 +
   5.156 +/*
   5.157 +** Simple structures
   5.158 +*/
   5.159 +
   5.160 +typedef LONG KPRIORITY;
   5.161 +typedef UCHAR KIRQL, *PKIRQL;
   5.162 +typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
   5.163 +typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
   5.164 +typedef CCHAR KPROCESSOR_MODE;
   5.165 +
   5.166 +typedef enum _MODE {
   5.167 +  KernelMode,
   5.168 +  UserMode,
   5.169 +  MaximumMode
   5.170 +} MODE;
   5.171 +
   5.172 +
   5.173 +/* Structures not exposed to drivers */
   5.174 +typedef struct _IO_TIMER *PIO_TIMER;
   5.175 +typedef struct _EPROCESS *PEPROCESS;
   5.176 +typedef struct _ETHREAD *PETHREAD;
   5.177 +typedef struct _KINTERRUPT *PKINTERRUPT;
   5.178 +typedef struct _OBJECT_TYPE *POBJECT_TYPE;
   5.179 +typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
   5.180 +typedef struct _COMPRESSED_DATA_INFO *PCOMPRESSED_DATA_INFO;
   5.181 +typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
   5.182 +typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
   5.183 +typedef struct _DRIVE_LAYOUT_INFORMATION *PDRIVE_LAYOUT_INFORMATION;
   5.184 +typedef struct _DRIVE_LAYOUT_INFORMATION_EX *PDRIVE_LAYOUT_INFORMATION_EX;
   5.185 +
   5.186 +/* Constants */
   5.187 +#define	MAXIMUM_PROCESSORS                32
   5.188 +
   5.189 +#define MAXIMUM_WAIT_OBJECTS              64
   5.190 +
   5.191 +#define METHOD_BUFFERED                   0
   5.192 +#define METHOD_IN_DIRECT                  1
   5.193 +#define METHOD_OUT_DIRECT                 2
   5.194 +#define METHOD_NEITHER                    3
   5.195 +
   5.196 +#define LOW_PRIORITY                      0
   5.197 +#define LOW_REALTIME_PRIORITY             16
   5.198 +#define HIGH_PRIORITY                     31
   5.199 +#define MAXIMUM_PRIORITY                  32
   5.200 +
   5.201 +#define FILE_SUPERSEDED                   0x00000000
   5.202 +#define FILE_OPENED                       0x00000001
   5.203 +#define FILE_CREATED                      0x00000002
   5.204 +#define FILE_OVERWRITTEN                  0x00000003
   5.205 +#define FILE_EXISTS                       0x00000004
   5.206 +#define FILE_DOES_NOT_EXIST               0x00000005
   5.207 +
   5.208 +/* also in winnt.h */
   5.209 +#define FILE_LIST_DIRECTORY               0x00000001
   5.210 +#define FILE_READ_DATA                    0x00000001
   5.211 +#define FILE_ADD_FILE                     0x00000002
   5.212 +#define FILE_WRITE_DATA                   0x00000002
   5.213 +#define FILE_ADD_SUBDIRECTORY             0x00000004
   5.214 +#define FILE_APPEND_DATA                  0x00000004
   5.215 +#define FILE_CREATE_PIPE_INSTANCE         0x00000004
   5.216 +#define FILE_READ_EA                      0x00000008
   5.217 +#define FILE_WRITE_EA                     0x00000010
   5.218 +#define FILE_EXECUTE                      0x00000020
   5.219 +#define FILE_TRAVERSE                     0x00000020
   5.220 +#define FILE_DELETE_CHILD                 0x00000040
   5.221 +#define FILE_READ_ATTRIBUTES              0x00000080
   5.222 +#define FILE_WRITE_ATTRIBUTES             0x00000100
   5.223 +
   5.224 +#define FILE_SHARE_READ                   0x00000001
   5.225 +#define FILE_SHARE_WRITE                  0x00000002
   5.226 +#define FILE_SHARE_DELETE                 0x00000004
   5.227 +#define FILE_SHARE_VALID_FLAGS            0x00000007
   5.228 +
   5.229 +#define FILE_ATTRIBUTE_READONLY           0x00000001
   5.230 +#define FILE_ATTRIBUTE_HIDDEN             0x00000002
   5.231 +#define FILE_ATTRIBUTE_SYSTEM             0x00000004
   5.232 +#define FILE_ATTRIBUTE_DIRECTORY          0x00000010
   5.233 +#define FILE_ATTRIBUTE_ARCHIVE            0x00000020
   5.234 +#define FILE_ATTRIBUTE_DEVICE             0x00000040
   5.235 +#define FILE_ATTRIBUTE_NORMAL             0x00000080
   5.236 +#define FILE_ATTRIBUTE_TEMPORARY          0x00000100
   5.237 +#define FILE_ATTRIBUTE_SPARSE_FILE        0x00000200
   5.238 +#define FILE_ATTRIBUTE_REPARSE_POINT      0x00000400
   5.239 +#define FILE_ATTRIBUTE_COMPRESSED         0x00000800
   5.240 +#define FILE_ATTRIBUTE_OFFLINE            0x00001000
   5.241 +#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
   5.242 +#define FILE_ATTRIBUTE_ENCRYPTED          0x00004000
   5.243 +
   5.244 +#define FILE_ATTRIBUTE_VALID_FLAGS        0x00007fb7
   5.245 +#define FILE_ATTRIBUTE_VALID_SET_FLAGS    0x000031a7
   5.246 +
   5.247 +#define FILE_COPY_STRUCTURED_STORAGE      0x00000041
   5.248 +#define FILE_STRUCTURED_STORAGE           0x00000441
   5.249 +
   5.250 +#define FILE_VALID_OPTION_FLAGS           0x00ffffff
   5.251 +#define FILE_VALID_PIPE_OPTION_FLAGS      0x00000032
   5.252 +#define FILE_VALID_MAILSLOT_OPTION_FLAGS  0x00000032
   5.253 +#define FILE_VALID_SET_FLAGS              0x00000036
   5.254 +
   5.255 +#define FILE_SUPERSEDE                    0x00000000
   5.256 +#define FILE_OPEN                         0x00000001
   5.257 +#define FILE_CREATE                       0x00000002
   5.258 +#define FILE_OPEN_IF                      0x00000003
   5.259 +#define FILE_OVERWRITE                    0x00000004
   5.260 +#define FILE_OVERWRITE_IF                 0x00000005
   5.261 +#define FILE_MAXIMUM_DISPOSITION          0x00000005
   5.262 +
   5.263 +#define FILE_DIRECTORY_FILE               0x00000001
   5.264 +#define FILE_WRITE_THROUGH                0x00000002
   5.265 +#define FILE_SEQUENTIAL_ONLY              0x00000004
   5.266 +#define FILE_NO_INTERMEDIATE_BUFFERING    0x00000008
   5.267 +#define FILE_SYNCHRONOUS_IO_ALERT         0x00000010
   5.268 +#define FILE_SYNCHRONOUS_IO_NONALERT      0x00000020
   5.269 +#define FILE_NON_DIRECTORY_FILE           0x00000040
   5.270 +#define FILE_CREATE_TREE_CONNECTION       0x00000080
   5.271 +#define FILE_COMPLETE_IF_OPLOCKED         0x00000100
   5.272 +#define FILE_NO_EA_KNOWLEDGE              0x00000200
   5.273 +#define FILE_OPEN_FOR_RECOVERY            0x00000400
   5.274 +#define FILE_RANDOM_ACCESS                0x00000800
   5.275 +#define FILE_DELETE_ON_CLOSE              0x00001000
   5.276 +#define FILE_OPEN_BY_FILE_ID              0x00002000
   5.277 +#define FILE_OPEN_FOR_BACKUP_INTENT       0x00004000
   5.278 +#define FILE_NO_COMPRESSION               0x00008000
   5.279 +#define FILE_RESERVE_OPFILTER             0x00100000
   5.280 +#define FILE_OPEN_REPARSE_POINT           0x00200000
   5.281 +#define FILE_OPEN_NO_RECALL               0x00400000
   5.282 +#define FILE_OPEN_FOR_FREE_SPACE_QUERY    0x00800000
   5.283 +
   5.284 +#define FILE_ANY_ACCESS                   0x00000000
   5.285 +#define FILE_SPECIAL_ACCESS               FILE_ANY_ACCESS
   5.286 +#define FILE_READ_ACCESS                  0x00000001
   5.287 +#define FILE_WRITE_ACCESS                 0x00000002
   5.288 +
   5.289 +#define FILE_ALL_ACCESS \
   5.290 +  (STANDARD_RIGHTS_REQUIRED | \
   5.291 +   SYNCHRONIZE | \
   5.292 +   0x1FF)
   5.293 +
   5.294 +#define FILE_GENERIC_EXECUTE \
   5.295 +  (STANDARD_RIGHTS_EXECUTE | \
   5.296 +   FILE_READ_ATTRIBUTES | \
   5.297 +   FILE_EXECUTE | \
   5.298 +   SYNCHRONIZE)
   5.299 +
   5.300 +#define FILE_GENERIC_READ \
   5.301 +  (STANDARD_RIGHTS_READ | \
   5.302 +   FILE_READ_DATA | \
   5.303 +   FILE_READ_ATTRIBUTES | \
   5.304 +   FILE_READ_EA | \
   5.305 +   SYNCHRONIZE)
   5.306 +
   5.307 +#define FILE_GENERIC_WRITE \
   5.308 +  (STANDARD_RIGHTS_WRITE | \
   5.309 +   FILE_WRITE_DATA | \
   5.310 +   FILE_WRITE_ATTRIBUTES | \
   5.311 +   FILE_WRITE_EA | \
   5.312 +   FILE_APPEND_DATA | \
   5.313 +   SYNCHRONIZE)
   5.314 +/* end winnt.h */
   5.315 +
   5.316 +#define DIRECTORY_QUERY (0x0001)
   5.317 +#define DIRECTORY_TRAVERSE (0x0002)
   5.318 +#define DIRECTORY_CREATE_OBJECT (0x0004)
   5.319 +#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
   5.320 +#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
   5.321 +  
   5.322 +/* Exported object types */
   5.323 +extern NTOSAPI POBJECT_TYPE ExDesktopObjectType;
   5.324 +extern NTOSAPI POBJECT_TYPE ExEventObjectType;
   5.325 +extern NTOSAPI POBJECT_TYPE ExSemaphoreObjectType;
   5.326 +extern NTOSAPI POBJECT_TYPE ExWindowStationObjectType;
   5.327 +extern NTOSAPI POBJECT_TYPE IoAdapterObjectType;
   5.328 +extern NTOSAPI ULONG IoDeviceHandlerObjectSize;
   5.329 +extern NTOSAPI POBJECT_TYPE IoDeviceHandlerObjectType;
   5.330 +extern NTOSAPI POBJECT_TYPE IoDeviceObjectType;
   5.331 +extern NTOSAPI POBJECT_TYPE IoDriverObjectType;
   5.332 +extern NTOSAPI POBJECT_TYPE IoFileObjectType;
   5.333 +extern NTOSAPI POBJECT_TYPE LpcPortObjectType;
   5.334 +extern NTOSAPI POBJECT_TYPE MmSectionObjectType;
   5.335 +extern NTOSAPI POBJECT_TYPE SeTokenObjectType;
   5.336 +
   5.337 +extern NTOSAPI CCHAR KeNumberProcessors;
   5.338 +extern NTOSAPI PHAL_DISPATCH_TABLE HalDispatchTable;
   5.339 +extern NTOSAPI PHAL_PRIVATE_DISPATCH_TABLE HalPrivateDispatchTable;
   5.340 +
   5.341 +
   5.342 +/*
   5.343 +** IRP function codes
   5.344 +*/
   5.345 +
   5.346 +#define IRP_MJ_CREATE                     0x00
   5.347 +#define IRP_MJ_CREATE_NAMED_PIPE          0x01
   5.348 +#define IRP_MJ_CLOSE                      0x02
   5.349 +#define IRP_MJ_READ                       0x03
   5.350 +#define IRP_MJ_WRITE                      0x04
   5.351 +#define IRP_MJ_QUERY_INFORMATION          0x05
   5.352 +#define IRP_MJ_SET_INFORMATION            0x06
   5.353 +#define IRP_MJ_QUERY_EA                   0x07
   5.354 +#define IRP_MJ_SET_EA                     0x08
   5.355 +#define IRP_MJ_FLUSH_BUFFERS              0x09
   5.356 +#define IRP_MJ_QUERY_VOLUME_INFORMATION   0x0a
   5.357 +#define IRP_MJ_SET_VOLUME_INFORMATION     0x0b
   5.358 +#define IRP_MJ_DIRECTORY_CONTROL          0x0c
   5.359 +#define IRP_MJ_FILE_SYSTEM_CONTROL        0x0d
   5.360 +#define IRP_MJ_DEVICE_CONTROL             0x0e
   5.361 +#define IRP_MJ_INTERNAL_DEVICE_CONTROL    0x0f
   5.362 +#define IRP_MJ_SCSI                       0x0f
   5.363 +#define IRP_MJ_SHUTDOWN                   0x10
   5.364 +#define IRP_MJ_LOCK_CONTROL               0x11
   5.365 +#define IRP_MJ_CLEANUP                    0x12
   5.366 +#define IRP_MJ_CREATE_MAILSLOT            0x13
   5.367 +#define IRP_MJ_QUERY_SECURITY             0x14
   5.368 +#define IRP_MJ_SET_SECURITY               0x15
   5.369 +#define IRP_MJ_POWER                      0x16
   5.370 +#define IRP_MJ_SYSTEM_CONTROL             0x17
   5.371 +#define IRP_MJ_DEVICE_CHANGE              0x18
   5.372 +#define IRP_MJ_QUERY_QUOTA                0x19
   5.373 +#define IRP_MJ_SET_QUOTA                  0x1a
   5.374 +#define IRP_MJ_PNP                        0x1b
   5.375 +#define IRP_MJ_PNP_POWER                  0x1b
   5.376 +#define IRP_MJ_MAXIMUM_FUNCTION           0x1b
   5.377 +
   5.378 +#define IRP_MN_QUERY_DIRECTORY            0x01
   5.379 +#define IRP_MN_NOTIFY_CHANGE_DIRECTORY    0x02
   5.380 +
   5.381 +#define IRP_MN_USER_FS_REQUEST            0x00
   5.382 +#define IRP_MN_MOUNT_VOLUME               0x01
   5.383 +#define IRP_MN_VERIFY_VOLUME              0x02
   5.384 +#define IRP_MN_LOAD_FILE_SYSTEM           0x03
   5.385 +#define IRP_MN_TRACK_LINK                 0x04
   5.386 +#define IRP_MN_KERNEL_CALL                0x04
   5.387 +
   5.388 +#define IRP_MN_LOCK                       0x01
   5.389 +#define IRP_MN_UNLOCK_SINGLE              0x02
   5.390 +#define IRP_MN_UNLOCK_ALL                 0x03
   5.391 +#define IRP_MN_UNLOCK_ALL_BY_KEY          0x04
   5.392 +
   5.393 +#define IRP_MN_NORMAL                     0x00
   5.394 +#define IRP_MN_DPC                        0x01
   5.395 +#define IRP_MN_MDL                        0x02
   5.396 +#define IRP_MN_COMPLETE                   0x04
   5.397 +#define IRP_MN_COMPRESSED                 0x08
   5.398 +
   5.399 +#define IRP_MN_MDL_DPC                    (IRP_MN_MDL | IRP_MN_DPC)
   5.400 +#define IRP_MN_COMPLETE_MDL               (IRP_MN_COMPLETE | IRP_MN_MDL)
   5.401 +#define IRP_MN_COMPLETE_MDL_DPC           (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
   5.402 +
   5.403 +#define IRP_MN_SCSI_CLASS                 0x01
   5.404 +
   5.405 +#define IRP_MN_START_DEVICE               0x00
   5.406 +#define IRP_MN_QUERY_REMOVE_DEVICE        0x01
   5.407 +#define IRP_MN_REMOVE_DEVICE              0x02
   5.408 +#define IRP_MN_CANCEL_REMOVE_DEVICE       0x03
   5.409 +#define IRP_MN_STOP_DEVICE                0x04
   5.410 +#define IRP_MN_QUERY_STOP_DEVICE          0x05
   5.411 +#define IRP_MN_CANCEL_STOP_DEVICE         0x06
   5.412 +
   5.413 +#define IRP_MN_QUERY_DEVICE_RELATIONS       0x07
   5.414 +#define IRP_MN_QUERY_INTERFACE              0x08
   5.415 +#define IRP_MN_QUERY_CAPABILITIES           0x09
   5.416 +#define IRP_MN_QUERY_RESOURCES              0x0A
   5.417 +#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS  0x0B
   5.418 +#define IRP_MN_QUERY_DEVICE_TEXT            0x0C
   5.419 +#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
   5.420 +
   5.421 +#define IRP_MN_READ_CONFIG                  0x0F
   5.422 +#define IRP_MN_WRITE_CONFIG                 0x10
   5.423 +#define IRP_MN_EJECT                        0x11
   5.424 +#define IRP_MN_SET_LOCK                     0x12
   5.425 +#define IRP_MN_QUERY_ID                     0x13
   5.426 +#define IRP_MN_QUERY_PNP_DEVICE_STATE       0x14
   5.427 +#define IRP_MN_QUERY_BUS_INFORMATION        0x15
   5.428 +#define IRP_MN_DEVICE_USAGE_NOTIFICATION    0x16
   5.429 +#define IRP_MN_SURPRISE_REMOVAL             0x17
   5.430 +#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
   5.431 +
   5.432 +#define IRP_MN_WAIT_WAKE                  0x00
   5.433 +#define IRP_MN_POWER_SEQUENCE             0x01
   5.434 +#define IRP_MN_SET_POWER                  0x02
   5.435 +#define IRP_MN_QUERY_POWER                0x03
   5.436 +
   5.437 +#define IRP_MN_QUERY_ALL_DATA             0x00
   5.438 +#define IRP_MN_QUERY_SINGLE_INSTANCE      0x01
   5.439 +#define IRP_MN_CHANGE_SINGLE_INSTANCE     0x02
   5.440 +#define IRP_MN_CHANGE_SINGLE_ITEM         0x03
   5.441 +#define IRP_MN_ENABLE_EVENTS              0x04
   5.442 +#define IRP_MN_DISABLE_EVENTS             0x05
   5.443 +#define IRP_MN_ENABLE_COLLECTION          0x06
   5.444 +#define IRP_MN_DISABLE_COLLECTION         0x07
   5.445 +#define IRP_MN_REGINFO                    0x08
   5.446 +#define IRP_MN_EXECUTE_METHOD             0x09
   5.447 +
   5.448 +#define IRP_MN_REGINFO_EX                 0x0b
   5.449 +
   5.450 +typedef enum _IO_ALLOCATION_ACTION {
   5.451 +  KeepObject = 1,
   5.452 +  DeallocateObject,
   5.453 +  DeallocateObjectKeepRegisters
   5.454 +} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
   5.455 +
   5.456 +typedef IO_ALLOCATION_ACTION
   5.457 +(DDKAPI *PDRIVER_CONTROL)(
   5.458 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.459 +  /*IN*/ struct _IRP  *Irp,
   5.460 +  /*IN*/ PVOID  MapRegisterBase,
   5.461 +  /*IN*/ PVOID  Context);
   5.462 +
   5.463 +typedef VOID
   5.464 +(DDKAPI *PDRIVER_LIST_CONTROL)(
   5.465 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.466 +  /*IN*/ struct _IRP  *Irp,
   5.467 +  /*IN*/ struct _SCATTER_GATHER_LIST  *ScatterGather,
   5.468 +  /*IN*/ PVOID  Context);
   5.469 +
   5.470 +typedef NTSTATUS
   5.471 +(DDKAPI *PDRIVER_ADD_DEVICE)(
   5.472 +  /*IN*/ struct _DRIVER_OBJECT  *DriverObject,
   5.473 +  /*IN*/ struct _DEVICE_OBJECT  *PhysicalDeviceObject);
   5.474 +
   5.475 +typedef NTSTATUS
   5.476 +(DDKAPI *PIO_COMPLETION_ROUTINE)(
   5.477 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.478 +  /*IN*/ struct _IRP  *Irp,
   5.479 +  /*IN*/ PVOID  Context);
   5.480 +
   5.481 +typedef VOID
   5.482 +(DDKAPI *PDRIVER_CANCEL)(
   5.483 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.484 +  /*IN*/ struct _IRP  *Irp);
   5.485 +
   5.486 +typedef VOID
   5.487 +(DDKAPI *PKDEFERRED_ROUTINE)(
   5.488 +  /*IN*/ struct _KDPC  *Dpc,
   5.489 +  /*IN*/ PVOID  DeferredContext,
   5.490 +  /*IN*/ PVOID  SystemArgument1,
   5.491 +  /*IN*/ PVOID  SystemArgument2);
   5.492 +
   5.493 +typedef NTSTATUS
   5.494 +(DDKAPI *PDRIVER_DISPATCH)(
   5.495 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.496 +  /*IN*/ struct _IRP  *Irp);
   5.497 +
   5.498 +typedef VOID
   5.499 +(DDKAPI *PIO_DPC_ROUTINE)(
   5.500 +  /*IN*/ struct _KDPC  *Dpc,
   5.501 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.502 +  /*IN*/ struct _IRP  *Irp,
   5.503 +  /*IN*/ PVOID  Context);
   5.504 +
   5.505 +typedef NTSTATUS
   5.506 +(DDKAPI *PMM_DLL_INITIALIZE)(
   5.507 +  /*IN*/ PUNICODE_STRING  RegistryPath);
   5.508 +
   5.509 +typedef NTSTATUS
   5.510 +(DDKAPI *PMM_DLL_UNLOAD)(
   5.511 +  VOID);
   5.512 +
   5.513 +typedef NTSTATUS
   5.514 +(DDKAPI *PDRIVER_ENTRY)( 
   5.515 +  /*IN*/ struct _DRIVER_OBJECT  *DriverObject, 
   5.516 +  /*IN*/ PUNICODE_STRING  RegistryPath); 
   5.517 +
   5.518 +typedef NTSTATUS
   5.519 +(DDKAPI *PDRIVER_INITIALIZE)(
   5.520 +  /*IN*/ struct _DRIVER_OBJECT  *DriverObject, 
   5.521 +  /*IN*/ PUNICODE_STRING  RegistryPath);
   5.522 +
   5.523 +typedef BOOLEAN
   5.524 +(DDKAPI *PKSERVICE_ROUTINE)(
   5.525 +  /*IN*/ struct _KINTERRUPT  *Interrupt,
   5.526 +  /*IN*/ PVOID  ServiceContext);
   5.527 +
   5.528 +typedef VOID
   5.529 +(DDKAPI *PIO_TIMER_ROUTINE)(
   5.530 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.531 +  /*IN*/ PVOID  Context);
   5.532 +
   5.533 +typedef VOID
   5.534 +(DDKAPI *PDRIVER_REINITIALIZE)( 
   5.535 +  /*IN*/ struct _DRIVER_OBJECT  *DriverObject, 
   5.536 +  /*IN*/ PVOID  Context, 
   5.537 +  /*IN*/ ULONG  Count); 
   5.538 +
   5.539 +typedef NTSTATUS
   5.540 +(DDKAPI *PDRIVER_STARTIO)(
   5.541 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   5.542 +  /*IN*/ struct _IRP  *Irp);
   5.543 +
   5.544 +typedef BOOLEAN
   5.545 +(DDKAPI *PKSYNCHRONIZE_ROUTINE)(
   5.546 +  /*IN*/ PVOID  SynchronizeContext);
   5.547 +
   5.548 +typedef VOID
   5.549 +(DDKAPI *PDRIVER_UNLOAD)( 
   5.550 +  /*IN*/ struct _DRIVER_OBJECT  *DriverObject); 
   5.551 +
   5.552 +
   5.553 +
   5.554 +/*
   5.555 +** Plug and Play structures
   5.556 +*/
   5.557 +
   5.558 +typedef VOID DDKAPI
   5.559 +(*PINTERFACE_REFERENCE)(
   5.560 +  PVOID  Context);
   5.561 +
   5.562 +typedef VOID DDKAPI
   5.563 +(*PINTERFACE_DEREFERENCE)(
   5.564 +  PVOID Context);
   5.565 +
   5.566 +typedef BOOLEAN DDKAPI
   5.567 +(*PTRANSLATE_BUS_ADDRESS)(
   5.568 +  /*IN*/ PVOID  Context,
   5.569 +  /*IN*/ PHYSICAL_ADDRESS  BusAddress,
   5.570 +  /*IN*/ ULONG  Length,
   5.571 +  /*IN OUT*/ PULONG  AddressSpace,
   5.572 +  /*OUT*/ PPHYSICAL_ADDRESS  TranslatedAddress);
   5.573 +
   5.574 +typedef struct _DMA_ADAPTER* DDKAPI
   5.575 +(*PGET_DMA_ADAPTER)(
   5.576 +  /*IN*/ PVOID  Context,
   5.577 +  /*IN*/ struct _DEVICE_DESCRIPTION  *DeviceDescriptor,
   5.578 +  /*OUT*/ PULONG  NumberOfMapRegisters);
   5.579 +
   5.580 +typedef ULONG DDKAPI
   5.581 +(*PGET_SET_DEVICE_DATA)(
   5.582 +  /*IN*/ PVOID  Context,
   5.583 +  /*IN*/ ULONG  DataType,
   5.584 +  /*IN*/ PVOID  Buffer,
   5.585 +  /*IN*/ ULONG  Offset,
   5.586 +  /*IN*/ ULONG  Length);
   5.587 +
   5.588 +typedef union _POWER_STATE {
   5.589 +  SYSTEM_POWER_STATE  SystemState;
   5.590 +  DEVICE_POWER_STATE  DeviceState;
   5.591 +} POWER_STATE, *PPOWER_STATE;
   5.592 +
   5.593 +typedef enum _POWER_STATE_TYPE {
   5.594 +  SystemPowerState,
   5.595 +  DevicePowerState
   5.596 +} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
   5.597 +
   5.598 +typedef struct _BUS_INTERFACE_STANDARD {
   5.599 +  USHORT  Size;
   5.600 +  USHORT  Version;
   5.601 +  PVOID  Context;
   5.602 +  PINTERFACE_REFERENCE  InterfaceReference;
   5.603 +  PINTERFACE_DEREFERENCE  InterfaceDereference;
   5.604 +  PTRANSLATE_BUS_ADDRESS  TranslateBusAddress;
   5.605 +  PGET_DMA_ADAPTER  GetDmaAdapter;
   5.606 +  PGET_SET_DEVICE_DATA  SetBusData;
   5.607 +  PGET_SET_DEVICE_DATA  GetBusData;
   5.608 +} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
   5.609 +
   5.610 +typedef struct _DEVICE_CAPABILITIES {
   5.611 +  USHORT  Size;
   5.612 +  USHORT  Version;
   5.613 +  ULONG  DeviceD1 : 1;
   5.614 +  ULONG  DeviceD2 : 1;
   5.615 +  ULONG  LockSupported : 1;
   5.616 +  ULONG  EjectSupported : 1;
   5.617 +  ULONG  Removable : 1;
   5.618 +  ULONG  DockDevice : 1;
   5.619 +  ULONG  UniqueID : 1;
   5.620 +  ULONG  SilentInstall : 1;
   5.621 +  ULONG  RawDeviceOK : 1;
   5.622 +  ULONG  SurpriseRemovalOK : 1;
   5.623 +  ULONG  WakeFromD0 : 1;
   5.624 +  ULONG  WakeFromD1 : 1;
   5.625 +  ULONG  WakeFromD2 : 1;
   5.626 +  ULONG  WakeFromD3 : 1;
   5.627 +  ULONG  HardwareDisabled : 1;
   5.628 +  ULONG  NonDynamic : 1;
   5.629 +  ULONG  WarmEjectSupported : 1;
   5.630 +  ULONG  NoDisplayInUI : 1;
   5.631 +  ULONG  Reserved : 14;
   5.632 +  ULONG  Address;
   5.633 +  ULONG  UINumber;
   5.634 +  DEVICE_POWER_STATE  DeviceState[PowerSystemMaximum];
   5.635 +  SYSTEM_POWER_STATE  SystemWake;
   5.636 +  DEVICE_POWER_STATE  DeviceWake;
   5.637 +  ULONG  D1Latency;
   5.638 +  ULONG  D2Latency;
   5.639 +  ULONG  D3Latency;
   5.640 +} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
   5.641 +
   5.642 +typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
   5.643 +  USHORT  Version;
   5.644 +  USHORT  Size;
   5.645 +  GUID  Event;
   5.646 +  GUID  InterfaceClassGuid;
   5.647 +  PUNICODE_STRING  SymbolicLinkName;
   5.648 +} DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
   5.649 +
   5.650 +typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
   5.651 +  USHORT  Version;
   5.652 +  USHORT  Size;
   5.653 +  GUID  Event;
   5.654 +} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
   5.655 +
   5.656 +#undef INTERFACE
   5.657 +
   5.658 +typedef struct _INTERFACE {
   5.659 +  USHORT  Size;
   5.660 +  USHORT  Version;
   5.661 +  PVOID  Context;
   5.662 +  PINTERFACE_REFERENCE  InterfaceReference;
   5.663 +  PINTERFACE_DEREFERENCE  InterfaceDereference;
   5.664 +} INTERFACE, *PINTERFACE; 
   5.665 +
   5.666 +typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
   5.667 +  USHORT  Version; 
   5.668 +  USHORT  Size; 
   5.669 +  GUID  Event;
   5.670 +} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
   5.671 +
   5.672 +typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
   5.673 +
   5.674 +/* PNP_DEVICE_STATE */
   5.675 +
   5.676 +#define PNP_DEVICE_DISABLED                      0x00000001
   5.677 +#define PNP_DEVICE_DONT_DISPLAY_IN_UI            0x00000002
   5.678 +#define PNP_DEVICE_FAILED                        0x00000004
   5.679 +#define PNP_DEVICE_REMOVED                       0x00000008
   5.680 +#define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
   5.681 +#define PNP_DEVICE_NOT_DISABLEABLE               0x00000020
   5.682 +
   5.683 +typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
   5.684 +  USHORT  Version;
   5.685 +  USHORT  Size;
   5.686 +  GUID  Event;
   5.687 +  struct _FILE_OBJECT  *FileObject;
   5.688 +  LONG  NameBufferOffset;
   5.689 +  UCHAR  CustomDataBuffer[1];
   5.690 +} TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
   5.691 +
   5.692 +typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
   5.693 +  USHORT  Version;
   5.694 +  USHORT  Size;
   5.695 +  GUID  Event;
   5.696 +  struct _FILE_OBJECT  *FileObject;
   5.697 +} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
   5.698 +
   5.699 +typedef enum _BUS_QUERY_ID_TYPE {
   5.700 +  BusQueryDeviceID,
   5.701 +  BusQueryHardwareIDs,
   5.702 +  BusQueryCompatibleIDs,
   5.703 +  BusQueryInstanceID,
   5.704 +  BusQueryDeviceSerialNumber
   5.705 +} BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
   5.706 +
   5.707 +typedef enum _DEVICE_TEXT_TYPE {
   5.708 +  DeviceTextDescription,
   5.709 +  DeviceTextLocationInformation
   5.710 +} DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
   5.711 +
   5.712 +typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
   5.713 +  DeviceUsageTypeUndefined,
   5.714 +  DeviceUsageTypePaging,
   5.715 +  DeviceUsageTypeHibernation,
   5.716 +  DeviceUsageTypeDumpFile
   5.717 +} DEVICE_USAGE_NOTIFICATION_TYPE;
   5.718 +
   5.719 +typedef struct _POWER_SEQUENCE {
   5.720 +  ULONG  SequenceD1;
   5.721 +  ULONG  SequenceD2;
   5.722 +  ULONG  SequenceD3;
   5.723 +} POWER_SEQUENCE, *PPOWER_SEQUENCE;
   5.724 +
   5.725 +typedef enum {
   5.726 +  DevicePropertyDeviceDescription,
   5.727 +  DevicePropertyHardwareID,
   5.728 +  DevicePropertyCompatibleIDs,
   5.729 +  DevicePropertyBootConfiguration,
   5.730 +  DevicePropertyBootConfigurationTranslated,
   5.731 +  DevicePropertyClassName,
   5.732 +  DevicePropertyClassGuid,
   5.733 +  DevicePropertyDriverKeyName,
   5.734 +  DevicePropertyManufacturer,
   5.735 +  DevicePropertyFriendlyName,
   5.736 +  DevicePropertyLocationInformation,
   5.737 +  DevicePropertyPhysicalDeviceObjectName,
   5.738 +  DevicePropertyBusTypeGuid,
   5.739 +  DevicePropertyLegacyBusType,
   5.740 +  DevicePropertyBusNumber,
   5.741 +  DevicePropertyEnumeratorName,
   5.742 +  DevicePropertyAddress,
   5.743 +  DevicePropertyUINumber,
   5.744 +  DevicePropertyInstallState,
   5.745 +  DevicePropertyRemovalPolicy
   5.746 +} DEVICE_REGISTRY_PROPERTY;
   5.747 +
   5.748 +typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
   5.749 +  EventCategoryReserved,
   5.750 +  EventCategoryHardwareProfileChange,
   5.751 +  EventCategoryDeviceInterfaceChange,
   5.752 +  EventCategoryTargetDeviceChange
   5.753 +} IO_NOTIFICATION_EVENT_CATEGORY;
   5.754 +
   5.755 +#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES    0x00000001
   5.756 +
   5.757 +typedef NTSTATUS DDKAPI
   5.758 +(*PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
   5.759 +  /*IN*/ PVOID NotificationStructure,
   5.760 +  /*IN*/ PVOID Context);
   5.761 +
   5.762 +typedef VOID DDKAPI
   5.763 +(*PDEVICE_CHANGE_COMPLETE_CALLBACK)(
   5.764 +  /*IN*/ PVOID Context);
   5.765 +
   5.766 +
   5.767 +
   5.768 +/*
   5.769 +** System structures
   5.770 +*/
   5.771 +
   5.772 +#define SYMBOLIC_LINK_QUERY               0x0001
   5.773 +#define SYMBOLIC_LINK_ALL_ACCESS          (STANDARD_RIGHTS_REQUIRED | 0x1)
   5.774 +
   5.775 +/* also in winnt,h */
   5.776 +#define DUPLICATE_CLOSE_SOURCE            0x00000001
   5.777 +#define DUPLICATE_SAME_ACCESS             0x00000002
   5.778 +#define DUPLICATE_SAME_ATTRIBUTES         0x00000004
   5.779 +/* end winnt.h */
   5.780 +
   5.781 +typedef struct _OBJECT_NAME_INFORMATION {               
   5.782 +  UNICODE_STRING  Name;                                
   5.783 +} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;   
   5.784 +
   5.785 +typedef VOID DDKAPI
   5.786 +(*PIO_APC_ROUTINE)(
   5.787 +  /*IN*/ PVOID ApcContext,
   5.788 +  /*IN*/ PIO_STATUS_BLOCK IoStatusBlock,
   5.789 +  /*IN*/ ULONG Reserved);
   5.790 +
   5.791 +typedef struct _IO_STATUS_BLOCK {
   5.792 +  _ANONYMOUS_UNION union {
   5.793 +    NTSTATUS  Status;
   5.794 +    PVOID  Pointer;
   5.795 +  } DUMMYUNIONNAME;
   5.796 +  ULONG_PTR  Information;
   5.797 +} IO_STATUS_BLOCK;
   5.798 +
   5.799 +typedef VOID DDKAPI
   5.800 +(*PKNORMAL_ROUTINE)(
   5.801 +  /*IN*/ PVOID  NormalContext,
   5.802 +  /*IN*/ PVOID  SystemArgument1,
   5.803 +  /*IN*/ PVOID  SystemArgument2);
   5.804 +
   5.805 +typedef VOID DDKAPI
   5.806 +(*PKKERNEL_ROUTINE)(
   5.807 +  /*IN*/ struct _KAPC  *Apc,
   5.808 +  /*IN OUT*/ PKNORMAL_ROUTINE  *NormalRoutine,
   5.809 +  /*IN OUT*/ PVOID  *NormalContext,
   5.810 +  /*IN OUT*/ PVOID  *SystemArgument1,
   5.811 +  /*IN OUT*/ PVOID  *SystemArgument2);
   5.812 +
   5.813 +typedef VOID DDKAPI
   5.814 +(*PKRUNDOWN_ROUTINE)(
   5.815 +  /*IN*/ struct _KAPC  *Apc);
   5.816 +
   5.817 +typedef BOOLEAN DDKAPI
   5.818 +(*PKTRANSFER_ROUTINE)(
   5.819 +  VOID);
   5.820 +
   5.821 +typedef struct _KAPC {
   5.822 +  CSHORT  Type;
   5.823 +  CSHORT  Size;
   5.824 +  ULONG  Spare0;
   5.825 +  struct _KTHREAD  *Thread;
   5.826 +  LIST_ENTRY  ApcListEntry;
   5.827 +  PKKERNEL_ROUTINE  KernelRoutine;
   5.828 +  PKRUNDOWN_ROUTINE  RundownRoutine;
   5.829 +  PKNORMAL_ROUTINE  NormalRoutine;
   5.830 +  PVOID  NormalContext;
   5.831 +  PVOID  SystemArgument1;
   5.832 +  PVOID  SystemArgument2;
   5.833 +  CCHAR  ApcStateIndex;
   5.834 +  KPROCESSOR_MODE  ApcMode;
   5.835 +  BOOLEAN  Inserted;
   5.836 +} KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
   5.837 +
   5.838 +typedef struct _KDEVICE_QUEUE {
   5.839 +  CSHORT  Type;
   5.840 +  CSHORT  Size;
   5.841 +  LIST_ENTRY  DeviceListHead;
   5.842 +  KSPIN_LOCK  Lock;
   5.843 +  BOOLEAN  Busy;
   5.844 +} KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
   5.845 +
   5.846 +typedef struct _KDEVICE_QUEUE_ENTRY {
   5.847 +  LIST_ENTRY  DeviceListEntry;
   5.848 +  ULONG  SortKey;
   5.849 +  BOOLEAN  Inserted;
   5.850 +} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
   5.851 +*RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
   5.852 +
   5.853 +#define LOCK_QUEUE_WAIT                   1
   5.854 +#define LOCK_QUEUE_OWNER                  2
   5.855 +
   5.856 +typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
   5.857 +  LockQueueDispatcherLock,
   5.858 +  LockQueueContextSwapLock,
   5.859 +  LockQueuePfnLock,
   5.860 +  LockQueueSystemSpaceLock,
   5.861 +  LockQueueVacbLock,
   5.862 +  LockQueueMasterLock,
   5.863 +  LockQueueNonPagedPoolLock,
   5.864 +  LockQueueIoCancelLock,
   5.865 +  LockQueueWorkQueueLock,
   5.866 +  LockQueueIoVpbLock,
   5.867 +  LockQueueIoDatabaseLock,
   5.868 +  LockQueueIoCompletionLock,
   5.869 +  LockQueueNtfsStructLock,
   5.870 +  LockQueueAfdWorkQueueLock,
   5.871 +  LockQueueBcbLock,
   5.872 +  LockQueueMaximumLock
   5.873 +} KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
   5.874 +
   5.875 +typedef struct _KSPIN_LOCK_QUEUE {
   5.876 +  struct _KSPIN_LOCK_QUEUE  *VOLATILE Next;
   5.877 +  PKSPIN_LOCK VOLATILE  Lock;
   5.878 +} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
   5.879 +
   5.880 +typedef struct _KLOCK_QUEUE_HANDLE {
   5.881 +  KSPIN_LOCK_QUEUE  LockQueue;
   5.882 +  KIRQL  OldIrql;
   5.883 +} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
   5.884 +
   5.885 +typedef struct _KDPC {
   5.886 +  CSHORT  Type;
   5.887 +  UCHAR  Number;
   5.888 +  UCHAR  Importance;
   5.889 +  LIST_ENTRY  DpcListEntry;
   5.890 +  PKDEFERRED_ROUTINE  DeferredRoutine;
   5.891 +  PVOID  DeferredContext;
   5.892 +  PVOID  SystemArgument1;
   5.893 +  PVOID  SystemArgument2;
   5.894 +  PULONG_PTR  Lock;
   5.895 +} KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
   5.896 +
   5.897 +typedef struct _WAIT_CONTEXT_BLOCK {
   5.898 +  KDEVICE_QUEUE_ENTRY  WaitQueueEntry;
   5.899 +  struct _DRIVER_CONTROL  *DeviceRoutine;
   5.900 +  PVOID  DeviceContext;
   5.901 +  ULONG  NumberOfMapRegisters;
   5.902 +  PVOID  DeviceObject;
   5.903 +  PVOID  CurrentIrp;
   5.904 +  PKDPC  BufferChainingDpc;
   5.905 +} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
   5.906 +
   5.907 +typedef struct _DISPATCHER_HEADER {
   5.908 +  UCHAR  Type;
   5.909 +  UCHAR  Absolute;
   5.910 +  UCHAR  Size;
   5.911 +  UCHAR  Inserted;
   5.912 +  LONG  SignalState;
   5.913 +  LIST_ENTRY  WaitListHead;
   5.914 +} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
   5.915 +
   5.916 +typedef struct _KEVENT {
   5.917 +  DISPATCHER_HEADER  Header;
   5.918 +} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
   5.919 +
   5.920 +typedef struct _KSEMAPHORE {
   5.921 +    DISPATCHER_HEADER Header;
   5.922 +    LONG Limit;
   5.923 +} KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
   5.924 +
   5.925 +typedef struct _FAST_MUTEX {
   5.926 +  LONG  Count;
   5.927 +  struct _KTHREAD  *Owner;
   5.928 +  ULONG  Contention;
   5.929 +  KEVENT  Event;
   5.930 +  ULONG  OldIrql;
   5.931 +} FAST_MUTEX, *PFAST_MUTEX;
   5.932 +
   5.933 +typedef struct _KTIMER {
   5.934 +  DISPATCHER_HEADER  Header;
   5.935 +  ULARGE_INTEGER  DueTime;
   5.936 +  LIST_ENTRY  TimerListEntry;
   5.937 +  struct _KDPC  *Dpc;
   5.938 +  LONG  Period;
   5.939 +} KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
   5.940 +
   5.941 +typedef struct _KMUTANT {
   5.942 +  DISPATCHER_HEADER  Header;
   5.943 +  LIST_ENTRY  MutantListEntry;
   5.944 +  struct _KTHREAD  *RESTRICTED_POINTER OwnerThread;
   5.945 +  BOOLEAN  Abandoned;
   5.946 +  UCHAR  ApcDisable;
   5.947 +} KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
   5.948 +
   5.949 +typedef enum _TIMER_TYPE {
   5.950 +  NotificationTimer,
   5.951 +  SynchronizationTimer
   5.952 +} TIMER_TYPE;
   5.953 +
   5.954 +#define EVENT_INCREMENT                   1
   5.955 +#define IO_NO_INCREMENT                   0
   5.956 +#define IO_CD_ROM_INCREMENT               1
   5.957 +#define IO_DISK_INCREMENT                 1
   5.958 +#define IO_KEYBOARD_INCREMENT             6
   5.959 +#define IO_MAILSLOT_INCREMENT             2
   5.960 +#define IO_MOUSE_INCREMENT                6
   5.961 +#define IO_NAMED_PIPE_INCREMENT           2
   5.962 +#define IO_NETWORK_INCREMENT              2
   5.963 +#define IO_PARALLEL_INCREMENT             1
   5.964 +#define IO_SERIAL_INCREMENT               2
   5.965 +#define IO_SOUND_INCREMENT                8
   5.966 +#define IO_VIDEO_INCREMENT                1
   5.967 +#define SEMAPHORE_INCREMENT               1
   5.968 +
   5.969 +typedef struct _IRP {
   5.970 +  CSHORT  Type;
   5.971 +  USHORT  Size;
   5.972 +  struct _MDL  *MdlAddress;
   5.973 +  ULONG  Flags;
   5.974 +  union {
   5.975 +    struct _IRP  *MasterIrp;
   5.976 +    LONG  IrpCount;
   5.977 +    PVOID  SystemBuffer;
   5.978 +  } AssociatedIrp;
   5.979 +  LIST_ENTRY  ThreadListEntry;
   5.980 +  IO_STATUS_BLOCK  IoStatus;
   5.981 +  KPROCESSOR_MODE  RequestorMode;
   5.982 +  BOOLEAN  PendingReturned;
   5.983 +  CHAR  StackCount;
   5.984 +  CHAR  CurrentLocation;
   5.985 +  BOOLEAN  Cancel;
   5.986 +  KIRQL  CancelIrql;
   5.987 +  CCHAR  ApcEnvironment;
   5.988 +  UCHAR  AllocationFlags;
   5.989 +  PIO_STATUS_BLOCK  UserIosb;
   5.990 +  PKEVENT  UserEvent;
   5.991 +  union {
   5.992 +    struct {
   5.993 +      PIO_APC_ROUTINE  UserApcRoutine;
   5.994 +      PVOID  UserApcContext;
   5.995 +    } AsynchronousParameters;
   5.996 +    LARGE_INTEGER  AllocationSize;
   5.997 +  } Overlay;
   5.998 +  PDRIVER_CANCEL  CancelRoutine;
   5.999 +  PVOID  UserBuffer;
  5.1000 +  union {
  5.1001 +    struct {
  5.1002 +      _ANONYMOUS_UNION union {
  5.1003 +        KDEVICE_QUEUE_ENTRY  DeviceQueueEntry;
  5.1004 +        _ANONYMOUS_STRUCT struct {
  5.1005 +          PVOID  DriverContext[4];
  5.1006 +        } DUMMYSTRUCTNAME;
  5.1007 +      } DUMMYUNIONNAME;
  5.1008 +      PETHREAD  Thread;
  5.1009 +      PCHAR  AuxiliaryBuffer;
  5.1010 +      _ANONYMOUS_STRUCT struct {
  5.1011 +        LIST_ENTRY  ListEntry;
  5.1012 +        _ANONYMOUS_UNION union {
  5.1013 +          struct _IO_STACK_LOCATION  *CurrentStackLocation;
  5.1014 +          ULONG  PacketType;
  5.1015 +        } DUMMYUNIONNAME;
  5.1016 +      } DUMMYSTRUCTNAME;
  5.1017 +      struct _FILE_OBJECT  *OriginalFileObject;
  5.1018 +    } Overlay;
  5.1019 +    KAPC  Apc;
  5.1020 +    PVOID  CompletionKey;
  5.1021 +  } Tail;
  5.1022 +} IRP;
  5.1023 +typedef struct _IRP *PIRP;
  5.1024 +
  5.1025 +/* IRP.Flags */
  5.1026 +
  5.1027 +#define SL_FORCE_ACCESS_CHECK             0x01
  5.1028 +#define SL_OPEN_PAGING_FILE               0x02
  5.1029 +#define SL_OPEN_TARGET_DIRECTORY          0x04
  5.1030 +#define SL_CASE_SENSITIVE                 0x80
  5.1031 +
  5.1032 +#define SL_KEY_SPECIFIED                  0x01
  5.1033 +#define SL_OVERRIDE_VERIFY_VOLUME         0x02
  5.1034 +#define SL_WRITE_THROUGH                  0x04
  5.1035 +#define SL_FT_SEQUENTIAL_WRITE            0x08
  5.1036 +
  5.1037 +#define SL_FAIL_IMMEDIATELY               0x01
  5.1038 +#define SL_EXCLUSIVE_LOCK                 0x02
  5.1039 +
  5.1040 +#define SL_RESTART_SCAN                   0x01
  5.1041 +#define SL_RETURN_SINGLE_ENTRY            0x02
  5.1042 +#define SL_INDEX_SPECIFIED                0x04
  5.1043 +
  5.1044 +#define SL_WATCH_TREE                     0x01
  5.1045 +
  5.1046 +#define SL_ALLOW_RAW_MOUNT                0x01
  5.1047 +
  5.1048 +#define CTL_CODE(DeviceType, Function, Method, Access)( \
  5.1049 +  ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
  5.1050 +
  5.1051 +#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
  5.1052 +
  5.1053 +enum
  5.1054 +{
  5.1055 +   IRP_NOCACHE = 0x1,
  5.1056 +   IRP_PAGING_IO = 0x2,
  5.1057 +   IRP_MOUNT_COMPLETION = 0x2,
  5.1058 +   IRP_SYNCHRONOUS_API = 0x4,
  5.1059 +   IRP_ASSOCIATED_IRP = 0x8,
  5.1060 +   IRP_BUFFERED_IO = 0x10,
  5.1061 +   IRP_DEALLOCATE_BUFFER = 0x20,
  5.1062 +   IRP_INPUT_OPERATION = 0x40,
  5.1063 +   IRP_SYNCHRONOUS_PAGING_IO = 0x40,
  5.1064 +   IRP_CREATE_OPERATION = 0x80,
  5.1065 +   IRP_READ_OPERATION = 0x100,
  5.1066 +   IRP_WRITE_OPERATION = 0x200,
  5.1067 +   IRP_CLOSE_OPERATION = 0x400,
  5.1068 +   IRP_DEFER_IO_COMPLETION = 0x800,
  5.1069 +   IRP_OB_QUERY_NAME = 0x1000,
  5.1070 +   IRP_HOLD_DEVICE_QUEUE = 0x2000,
  5.1071 +   IRP_RETRY_IO_COMPLETION = 0x4000
  5.1072 +};
  5.1073 +
  5.1074 +
  5.1075 +typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
  5.1076 +  ULONG  Signature;
  5.1077 +} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
  5.1078 +
  5.1079 +typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
  5.1080 +  GUID  DiskId;
  5.1081 +  LARGE_INTEGER  StartingUsableOffset;
  5.1082 +  LARGE_INTEGER  UsableLength;
  5.1083 +  ULONG  MaxPartitionCount;
  5.1084 +} DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
  5.1085 +
  5.1086 +typedef struct _PARTITION_INFORMATION_MBR {
  5.1087 +  UCHAR  PartitionType;
  5.1088 +  BOOLEAN  BootIndicator;
  5.1089 +  BOOLEAN  RecognizedPartition;
  5.1090 +  ULONG  HiddenSectors;
  5.1091 +} PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
  5.1092 +
  5.1093 +
  5.1094 +typedef struct _BOOTDISK_INFORMATION {
  5.1095 +  LONGLONG  BootPartitionOffset;
  5.1096 +  LONGLONG  SystemPartitionOffset;
  5.1097 +  ULONG  BootDeviceSignature;
  5.1098 +  ULONG  SystemDeviceSignature;
  5.1099 +} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
  5.1100 +
  5.1101 +typedef struct _BOOTDISK_INFORMATION_EX {
  5.1102 +  LONGLONG  BootPartitionOffset;
  5.1103 +  LONGLONG  SystemPartitionOffset;
  5.1104 +  ULONG  BootDeviceSignature;
  5.1105 +  ULONG  SystemDeviceSignature;
  5.1106 +  GUID  BootDeviceGuid;
  5.1107 +  GUID  SystemDeviceGuid;
  5.1108 +  BOOLEAN  BootDeviceIsGpt;
  5.1109 +  BOOLEAN  SystemDeviceIsGpt;
  5.1110 +} BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
  5.1111 +
  5.1112 +typedef struct _EISA_MEMORY_TYPE {
  5.1113 +  UCHAR  ReadWrite : 1;
  5.1114 +  UCHAR  Cached : 1;
  5.1115 +  UCHAR  Reserved0 : 1;
  5.1116 +  UCHAR  Type : 2;
  5.1117 +  UCHAR  Shared : 1;
  5.1118 +  UCHAR  Reserved1 : 1;
  5.1119 +  UCHAR  MoreEntries : 1;
  5.1120 +} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
  5.1121 +
  5.1122 +#include <pshpack1.h>
  5.1123 +typedef struct _EISA_MEMORY_CONFIGURATION {
  5.1124 +  EISA_MEMORY_TYPE  ConfigurationByte;
  5.1125 +  UCHAR  DataSize;
  5.1126 +  USHORT  AddressLowWord;
  5.1127 +  UCHAR  AddressHighByte;
  5.1128 +  USHORT  MemorySize;
  5.1129 +} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
  5.1130 +#include <poppack.h>
  5.1131 +
  5.1132 +typedef struct _EISA_IRQ_DESCRIPTOR {
  5.1133 +  UCHAR  Interrupt : 4;
  5.1134 +  UCHAR  Reserved : 1;
  5.1135 +  UCHAR  LevelTriggered : 1;
  5.1136 +  UCHAR  Shared : 1;
  5.1137 +  UCHAR  MoreEntries : 1;
  5.1138 +} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
  5.1139 +
  5.1140 +typedef struct _EISA_IRQ_CONFIGURATION {
  5.1141 +  EISA_IRQ_DESCRIPTOR  ConfigurationByte;
  5.1142 +  UCHAR  Reserved;
  5.1143 +} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
  5.1144 +
  5.1145 +typedef struct _DMA_CONFIGURATION_BYTE0 {
  5.1146 +  UCHAR Channel : 3;
  5.1147 +  UCHAR Reserved : 3;
  5.1148 +  UCHAR Shared : 1;
  5.1149 +  UCHAR MoreEntries : 1;
  5.1150 +} DMA_CONFIGURATION_BYTE0;
  5.1151 +
  5.1152 +typedef struct _DMA_CONFIGURATION_BYTE1 {
  5.1153 +  UCHAR  Reserved0 : 2;
  5.1154 +  UCHAR  TransferSize : 2;
  5.1155 +  UCHAR  Timing : 2;
  5.1156 +  UCHAR  Reserved1 : 2;
  5.1157 +} DMA_CONFIGURATION_BYTE1;
  5.1158 +
  5.1159 +typedef struct _EISA_DMA_CONFIGURATION {
  5.1160 +  DMA_CONFIGURATION_BYTE0  ConfigurationByte0;
  5.1161 +  DMA_CONFIGURATION_BYTE1  ConfigurationByte1;
  5.1162 +} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
  5.1163 +
  5.1164 +#include <pshpack1.h>
  5.1165 +typedef struct _EISA_PORT_DESCRIPTOR {
  5.1166 +  UCHAR  NumberPorts : 5;
  5.1167 +  UCHAR  Reserved : 1;
  5.1168 +  UCHAR  Shared : 1;
  5.1169 +  UCHAR  MoreEntries : 1;
  5.1170 +} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
  5.1171 +
  5.1172 +typedef struct _EISA_PORT_CONFIGURATION {
  5.1173 +  EISA_PORT_DESCRIPTOR  Configuration;
  5.1174 +  USHORT  PortAddress;
  5.1175 +} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
  5.1176 +#include <poppack.h>
  5.1177 +
  5.1178 +typedef struct _CM_EISA_FUNCTION_INFORMATION {
  5.1179 +  ULONG  CompressedId;
  5.1180 +  UCHAR  IdSlotFlags1;
  5.1181 +  UCHAR  IdSlotFlags2;
  5.1182 +  UCHAR  MinorRevision;
  5.1183 +  UCHAR  MajorRevision;
  5.1184 +  UCHAR  Selections[26];
  5.1185 +  UCHAR  FunctionFlags;
  5.1186 +  UCHAR  TypeString[80];
  5.1187 +  EISA_MEMORY_CONFIGURATION  EisaMemory[9];
  5.1188 +  EISA_IRQ_CONFIGURATION  EisaIrq[7];
  5.1189 +  EISA_DMA_CONFIGURATION  EisaDma[4];
  5.1190 +  EISA_PORT_CONFIGURATION  EisaPort[20];
  5.1191 +  UCHAR  InitializationData[60];
  5.1192 +} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
  5.1193 +
  5.1194 +/* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
  5.1195 +
  5.1196 +#define EISA_FUNCTION_ENABLED           0x80
  5.1197 +#define EISA_FREE_FORM_DATA             0x40
  5.1198 +#define EISA_HAS_PORT_INIT_ENTRY        0x20
  5.1199 +#define EISA_HAS_PORT_RANGE             0x10
  5.1200 +#define EISA_HAS_DMA_ENTRY              0x08
  5.1201 +#define EISA_HAS_IRQ_ENTRY              0x04
  5.1202 +#define EISA_HAS_MEMORY_ENTRY           0x02
  5.1203 +#define EISA_HAS_TYPE_ENTRY             0x01
  5.1204 +#define EISA_HAS_INFORMATION \
  5.1205 +  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
  5.1206 +  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
  5.1207 +
  5.1208 +typedef struct _CM_EISA_SLOT_INFORMATION {
  5.1209 +  UCHAR  ReturnCode;
  5.1210 +  UCHAR  ReturnFlags;
  5.1211 +  UCHAR  MajorRevision;
  5.1212 +  UCHAR  MinorRevision;
  5.1213 +  USHORT  Checksum;
  5.1214 +  UCHAR  NumberFunctions;
  5.1215 +  UCHAR  FunctionInformation;
  5.1216 +  ULONG  CompressedId;
  5.1217 +} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
  5.1218 +
  5.1219 +/* CM_EISA_SLOT_INFORMATION.ReturnCode */
  5.1220 +
  5.1221 +#define EISA_INVALID_SLOT               0x80
  5.1222 +#define EISA_INVALID_FUNCTION           0x81
  5.1223 +#define EISA_INVALID_CONFIGURATION      0x82
  5.1224 +#define EISA_EMPTY_SLOT                 0x83
  5.1225 +#define EISA_INVALID_BIOS_CALL          0x86
  5.1226 +
  5.1227 +typedef struct _CM_FLOPPY_DEVICE_DATA {
  5.1228 +  USHORT  Version;
  5.1229 +  USHORT  Revision;
  5.1230 +  CHAR  Size[8];
  5.1231 +  ULONG  MaxDensity;
  5.1232 +  ULONG  MountDensity;
  5.1233 +  UCHAR  StepRateHeadUnloadTime;
  5.1234 +  UCHAR  HeadLoadTime;
  5.1235 +  UCHAR  MotorOffTime;
  5.1236 +  UCHAR  SectorLengthCode;
  5.1237 +  UCHAR  SectorPerTrack;
  5.1238 +  UCHAR  ReadWriteGapLength;
  5.1239 +  UCHAR  DataTransferLength;
  5.1240 +  UCHAR  FormatGapLength;
  5.1241 +  UCHAR  FormatFillCharacter;
  5.1242 +  UCHAR  HeadSettleTime;
  5.1243 +  UCHAR  MotorSettleTime;
  5.1244 +  UCHAR  MaximumTrackValue;
  5.1245 +  UCHAR  DataTransferRate;
  5.1246 +} CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
  5.1247 +
  5.1248 +typedef enum _INTERFACE_TYPE {
  5.1249 +  InterfaceTypeUndefined = -1,
  5.1250 +  Internal,
  5.1251 +  Isa,
  5.1252 +  Eisa,
  5.1253 +  MicroChannel,
  5.1254 +  TurboChannel,
  5.1255 +  PCIBus,
  5.1256 +  VMEBus,
  5.1257 +  NuBus,
  5.1258 +  PCMCIABus,
  5.1259 +  CBus,
  5.1260 +  MPIBus,
  5.1261 +  MPSABus,
  5.1262 +  ProcessorInternal,
  5.1263 +  InternalPowerBus,
  5.1264 +  PNPISABus,
  5.1265 +  PNPBus,
  5.1266 +  MaximumInterfaceType
  5.1267 +} INTERFACE_TYPE, *PINTERFACE_TYPE;
  5.1268 +
  5.1269 +typedef struct _PNP_BUS_INFORMATION {
  5.1270 +  GUID  BusTypeGuid;
  5.1271 +  INTERFACE_TYPE  LegacyBusType;
  5.1272 +  ULONG  BusNumber;
  5.1273 +} PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
  5.1274 +
  5.1275 +#include <pshpack1.h>
  5.1276 +typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
  5.1277 +  UCHAR Type;
  5.1278 +  UCHAR ShareDisposition;
  5.1279 +  USHORT Flags;
  5.1280 +  union {
  5.1281 +    struct {
  5.1282 +      PHYSICAL_ADDRESS Start;
  5.1283 +      ULONG Length;
  5.1284 +    } Generic;
  5.1285 +    struct {
  5.1286 +      PHYSICAL_ADDRESS Start;
  5.1287 +      ULONG Length;
  5.1288 +    } Port;
  5.1289 +    struct {
  5.1290 +      ULONG Level;
  5.1291 +      ULONG Vector;
  5.1292 +      ULONG Affinity;
  5.1293 +    } Interrupt;
  5.1294 +    struct {
  5.1295 +      PHYSICAL_ADDRESS Start;
  5.1296 +      ULONG Length;
  5.1297 +    } Memory;
  5.1298 +    struct {
  5.1299 +      ULONG Channel;
  5.1300 +      ULONG Port;
  5.1301 +      ULONG Reserved1;
  5.1302 +    } Dma;
  5.1303 +    struct {
  5.1304 +      ULONG Data[3];
  5.1305 +    } DevicePrivate;
  5.1306 +    struct {
  5.1307 +      ULONG Start;
  5.1308 +      ULONG Length;
  5.1309 +      ULONG Reserved;
  5.1310 +    } BusNumber;
  5.1311 +    struct {
  5.1312 +      ULONG DataSize;
  5.1313 +      ULONG Reserved1;
  5.1314 +      ULONG Reserved2;
  5.1315 +    } DeviceSpecificData;
  5.1316 +  } u;
  5.1317 +} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
  5.1318 +
  5.1319 +/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
  5.1320 +
  5.1321 +#define CmResourceTypeNull                0
  5.1322 +#define CmResourceTypePort                1
  5.1323 +#define CmResourceTypeInterrupt           2
  5.1324 +#define CmResourceTypeMemory              3
  5.1325 +#define CmResourceTypeDma                 4
  5.1326 +#define CmResourceTypeDeviceSpecific      5
  5.1327 +#define CmResourceTypeBusNumber           6
  5.1328 +#define CmResourceTypeMaximum             7
  5.1329 +#define CmResourceTypeNonArbitrated     128
  5.1330 +#define CmResourceTypeConfigData        128
  5.1331 +#define CmResourceTypeDevicePrivate     129
  5.1332 +#define CmResourceTypePcCardConfig      130
  5.1333 +#define CmResourceTypeMfCardConfig      131
  5.1334 +
  5.1335 +/* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
  5.1336 +
  5.1337 +typedef enum _CM_SHARE_DISPOSITION {
  5.1338 +  CmResourceShareUndetermined,
  5.1339 +  CmResourceShareDeviceExclusive,
  5.1340 +  CmResourceShareDriverExclusive,
  5.1341 +  CmResourceShareShared
  5.1342 +} CM_SHARE_DISPOSITION;
  5.1343 +
  5.1344 +/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
  5.1345 +
  5.1346 +#define CM_RESOURCE_PORT_MEMORY           0x0000
  5.1347 +#define CM_RESOURCE_PORT_IO               0x0001
  5.1348 +#define CM_RESOURCE_PORT_10_BIT_DECODE    0x0004
  5.1349 +#define CM_RESOURCE_PORT_12_BIT_DECODE    0x0008
  5.1350 +#define CM_RESOURCE_PORT_16_BIT_DECODE    0x0010
  5.1351 +#define CM_RESOURCE_PORT_POSITIVE_DECODE  0x0020
  5.1352 +#define CM_RESOURCE_PORT_PASSIVE_DECODE   0x0040
  5.1353 +#define CM_RESOURCE_PORT_WINDOW_DECODE    0x0080
  5.1354 +
  5.1355 +/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
  5.1356 +
  5.1357 +#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
  5.1358 +#define CM_RESOURCE_INTERRUPT_LATCHED         0x0001
  5.1359 +
  5.1360 +/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
  5.1361 +
  5.1362 +#define CM_RESOURCE_MEMORY_READ_WRITE     0x0000
  5.1363 +#define CM_RESOURCE_MEMORY_READ_ONLY      0x0001
  5.1364 +#define CM_RESOURCE_MEMORY_WRITE_ONLY     0x0002
  5.1365 +#define CM_RESOURCE_MEMORY_PREFETCHABLE   0x0004
  5.1366 +#define CM_RESOURCE_MEMORY_COMBINEDWRITE  0x0008
  5.1367 +#define CM_RESOURCE_MEMORY_24             0x0010
  5.1368 +#define CM_RESOURCE_MEMORY_CACHEABLE      0x0020
  5.1369 +
  5.1370 +/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
  5.1371 +
  5.1372 +#define CM_RESOURCE_DMA_8                 0x0000
  5.1373 +#define CM_RESOURCE_DMA_16                0x0001
  5.1374 +#define CM_RESOURCE_DMA_32                0x0002
  5.1375 +#define CM_RESOURCE_DMA_8_AND_16          0x0004
  5.1376 +#define CM_RESOURCE_DMA_BUS_MASTER        0x0008
  5.1377 +#define CM_RESOURCE_DMA_TYPE_A            0x0010
  5.1378 +#define CM_RESOURCE_DMA_TYPE_B            0x0020
  5.1379 +#define CM_RESOURCE_DMA_TYPE_F            0x0040
  5.1380 +
  5.1381 +typedef struct _CM_PARTIAL_RESOURCE_LIST {
  5.1382 +  USHORT  Version;
  5.1383 +  USHORT  Revision;
  5.1384 +  ULONG  Count;
  5.1385 +  CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
  5.1386 +} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
  5.1387 +
  5.1388 +typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
  5.1389 +  INTERFACE_TYPE  InterfaceType;
  5.1390 +  ULONG  BusNumber;
  5.1391 +  CM_PARTIAL_RESOURCE_LIST  PartialResourceList;
  5.1392 +} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
  5.1393 +
  5.1394 +typedef struct _CM_RESOURCE_LIST {
  5.1395 +  ULONG  Count;
  5.1396 +  CM_FULL_RESOURCE_DESCRIPTOR  List[1];
  5.1397 +} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
  5.1398 +
  5.1399 +typedef struct _CM_INT13_DRIVE_PARAMETER {
  5.1400 +  USHORT  DriveSelect;
  5.1401 +  ULONG  MaxCylinders;
  5.1402 +  USHORT  SectorsPerTrack;
  5.1403 +  USHORT  MaxHeads;
  5.1404 +  USHORT  NumberDrives;
  5.1405 +} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
  5.1406 +#include <poppack.h>
  5.1407 +
  5.1408 +typedef struct _CM_KEYBOARD_DEVICE_DATA {
  5.1409 +  USHORT  Version;
  5.1410 +  USHORT  Revision;
  5.1411 +  UCHAR  Type;
  5.1412 +  UCHAR  Subtype;
  5.1413 +  USHORT  KeyboardFlags;
  5.1414 +} CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
  5.1415 +
  5.1416 +#define KEYBOARD_INSERT_ON                0x80
  5.1417 +#define KEYBOARD_CAPS_LOCK_ON             0x40
  5.1418 +#define KEYBOARD_NUM_LOCK_ON              0x20
  5.1419 +#define KEYBOARD_SCROLL_LOCK_ON           0x10
  5.1420 +#define KEYBOARD_ALT_KEY_DOWN             0x08
  5.1421 +#define KEYBOARD_CTRL_KEY_DOWN            0x04
  5.1422 +#define KEYBOARD_LEFT_SHIFT_DOWN          0x02
  5.1423 +#define KEYBOARD_RIGHT_SHIFT_DOWN         0x01
  5.1424 +
  5.1425 +typedef struct _CM_MCA_POS_DATA {
  5.1426 +  USHORT  AdapterId;
  5.1427 +  UCHAR  PosData1;
  5.1428 +  UCHAR  PosData2;
  5.1429 +  UCHAR  PosData3;
  5.1430 +  UCHAR  PosData4;
  5.1431 +} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
  5.1432 +
  5.1433 +typedef struct CM_Power_Data_s {
  5.1434 +  ULONG  PD_Size;
  5.1435 +  DEVICE_POWER_STATE  PD_MostRecentPowerState;
  5.1436 +  ULONG  PD_Capabilities;
  5.1437 +  ULONG  PD_D1Latency;
  5.1438 +  ULONG  PD_D2Latency;
  5.1439 +  ULONG  PD_D3Latency;
  5.1440 +  DEVICE_POWER_STATE  PD_PowerStateMapping[PowerSystemMaximum];
  5.1441 +} CM_POWER_DATA, *PCM_POWER_DATA;
  5.1442 +
  5.1443 +#define PDCAP_D0_SUPPORTED                0x00000001
  5.1444 +#define PDCAP_D1_SUPPORTED                0x00000002
  5.1445 +#define PDCAP_D2_SUPPORTED                0x00000004
  5.1446 +#define PDCAP_D3_SUPPORTED                0x00000008
  5.1447 +#define PDCAP_WAKE_FROM_D0_SUPPORTED      0x00000010
  5.1448 +#define PDCAP_WAKE_FROM_D1_SUPPORTED      0x00000020
  5.1449 +#define PDCAP_WAKE_FROM_D2_SUPPORTED      0x00000040
  5.1450 +#define PDCAP_WAKE_FROM_D3_SUPPORTED      0x00000080
  5.1451 +#define PDCAP_WARM_EJECT_SUPPORTED        0x00000100
  5.1452 +
  5.1453 +typedef struct _CM_SCSI_DEVICE_DATA {
  5.1454 +  USHORT  Version;
  5.1455 +  USHORT  Revision;
  5.1456 +  UCHAR  HostIdentifier;
  5.1457 +} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
  5.1458 +
  5.1459 +typedef struct _CM_SERIAL_DEVICE_DATA {
  5.1460 +  USHORT  Version;
  5.1461 +  USHORT  Revision;
  5.1462 +  ULONG  BaudClock;
  5.1463 +} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
  5.1464 +
  5.1465 +/* IO_RESOURCE_DESCRIPTOR.Option */
  5.1466 +
  5.1467 +#define IO_RESOURCE_PREFERRED             0x01
  5.1468 +#define IO_RESOURCE_DEFAULT               0x02
  5.1469 +#define IO_RESOURCE_ALTERNATIVE           0x08
  5.1470 +
  5.1471 +typedef struct _IO_RESOURCE_DESCRIPTOR {
  5.1472 +  UCHAR  Option;
  5.1473 +  UCHAR  Type;
  5.1474 +  UCHAR  ShareDisposition;
  5.1475 +  UCHAR  Spare1;
  5.1476 +  USHORT  Flags;
  5.1477 +  USHORT  Spare2;
  5.1478 +  union {
  5.1479 +    struct {
  5.1480 +      ULONG  Length;
  5.1481 +      ULONG  Alignment;
  5.1482 +      PHYSICAL_ADDRESS  MinimumAddress;
  5.1483 +      PHYSICAL_ADDRESS  MaximumAddress;
  5.1484 +    } Port;
  5.1485 +    struct {
  5.1486 +      ULONG  Length;
  5.1487 +      ULONG  Alignment;
  5.1488 +      PHYSICAL_ADDRESS  MinimumAddress;
  5.1489 +      PHYSICAL_ADDRESS  MaximumAddress;
  5.1490 +    } Memory;
  5.1491 +    struct {
  5.1492 +      ULONG  MinimumVector;
  5.1493 +      ULONG  MaximumVector;
  5.1494 +    } Interrupt;
  5.1495 +    struct {
  5.1496 +      ULONG  MinimumChannel;
  5.1497 +      ULONG  MaximumChannel;
  5.1498 +    } Dma;
  5.1499 +    struct {
  5.1500 +      ULONG  Length;
  5.1501 +      ULONG  Alignment;
  5.1502 +      PHYSICAL_ADDRESS  MinimumAddress;
  5.1503 +      PHYSICAL_ADDRESS  MaximumAddress;
  5.1504 +    } Generic;
  5.1505 +    struct {
  5.1506 +      ULONG  Data[3];
  5.1507 +    } DevicePrivate;
  5.1508 +    struct {
  5.1509 +      ULONG  Length;
  5.1510 +      ULONG  MinBusNumber;
  5.1511 +      ULONG  MaxBusNumber;
  5.1512 +      ULONG  Reserved;
  5.1513 +    } BusNumber;
  5.1514 +    struct {
  5.1515 +      ULONG  Priority;
  5.1516 +      ULONG  Reserved1;
  5.1517 +      ULONG  Reserved2;
  5.1518 +    } ConfigData;
  5.1519 +  } u;
  5.1520 +} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
  5.1521 +
  5.1522 +typedef struct _IO_RESOURCE_LIST {
  5.1523 +  USHORT  Version;
  5.1524 +  USHORT  Revision;
  5.1525 +  ULONG  Count;
  5.1526 +  IO_RESOURCE_DESCRIPTOR  Descriptors[1];
  5.1527 +} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
  5.1528 +
  5.1529 +typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
  5.1530 +  ULONG  ListSize;
  5.1531 +  INTERFACE_TYPE  InterfaceType;
  5.1532 +  ULONG  BusNumber;
  5.1533 +  ULONG  SlotNumber;
  5.1534 +  ULONG  Reserved[3];
  5.1535 +  ULONG  AlternativeLists;
  5.1536 +  IO_RESOURCE_LIST  List[1];
  5.1537 +} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
  5.1538 +
  5.1539 +typedef struct _CONTROLLER_OBJECT {
  5.1540 +  CSHORT  Type;
  5.1541 +  CSHORT  Size;
  5.1542 +  PVOID  ControllerExtension;
  5.1543 +  KDEVICE_QUEUE  DeviceWaitQueue;
  5.1544 +  ULONG  Spare1;
  5.1545 +  LARGE_INTEGER  Spare2;
  5.1546 +} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
  5.1547 +
  5.1548 +typedef enum _DMA_WIDTH {
  5.1549 +  Width8Bits,
  5.1550 +  Width16Bits,
  5.1551 +  Width32Bits,
  5.1552 +  MaximumDmaWidth
  5.1553 +} DMA_WIDTH, *PDMA_WIDTH;
  5.1554 +
  5.1555 +typedef enum _DMA_SPEED {
  5.1556 +  Compatible,
  5.1557 +  TypeA,
  5.1558 +  TypeB,
  5.1559 +  TypeC,
  5.1560 +  TypeF,
  5.1561 +  MaximumDmaSpeed
  5.1562 +} DMA_SPEED, *PDMA_SPEED;
  5.1563 +
  5.1564 +/* DEVICE_DESCRIPTION.Version */
  5.1565 +
  5.1566 +#define DEVICE_DESCRIPTION_VERSION        0x0000
  5.1567 +#define DEVICE_DESCRIPTION_VERSION1       0x0001
  5.1568 +#define DEVICE_DESCRIPTION_VERSION2       0x0002
  5.1569 +
  5.1570 +typedef struct _DEVICE_DESCRIPTION {
  5.1571 +  ULONG  Version;
  5.1572 +  BOOLEAN  Master;
  5.1573 +  BOOLEAN  ScatterGather;
  5.1574 +  BOOLEAN  DemandMode;
  5.1575 +  BOOLEAN  AutoInitialize;
  5.1576 +  BOOLEAN  Dma32BitAddresses;
  5.1577 +  BOOLEAN  IgnoreCount;
  5.1578 +  BOOLEAN  Reserved1;
  5.1579 +  BOOLEAN  Dma64BitAddresses;
  5.1580 +  ULONG  BusNumber; 
  5.1581 +  ULONG  DmaChannel;
  5.1582 +  INTERFACE_TYPE  InterfaceType;
  5.1583 +  DMA_WIDTH  DmaWidth;
  5.1584 +  DMA_SPEED  DmaSpeed;
  5.1585 +  ULONG  MaximumLength;
  5.1586 +  ULONG  DmaPort;
  5.1587 +} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
  5.1588 +
  5.1589 +/* VPB.Flags */
  5.1590 +#define VPB_MOUNTED                       0x0001
  5.1591 +#define VPB_LOCKED                        0x0002
  5.1592 +#define VPB_PERSISTENT                    0x0004
  5.1593 +#define VPB_REMOVE_PENDING                0x0008
  5.1594 +#define VPB_RAW_MOUNT                     0x0010
  5.1595 +
  5.1596 +#define MAXIMUM_VOLUME_LABEL_LENGTH       (32 * sizeof(WCHAR))
  5.1597 +
  5.1598 +typedef struct _VPB {
  5.1599 +  CSHORT  Type;
  5.1600 +  CSHORT  Size;
  5.1601 +  USHORT  Flags;
  5.1602 +  USHORT  VolumeLabelLength;
  5.1603 +  struct _DEVICE_OBJECT  *DeviceObject;
  5.1604 +  struct _DEVICE_OBJECT  *RealDevice;
  5.1605 +  ULONG  SerialNumber;
  5.1606 +  ULONG  ReferenceCount;
  5.1607 +  WCHAR  VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
  5.1608 +} VPB, *PVPB;
  5.1609 +
  5.1610 +/* DEVICE_OBJECT.Flags */
  5.1611 +
  5.1612 +#define DO_VERIFY_VOLUME                  0x00000002      
  5.1613 +#define DO_BUFFERED_IO                    0x00000004      
  5.1614 +#define DO_EXCLUSIVE                      0x00000008      
  5.1615 +#define DO_DIRECT_IO                      0x00000010      
  5.1616 +#define DO_MAP_IO_BUFFER                  0x00000020      
  5.1617 +#define DO_DEVICE_HAS_NAME                0x00000040      
  5.1618 +#define DO_DEVICE_INITIALIZING            0x00000080      
  5.1619 +#define DO_SYSTEM_BOOT_PARTITION          0x00000100      
  5.1620 +#define DO_LONG_TERM_REQUESTS             0x00000200      
  5.1621 +#define DO_NEVER_LAST_DEVICE              0x00000400      
  5.1622 +#define DO_SHUTDOWN_REGISTERED            0x00000800      
  5.1623 +#define DO_BUS_ENUMERATED_DEVICE          0x00001000      
  5.1624 +#define DO_POWER_PAGABLE                  0x00002000      
  5.1625 +#define DO_POWER_INRUSH                   0x00004000      
  5.1626 +#define DO_LOW_PRIORITY_FILESYSTEM        0x00010000      
  5.1627 +
  5.1628 +/* DEVICE_OBJECT.Characteristics */
  5.1629 +
  5.1630 +#define FILE_REMOVABLE_MEDIA            0x00000001
  5.1631 +#define FILE_READ_ONLY_DEVICE           0x00000002
  5.1632 +#define FILE_FLOPPY_DISKETTE            0x00000004
  5.1633 +#define FILE_WRITE_ONCE_MEDIA           0x00000008
  5.1634 +#define FILE_REMOTE_DEVICE              0x00000010
  5.1635 +#define FILE_DEVICE_IS_MOUNTED          0x00000020
  5.1636 +#define FILE_VIRTUAL_VOLUME             0x00000040
  5.1637 +#define FILE_AUTOGENERATED_DEVICE_NAME  0x00000080
  5.1638 +#define FILE_DEVICE_SECURE_OPEN         0x00000100
  5.1639 +
  5.1640 +/* DEVICE_OBJECT.AlignmentRequirement */
  5.1641 +
  5.1642 +#define FILE_BYTE_ALIGNMENT             0x00000000
  5.1643 +#define FILE_WORD_ALIGNMENT             0x00000001
  5.1644 +#define FILE_LONG_ALIGNMENT             0x00000003
  5.1645 +#define FILE_QUAD_ALIGNMENT             0x00000007
  5.1646 +#define FILE_OCTA_ALIGNMENT             0x0000000f
  5.1647 +#define FILE_32_BYTE_ALIGNMENT          0x0000001f
  5.1648 +#define FILE_64_BYTE_ALIGNMENT          0x0000003f
  5.1649 +#define FILE_128_BYTE_ALIGNMENT         0x0000007f
  5.1650 +#define FILE_256_BYTE_ALIGNMENT         0x000000ff
  5.1651 +#define FILE_512_BYTE_ALIGNMENT         0x000001ff
  5.1652 +
  5.1653 +/* DEVICE_OBJECT.DeviceType */
  5.1654 +
  5.1655 +#define DEVICE_TYPE ULONG
  5.1656 +
  5.1657 +#define FILE_DEVICE_BEEP                  0x00000001
  5.1658 +#define FILE_DEVICE_CD_ROM                0x00000002
  5.1659 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM    0x00000003
  5.1660 +#define FILE_DEVICE_CONTROLLER            0x00000004
  5.1661 +#define FILE_DEVICE_DATALINK              0x00000005
  5.1662 +#define FILE_DEVICE_DFS                   0x00000006
  5.1663 +#define FILE_DEVICE_DISK                  0x00000007
  5.1664 +#define FILE_DEVICE_DISK_FILE_SYSTEM      0x00000008
  5.1665 +#define FILE_DEVICE_FILE_SYSTEM           0x00000009
  5.1666 +#define FILE_DEVICE_INPORT_PORT           0x0000000a
  5.1667 +#define FILE_DEVICE_KEYBOARD              0x0000000b
  5.1668 +#define FILE_DEVICE_MAILSLOT              0x0000000c
  5.1669 +#define FILE_DEVICE_MIDI_IN               0x0000000d
  5.1670 +#define FILE_DEVICE_MIDI_OUT              0x0000000e
  5.1671 +#define FILE_DEVICE_MOUSE                 0x0000000f
  5.1672 +#define FILE_DEVICE_MULTI_UNC_PROVIDER    0x00000010
  5.1673 +#define FILE_DEVICE_NAMED_PIPE            0x00000011
  5.1674 +#define FILE_DEVICE_NETWORK               0x00000012
  5.1675 +#define FILE_DEVICE_NETWORK_BROWSER       0x00000013
  5.1676 +#define FILE_DEVICE_NETWORK_FILE_SYSTEM   0x00000014
  5.1677 +#define FILE_DEVICE_NULL                  0x00000015
  5.1678 +#define FILE_DEVICE_PARALLEL_PORT         0x00000016
  5.1679 +#define FILE_DEVICE_PHYSICAL_NETCARD      0x00000017
  5.1680 +#define FILE_DEVICE_PRINTER               0x00000018
  5.1681 +#define FILE_DEVICE_SCANNER               0x00000019
  5.1682 +#define FILE_DEVICE_SERIAL_MOUSE_PORT     0x0000001a
  5.1683 +#define FILE_DEVICE_SERIAL_PORT           0x0000001b
  5.1684 +#define FILE_DEVICE_SCREEN                0x0000001c
  5.1685 +#define FILE_DEVICE_SOUND                 0x0000001d
  5.1686 +#define FILE_DEVICE_STREAMS               0x0000001e
  5.1687 +#define FILE_DEVICE_TAPE                  0x0000001f
  5.1688 +#define FILE_DEVICE_TAPE_FILE_SYSTEM      0x00000020
  5.1689 +#define FILE_DEVICE_TRANSPORT             0x00000021
  5.1690 +#define FILE_DEVICE_UNKNOWN               0x00000022
  5.1691 +#define FILE_DEVICE_VIDEO                 0x00000023
  5.1692 +#define FILE_DEVICE_VIRTUAL_DISK          0x00000024
  5.1693 +#define FILE_DEVICE_WAVE_IN               0x00000025
  5.1694 +#define FILE_DEVICE_WAVE_OUT              0x00000026
  5.1695 +#define FILE_DEVICE_8042_PORT             0x00000027
  5.1696 +#define FILE_DEVICE_NETWORK_REDIRECTOR    0x00000028
  5.1697 +#define FILE_DEVICE_BATTERY               0x00000029
  5.1698 +#define FILE_DEVICE_BUS_EXTENDER          0x0000002a
  5.1699 +#define FILE_DEVICE_MODEM                 0x0000002b
  5.1700 +#define FILE_DEVICE_VDM                   0x0000002c
  5.1701 +#define FILE_DEVICE_MASS_STORAGE          0x0000002d
  5.1702 +#define FILE_DEVICE_SMB                   0x0000002e
  5.1703 +#define FILE_DEVICE_KS                    0x0000002f
  5.1704 +#define FILE_DEVICE_CHANGER               0x00000030
  5.1705 +#define FILE_DEVICE_SMARTCARD             0x00000031
  5.1706 +#define FILE_DEVICE_ACPI                  0x00000032
  5.1707 +#define FILE_DEVICE_DVD                   0x00000033
  5.1708 +#define FILE_DEVICE_FULLSCREEN_VIDEO      0x00000034
  5.1709 +#define FILE_DEVICE_DFS_FILE_SYSTEM       0x00000035
  5.1710 +#define FILE_DEVICE_DFS_VOLUME            0x00000036
  5.1711 +#define FILE_DEVICE_SERENUM               0x00000037
  5.1712 +#define FILE_DEVICE_TERMSRV               0x00000038
  5.1713 +#define FILE_DEVICE_KSEC                  0x00000039
  5.1714 +#define FILE_DEVICE_FIPS		              0x0000003a
  5.1715 +
  5.1716 +typedef struct _DEVICE_OBJECT {
  5.1717 +  CSHORT  Type;
  5.1718 +  USHORT  Size;
  5.1719 +  LONG  ReferenceCount;
  5.1720 +  struct _DRIVER_OBJECT  *DriverObject;
  5.1721 +  struct _DEVICE_OBJECT  *NextDevice;
  5.1722 +  struct _DEVICE_OBJECT  *AttachedDevice;
  5.1723 +  struct _IRP  *CurrentIrp;
  5.1724 +  PIO_TIMER  Timer;
  5.1725 +  ULONG  Flags;
  5.1726 +  ULONG  Characteristics;
  5.1727 +  PVPB  Vpb;
  5.1728 +  PVOID  DeviceExtension;
  5.1729 +  DEVICE_TYPE  DeviceType;
  5.1730 +  CCHAR  StackSize;
  5.1731 +  union {
  5.1732 +    LIST_ENTRY  ListEntry;
  5.1733 +    WAIT_CONTEXT_BLOCK  Wcb;
  5.1734 +  } Queue;
  5.1735 +  ULONG  AlignmentRequirement;
  5.1736 +  KDEVICE_QUEUE  DeviceQueue;
  5.1737 +  KDPC  Dpc;
  5.1738 +  ULONG  ActiveThreadCount;
  5.1739 +  PSECURITY_DESCRIPTOR  SecurityDescriptor;
  5.1740 +  KEVENT  DeviceLock;
  5.1741 +  USHORT  SectorSize;
  5.1742 +  USHORT  Spare1;
  5.1743 +  struct _DEVOBJ_EXTENSION  *DeviceObjectExtension;
  5.1744 +  PVOID  Reserved;
  5.1745 +} DEVICE_OBJECT;
  5.1746 +typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
  5.1747 +
  5.1748 +typedef enum _DEVICE_RELATION_TYPE {
  5.1749 +  BusRelations,
  5.1750 +  EjectionRelations,
  5.1751 +  PowerRelations,
  5.1752 +  RemovalRelations,
  5.1753 +  TargetDeviceRelation,
  5.1754 +  SingleBusRelations
  5.1755 +} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
  5.1756 +
  5.1757 +typedef struct _DEVICE_RELATIONS {
  5.1758 +  ULONG  Count;
  5.1759 +  PDEVICE_OBJECT Objects[1];
  5.1760 +} DEVICE_RELATIONS, *PDEVICE_RELATIONS;
  5.1761 +
  5.1762 +typedef struct _SCATTER_GATHER_ELEMENT {
  5.1763 +  PHYSICAL_ADDRESS  Address;   
  5.1764 +  ULONG  Length;          
  5.1765 +  ULONG_PTR  Reserved;
  5.1766 +} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
  5.1767 +
  5.1768 +typedef struct _SCATTER_GATHER_LIST {
  5.1769 +  ULONG  NumberOfElements;
  5.1770 +  ULONG_PTR  Reserved;
  5.1771 +  SCATTER_GATHER_ELEMENT  Elements[0];
  5.1772 +} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
  5.1773 +
  5.1774 +typedef struct _MDL {
  5.1775 +  struct _MDL  *Next;
  5.1776 +  CSHORT  Size;
  5.1777 +  CSHORT  MdlFlags;
  5.1778 +  struct _EPROCESS  *Process;
  5.1779 +  PVOID  MappedSystemVa;
  5.1780 +  PVOID  StartVa;
  5.1781 +  ULONG  ByteCount;
  5.1782 +  ULONG  ByteOffset;
  5.1783 +} MDL, *PMDL;
  5.1784 +
  5.1785 +#define MDL_MAPPED_TO_SYSTEM_VA           0x0001
  5.1786 +#define MDL_PAGES_LOCKED                  0x0002
  5.1787 +#define MDL_SOURCE_IS_NONPAGED_POOL       0x0004
  5.1788 +#define MDL_ALLOCATED_FIXED_SIZE          0x0008
  5.1789 +#define MDL_PARTIAL                       0x0010
  5.1790 +#define MDL_PARTIAL_HAS_BEEN_MAPPED       0x0020
  5.1791 +#define MDL_IO_PAGE_READ                  0x0040
  5.1792 +#define MDL_WRITE_OPERATION               0x0080
  5.1793 +#define MDL_PARENT_MAPPED_SYSTEM_VA       0x0100
  5.1794 +#define MDL_FREE_EXTRA_PTES               0x0200
  5.1795 +#define MDL_IO_SPACE                      0x0800
  5.1796 +#define MDL_NETWORK_HEADER                0x1000
  5.1797 +#define MDL_MAPPING_CAN_FAIL              0x2000
  5.1798 +#define MDL_ALLOCATED_MUST_SUCCEED        0x4000
  5.1799 +
  5.1800 +#define MDL_MAPPING_FLAGS ( \
  5.1801 +  MDL_MAPPED_TO_SYSTEM_VA     | \
  5.1802 +  MDL_PAGES_LOCKED            | \
  5.1803 +  MDL_SOURCE_IS_NONPAGED_POOL | \
  5.1804 +  MDL_PARTIAL_HAS_BEEN_MAPPED | \
  5.1805 +  MDL_PARENT_MAPPED_SYSTEM_VA | \
  5.1806 +  MDL_SYSTEM_VA               | \
  5.1807 +  MDL_IO_SPACE)
  5.1808 +
  5.1809 +typedef VOID DDKAPI
  5.1810 +(*PPUT_DMA_ADAPTER)(
  5.1811 +  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  5.1812 +
  5.1813 +typedef PVOID DDKAPI
  5.1814 +(*PALLOCATE_COMMON_BUFFER)(
  5.1815 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1816 +  /*IN*/ ULONG  Length,
  5.1817 +  /*OUT*/ PPHYSICAL_ADDRESS  LogicalAddress,
  5.1818 +  /*IN*/ BOOLEAN  CacheEnabled);
  5.1819 +
  5.1820 +typedef VOID DDKAPI
  5.1821 +(*PFREE_COMMON_BUFFER)(
  5.1822 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1823 +  /*IN*/ ULONG  Length,
  5.1824 +  /*IN*/ PHYSICAL_ADDRESS  LogicalAddress,
  5.1825 +  /*IN*/ PVOID  VirtualAddress,
  5.1826 +  /*IN*/ BOOLEAN  CacheEnabled);
  5.1827 +
  5.1828 +typedef NTSTATUS DDKAPI
  5.1829 +(*PALLOCATE_ADAPTER_CHANNEL)(
  5.1830 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1831 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.1832 +  /*IN*/ ULONG  NumberOfMapRegisters,
  5.1833 +  /*IN*/ PDRIVER_CONTROL  ExecutionRoutine,
  5.1834 +  /*IN*/ PVOID  Context);
  5.1835 +
  5.1836 +typedef BOOLEAN DDKAPI
  5.1837 +(*PFLUSH_ADAPTER_BUFFERS)(
  5.1838 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1839 +  /*IN*/ PMDL  Mdl,
  5.1840 +  /*IN*/ PVOID  MapRegisterBase,
  5.1841 +  /*IN*/ PVOID  CurrentVa,
  5.1842 +  /*IN*/ ULONG  Length,
  5.1843 +  /*IN*/ BOOLEAN  WriteToDevice);
  5.1844 +
  5.1845 +typedef VOID DDKAPI
  5.1846 +(*PFREE_ADAPTER_CHANNEL)(
  5.1847 +  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  5.1848 +
  5.1849 +typedef VOID DDKAPI
  5.1850 +(*PFREE_MAP_REGISTERS)(
  5.1851 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1852 +  PVOID  MapRegisterBase,
  5.1853 +  ULONG  NumberOfMapRegisters);
  5.1854 +
  5.1855 +typedef PHYSICAL_ADDRESS DDKAPI
  5.1856 +(*PMAP_TRANSFER)(
  5.1857 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1858 +  /*IN*/ PMDL  Mdl,
  5.1859 +  /*IN*/ PVOID  MapRegisterBase,
  5.1860 +  /*IN*/ PVOID  CurrentVa,
  5.1861 +  /*IN OUT*/ PULONG  Length,
  5.1862 +  /*IN*/ BOOLEAN  WriteToDevice);
  5.1863 +
  5.1864 +typedef ULONG DDKAPI
  5.1865 +(*PGET_DMA_ALIGNMENT)(
  5.1866 +  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  5.1867 +
  5.1868 +typedef ULONG DDKAPI
  5.1869 +(*PREAD_DMA_COUNTER)(
  5.1870 +  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  5.1871 +
  5.1872 +typedef NTSTATUS DDKAPI
  5.1873 +(*PGET_SCATTER_GATHER_LIST)(
  5.1874 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1875 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.1876 +  /*IN*/ PMDL  Mdl,
  5.1877 +  /*IN*/ PVOID  CurrentVa,
  5.1878 +  /*IN*/ ULONG  Length,
  5.1879 +  /*IN*/ PDRIVER_LIST_CONTROL  ExecutionRoutine,
  5.1880 +  /*IN*/ PVOID  Context,
  5.1881 +  /*IN*/ BOOLEAN  WriteToDevice);
  5.1882 +
  5.1883 +typedef VOID DDKAPI
  5.1884 +(*PPUT_SCATTER_GATHER_LIST)(
  5.1885 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1886 +  /*IN*/ PSCATTER_GATHER_LIST  ScatterGather,
  5.1887 +  /*IN*/ BOOLEAN  WriteToDevice);
  5.1888 +
  5.1889 +typedef NTSTATUS DDKAPI
  5.1890 +(*PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
  5.1891 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1892 +  /*IN*/ PMDL  Mdl  /*OPTIONAL*/,
  5.1893 +  /*IN*/ PVOID  CurrentVa,
  5.1894 +  /*IN*/ ULONG  Length,
  5.1895 +  /*OUT*/ PULONG  ScatterGatherListSize,
  5.1896 +  /*OUT*/ PULONG  pNumberOfMapRegisters  /*OPTIONAL*/);
  5.1897 +
  5.1898 +typedef NTSTATUS DDKAPI
  5.1899 +(*PBUILD_SCATTER_GATHER_LIST)(
  5.1900 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1901 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.1902 +  /*IN*/ PMDL  Mdl,
  5.1903 +  /*IN*/ PVOID  CurrentVa,
  5.1904 +  /*IN*/ ULONG  Length,
  5.1905 +  /*IN*/ PDRIVER_LIST_CONTROL  ExecutionRoutine,
  5.1906 +  /*IN*/ PVOID  Context,
  5.1907 +  /*IN*/ BOOLEAN  WriteToDevice,
  5.1908 +  /*IN*/ PVOID  ScatterGatherBuffer,
  5.1909 +  /*IN*/ ULONG  ScatterGatherLength);
  5.1910 +
  5.1911 +typedef NTSTATUS DDKAPI
  5.1912 +(*PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
  5.1913 +  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  5.1914 +  /*IN*/ PSCATTER_GATHER_LIST  ScatterGather,
  5.1915 +  /*IN*/ PMDL  OriginalMdl,
  5.1916 +  /*OUT*/ PMDL  *TargetMdl);
  5.1917 +
  5.1918 +typedef struct _DMA_OPERATIONS {
  5.1919 +  ULONG  Size;
  5.1920 +  PPUT_DMA_ADAPTER  PutDmaAdapter;
  5.1921 +  PALLOCATE_COMMON_BUFFER  AllocateCommonBuffer;
  5.1922 +  PFREE_COMMON_BUFFER  FreeCommonBuffer;
  5.1923 +  PALLOCATE_ADAPTER_CHANNEL  AllocateAdapterChannel;
  5.1924 +  PFLUSH_ADAPTER_BUFFERS  FlushAdapterBuffers;
  5.1925 +  PFREE_ADAPTER_CHANNEL  FreeAdapterChannel;
  5.1926 +  PFREE_MAP_REGISTERS  FreeMapRegisters;
  5.1927 +  PMAP_TRANSFER  MapTransfer;
  5.1928 +  PGET_DMA_ALIGNMENT  GetDmaAlignment;
  5.1929 +  PREAD_DMA_COUNTER  ReadDmaCounter;
  5.1930 +  PGET_SCATTER_GATHER_LIST  GetScatterGatherList;
  5.1931 +  PPUT_SCATTER_GATHER_LIST  PutScatterGatherList;
  5.1932 +  PCALCULATE_SCATTER_GATHER_LIST_SIZE  CalculateScatterGatherList;
  5.1933 +  PBUILD_SCATTER_GATHER_LIST  BuildScatterGatherList;
  5.1934 +  PBUILD_MDL_FROM_SCATTER_GATHER_LIST  BuildMdlFromScatterGatherList;
  5.1935 +} DMA_OPERATIONS, *PDMA_OPERATIONS;
  5.1936 +
  5.1937 +typedef struct _DMA_ADAPTER {
  5.1938 +  USHORT  Version;
  5.1939 +  USHORT  Size;
  5.1940 +  PDMA_OPERATIONS  DmaOperations;
  5.1941 +} DMA_ADAPTER;
  5.1942 +
  5.1943 +typedef enum _FILE_INFORMATION_CLASS {
  5.1944 +  FileDirectoryInformation = 1,
  5.1945 +  FileFullDirectoryInformation,
  5.1946 +  FileBothDirectoryInformation,
  5.1947 +  FileBasicInformation,
  5.1948 +  FileStandardInformation,
  5.1949 +  FileInternalInformation,
  5.1950 +  FileEaInformation,
  5.1951 +  FileAccessInformation,
  5.1952 +  FileNameInformation,
  5.1953 +  FileRenameInformation,
  5.1954 +  FileLinkInformation,
  5.1955 +  FileNamesInformation,
  5.1956 +  FileDispositionInformation,
  5.1957 +  FilePositionInformation,
  5.1958 +  FileFullEaInformation,
  5.1959 +  FileModeInformation,
  5.1960 +  FileAlignmentInformation,
  5.1961 +  FileAllInformation,
  5.1962 +  FileAllocationInformation,
  5.1963 +  FileEndOfFileInformation,
  5.1964 +  FileAlternateNameInformation,
  5.1965 +  FileStreamInformation,
  5.1966 +  FilePipeInformation,
  5.1967 +  FilePipeLocalInformation,
  5.1968 +  FilePipeRemoteInformation,
  5.1969 +  FileMailslotQueryInformation,
  5.1970 +  FileMailslotSetInformation,
  5.1971 +  FileCompressionInformation,
  5.1972 +  FileObjectIdInformation,
  5.1973 +  FileCompletionInformation,
  5.1974 +  FileMoveClusterInformation,
  5.1975 +  FileQuotaInformation,
  5.1976 +  FileReparsePointInformation,
  5.1977 +  FileNetworkOpenInformation,
  5.1978 +  FileAttributeTagInformation,
  5.1979 +  FileTrackingInformation,
  5.1980 +  FileIdBothDirectoryInformation,
  5.1981 +  FileIdFullDirectoryInformation,
  5.1982 +  FileValidDataLengthInformation,
  5.1983 +  FileShortNameInformation,
  5.1984 +  FileMaximumInformation
  5.1985 +} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
  5.1986 +
  5.1987 +typedef struct _FILE_POSITION_INFORMATION {                 
  5.1988 +  LARGE_INTEGER  CurrentByteOffset;                        
  5.1989 +} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;   
  5.1990 +
  5.1991 +typedef struct _FILE_ALIGNMENT_INFORMATION {
  5.1992 +  ULONG  AlignmentRequirement;
  5.1993 +} FILE_ALIGNMENT_INFORMATION;
  5.1994 +
  5.1995 +typedef struct _FILE_NAME_INFORMATION {                     
  5.1996 +  ULONG  FileNameLength;                                   
  5.1997 +  WCHAR  FileName[1];                                      
  5.1998 +} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;           
  5.1999 +
  5.2000 +typedef struct _FILE_BASIC_INFORMATION {
  5.2001 +  LARGE_INTEGER  CreationTime;
  5.2002 +  LARGE_INTEGER  LastAccessTime;
  5.2003 +  LARGE_INTEGER  LastWriteTime;
  5.2004 +  LARGE_INTEGER  ChangeTime;
  5.2005 +  ULONG  FileAttributes;
  5.2006 +} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
  5.2007 +
  5.2008 +typedef struct _FILE_STANDARD_INFORMATION {
  5.2009 +  LARGE_INTEGER  AllocationSize;
  5.2010 +  LARGE_INTEGER  EndOfFile;
  5.2011 +  ULONG  NumberOfLinks;
  5.2012 +  BOOLEAN  DeletePending;
  5.2013 +  BOOLEAN  Directory;
  5.2014 +} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
  5.2015 +
  5.2016 +typedef struct _FILE_NETWORK_OPEN_INFORMATION {                 
  5.2017 +  LARGE_INTEGER  CreationTime;                                 
  5.2018 +  LARGE_INTEGER  LastAccessTime;                               
  5.2019 +  LARGE_INTEGER  LastWriteTime;                                
  5.2020 +  LARGE_INTEGER  ChangeTime;                                   
  5.2021 +  LARGE_INTEGER  AllocationSize;                               
  5.2022 +  LARGE_INTEGER  EndOfFile;                                    
  5.2023 +  ULONG  FileAttributes;                                       
  5.2024 +} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;   
  5.2025 +
  5.2026 +typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION {               
  5.2027 +  ULONG  FileAttributes;                                       
  5.2028 +  ULONG  ReparseTag;                                           
  5.2029 +} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
  5.2030 +
  5.2031 +typedef struct _FILE_DISPOSITION_INFORMATION {                  
  5.2032 +  BOOLEAN  DoDeleteFile;                                         
  5.2033 +} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; 
  5.2034 +                                                                
  5.2035 +typedef struct _FILE_END_OF_FILE_INFORMATION {                  
  5.2036 +  LARGE_INTEGER  EndOfFile;                                    
  5.2037 +} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; 
  5.2038 +                                                                
  5.2039 +typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION {                                    
  5.2040 +  LARGE_INTEGER  ValidDataLength;                                                      
  5.2041 +} FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;             
  5.2042 +
  5.2043 +typedef enum _FSINFOCLASS {
  5.2044 +  FileFsVolumeInformation = 1,
  5.2045 +  FileFsLabelInformation,
  5.2046 +  FileFsSizeInformation,
  5.2047 +  FileFsDeviceInformation,
  5.2048 +  FileFsAttributeInformation,
  5.2049 +  FileFsControlInformation,
  5.2050 +  FileFsFullSizeInformation,
  5.2051 +  FileFsObjectIdInformation,
  5.2052 +  FileFsDriverPathInformation,
  5.2053 +  FileFsMaximumInformation
  5.2054 +} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
  5.2055 +
  5.2056 +typedef struct _FILE_FS_DEVICE_INFORMATION {
  5.2057 +  DEVICE_TYPE  DeviceType;
  5.2058 +  ULONG  Characteristics;
  5.2059 +} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
  5.2060 +
  5.2061 +typedef struct _FILE_FULL_EA_INFORMATION {
  5.2062 +  ULONG  NextEntryOffset;
  5.2063 +  UCHAR  Flags;
  5.2064 +  UCHAR  EaNameLength;
  5.2065 +  USHORT  EaValueLength;
  5.2066 +  CHAR  EaName[1];
  5.2067 +} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
  5.2068 +
  5.2069 +typedef ULONG_PTR ERESOURCE_THREAD;
  5.2070 +typedef ERESOURCE_THREAD *PERESOURCE_THREAD;
  5.2071 +
  5.2072 +typedef struct _OWNER_ENTRY {
  5.2073 +  ERESOURCE_THREAD  OwnerThread;
  5.2074 +  _ANONYMOUS_UNION union {
  5.2075 +      LONG  OwnerCount;
  5.2076 +      ULONG  TableSize;
  5.2077 +  } DUMMYUNIONNAME;
  5.2078 +} OWNER_ENTRY, *POWNER_ENTRY;
  5.2079 +
  5.2080 +/* ERESOURCE.Flag */
  5.2081 +
  5.2082 +#define ResourceNeverExclusive            0x0010
  5.2083 +#define ResourceReleaseByOtherThread      0x0020
  5.2084 +#define ResourceOwnedExclusive            0x0080
  5.2085 +
  5.2086 +#define RESOURCE_HASH_TABLE_SIZE          64
  5.2087 +
  5.2088 +typedef struct _ERESOURCE {
  5.2089 +  LIST_ENTRY  SystemResourcesList;
  5.2090 +  POWNER_ENTRY  OwnerTable;
  5.2091 +  SHORT  ActiveCount;
  5.2092 +  USHORT  Flag;
  5.2093 +  PKSEMAPHORE  SharedWaiters;
  5.2094 +  PKEVENT  ExclusiveWaiters;
  5.2095 +  OWNER_ENTRY  OwnerThreads[2];
  5.2096 +  ULONG  ContentionCount;
  5.2097 +  USHORT  NumberOfSharedWaiters;
  5.2098 +  USHORT  NumberOfExclusiveWaiters;
  5.2099 +  _ANONYMOUS_UNION union {
  5.2100 +    PVOID  Address;
  5.2101 +    ULONG_PTR  CreatorBackTraceIndex;
  5.2102 +  } DUMMYUNIONNAME;
  5.2103 +  KSPIN_LOCK  SpinLock;
  5.2104 +} ERESOURCE, *PERESOURCE;
  5.2105 +
  5.2106 +/* NOTE: PVOID for methods to avoid 'assignment from incompatible pointer type' warning */
  5.2107 +typedef struct _DRIVER_EXTENSION {
  5.2108 +  struct _DRIVER_OBJECT  *DriverObject;
  5.2109 +  PVOID  AddDevice;
  5.2110 +  ULONG  Count;
  5.2111 +  UNICODE_STRING  ServiceKeyName;
  5.2112 +} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
  5.2113 +
  5.2114 +typedef BOOLEAN DDKAPI
  5.2115 +(*PFAST_IO_CHECK_IF_POSSIBLE)(
  5.2116 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2117 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2118 +  /*IN*/ ULONG  Length,
  5.2119 +  /*IN*/ BOOLEAN  Wait,
  5.2120 +  /*IN*/ ULONG  LockKey,
  5.2121 +  /*IN*/ BOOLEAN  CheckForReadOperation,
  5.2122 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2123 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2124 +
  5.2125 +typedef BOOLEAN DDKAPI
  5.2126 +(*PFAST_IO_READ)(
  5.2127 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2128 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2129 +  /*IN*/ ULONG  Length,
  5.2130 +  /*IN*/ BOOLEAN  Wait,
  5.2131 +  /*IN*/ ULONG  LockKey,
  5.2132 +  /*OUT*/ PVOID  Buffer,
  5.2133 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2134 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2135 +
  5.2136 +typedef BOOLEAN DDKAPI
  5.2137 +(*PFAST_IO_WRITE)(
  5.2138 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2139 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2140 +  /*IN*/ ULONG  Length,
  5.2141 +  /*IN*/ BOOLEAN  Wait,
  5.2142 +  /*IN*/ ULONG  LockKey,
  5.2143 +  /*IN*/ PVOID  Buffer,
  5.2144 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2145 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2146 +
  5.2147 +typedef BOOLEAN DDKAPI
  5.2148 +(*PFAST_IO_QUERY_BASIC_INFO)(
  5.2149 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2150 +  /*IN*/ BOOLEAN  Wait,
  5.2151 +  /*OUT*/ PFILE_BASIC_INFORMATION  Buffer,
  5.2152 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2153 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2154 +
  5.2155 +typedef BOOLEAN DDKAPI
  5.2156 +(*PFAST_IO_QUERY_STANDARD_INFO)(
  5.2157 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2158 +  /*IN*/ BOOLEAN  Wait,
  5.2159 +  /*OUT*/ PFILE_STANDARD_INFORMATION  Buffer,
  5.2160 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2161 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2162 +
  5.2163 +typedef BOOLEAN DDKAPI
  5.2164 +(*PFAST_IO_LOCK)(
  5.2165 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2166 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2167 +  /*IN*/ PLARGE_INTEGER  Length,
  5.2168 +  PEPROCESS  ProcessId,
  5.2169 +  ULONG  Key,
  5.2170 +  BOOLEAN  FailImmediately,
  5.2171 +  BOOLEAN  ExclusiveLock,
  5.2172 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2173 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2174 +
  5.2175 +typedef BOOLEAN DDKAPI
  5.2176 +(*PFAST_IO_UNLOCK_SINGLE)(
  5.2177 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2178 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2179 +  /*IN*/ PLARGE_INTEGER  Length,
  5.2180 +  PEPROCESS  ProcessId,
  5.2181 +  ULONG  Key,
  5.2182 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2183 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2184 +
  5.2185 +typedef BOOLEAN DDKAPI
  5.2186 +(*PFAST_IO_UNLOCK_ALL)(
  5.2187 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2188 +  PEPROCESS  ProcessId,
  5.2189 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2190 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2191 +
  5.2192 +typedef BOOLEAN DDKAPI
  5.2193 +(*PFAST_IO_UNLOCK_ALL_BY_KEY)(
  5.2194 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2195 +  PVOID  ProcessId,
  5.2196 +  ULONG  Key,
  5.2197 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2198 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2199 +
  5.2200 +typedef BOOLEAN DDKAPI
  5.2201 +(*PFAST_IO_DEVICE_CONTROL)(
  5.2202 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2203 +  /*IN*/ BOOLEAN  Wait,
  5.2204 +  /*IN*/ PVOID  InputBuffer  /*OPTIONAL*/,
  5.2205 +  /*IN*/ ULONG  InputBufferLength,
  5.2206 +  /*OUT*/ PVOID  OutputBuffer  /*OPTIONAL*/,
  5.2207 +  /*IN*/ ULONG  OutputBufferLength,
  5.2208 +  /*IN*/ ULONG  IoControlCode,
  5.2209 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2210 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2211 +
  5.2212 +typedef VOID DDKAPI
  5.2213 +(*PFAST_IO_ACQUIRE_FILE)(
  5.2214 +  /*IN*/ struct _FILE_OBJECT  *FileObject);
  5.2215 +
  5.2216 +typedef VOID DDKAPI
  5.2217 +(*PFAST_IO_RELEASE_FILE)(
  5.2218 +  /*IN*/ struct _FILE_OBJECT  *FileObject);
  5.2219 +
  5.2220 +typedef VOID DDKAPI
  5.2221 +(*PFAST_IO_DETACH_DEVICE)(
  5.2222 +  /*IN*/ struct _DEVICE_OBJECT  *SourceDevice,
  5.2223 +  /*IN*/ struct _DEVICE_OBJECT  *TargetDevice);
  5.2224 +
  5.2225 +typedef BOOLEAN DDKAPI
  5.2226 +(*PFAST_IO_QUERY_NETWORK_OPEN_INFO)(
  5.2227 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2228 +  /*IN*/ BOOLEAN  Wait,
  5.2229 +  /*OUT*/ struct _FILE_NETWORK_OPEN_INFORMATION  *Buffer,
  5.2230 +  /*OUT*/ struct _IO_STATUS_BLOCK  *IoStatus,
  5.2231 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2232 +
  5.2233 +typedef NTSTATUS DDKAPI
  5.2234 +(*PFAST_IO_ACQUIRE_FOR_MOD_WRITE)(
  5.2235 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2236 +  /*IN*/ PLARGE_INTEGER  EndingOffset,
  5.2237 +  /*OUT*/ struct _ERESOURCE  **ResourceToRelease,
  5.2238 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2239 +
  5.2240 +typedef BOOLEAN DDKAPI
  5.2241 +(*PFAST_IO_MDL_READ)(
  5.2242 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2243 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2244 +  /*IN*/ ULONG  Length,
  5.2245 +  /*IN*/ ULONG  LockKey,
  5.2246 +  /*OUT*/ PMDL  *MdlChain,
  5.2247 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2248 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2249 +
  5.2250 +typedef BOOLEAN DDKAPI
  5.2251 +(*PFAST_IO_MDL_READ_COMPLETE)(
  5.2252 +  /*IN*/ struct _FILE_OBJECT *FileObject,
  5.2253 +  /*IN*/ PMDL MdlChain,
  5.2254 +  /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
  5.2255 +
  5.2256 +typedef BOOLEAN DDKAPI
  5.2257 +(*PFAST_IO_PREPARE_MDL_WRITE)(
  5.2258 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2259 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2260 +  /*IN*/ ULONG  Length,
  5.2261 +  /*IN*/ ULONG  LockKey,
  5.2262 +  /*OUT*/ PMDL  *MdlChain,
  5.2263 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2264 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2265 +
  5.2266 +typedef BOOLEAN DDKAPI
  5.2267 +(*PFAST_IO_MDL_WRITE_COMPLETE)(
  5.2268 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2269 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2270 +  /*IN*/ PMDL  MdlChain,
  5.2271 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2272 +
  5.2273 +typedef BOOLEAN DDKAPI
  5.2274 +(*PFAST_IO_READ_COMPRESSED)(
  5.2275 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2276 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2277 +  /*IN*/ ULONG  Length,
  5.2278 +  /*IN*/ ULONG  LockKey,
  5.2279 +  /*OUT*/ PVOID  Buffer,
  5.2280 +  /*OUT*/ PMDL  *MdlChain,
  5.2281 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2282 +  /*OUT*/ struct _COMPRESSED_DATA_INFO  *CompressedDataInfo,
  5.2283 +  /*IN*/ ULONG  CompressedDataInfoLength,
  5.2284 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2285 +
  5.2286 +typedef BOOLEAN DDKAPI
  5.2287 +(*PFAST_IO_WRITE_COMPRESSED)(
  5.2288 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2289 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2290 +  /*IN*/ ULONG  Length,
  5.2291 +  /*IN*/ ULONG  LockKey,
  5.2292 +  /*IN*/ PVOID  Buffer,
  5.2293 +  /*OUT*/ PMDL  *MdlChain,
  5.2294 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  5.2295 +  /*IN*/ struct _COMPRESSED_DATA_INFO  *CompressedDataInfo,
  5.2296 +  /*IN*/ ULONG  CompressedDataInfoLength,
  5.2297 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2298 +
  5.2299 +typedef BOOLEAN DDKAPI
  5.2300 +(*PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
  5.2301 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2302 +  /*IN*/ PMDL  MdlChain,
  5.2303 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2304 +
  5.2305 +typedef BOOLEAN DDKAPI
  5.2306 +(*PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
  5.2307 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2308 +  /*IN*/ PLARGE_INTEGER  FileOffset,
  5.2309 +  /*IN*/ PMDL  MdlChain,
  5.2310 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2311 +
  5.2312 +typedef BOOLEAN DDKAPI
  5.2313 +(*PFAST_IO_QUERY_OPEN)(
  5.2314 +  /*IN*/ struct _IRP  *Irp,
  5.2315 +  /*OUT*/ PFILE_NETWORK_OPEN_INFORMATION  NetworkInformation,
  5.2316 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2317 +
  5.2318 +typedef NTSTATUS DDKAPI
  5.2319 +(*PFAST_IO_RELEASE_FOR_MOD_WRITE)(
  5.2320 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2321 +  /*IN*/ struct _ERESOURCE  *ResourceToRelease,
  5.2322 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2323 +
  5.2324 +typedef NTSTATUS DDKAPI
  5.2325 +(*PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
  5.2326 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2327 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2328 +
  5.2329 +typedef NTSTATUS DDKAPI
  5.2330 +(*PFAST_IO_RELEASE_FOR_CCFLUSH) (
  5.2331 +  /*IN*/ struct _FILE_OBJECT  *FileObject,
  5.2332 +  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  5.2333 +
  5.2334 +typedef struct _FAST_IO_DISPATCH {
  5.2335 +  ULONG  SizeOfFastIoDispatch;
  5.2336 +  PFAST_IO_CHECK_IF_POSSIBLE  FastIoCheckIfPossible;
  5.2337 +  PFAST_IO_READ  FastIoRead;
  5.2338 +  PFAST_IO_WRITE  FastIoWrite;
  5.2339 +  PFAST_IO_QUERY_BASIC_INFO  FastIoQueryBasicInfo;
  5.2340 +  PFAST_IO_QUERY_STANDARD_INFO  FastIoQueryStandardInfo;
  5.2341 +  PFAST_IO_LOCK  FastIoLock;
  5.2342 +  PFAST_IO_UNLOCK_SINGLE  FastIoUnlockSingle;
  5.2343 +  PFAST_IO_UNLOCK_ALL  FastIoUnlockAll;
  5.2344 +  PFAST_IO_UNLOCK_ALL_BY_KEY  FastIoUnlockAllByKey;
  5.2345 +  PFAST_IO_DEVICE_CONTROL  FastIoDeviceControl;
  5.2346 +  PFAST_IO_ACQUIRE_FILE  AcquireFileForNtCreateSection;
  5.2347 +  PFAST_IO_RELEASE_FILE  ReleaseFileForNtCreateSection;
  5.2348 +  PFAST_IO_DETACH_DEVICE  FastIoDetachDevice;
  5.2349 +  PFAST_IO_QUERY_NETWORK_OPEN_INFO  FastIoQueryNetworkOpenInfo;
  5.2350 +  PFAST_IO_ACQUIRE_FOR_MOD_WRITE  AcquireForModWrite;
  5.2351 +  PFAST_IO_MDL_READ  MdlRead;
  5.2352 +  PFAST_IO_MDL_READ_COMPLETE  MdlReadComplete;
  5.2353 +  PFAST_IO_PREPARE_MDL_WRITE  PrepareMdlWrite;
  5.2354 +  PFAST_IO_MDL_WRITE_COMPLETE  MdlWriteComplete;
  5.2355 +  PFAST_IO_READ_COMPRESSED  FastIoReadCompressed;
  5.2356 +  PFAST_IO_WRITE_COMPRESSED  FastIoWriteCompressed;
  5.2357 +  PFAST_IO_MDL_READ_COMPLETE_COMPRESSED  MdlReadCompleteCompressed;
  5.2358 +  PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED  MdlWriteCompleteCompressed;
  5.2359 +  PFAST_IO_QUERY_OPEN  FastIoQueryOpen;
  5.2360 +  PFAST_IO_RELEASE_FOR_MOD_WRITE  ReleaseForModWrite;
  5.2361 +  PFAST_IO_ACQUIRE_FOR_CCFLUSH  AcquireForCcFlush;
  5.2362 +  PFAST_IO_RELEASE_FOR_CCFLUSH  ReleaseForCcFlush;
  5.2363 +} FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
  5.2364 +
  5.2365 +typedef struct _DRIVER_OBJECT {
  5.2366 +  CSHORT  Type;
  5.2367 +  CSHORT  Size;
  5.2368 +  PDEVICE_OBJECT  DeviceObject;
  5.2369 +  ULONG  Flags;
  5.2370 +  PVOID  DriverStart;
  5.2371 +  ULONG  DriverSize;
  5.2372 +  PVOID  DriverSection;
  5.2373 +  PDRIVER_EXTENSION  DriverExtension;
  5.2374 +  UNICODE_STRING  DriverName;
  5.2375 +  PUNICODE_STRING  HardwareDatabase;
  5.2376 +  PFAST_IO_DISPATCH  FastIoDispatch;
  5.2377 +  PDRIVER_INITIALIZE  DriverInit;
  5.2378 +  PDRIVER_STARTIO  DriverStartIo;
  5.2379 +  PDRIVER_UNLOAD  DriverUnload;
  5.2380 +  PDRIVER_DISPATCH  MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
  5.2381 +} DRIVER_OBJECT;
  5.2382 +typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
  5.2383 +
  5.2384 +typedef struct _SECTION_OBJECT_POINTERS {
  5.2385 +  PVOID  DataSectionObject;
  5.2386 +  PVOID  SharedCacheMap;
  5.2387 +  PVOID  ImageSectionObject;
  5.2388 +} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
  5.2389 +
  5.2390 +typedef struct _IO_COMPLETION_CONTEXT {
  5.2391 +  PVOID  Port;
  5.2392 +  PVOID  Key;
  5.2393 +} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
  5.2394 +
  5.2395 +/* FILE_OBJECT.Flags */
  5.2396 +
  5.2397 +#define FO_FILE_OPEN                      0x00000001
  5.2398 +#define FO_SYNCHRONOUS_IO                 0x00000002
  5.2399 +#define FO_ALERTABLE_IO                   0x00000004
  5.2400 +#define FO_NO_INTERMEDIATE_BUFFERING      0x00000008
  5.2401 +#define FO_WRITE_THROUGH                  0x00000010
  5.2402 +#define FO_SEQUENTIAL_ONLY                0x00000020
  5.2403 +#define FO_CACHE_SUPPORTED                0x00000040
  5.2404 +#define FO_NAMED_PIPE                     0x00000080
  5.2405 +#define FO_STREAM_FILE                    0x00000100
  5.2406 +#define FO_MAILSLOT                       0x00000200
  5.2407 +#define FO_GENERATE_AUDIT_ON_CLOSE        0x00000400
  5.2408 +#define FO_DIRECT_DEVICE_OPEN             0x00000800
  5.2409 +#define FO_FILE_MODIFIED                  0x00001000
  5.2410 +#define FO_FILE_SIZE_CHANGED              0x00002000
  5.2411 +#define FO_CLEANUP_COMPLETE               0x00004000
  5.2412 +#define FO_TEMPORARY_FILE                 0x00008000
  5.2413 +#define FO_DELETE_ON_CLOSE                0x00010000
  5.2414 +#define FO_OPENED_CASE_SENSITIVE          0x00020000
  5.2415 +#define FO_HANDLE_CREATED                 0x00040000
  5.2416 +#define FO_FILE_FAST_IO_READ              0x00080000
  5.2417 +#define FO_RANDOM_ACCESS                  0x00100000
  5.2418 +#define FO_FILE_OPEN_CANCELLED            0x00200000
  5.2419 +#define FO_VOLUME_OPEN                    0x00400000
  5.2420 +#define FO_FILE_OBJECT_HAS_EXTENSION      0x00800000
  5.2421 +#define FO_REMOTE_ORIGIN                  0x01000000
  5.2422 +
  5.2423 +typedef struct _FILE_OBJECT {
  5.2424 +  CSHORT  Type;
  5.2425 +  CSHORT  Size;
  5.2426 +  PDEVICE_OBJECT  DeviceObject;
  5.2427 +  PVPB  Vpb;
  5.2428 +  PVOID  FsContext;
  5.2429 +  PVOID  FsContext2;
  5.2430 +  PSECTION_OBJECT_POINTERS  SectionObjectPointer;
  5.2431 +  PVOID  PrivateCacheMap;
  5.2432 +  NTSTATUS  FinalStatus;
  5.2433 +  struct _FILE_OBJECT  *RelatedFileObject;
  5.2434 +  BOOLEAN  LockOperation;
  5.2435 +  BOOLEAN  DeletePending;
  5.2436 +  BOOLEAN  ReadAccess;
  5.2437 +  BOOLEAN  WriteAccess;
  5.2438 +  BOOLEAN  DeleteAccess;
  5.2439 +  BOOLEAN  SharedRead;
  5.2440 +  BOOLEAN  SharedWrite;
  5.2441 +  BOOLEAN  SharedDelete;
  5.2442 +  ULONG  Flags;
  5.2443 +  UNICODE_STRING  FileName;
  5.2444 +  LARGE_INTEGER  CurrentByteOffset;
  5.2445 +  ULONG  Waiters;
  5.2446 +  ULONG  Busy;
  5.2447 +  PVOID  LastLock;
  5.2448 +  KEVENT  Lock;
  5.2449 +  KEVENT  Event;
  5.2450 +  PIO_COMPLETION_CONTEXT  CompletionContext;
  5.2451 +} FILE_OBJECT;
  5.2452 +typedef struct _FILE_OBJECT *PFILE_OBJECT;
  5.2453 +
  5.2454 +typedef enum _SECURITY_OPERATION_CODE {
  5.2455 +  SetSecurityDescriptor,
  5.2456 +  QuerySecurityDescriptor,
  5.2457 +  DeleteSecurityDescriptor,
  5.2458 +  AssignSecurityDescriptor
  5.2459 +} SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
  5.2460 +
  5.2461 +#define INITIAL_PRIVILEGE_COUNT           3
  5.2462 +
  5.2463 +typedef struct _INITIAL_PRIVILEGE_SET {
  5.2464 +  ULONG  PrivilegeCount;
  5.2465 +  ULONG  Control;
  5.2466 +  LUID_AND_ATTRIBUTES  Privilege[INITIAL_PRIVILEGE_COUNT];
  5.2467 +} INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
  5.2468 +
  5.2469 +typedef struct _SECURITY_SUBJECT_CONTEXT {
  5.2470 +  PACCESS_TOKEN  ClientToken;
  5.2471 +  SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel;
  5.2472 +  PACCESS_TOKEN  PrimaryToken;
  5.2473 +  PVOID  ProcessAuditId;
  5.2474 +} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
  5.2475 +
  5.2476 +#include <pshpack4.h>
  5.2477 +typedef struct _ACCESS_STATE {
  5.2478 +  LUID  OperationID;
  5.2479 +  BOOLEAN  SecurityEvaluated;
  5.2480 +  BOOLEAN  GenerateAudit;
  5.2481 +  BOOLEAN  GenerateOnClose;
  5.2482 +  BOOLEAN  PrivilegesAllocated;
  5.2483 +  ULONG  Flags;
  5.2484 +  ACCESS_MASK  RemainingDesiredAccess;
  5.2485 +  ACCESS_MASK  PreviouslyGrantedAccess;
  5.2486 +  ACCESS_MASK  OriginalDesiredAccess;
  5.2487 +  SECURITY_SUBJECT_CONTEXT  SubjectSecurityContext;
  5.2488 +  PSECURITY_DESCRIPTOR  SecurityDescriptor;
  5.2489 +  PVOID  AuxData;
  5.2490 +  union {
  5.2491 +    INITIAL_PRIVILEGE_SET  InitialPrivilegeSet;
  5.2492 +    PRIVILEGE_SET  PrivilegeSet;
  5.2493 +  } Privileges;
  5.2494 +
  5.2495 +  BOOLEAN  AuditPrivileges;
  5.2496 +  UNICODE_STRING  ObjectName;
  5.2497 +  UNICODE_STRING  ObjectTypeName;
  5.2498 +} ACCESS_STATE, *PACCESS_STATE;
  5.2499 +#include <poppack.h>
  5.2500 +
  5.2501 +typedef struct _IO_SECURITY_CONTEXT {
  5.2502 +  PSECURITY_QUALITY_OF_SERVICE  SecurityQos;
  5.2503 +  PACCESS_STATE  AccessState;
  5.2504 +  ACCESS_MASK  DesiredAccess;
  5.2505 +  ULONG  FullCreateOptions;
  5.2506 +} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
  5.2507 +
  5.2508 +struct _IO_CSQ;
  5.2509 +
  5.2510 +typedef struct _IO_CSQ_IRP_CONTEXT {
  5.2511 +  ULONG  Type;
  5.2512 +  struct _IRP  *Irp;
  5.2513 +  struct _IO_CSQ  *Csq;
  5.2514 +} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
  5.2515 +
  5.2516 +typedef VOID DDKAPI
  5.2517 +(*PIO_CSQ_INSERT_IRP)(
  5.2518 +  /*IN*/ struct _IO_CSQ  *Csq,
  5.2519 +  /*IN*/ PIRP  Irp);
  5.2520 +
  5.2521 +typedef VOID DDKAPI
  5.2522 +(*PIO_CSQ_REMOVE_IRP)(
  5.2523 +  /*IN*/ struct _IO_CSQ  *Csq,
  5.2524 +  /*IN*/ PIRP  Irp);
  5.2525 +
  5.2526 +typedef PIRP DDKAPI
  5.2527 +(*PIO_CSQ_PEEK_NEXT_IRP)(
  5.2528 +  /*IN*/ struct _IO_CSQ  *Csq,
  5.2529 +  /*IN*/ PIRP  Irp,
  5.2530 +  /*IN*/ PVOID  PeekContext);
  5.2531 +
  5.2532 +typedef VOID DDKAPI
  5.2533 +(*PIO_CSQ_ACQUIRE_LOCK)(
  5.2534 +  /*IN*/ struct _IO_CSQ  *Csq,
  5.2535 +  /*OUT*/ PKIRQL  Irql);
  5.2536 +
  5.2537 +typedef VOID DDKAPI
  5.2538 +(*PIO_CSQ_RELEASE_LOCK)(
  5.2539 +  /*IN*/ struct _IO_CSQ  *Csq,
  5.2540 +  /*IN*/ KIRQL  Irql);
  5.2541 +
  5.2542 +typedef VOID DDKAPI
  5.2543 +(*PIO_CSQ_COMPLETE_CANCELED_IRP)(
  5.2544 +  /*IN*/ struct _IO_CSQ  *Csq,
  5.2545 +  /*IN*/ PIRP  Irp);
  5.2546 +
  5.2547 +typedef struct _IO_CSQ {
  5.2548 +  ULONG  Type;
  5.2549 +  PIO_CSQ_INSERT_IRP  CsqInsertIrp;
  5.2550 +  PIO_CSQ_REMOVE_IRP  CsqRemoveIrp;
  5.2551 +  PIO_CSQ_PEEK_NEXT_IRP  CsqPeekNextIrp;
  5.2552 +  PIO_CSQ_ACQUIRE_LOCK  CsqAcquireLock;
  5.2553 +  PIO_CSQ_RELEASE_LOCK  CsqReleaseLock;
  5.2554 +  PIO_CSQ_COMPLETE_CANCELED_IRP  CsqCompleteCanceledIrp;
  5.2555 +  PVOID  ReservePointer;
  5.2556 +} IO_CSQ, *PIO_CSQ;
  5.2557 +
  5.2558 +#include <pshpack4.h>
  5.2559 +typedef struct _IO_STACK_LOCATION {
  5.2560 +  UCHAR  MajorFunction;
  5.2561 +  UCHAR  MinorFunction;
  5.2562 +  UCHAR  Flags;
  5.2563 +  UCHAR  Control;
  5.2564 +  union {
  5.2565 +    struct {
  5.2566 +      PIO_SECURITY_CONTEXT  SecurityContext;
  5.2567 +      ULONG  Options;
  5.2568 +      USHORT POINTER_ALIGNMENT  FileAttributes;
  5.2569 +      USHORT  ShareAccess;
  5.2570 +      ULONG POINTER_ALIGNMENT  EaLength;
  5.2571 +    } Create;
  5.2572 +    struct {
  5.2573 +      ULONG  Length;
  5.2574 +      ULONG POINTER_ALIGNMENT  Key;
  5.2575 +      LARGE_INTEGER  ByteOffset;
  5.2576 +    } Read;
  5.2577 +    struct {
  5.2578 +      ULONG  Length;
  5.2579 +      ULONG POINTER_ALIGNMENT  Key;
  5.2580 +      LARGE_INTEGER  ByteOffset;
  5.2581 +    } Write;
  5.2582 +    struct {
  5.2583 +      ULONG  Length;
  5.2584 +      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
  5.2585 +    } QueryFile;
  5.2586 +    struct {
  5.2587 +      ULONG  Length;
  5.2588 +      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
  5.2589 +      PFILE_OBJECT  FileObject;
  5.2590 +      _ANONYMOUS_UNION union {
  5.2591 +        _ANONYMOUS_STRUCT struct {
  5.2592 +          BOOLEAN  ReplaceIfExists;
  5.2593 +          BOOLEAN  AdvanceOnly;
  5.2594 +        } DUMMYSTRUCTNAME;
  5.2595 +        ULONG  ClusterCount;
  5.2596 +        HANDLE  DeleteHandle;
  5.2597 +      } DUMMYUNIONNAME;
  5.2598 +    } SetFile;
  5.2599 +    struct {
  5.2600 +      ULONG  Length;
  5.2601 +      FS_INFORMATION_CLASS POINTER_ALIGNMENT  FsInformationClass;
  5.2602 +    } QueryVolume;
  5.2603 +    struct {
  5.2604 +      ULONG  OutputBufferLength;
  5.2605 +      ULONG POINTER_ALIGNMENT  InputBufferLength;
  5.2606 +      ULONG POINTER_ALIGNMENT  IoControlCode;
  5.2607 +      PVOID  Type3InputBuffer;
  5.2608 +    } DeviceIoControl;
  5.2609 +    struct {
  5.2610 +      SECURITY_INFORMATION  SecurityInformation;
  5.2611 +      ULONG POINTER_ALIGNMENT  Length;
  5.2612 +    } QuerySecurity;
  5.2613 +    struct {
  5.2614 +      SECURITY_INFORMATION  SecurityInformation;
  5.2615 +      PSECURITY_DESCRIPTOR  SecurityDescriptor;
  5.2616 +    } SetSecurity;
  5.2617 +    struct {
  5.2618 +      PVPB  Vpb;
  5.2619 +      PDEVICE_OBJECT  DeviceObject;
  5.2620 +    } MountVolume;
  5.2621 +    struct {
  5.2622 +      PVPB  Vpb;
  5.2623 +      PDEVICE_OBJECT  DeviceObject;
  5.2624 +    } VerifyVolume;
  5.2625 +    struct {
  5.2626 +      struct _SCSI_REQUEST_BLOCK  *Srb;
  5.2627 +    } Scsi;
  5.2628 +    struct {
  5.2629 +      DEVICE_RELATION_TYPE  Type;
  5.2630 +    } QueryDeviceRelations;
  5.2631 +    struct {
  5.2632 +      CONST GUID  *InterfaceType;
  5.2633 +      USHORT  Size;
  5.2634 +      USHORT  Version;
  5.2635 +      PINTERFACE  Interface;
  5.2636 +      PVOID  InterfaceSpecificData;
  5.2637 +    } QueryInterface;
  5.2638 +    struct {
  5.2639 +      PDEVICE_CAPABILITIES  Capabilities;
  5.2640 +    } DeviceCapabilities;
  5.2641 +    struct {
  5.2642 +      PIO_RESOURCE_REQUIREMENTS_LIST  IoResourceRequirementList;
  5.2643 +    } FilterResourceRequirements;
  5.2644 +    struct {
  5.2645 +      ULONG  WhichSpace;
  5.2646 +      PVOID  Buffer;
  5.2647 +      ULONG  Offset;
  5.2648 +      ULONG POINTER_ALIGNMENT  Length;
  5.2649 +    } ReadWriteConfig;
  5.2650 +    struct {
  5.2651 +      BOOLEAN  Lock;
  5.2652 +    } SetLock;
  5.2653 +    struct {
  5.2654 +      BUS_QUERY_ID_TYPE  IdType;
  5.2655 +    } QueryId;
  5.2656 +    struct {
  5.2657 +      DEVICE_TEXT_TYPE  DeviceTextType;
  5.2658 +      LCID POINTER_ALIGNMENT  LocaleId;
  5.2659 +    } QueryDeviceText;
  5.2660 +    struct {
  5.2661 +      BOOLEAN  InPath;
  5.2662 +      BOOLEAN  Reserved[3];
  5.2663 +      DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT  Type;
  5.2664 +    } UsageNotification;
  5.2665 +    struct {
  5.2666 +      SYSTEM_POWER_STATE  PowerState;
  5.2667 +    } WaitWake;
  5.2668 +    struct {
  5.2669 +      PPOWER_SEQUENCE  PowerSequence;
  5.2670 +    } PowerSequence;
  5.2671 +    struct {
  5.2672 +      ULONG  SystemContext;
  5.2673 +      POWER_STATE_TYPE POINTER_ALIGNMENT  Type;
  5.2674 +      POWER_STATE POINTER_ALIGNMENT  State;
  5.2675 +      POWER_ACTION POINTER_ALIGNMENT  ShutdownType;
  5.2676 +    } Power;
  5.2677 +    struct {
  5.2678 +      PCM_RESOURCE_LIST  AllocatedResources;
  5.2679 +      PCM_RESOURCE_LIST  AllocatedResourcesTranslated;
  5.2680 +    } StartDevice;
  5.2681 +    struct {
  5.2682 +      ULONG_PTR  ProviderId;
  5.2683 +      PVOID  DataPath;
  5.2684 +      ULONG  BufferSize;
  5.2685 +      PVOID  Buffer;
  5.2686 +    } WMI;
  5.2687 +    struct {
  5.2688 +      PVOID  Argument1;
  5.2689 +      PVOID  Argument2;
  5.2690 +      PVOID  Argument3;
  5.2691 +      PVOID  Argument4;
  5.2692 +    } Others;
  5.2693 +  } Parameters;
  5.2694 +  PDEVICE_OBJECT  DeviceObject;
  5.2695 +  PFILE_OBJECT  FileObject;
  5.2696 +  PIO_COMPLETION_ROUTINE  CompletionRoutine;
  5.2697 +  PVOID  Context;
  5.2698 +} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
  5.2699 +#include <poppack.h>
  5.2700 +
  5.2701 +/* IO_STACK_LOCATION.Control */
  5.2702 +
  5.2703 +#define SL_PENDING_RETURNED               0x01
  5.2704 +#define SL_INVOKE_ON_CANCEL               0x20
  5.2705 +#define SL_INVOKE_ON_SUCCESS              0x40
  5.2706 +#define SL_INVOKE_ON_ERROR                0x80
  5.2707 +
  5.2708 +typedef enum _KEY_INFORMATION_CLASS {
  5.2709 +  KeyBasicInformation,
  5.2710 +  KeyNodeInformation,
  5.2711 +  KeyFullInformation,
  5.2712 +  KeyNameInformation,
  5.2713 +  KeyCachedInformation,
  5.2714 +  KeyFlagsInformation
  5.2715 +} KEY_INFORMATION_CLASS;
  5.2716 +
  5.2717 +typedef struct _KEY_BASIC_INFORMATION {
  5.2718 +  LARGE_INTEGER  LastWriteTime;
  5.2719 +  ULONG  TitleIndex;
  5.2720 +  ULONG  NameLength;
  5.2721 +  WCHAR  Name[1];
  5.2722 +} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
  5.2723 +
  5.2724 +typedef struct _KEY_FULL_INFORMATION {
  5.2725 +  LARGE_INTEGER  LastWriteTime;
  5.2726 +  ULONG  TitleIndex;
  5.2727 +  ULONG  ClassOffset;
  5.2728 +  ULONG  ClassLength;
  5.2729 +  ULONG  SubKeys;
  5.2730 +  ULONG  MaxNameLen;
  5.2731 +  ULONG  MaxClassLen;
  5.2732 +  ULONG  Values;
  5.2733 +  ULONG  MaxValueNameLen;
  5.2734 +  ULONG  MaxValueDataLen;
  5.2735 +  WCHAR  Class[1];
  5.2736 +} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
  5.2737 +
  5.2738 +typedef struct _KEY_NODE_INFORMATION {
  5.2739 +  LARGE_INTEGER  LastWriteTime;
  5.2740 +  ULONG  TitleIndex;
  5.2741 +  ULONG  ClassOffset;
  5.2742 +  ULONG  ClassLength;
  5.2743 +  ULONG  NameLength;
  5.2744 +  WCHAR  Name[1];
  5.2745 +} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
  5.2746 +
  5.2747 +typedef struct _KEY_VALUE_BASIC_INFORMATION {
  5.2748 +  ULONG  TitleIndex;
  5.2749 +  ULONG  Type;
  5.2750 +  ULONG  NameLength;
  5.2751 +  WCHAR  Name[1];
  5.2752 +} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
  5.2753 +
  5.2754 +typedef struct _KEY_VALUE_FULL_INFORMATION {
  5.2755 +  ULONG  TitleIndex;
  5.2756 +  ULONG  Type;
  5.2757 +  ULONG  DataOffset;
  5.2758 +  ULONG  DataLength;
  5.2759 +  ULONG  NameLength;
  5.2760 +  WCHAR  Name[1];
  5.2761 +} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
  5.2762 +
  5.2763 +typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
  5.2764 +  ULONG  TitleIndex;
  5.2765 +  ULONG  Type;
  5.2766 +  ULONG  DataLength;
  5.2767 +  UCHAR  Data[1];
  5.2768 +} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
  5.2769 +
  5.2770 +typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
  5.2771 +  ULONG  Type;
  5.2772 +  ULONG  DataLength;
  5.2773 +  UCHAR  Data[1];
  5.2774 +} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
  5.2775 +
  5.2776 +typedef struct _KEY_VALUE_ENTRY {
  5.2777 +  PUNICODE_STRING  ValueName;
  5.2778 +  ULONG  DataLength;
  5.2779 +  ULONG  DataOffset;
  5.2780 +  ULONG  Type;
  5.2781 +} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
  5.2782 +
  5.2783 +typedef enum _KEY_VALUE_INFORMATION_CLASS {
  5.2784 +  KeyValueBasicInformation,
  5.2785 +  KeyValueFullInformation,
  5.2786 +  KeyValuePartialInformation,
  5.2787 +  KeyValueFullInformationAlign64,
  5.2788 +  KeyValuePartialInformationAlign64
  5.2789 +} KEY_VALUE_INFORMATION_CLASS;
  5.2790 +
  5.2791 +/* KEY_VALUE_Xxx.Type */
  5.2792 +
  5.2793 +#define REG_NONE                           0
  5.2794 +#define REG_SZ                             1
  5.2795 +#define REG_EXPAND_SZ                      2
  5.2796 +#define REG_BINARY                         3
  5.2797 +#define REG_DWORD                          4
  5.2798 +#define REG_DWORD_LITTLE_ENDIAN            4
  5.2799 +#define REG_DWORD_BIG_ENDIAN               5
  5.2800 +#define REG_LINK                           6
  5.2801 +#define REG_MULTI_SZ                       7
  5.2802 +#define REG_RESOURCE_LIST                  8
  5.2803 +#define REG_FULL_RESOURCE_DESCRIPTOR       9
  5.2804 +#define REG_RESOURCE_REQUIREMENTS_LIST    10
  5.2805 +#define REG_QWORD                         11
  5.2806 +#define REG_QWORD_LITTLE_ENDIAN           11
  5.2807 +
  5.2808 +#define PCI_TYPE0_ADDRESSES               6
  5.2809 +#define PCI_TYPE1_ADDRESSES               2
  5.2810 +#define PCI_TYPE2_ADDRESSES               5
  5.2811 +
  5.2812 +typedef struct _PCI_COMMON_CONFIG {
  5.2813 +  USHORT  VendorID;
  5.2814 +  USHORT  DeviceID;
  5.2815 +  USHORT  Command;
  5.2816 +  USHORT  Status;
  5.2817 +  UCHAR  RevisionID;
  5.2818 +  UCHAR  ProgIf;
  5.2819 +  UCHAR  SubClass;
  5.2820 +  UCHAR  BaseClass;
  5.2821 +  UCHAR  CacheLineSize;
  5.2822 +  UCHAR  LatencyTimer;
  5.2823 +  UCHAR  HeaderType;
  5.2824 +  UCHAR  BIST;
  5.2825 +  union {
  5.2826 +    struct _PCI_HEADER_TYPE_0 {
  5.2827 +      ULONG  BaseAddresses[PCI_TYPE0_ADDRESSES];
  5.2828 +      ULONG  CIS;
  5.2829 +      USHORT  SubVendorID;
  5.2830 +      USHORT  SubSystemID;
  5.2831 +      ULONG  ROMBaseAddress;
  5.2832 +      UCHAR  CapabilitiesPtr;
  5.2833 +      UCHAR  Reserved1[3];
  5.2834 +      ULONG  Reserved2;
  5.2835 +      UCHAR  InterruptLine;
  5.2836 +      UCHAR  InterruptPin;
  5.2837 +      UCHAR  MinimumGrant;
  5.2838 +      UCHAR  MaximumLatency;
  5.2839 +    } type0;
  5.2840 +      struct _PCI_HEADER_TYPE_1 {
  5.2841 +        ULONG  BaseAddresses[PCI_TYPE1_ADDRESSES];
  5.2842 +        UCHAR  PrimaryBus;
  5.2843 +        UCHAR  SecondaryBus;
  5.2844 +        UCHAR  SubordinateBus;
  5.2845 +        UCHAR  SecondaryLatency;
  5.2846 +        UCHAR  IOBase;
  5.2847 +        UCHAR  IOLimit;
  5.2848 +        USHORT  SecondaryStatus;
  5.2849 +        USHORT  MemoryBase;
  5.2850 +        USHORT  MemoryLimit;
  5.2851 +        USHORT  PrefetchBase;
  5.2852 +        USHORT  PrefetchLimit;
  5.2853 +        ULONG  PrefetchBaseUpper32;
  5.2854 +        ULONG  PrefetchLimitUpper32;
  5.2855 +        USHORT  IOBaseUpper16;
  5.2856 +        USHORT  IOLimitUpper16;
  5.2857 +        UCHAR  CapabilitiesPtr;
  5.2858 +        UCHAR  Reserved1[3];
  5.2859 +        ULONG  ROMBaseAddress;
  5.2860 +        UCHAR  InterruptLine;
  5.2861 +        UCHAR  InterruptPin;
  5.2862 +        USHORT  BridgeControl;
  5.2863 +      } type1;
  5.2864 +      struct _PCI_HEADER_TYPE_2 {
  5.2865 +        ULONG  SocketRegistersBaseAddress;
  5.2866 +        UCHAR  CapabilitiesPtr;
  5.2867 +        UCHAR  Reserved;
  5.2868 +        USHORT  SecondaryStatus;
  5.2869 +        UCHAR  PrimaryBus;
  5.2870 +        UCHAR  SecondaryBus;
  5.2871 +        UCHAR  SubordinateBus;
  5.2872 +        UCHAR  SecondaryLatency;
  5.2873 +        struct {
  5.2874 +          ULONG  Base;
  5.2875 +          ULONG  Limit;
  5.2876 +        } Range[PCI_TYPE2_ADDRESSES - 1];
  5.2877 +        UCHAR  InterruptLine;
  5.2878 +        UCHAR  InterruptPin;
  5.2879 +        USHORT  BridgeControl;
  5.2880 +      } type2;
  5.2881 +  } u;
  5.2882 +  UCHAR  DeviceSpecific[192];
  5.2883 +} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
  5.2884 +
  5.2885 +/* PCI_COMMON_CONFIG.Command */
  5.2886 +
  5.2887 +#define PCI_ENABLE_IO_SPACE               0x0001
  5.2888 +#define PCI_ENABLE_MEMORY_SPACE           0x0002
  5.2889 +#define PCI_ENABLE_BUS_MASTER             0x0004
  5.2890 +#define PCI_ENABLE_SPECIAL_CYCLES         0x0008
  5.2891 +#define PCI_ENABLE_WRITE_AND_INVALIDATE   0x0010
  5.2892 +#define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
  5.2893 +#define PCI_ENABLE_PARITY                 0x0040
  5.2894 +#define PCI_ENABLE_WAIT_CYCLE             0x0080
  5.2895 +#define PCI_ENABLE_SERR                   0x0100
  5.2896 +#define PCI_ENABLE_FAST_BACK_TO_BACK      0x0200
  5.2897 +
  5.2898 +/* PCI_COMMON_CONFIG.Status */
  5.2899 +
  5.2900 +#define PCI_STATUS_CAPABILITIES_LIST      0x0010
  5.2901 +#define PCI_STATUS_66MHZ_CAPABLE          0x0020
  5.2902 +#define PCI_STATUS_UDF_SUPPORTED          0x0040
  5.2903 +#define PCI_STATUS_FAST_BACK_TO_BACK      0x0080
  5.2904 +#define PCI_STATUS_DATA_PARITY_DETECTED   0x0100
  5.2905 +#define PCI_STATUS_DEVSEL                 0x0600
  5.2906 +#define PCI_STATUS_SIGNALED_TARGET_ABORT  0x0800
  5.2907 +#define PCI_STATUS_RECEIVED_TARGET_ABORT  0x1000
  5.2908 +#define PCI_STATUS_RECEIVED_MASTER_ABORT  0x2000
  5.2909 +#define PCI_STATUS_SIGNALED_SYSTEM_ERROR  0x4000
  5.2910 +#define PCI_STATUS_DETECTED_PARITY_ERROR  0x8000
  5.2911 +
  5.2912 +/* PCI_COMMON_CONFIG.HeaderType */
  5.2913 +
  5.2914 +#define PCI_MULTIFUNCTION                 0x80
  5.2915 +#define PCI_DEVICE_TYPE                   0x00
  5.2916 +#define PCI_BRIDGE_TYPE                   0x01
  5.2917 +#define PCI_CARDBUS_BRIDGE_TYPE           0x02
  5.2918 +
  5.2919 +#define PCI_CONFIGURATION_TYPE(PciData) \
  5.2920 +  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
  5.2921 +
  5.2922 +#define PCI_MULTIFUNCTION_DEVICE(PciData) \
  5.2923 +  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
  5.2924 +
  5.2925 +typedef struct _PCI_SLOT_NUMBER {
  5.2926 +  union {
  5.2927 +    struct {
  5.2928 +      ULONG  DeviceNumber : 5;
  5.2929 +      ULONG  FunctionNumber : 3;
  5.2930 +      ULONG  Reserved : 24;
  5.2931 +    } bits;
  5.2932 +    ULONG  AsULONG;
  5.2933 +  } u;
  5.2934 +} PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
  5.2935 +
  5.2936 +typedef enum _POOL_TYPE {
  5.2937 +  NonPagedPool,
  5.2938 +  PagedPool,
  5.2939 +  NonPagedPoolMustSucceed,
  5.2940 +  DontUseThisType,
  5.2941 +  NonPagedPoolCacheAligned,
  5.2942 +  PagedPoolCacheAligned,
  5.2943 +  NonPagedPoolCacheAlignedMustS,
  5.2944 +	MaxPoolType,
  5.2945 +	NonPagedPoolSession = 32,
  5.2946 +	PagedPoolSession,
  5.2947 +	NonPagedPoolMustSucceedSession,
  5.2948 +	DontUseThisTypeSession,
  5.2949 +	NonPagedPoolCacheAlignedSession,
  5.2950 +	PagedPoolCacheAlignedSession,
  5.2951 +	NonPagedPoolCacheAlignedMustSSession
  5.2952 +} POOL_TYPE;
  5.2953 +
  5.2954 +typedef enum _EX_POOL_PRIORITY {
  5.2955 +  LowPoolPriority,
  5.2956 +  LowPoolPrioritySpecialPoolOverrun = 8,
  5.2957 +  LowPoolPrioritySpecialPoolUnderrun = 9,
  5.2958 +  NormalPoolPriority = 16,
  5.2959 +  NormalPoolPrioritySpecialPoolOverrun = 24,
  5.2960 +  NormalPoolPrioritySpecialPoolUnderrun = 25,
  5.2961 +  HighPoolPriority = 32,
  5.2962 +  HighPoolPrioritySpecialPoolOverrun = 40,
  5.2963 +  HighPoolPrioritySpecialPoolUnderrun = 41
  5.2964 +} EX_POOL_PRIORITY;
  5.2965 +
  5.2966 +/* PRIVILEGE_SET.Control */
  5.2967 +
  5.2968 +#define PRIVILEGE_SET_ALL_NECESSARY       1
  5.2969 +
  5.2970 +typedef struct _RTL_OSVERSIONINFOW {
  5.2971 +  ULONG  dwOSVersionInfoSize;
  5.2972 +  ULONG  dwMajorVersion;
  5.2973 +  ULONG  dwMinorVersion;
  5.2974 +  ULONG  dwBuildNumber;
  5.2975 +  ULONG  dwPlatformId;
  5.2976 +  WCHAR  szCSDVersion[128];
  5.2977 +} RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
  5.2978 +
  5.2979 +typedef struct _RTL_OSVERSIONINFOEXW {
  5.2980 +  ULONG  dwOSVersionInfoSize;
  5.2981 +  ULONG  dwMajorVersion;
  5.2982 +  ULONG  dwMinorVersion;
  5.2983 +  ULONG  dwBuildNumber;
  5.2984 +  ULONG  dwPlatformId;
  5.2985 +  WCHAR  szCSDVersion[128];
  5.2986 +  USHORT  wServicePackMajor;
  5.2987 +  USHORT  wServicePackMinor;
  5.2988 +  USHORT  wSuiteMask;
  5.2989 +  UCHAR  wProductType;
  5.2990 +  UCHAR  wReserved;
  5.2991 +} RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
  5.2992 +
  5.2993 +NTOSAPI
  5.2994 +ULONGLONG
  5.2995 +DDKAPI
  5.2996 +VerSetConditionMask(
  5.2997 +  /*IN*/ ULONGLONG  ConditionMask,
  5.2998 +  /*IN*/ ULONG  TypeMask,
  5.2999 +  /*IN*/ UCHAR  Condition);
  5.3000 +
  5.3001 +#define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType)  \
  5.3002 +        ((ConditionMask) = VerSetConditionMask((ConditionMask), \
  5.3003 +        (TypeBitMask), (ComparisonType)))
  5.3004 +
  5.3005 +/* RtlVerifyVersionInfo() TypeMask */
  5.3006 +
  5.3007 +#define VER_MINORVERSION                  0x0000001
  5.3008 +#define VER_MAJORVERSION                  0x0000002
  5.3009 +#define VER_BUILDNUMBER                   0x0000004
  5.3010 +#define VER_PLATFORMID                    0x0000008
  5.3011 +#define VER_SERVICEPACKMINOR              0x0000010
  5.3012 +#define VER_SERVICEPACKMAJOR              0x0000020
  5.3013 +#define VER_SUITENAME                     0x0000040
  5.3014 +#define VER_PRODUCT_TYPE                  0x0000080
  5.3015 +
  5.3016 +/* RtlVerifyVersionInfo() ComparisonType */
  5.3017 +
  5.3018 +#define VER_EQUAL                       1
  5.3019 +#define VER_GREATER                     2
  5.3020 +#define VER_GREATER_EQUAL               3
  5.3021 +#define VER_LESS                        4
  5.3022 +#define VER_LESS_EQUAL                  5
  5.3023 +#define VER_AND                         6
  5.3024 +#define VER_OR                          7
  5.3025 +
  5.3026 +#define VER_CONDITION_MASK              7
  5.3027 +#define VER_NUM_BITS_PER_CONDITION_MASK 3
  5.3028 +
  5.3029 +typedef struct _RTL_BITMAP {
  5.3030 +  ULONG  SizeOfBitMap;
  5.3031 +  PULONG  Buffer;
  5.3032 +} RTL_BITMAP, *PRTL_BITMAP;
  5.3033 +
  5.3034 +typedef struct _RTL_BITMAP_RUN {
  5.3035 +    ULONG  StartingIndex;
  5.3036 +    ULONG  NumberOfBits;
  5.3037 +} RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
  5.3038 +
  5.3039 +typedef NTSTATUS DDKAPI
  5.3040 +(*PRTL_QUERY_REGISTRY_ROUTINE)(
  5.3041 +  /*IN*/ PWSTR  ValueName,
  5.3042 +  /*IN*/ ULONG  ValueType,
  5.3043 +  /*IN*/ PVOID  ValueData,
  5.3044 +  /*IN*/ ULONG  ValueLength,
  5.3045 +  /*IN*/ PVOID  Context,
  5.3046 +  /*IN*/ PVOID  EntryContext);
  5.3047 +
  5.3048 +#define RTL_REGISTRY_ABSOLUTE             0
  5.3049 +#define RTL_REGISTRY_SERVICES             1
  5.3050 +#define RTL_REGISTRY_CONTROL              2
  5.3051 +#define RTL_REGISTRY_WINDOWS_NT           3
  5.3052 +#define RTL_REGISTRY_DEVICEMAP            4
  5.3053 +#define RTL_REGISTRY_USER                 5
  5.3054 +
  5.3055 +/* RTL_QUERY_REGISTRY_TABLE.Flags */
  5.3056 +#define RTL_QUERY_REGISTRY_SUBKEY         0x00000001
  5.3057 +#define RTL_QUERY_REGISTRY_TOPKEY         0x00000002
  5.3058 +#define RTL_QUERY_REGISTRY_REQUIRED       0x00000004
  5.3059 +#define RTL_QUERY_REGISTRY_NOVALUE        0x00000008
  5.3060 +#define RTL_QUERY_REGISTRY_NOEXPAND       0x00000010
  5.3061 +#define RTL_QUERY_REGISTRY_DIRECT         0x00000020
  5.3062 +#define RTL_QUERY_REGISTRY_DELETE         0x00000040
  5.3063 +
  5.3064 +typedef struct _RTL_QUERY_REGISTRY_TABLE {
  5.3065 +  PRTL_QUERY_REGISTRY_ROUTINE  QueryRoutine;
  5.3066 +  ULONG  Flags;
  5.3067 +  PWSTR  Name;
  5.3068 +  PVOID  EntryContext;
  5.3069 +  ULONG  DefaultType;
  5.3070 +  PVOID  DefaultData;
  5.3071 +  ULONG  DefaultLength;
  5.3072 +} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
  5.3073 +
  5.3074 +typedef struct _TIME_FIELDS {
  5.3075 +  CSHORT  Year;
  5.3076 +  CSHORT  Month;
  5.3077 +  CSHORT  Day;
  5.3078 +  CSHORT  Hour;
  5.3079 +  CSHORT  Minute;
  5.3080 +  CSHORT  Second;
  5.3081 +  CSHORT  Milliseconds;
  5.3082 +  CSHORT  Weekday;
  5.3083 +} TIME_FIELDS, *PTIME_FIELDS;
  5.3084 +
  5.3085 +typedef PVOID DDKAPI
  5.3086 +(*PALLOCATE_FUNCTION)(
  5.3087 +  /*IN*/ POOL_TYPE  PoolType,
  5.3088 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.3089 +  /*IN*/ ULONG  Tag);
  5.3090 +
  5.3091 +typedef VOID DDKAPI
  5.3092 +(*PFREE_FUNCTION)(
  5.3093 +  /*IN*/ PVOID  Buffer);
  5.3094 +
  5.3095 +#define GENERAL_LOOKASIDE_S \
  5.3096 +  SLIST_HEADER  ListHead; \
  5.3097 +  USHORT  Depth; \
  5.3098 +  USHORT  MaximumDepth; \
  5.3099 +  ULONG  TotalAllocates; \
  5.3100 +  _ANONYMOUS_UNION union { \
  5.3101 +    ULONG  AllocateMisses; \
  5.3102 +    ULONG  AllocateHits; \
  5.3103 +  } DUMMYUNIONNAME; \
  5.3104 +  ULONG  TotalFrees; \
  5.3105 +  _ANONYMOUS_UNION union { \
  5.3106 +    ULONG  FreeMisses; \
  5.3107 +    ULONG  FreeHits; \
  5.3108 +  } DUMMYUNIONNAME2; \
  5.3109 +  POOL_TYPE  Type; \
  5.3110 +  ULONG  Tag; \
  5.3111 +  ULONG  Size; \
  5.3112 +  PALLOCATE_FUNCTION  Allocate; \
  5.3113 +  PFREE_FUNCTION  Free; \
  5.3114 +  LIST_ENTRY  ListEntry; \
  5.3115 +  ULONG  LastTotalAllocates; \
  5.3116 +  _ANONYMOUS_UNION union { \
  5.3117 +    ULONG  LastAllocateMisses; \
  5.3118 +    ULONG  LastAllocateHits; \
  5.3119 +  } DUMMYUNIONNAME3; \
  5.3120 +  ULONG Future[2];
  5.3121 +
  5.3122 +typedef struct _GENERAL_LOOKASIDE {
  5.3123 +  GENERAL_LOOKASIDE_S
  5.3124 +} GENERAL_LOOKASIDE, *PGENERAL_LOOKASIDE;
  5.3125 +
  5.3126 +typedef struct _NPAGED_LOOKASIDE_LIST {
  5.3127 +  GENERAL_LOOKASIDE_S
  5.3128 +  KSPIN_LOCK  Obsoleted;
  5.3129 +} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
  5.3130 +
  5.3131 +typedef struct _PAGED_LOOKASIDE_LIST {
  5.3132 +  GENERAL_LOOKASIDE_S
  5.3133 +  FAST_MUTEX  Obsoleted;
  5.3134 +} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
  5.3135 +
  5.3136 +typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
  5.3137 +
  5.3138 +typedef VOID DDKAPI (*PCALLBACK_FUNCTION)(
  5.3139 +  /*IN*/ PVOID  CallbackContext,
  5.3140 +  /*IN*/ PVOID  Argument1,
  5.3141 +  /*IN*/ PVOID  Argument2);
  5.3142 +
  5.3143 +typedef enum _EVENT_TYPE {
  5.3144 +  NotificationEvent,
  5.3145 +  SynchronizationEvent
  5.3146 +} EVENT_TYPE;
  5.3147 +
  5.3148 +typedef enum _KWAIT_REASON {
  5.3149 +  Executive,
  5.3150 +  FreePage,
  5.3151 +  PageIn,
  5.3152 +  PoolAllocation,
  5.3153 +  DelayExecution,
  5.3154 +  Suspended,
  5.3155 +  UserRequest,
  5.3156 +  WrExecutive,
  5.3157 +  WrFreePage,
  5.3158 +  WrPageIn,
  5.3159 +  WrPoolAllocation,
  5.3160 +  WrDelayExecution,
  5.3161 +  WrSuspended,
  5.3162 +  WrUserRequest,
  5.3163 +  WrEventPair,
  5.3164 +  WrQueue,
  5.3165 +  WrLpcReceive,
  5.3166 +  WrLpcReply,
  5.3167 +  WrVirtualMemory,
  5.3168 +  WrPageOut,
  5.3169 +  WrRendezvous,
  5.3170 +  Spare2,
  5.3171 +  Spare3,
  5.3172 +  Spare4,
  5.3173 +  Spare5,
  5.3174 +  Spare6,
  5.3175 +  WrKernel,
  5.3176 +  MaximumWaitReason
  5.3177 +} KWAIT_REASON;
  5.3178 +
  5.3179 +typedef struct _KWAIT_BLOCK {
  5.3180 +  LIST_ENTRY  WaitListEntry;
  5.3181 +  struct _KTHREAD * RESTRICTED_POINTER  Thread;
  5.3182 +  PVOID  Object;
  5.3183 +  struct _KWAIT_BLOCK * RESTRICTED_POINTER  NextWaitBlock;
  5.3184 +  USHORT  WaitKey;
  5.3185 +  USHORT  WaitType;
  5.3186 +} KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
  5.3187 +
  5.3188 +typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
  5.3189 +
  5.3190 +typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
  5.3191 +  BOOLEAN  Removed;
  5.3192 +  BOOLEAN  Reserved[3];
  5.3193 +  LONG  IoCount;
  5.3194 +  KEVENT  RemoveEvent;
  5.3195 +} IO_REMOVE_LOCK_COMMON_BLOCK;
  5.3196 +
  5.3197 +typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
  5.3198 +  LONG  Signature;
  5.3199 +  LONG  HighWatermark;
  5.3200 +  LONGLONG  MaxLockedTicks;
  5.3201 +  LONG  AllocateTag;
  5.3202 +  LIST_ENTRY  LockList;
  5.3203 +  KSPIN_LOCK  Spin;
  5.3204 +  LONG  LowMemoryCount;
  5.3205 +  ULONG  Reserved1[4];
  5.3206 +  PVOID  Reserved2;
  5.3207 +  PIO_REMOVE_LOCK_TRACKING_BLOCK  Blocks;
  5.3208 +} IO_REMOVE_LOCK_DBG_BLOCK;
  5.3209 +
  5.3210 +typedef struct _IO_REMOVE_LOCK {
  5.3211 +  IO_REMOVE_LOCK_COMMON_BLOCK  Common;
  5.3212 +#ifdef DBG
  5.3213 +  IO_REMOVE_LOCK_DBG_BLOCK  Dbg;
  5.3214 +#endif
  5.3215 +} IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
  5.3216 +
  5.3217 +typedef struct _IO_WORKITEM *PIO_WORKITEM;
  5.3218 +
  5.3219 +typedef VOID DDKAPI
  5.3220 +(*PIO_WORKITEM_ROUTINE)(
  5.3221 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.3222 +  /*IN*/ PVOID  Context);
  5.3223 +
  5.3224 +typedef struct _SHARE_ACCESS {
  5.3225 +  ULONG  OpenCount;
  5.3226 +  ULONG  Readers;
  5.3227 +  ULONG  Writers;
  5.3228 +  ULONG  Deleters;
  5.3229 +  ULONG  SharedRead;
  5.3230 +  ULONG  SharedWrite;
  5.3231 +  ULONG  SharedDelete;
  5.3232 +} SHARE_ACCESS, *PSHARE_ACCESS;
  5.3233 +
  5.3234 +typedef enum _KINTERRUPT_MODE {
  5.3235 +  LevelSensitive,
  5.3236 +  Latched
  5.3237 +} KINTERRUPT_MODE;
  5.3238 +
  5.3239 +typedef VOID DDKAPI
  5.3240 +(*PKINTERRUPT_ROUTINE)(
  5.3241 +  VOID);
  5.3242 +
  5.3243 +typedef enum _KPROFILE_SOURCE {
  5.3244 +  ProfileTime,
  5.3245 +  ProfileAlignmentFixup,
  5.3246 +  ProfileTotalIssues,
  5.3247 +  ProfilePipelineDry,
  5.3248 +  ProfileLoadInstructions,
  5.3249 +  ProfilePipelineFrozen,
  5.3250 +  ProfileBranchInstructions,
  5.3251 +  ProfileTotalNonissues,
  5.3252 +  ProfileDcacheMisses,
  5.3253 +  ProfileIcacheMisses,
  5.3254 +  ProfileCacheMisses,
  5.3255 +  ProfileBranchMispredictions,
  5.3256 +  ProfileStoreInstructions,
  5.3257 +  ProfileFpInstructions,
  5.3258 +  ProfileIntegerInstructions,
  5.3259 +  Profile2Issue,
  5.3260 +  Profile3Issue,
  5.3261 +  Profile4Issue,
  5.3262 +  ProfileSpecialInstructions,
  5.3263 +  ProfileTotalCycles,
  5.3264 +  ProfileIcacheIssues,
  5.3265 +  ProfileDcacheAccesses,
  5.3266 +  ProfileMemoryBarrierCycles,
  5.3267 +  ProfileLoadLinkedIssues,
  5.3268 +  ProfileMaximum
  5.3269 +} KPROFILE_SOURCE;
  5.3270 +
  5.3271 +typedef enum _CREATE_FILE_TYPE {
  5.3272 +  CreateFileTypeNone,
  5.3273 +  CreateFileTypeNamedPipe,
  5.3274 +  CreateFileTypeMailslot
  5.3275 +} CREATE_FILE_TYPE;
  5.3276 +
  5.3277 +typedef struct _CONFIGURATION_INFORMATION {
  5.3278 +  ULONG  DiskCount;
  5.3279 +  ULONG  FloppyCount;
  5.3280 +  ULONG  CdRomCount;
  5.3281 +  ULONG  TapeCount;
  5.3282 +  ULONG  ScsiPortCount;
  5.3283 +  ULONG  SerialCount;
  5.3284 +  ULONG  ParallelCount;
  5.3285 +  BOOLEAN  AtDiskPrimaryAddressClaimed;
  5.3286 +  BOOLEAN  AtDiskSecondaryAddressClaimed;
  5.3287 +  ULONG  Version;
  5.3288 +  ULONG  MediumChangerCount;
  5.3289 +} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
  5.3290 +
  5.3291 +typedef enum _CONFIGURATION_TYPE {
  5.3292 +  ArcSystem,
  5.3293 +  CentralProcessor,
  5.3294 +  FloatingPointProcessor,
  5.3295 +  PrimaryIcache,
  5.3296 +  PrimaryDcache,
  5.3297 +  SecondaryIcache,
  5.3298 +  SecondaryDcache,
  5.3299 +  SecondaryCache,
  5.3300 +  EisaAdapter,
  5.3301 +  TcAdapter,
  5.3302 +  ScsiAdapter,
  5.3303 +  DtiAdapter,
  5.3304 +  MultiFunctionAdapter,
  5.3305 +  DiskController,
  5.3306 +  TapeController,
  5.3307 +  CdromController,
  5.3308 +  WormController,
  5.3309 +  SerialController,
  5.3310 +  NetworkController,
  5.3311 +  DisplayController,
  5.3312 +  ParallelController,
  5.3313 +  PointerController,
  5.3314 +  KeyboardController,
  5.3315 +  AudioController,
  5.3316 +  OtherController,
  5.3317 +  DiskPeripheral,
  5.3318 +  FloppyDiskPeripheral,
  5.3319 +  TapePeripheral,
  5.3320 +  ModemPeripheral,
  5.3321 +  MonitorPeripheral,
  5.3322 +  PrinterPeripheral,
  5.3323 +  PointerPeripheral,
  5.3324 +  KeyboardPeripheral,
  5.3325 +  TerminalPeripheral,
  5.3326 +  OtherPeripheral,
  5.3327 +  LinePeripheral,
  5.3328 +  NetworkPeripheral,
  5.3329 +  SystemMemory,
  5.3330 +  DockingInformation,
  5.3331 +  RealModeIrqRoutingTable,
  5.3332 +  MaximumType
  5.3333 +} CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
  5.3334 +
  5.3335 +typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(
  5.3336 +  /*IN*/ PVOID  Context,
  5.3337 +  /*IN*/ PUNICODE_STRING  PathName,
  5.3338 +  /*IN*/ INTERFACE_TYPE  BusType,
  5.3339 +  /*IN*/ ULONG  BusNumber,
  5.3340 +  /*IN*/ PKEY_VALUE_FULL_INFORMATION  *BusInformation,
  5.3341 +  /*IN*/ CONFIGURATION_TYPE  ControllerType,
  5.3342 +  /*IN*/ ULONG  ControllerNumber,
  5.3343 +  /*IN*/ PKEY_VALUE_FULL_INFORMATION  *ControllerInformation,
  5.3344 +  /*IN*/ CONFIGURATION_TYPE  PeripheralType,
  5.3345 +  /*IN*/ ULONG  PeripheralNumber,
  5.3346 +  /*IN*/ PKEY_VALUE_FULL_INFORMATION  *PeripheralInformation);
  5.3347 +
  5.3348 +typedef enum _WORK_QUEUE_TYPE {
  5.3349 +  CriticalWorkQueue,
  5.3350 +  DelayedWorkQueue,
  5.3351 +  HyperCriticalWorkQueue,
  5.3352 +  MaximumWorkQueue
  5.3353 +} WORK_QUEUE_TYPE;
  5.3354 +
  5.3355 +typedef VOID DDKAPI
  5.3356 +(*PWORKER_THREAD_ROUTINE)(
  5.3357 +  /*IN*/ PVOID Parameter);
  5.3358 +
  5.3359 +typedef struct _WORK_QUEUE_ITEM {
  5.3360 +  LIST_ENTRY  List;
  5.3361 +  PWORKER_THREAD_ROUTINE  WorkerRoutine;
  5.3362 +  PVOID  Parameter;
  5.3363 +} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
  5.3364 +
  5.3365 +typedef enum _KBUGCHECK_BUFFER_DUMP_STATE {
  5.3366 +    BufferEmpty,
  5.3367 +    BufferInserted,
  5.3368 +    BufferStarted,
  5.3369 +    BufferFinished,
  5.3370 +    BufferIncomplete
  5.3371 +} KBUGCHECK_BUFFER_DUMP_STATE;
  5.3372 +
  5.3373 +typedef VOID DDKAPI
  5.3374 +(*PKBUGCHECK_CALLBACK_ROUTINE)(
  5.3375 +  /*IN*/ PVOID  Buffer,
  5.3376 +  /*IN*/ ULONG  Length);
  5.3377 +
  5.3378 +typedef struct _KBUGCHECK_CALLBACK_RECORD {
  5.3379 +  LIST_ENTRY  Entry;
  5.3380 +  PKBUGCHECK_CALLBACK_ROUTINE  CallbackRoutine;
  5.3381 +  PVOID  Buffer;
  5.3382 +  ULONG  Length;
  5.3383 +  PUCHAR  Component;
  5.3384 +  ULONG_PTR  Checksum;
  5.3385 +  UCHAR  State;
  5.3386 +} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
  5.3387 +
  5.3388 +/*
  5.3389 + * VOID
  5.3390 + * KeInitializeCallbackRecord(
  5.3391 + * IN PKBUGCHECK_CALLBACK_RECORD  CallbackRecord)
  5.3392 + */
  5.3393 +#define KeInitializeCallbackRecord(CallbackRecord) \
  5.3394 +  CallbackRecord->State = BufferEmpty;
  5.3395 +
  5.3396 +typedef enum _KDPC_IMPORTANCE {
  5.3397 +  LowImportance,
  5.3398 +  MediumImportance,
  5.3399 +  HighImportance
  5.3400 +} KDPC_IMPORTANCE;
  5.3401 +
  5.3402 +typedef enum _MEMORY_CACHING_TYPE_ORIG {
  5.3403 +  MmFrameBufferCached = 2
  5.3404 +} MEMORY_CACHING_TYPE_ORIG;
  5.3405 +
  5.3406 +typedef enum _MEMORY_CACHING_TYPE {
  5.3407 +  MmNonCached = FALSE,
  5.3408 +  MmCached = TRUE,
  5.3409 +  MmWriteCombined = MmFrameBufferCached,
  5.3410 +  MmHardwareCoherentCached,
  5.3411 +  MmNonCachedUnordered,
  5.3412 +  MmUSWCCached,
  5.3413 +  MmMaximumCacheType
  5.3414 +} MEMORY_CACHING_TYPE;
  5.3415 +
  5.3416 +typedef enum _MM_PAGE_PRIORITY {
  5.3417 +  LowPagePriority,
  5.3418 +  NormalPagePriority = 16,
  5.3419 +  HighPagePriority = 32
  5.3420 +} MM_PAGE_PRIORITY;
  5.3421 +
  5.3422 +typedef enum _LOCK_OPERATION {
  5.3423 +  IoReadAccess,
  5.3424 +  IoWriteAccess,
  5.3425 +  IoModifyAccess
  5.3426 +} LOCK_OPERATION;
  5.3427 +
  5.3428 +typedef enum _MM_SYSTEM_SIZE {
  5.3429 +  MmSmallSystem,
  5.3430 +  MmMediumSystem,
  5.3431 +  MmLargeSystem
  5.3432 +} MM_SYSTEM_SIZE;
  5.3433 +
  5.3434 +typedef struct _OBJECT_HANDLE_INFORMATION {
  5.3435 +  ULONG HandleAttributes;
  5.3436 +  ACCESS_MASK GrantedAccess;
  5.3437 +} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
  5.3438 +
  5.3439 +typedef struct _CLIENT_ID {
  5.3440 +  HANDLE  UniqueProcess;
  5.3441 +  HANDLE  UniqueThread;
  5.3442 +} CLIENT_ID, *PCLIENT_ID;
  5.3443 +
  5.3444 +typedef VOID DDKAPI
  5.3445 +(*PKSTART_ROUTINE)(
  5.3446 +  /*IN*/ PVOID  StartContext);
  5.3447 +
  5.3448 +typedef VOID DDKAPI
  5.3449 +(*PCREATE_PROCESS_NOTIFY_ROUTINE)(
  5.3450 +  /*IN*/ HANDLE  ParentId,
  5.3451 +  /*IN*/ HANDLE  ProcessId,
  5.3452 +  /*IN*/ BOOLEAN  Create);
  5.3453 +
  5.3454 +typedef VOID DDKAPI
  5.3455 +(*PCREATE_THREAD_NOTIFY_ROUTINE)(
  5.3456 +  /*IN*/ HANDLE  ProcessId,
  5.3457 +  /*IN*/ HANDLE  ThreadId,
  5.3458 +  /*IN*/ BOOLEAN  Create);
  5.3459 +
  5.3460 +typedef struct _IMAGE_INFO {
  5.3461 +  _ANONYMOUS_UNION union {
  5.3462 +    ULONG  Properties;
  5.3463 +    _ANONYMOUS_STRUCT struct {
  5.3464 +      ULONG  ImageAddressingMode  : 8;
  5.3465 +      ULONG  SystemModeImage      : 1;
  5.3466 +      ULONG  ImageMappedToAllPids : 1;
  5.3467 +      ULONG  Reserved             : 22;
  5.3468 +    } DUMMYSTRUCTNAME;
  5.3469 +  } DUMMYUNIONNAME;
  5.3470 +  PVOID  ImageBase;
  5.3471 +  ULONG  ImageSelector;
  5.3472 +  SIZE_T  ImageSize;
  5.3473 +  ULONG  ImageSectionNumber;
  5.3474 +} IMAGE_INFO, *PIMAGE_INFO;
  5.3475 +
  5.3476 +#define IMAGE_ADDRESSING_MODE_32BIT       3
  5.3477 +
  5.3478 +typedef VOID DDKAPI
  5.3479 +(*PLOAD_IMAGE_NOTIFY_ROUTINE)(
  5.3480 +  /*IN*/ PUNICODE_STRING  FullImageName,
  5.3481 +  /*IN*/ HANDLE  ProcessId,
  5.3482 +  /*IN*/ PIMAGE_INFO  ImageInfo);
  5.3483 +
  5.3484 +typedef enum _PROCESSINFOCLASS {
  5.3485 +  ProcessBasicInformation,
  5.3486 +  ProcessQuotaLimits,
  5.3487 +  ProcessIoCounters,
  5.3488 +  ProcessVmCounters,
  5.3489 +  ProcessTimes,
  5.3490 +  ProcessBasePriority,
  5.3491 +  ProcessRaisePriority,
  5.3492 +  ProcessDebugPort,
  5.3493 +  ProcessExceptionPort,
  5.3494 +  ProcessAccessToken,
  5.3495 +  ProcessLdtInformation,
  5.3496 +  ProcessLdtSize,
  5.3497 +  ProcessDefaultHardErrorMode,
  5.3498 +  ProcessIoPortHandlers,
  5.3499 +  ProcessPooledUsageAndLimits,
  5.3500 +  ProcessWorkingSetWatch,
  5.3501 +  ProcessUserModeIOPL,
  5.3502 +  ProcessEnableAlignmentFaultFixup,
  5.3503 +  ProcessPriorityClass,
  5.3504 +  ProcessWx86Information,
  5.3505 +  ProcessHandleCount,
  5.3506 +  ProcessAffinityMask,
  5.3507 +  ProcessPriorityBoost,
  5.3508 +  ProcessDeviceMap,
  5.3509 +  ProcessSessionInformation,
  5.3510 +  ProcessForegroundInformation,
  5.3511 +  ProcessWow64Information,
  5.3512 +  ProcessImageFileName,
  5.3513 +  ProcessLUIDDeviceMapsEnabled,
  5.3514 +  ProcessBreakOnTermination,
  5.3515 +  ProcessDebugObjectHandle,
  5.3516 +  ProcessDebugFlags,
  5.3517 +  ProcessHandleTracing,
  5.3518 +  MaxProcessInfoClass
  5.3519 +} PROCESSINFOCLASS;
  5.3520 +
  5.3521 +typedef enum _THREADINFOCLASS {
  5.3522 +  ThreadBasicInformation,
  5.3523 +  ThreadTimes,
  5.3524 +  ThreadPriority,
  5.3525 +  ThreadBasePriority,
  5.3526 +  ThreadAffinityMask,
  5.3527 +  ThreadImpersonationToken,
  5.3528 +  ThreadDescriptorTableEntry,
  5.3529 +  ThreadEnableAlignmentFaultFixup,
  5.3530 +  ThreadEventPair_Reusable,
  5.3531 +  ThreadQuerySetWin32StartAddress,
  5.3532 +  ThreadZeroTlsCell,
  5.3533 +  ThreadPerformanceCount,
  5.3534 +  ThreadAmILastThread,
  5.3535 +  ThreadIdealProcessor,
  5.3536 +  ThreadPriorityBoost,
  5.3537 +  ThreadSetTlsArrayAddress,
  5.3538 +  ThreadIsIoPending,
  5.3539 +  ThreadHideFromDebugger,
  5.3540 +  ThreadBreakOnTermination,
  5.3541 +  MaxThreadInfoClass
  5.3542 +} THREADINFOCLASS;
  5.3543 +
  5.3544 +#define ES_SYSTEM_REQUIRED                0x00000001
  5.3545 +#define ES_DISPLAY_REQUIRED               0x00000002
  5.3546 +#define ES_USER_PRESENT                   0x00000004
  5.3547 +#define ES_CONTINUOUS                     0x80000000
  5.3548 +
  5.3549 +typedef ULONG EXECUTION_STATE;
  5.3550 +
  5.3551 +typedef VOID DDKAPI
  5.3552 +(*PREQUEST_POWER_COMPLETE)(
  5.3553 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.3554 +  /*IN*/ UCHAR  MinorFunction,
  5.3555 +  /*IN*/ POWER_STATE  PowerState,
  5.3556 +  /*IN*/ PVOID  Context,
  5.3557 +  /*IN*/ PIO_STATUS_BLOCK  IoStatus);
  5.3558 +
  5.3559 +typedef enum _TRACE_INFORMATION_CLASS {
  5.3560 +  TraceIdClass,
  5.3561 +  TraceHandleClass,
  5.3562 +  TraceEnableFlagsClass,
  5.3563 +  TraceEnableLevelClass,
  5.3564 +  GlobalLoggerHandleClass,
  5.3565 +  EventLoggerHandleClass,
  5.3566 +  AllLoggerHandlesClass,
  5.3567 +  TraceHandleByNameClass
  5.3568 +} TRACE_INFORMATION_CLASS;
  5.3569 +
  5.3570 +typedef NTSTATUS DDKAPI
  5.3571 +(*PEX_CALLBACK_FUNCTION)(
  5.3572 +  /*IN*/ PVOID  CallbackContext,
  5.3573 +  /*IN*/ PVOID  Argument1,
  5.3574 +  /*IN*/ PVOID  Argument2);
  5.3575 +
  5.3576 +
  5.3577 +
  5.3578 +/*
  5.3579 +** Storage structures
  5.3580 +*/
  5.3581 +typedef enum _PARTITION_STYLE {
  5.3582 +  PARTITION_STYLE_MBR,
  5.3583 +  PARTITION_STYLE_GPT
  5.3584 +} PARTITION_STYLE;
  5.3585 +
  5.3586 +typedef struct _CREATE_DISK_MBR {
  5.3587 +  ULONG  Signature;
  5.3588 +} CREATE_DISK_MBR, *PCREATE_DISK_MBR;
  5.3589 +
  5.3590 +typedef struct _CREATE_DISK_GPT {
  5.3591 +  GUID  DiskId;
  5.3592 +  ULONG  MaxPartitionCount;
  5.3593 +} CREATE_DISK_GPT, *PCREATE_DISK_GPT;
  5.3594 +
  5.3595 +typedef struct _CREATE_DISK {
  5.3596 +  PARTITION_STYLE  PartitionStyle;
  5.3597 +  _ANONYMOUS_UNION union {
  5.3598 +    CREATE_DISK_MBR  Mbr;
  5.3599 +    CREATE_DISK_GPT  Gpt;
  5.3600 +  } DUMMYUNIONNAME;
  5.3601 +} CREATE_DISK, *PCREATE_DISK;
  5.3602 +
  5.3603 +typedef struct _DISK_SIGNATURE {
  5.3604 +  ULONG  PartitionStyle;
  5.3605 +  _ANONYMOUS_UNION union {
  5.3606 +    struct {
  5.3607 +      ULONG  Signature;
  5.3608 +      ULONG  CheckSum;
  5.3609 +    } Mbr;
  5.3610 +    struct {
  5.3611 +      GUID  DiskId;
  5.3612 +    } Gpt;
  5.3613 +  } DUMMYUNIONNAME;
  5.3614 +} DISK_SIGNATURE, *PDISK_SIGNATURE;
  5.3615 +
  5.3616 +typedef VOID DDKFASTAPI
  5.3617 +(*PTIME_UPDATE_NOTIFY_ROUTINE)(
  5.3618 +  /*IN*/ HANDLE  ThreadId,
  5.3619 +  /*IN*/ KPROCESSOR_MODE  Mode);
  5.3620 +
  5.3621 +#define DBG_STATUS_CONTROL_C              1
  5.3622 +#define DBG_STATUS_SYSRQ                  2
  5.3623 +#define DBG_STATUS_BUGCHECK_FIRST         3
  5.3624 +#define DBG_STATUS_BUGCHECK_SECOND        4
  5.3625 +#define DBG_STATUS_FATAL                  5
  5.3626 +#define DBG_STATUS_DEBUG_CONTROL          6
  5.3627 +#define DBG_STATUS_WORKER                 7
  5.3628 +
  5.3629 +typedef struct _PHYSICAL_MEMORY_RANGE {
  5.3630 +  PHYSICAL_ADDRESS  BaseAddress;
  5.3631 +  LARGE_INTEGER  NumberOfBytes;
  5.3632 +} PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
  5.3633 +
  5.3634 +typedef ULONG_PTR
  5.3635 +(*PDRIVER_VERIFIER_THUNK_ROUTINE)(
  5.3636 +  /*IN*/ PVOID  Context);
  5.3637 +
  5.3638 +typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
  5.3639 +  PDRIVER_VERIFIER_THUNK_ROUTINE  PristineRoutine;
  5.3640 +  PDRIVER_VERIFIER_THUNK_ROUTINE  NewRoutine;
  5.3641 +} DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS;
  5.3642 +
  5.3643 +#define DRIVER_VERIFIER_SPECIAL_POOLING             0x0001
  5.3644 +#define DRIVER_VERIFIER_FORCE_IRQL_CHECKING         0x0002
  5.3645 +#define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES  0x0004
  5.3646 +#define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS      0x0008
  5.3647 +#define DRIVER_VERIFIER_IO_CHECKING                 0x0010
  5.3648 +
  5.3649 +#define RTL_RANGE_LIST_ADD_IF_CONFLICT    0x00000001
  5.3650 +#define RTL_RANGE_LIST_ADD_SHARED         0x00000002
  5.3651 +
  5.3652 +#define RTL_RANGE_LIST_SHARED_OK          0x00000001
  5.3653 +#define RTL_RANGE_LIST_NULL_CONFLICT_OK   0x00000002
  5.3654 +
  5.3655 +#define RTL_RANGE_LIST_SHARED_OK          0x00000001
  5.3656 +#define RTL_RANGE_LIST_NULL_CONFLICT_OK   0x00000002
  5.3657 +
  5.3658 +#define RTL_RANGE_LIST_MERGE_IF_CONFLICT  RTL_RANGE_LIST_ADD_IF_CONFLICT
  5.3659 +
  5.3660 +typedef struct _RTL_RANGE {
  5.3661 +  ULONGLONG  Start;
  5.3662 +  ULONGLONG  End;
  5.3663 +  PVOID  UserData;
  5.3664 +  PVOID  Owner;
  5.3665 +  UCHAR  Attributes;
  5.3666 +  UCHAR  Flags;
  5.3667 +} RTL_RANGE, *PRTL_RANGE;
  5.3668 +
  5.3669 +#define RTL_RANGE_SHARED                  0x01
  5.3670 +#define RTL_RANGE_CONFLICT                0x02
  5.3671 +
  5.3672 +typedef struct _RTL_RANGE_LIST {
  5.3673 +  LIST_ENTRY  ListHead;
  5.3674 +  ULONG  Flags;
  5.3675 +  ULONG  Count;
  5.3676 +  ULONG  Stamp;
  5.3677 +} RTL_RANGE_LIST, *PRTL_RANGE_LIST;
  5.3678 +
  5.3679 +typedef struct _RANGE_LIST_ITERATOR {
  5.3680 +  PLIST_ENTRY  RangeListHead;
  5.3681 +  PLIST_ENTRY  MergedHead;
  5.3682 +  PVOID  Current;
  5.3683 +  ULONG  Stamp;
  5.3684 +} RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
  5.3685 +
  5.3686 +typedef BOOLEAN
  5.3687 +(*PRTL_CONFLICT_RANGE_CALLBACK)(
  5.3688 +  /*IN*/ PVOID  Context,
  5.3689 +  /*IN*/ PRTL_RANGE  Range);
  5.3690 +
  5.3691 +#define HASH_STRING_ALGORITHM_DEFAULT     0
  5.3692 +#define HASH_STRING_ALGORITHM_X65599      1
  5.3693 +#define HASH_STRING_ALGORITHM_INVALID     0xffffffff
  5.3694 +
  5.3695 +typedef enum _SUITE_TYPE {
  5.3696 +  SmallBusiness,
  5.3697 +  Enterprise,
  5.3698 +  BackOffice,
  5.3699 +  CommunicationServer,
  5.3700 +  TerminalServer,
  5.3701 +  SmallBusinessRestricted,
  5.3702 +  EmbeddedNT,
  5.3703 +  DataCenter,
  5.3704 +  SingleUserTS,
  5.3705 +  Personal,
  5.3706 +  Blade,
  5.3707 +  MaxSuiteType
  5.3708 +} SUITE_TYPE;
  5.3709 +
  5.3710 +typedef VOID DDKAPI
  5.3711 +(*PTIMER_APC_ROUTINE)(
  5.3712 +  /*IN*/ PVOID  TimerContext,
  5.3713 +  /*IN*/ ULONG  TimerLowValue,
  5.3714 +  /*IN*/ LONG  TimerHighValue);
  5.3715 +
  5.3716 +
  5.3717 +
  5.3718 +/*
  5.3719 +** WMI structures
  5.3720 +*/
  5.3721 +
  5.3722 +typedef VOID DDKAPI
  5.3723 +(*WMI_NOTIFICATION_CALLBACK)(
  5.3724 +  PVOID  Wnode,
  5.3725 +  PVOID  Context);
  5.3726 +
  5.3727 +
  5.3728 +/*
  5.3729 +** Architecture specific structures
  5.3730 +*/
  5.3731 +
  5.3732 +#ifdef _X86_
  5.3733 +
  5.3734 +typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
  5.3735 +
  5.3736 +#define PASSIVE_LEVEL                      0
  5.3737 +#define LOW_LEVEL                          0
  5.3738 +#define APC_LEVEL                          1
  5.3739 +#define DISPATCH_LEVEL                     2
  5.3740 +#define SYNCH_LEVEL                       27
  5.3741 +#define PROFILE_LEVEL                     27
  5.3742 +#define CLOCK1_LEVEL                      28
  5.3743 +#define CLOCK2_LEVEL                      28
  5.3744 +#define IPI_LEVEL                         29
  5.3745 +#define POWER_LEVEL                       30
  5.3746 +#define HIGH_LEVEL                        31
  5.3747 +
  5.3748 +typedef struct _KPCR_TIB {
  5.3749 +  PVOID  ExceptionList;         /* 00 */
  5.3750 +  PVOID  StackBase;             /* 04 */
  5.3751 +  PVOID  StackLimit;            /* 08 */
  5.3752 +  PVOID  SubSystemTib;          /* 0C */
  5.3753 +  _ANONYMOUS_UNION union {
  5.3754 +    PVOID  FiberData;           /* 10 */
  5.3755 +    DWORD  Version;             /* 10 */
  5.3756 +  } DUMMYUNIONNAME;
  5.3757 +  PVOID  ArbitraryUserPointer;  /* 14 */
  5.3758 +  struct _NT_TIB *Self;         /* 18 */
  5.3759 +} KPCR_TIB, *PKPCR_TIB;         /* 1C */
  5.3760 +
  5.3761 +#define PCR_MINOR_VERSION 1
  5.3762 +#define PCR_MAJOR_VERSION 1
  5.3763 +
  5.3764 +typedef struct _KPCR {
  5.3765 +  KPCR_TIB  Tib;                /* 00 */
  5.3766 +  struct _KPCR  *Self;          /* 1C */
  5.3767 +  struct _KPRCB  *PCRCB;        /* 20 */
  5.3768 +  KIRQL  Irql;                  /* 24 */
  5.3769 +  ULONG  IRR;                   /* 28 */
  5.3770 +  ULONG  IrrActive;             /* 2C */
  5.3771 +  ULONG  IDR;                   /* 30 */
  5.3772 +  PVOID  KdVersionBlock;        /* 34 */
  5.3773 +  PUSHORT  IDT;                 /* 38 */
  5.3774 +  PUSHORT  GDT;                 /* 3C */
  5.3775 +  struct _KTSS  *TSS;           /* 40 */
  5.3776 +  USHORT  MajorVersion;         /* 44 */
  5.3777 +  USHORT  MinorVersion;         /* 46 */
  5.3778 +  KAFFINITY  SetMember;         /* 48 */
  5.3779 +  ULONG  StallScaleFactor;      /* 4C */
  5.3780 +  UCHAR  SpareUnused;           /* 50 */
  5.3781 +  UCHAR  Number;                /* 51 */
  5.3782 +} KPCR, *PKPCR;                 /* 54 */
  5.3783 +
  5.3784 +typedef struct _KFLOATING_SAVE {
  5.3785 +  ULONG  ControlWord;
  5.3786 +  ULONG  StatusWord;
  5.3787 +  ULONG  ErrorOffset;
  5.3788 +  ULONG  ErrorSelector;
  5.3789 +  ULONG  DataOffset;
  5.3790 +  ULONG  DataSelector;
  5.3791 +  ULONG  Cr0NpxState;
  5.3792 +  ULONG  Spare1;
  5.3793 +} KFLOATING_SAVE, *PKFLOATING_SAVE;
  5.3794 +
  5.3795 +#define PAGE_SIZE                         0x1000
  5.3796 +#define PAGE_SHIFT                        12L
  5.3797 +
  5.3798 +extern NTOSAPI PVOID *MmHighestUserAddress;
  5.3799 +extern NTOSAPI PVOID *MmSystemRangeStart;
  5.3800 +extern NTOSAPI ULONG *MmUserProbeAddress;
  5.3801 +
  5.3802 +#define MM_HIGHEST_USER_ADDRESS           *MmHighestUserAddress
  5.3803 +#define MM_SYSTEM_RANGE_START             *MmSystemRangeStart
  5.3804 +#define MM_USER_PROBE_ADDRESS             *MmUserProbeAddress
  5.3805 +#define MM_LOWEST_USER_ADDRESS            (PVOID)0x10000
  5.3806 +#define MM_LOWEST_SYSTEM_ADDRESS          (PVOID)0xC0C00000
  5.3807 +
  5.3808 +#define KI_USER_SHARED_DATA               0xffdf0000
  5.3809 +#define SharedUserData                    ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
  5.3810 +
  5.3811 +#define EFLAG_SIGN                        0x8000
  5.3812 +#define EFLAG_ZERO                        0x4000
  5.3813 +#define EFLAG_SELECT                      (EFLAG_SIGN | EFLAG_ZERO)
  5.3814 +
  5.3815 +#define RESULT_NEGATIVE                   ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
  5.3816 +#define RESULT_ZERO                       ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
  5.3817 +#define RESULT_POSITIVE                   ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
  5.3818 +
  5.3819 +typedef enum _INTERLOCKED_RESULT {
  5.3820 +  ResultNegative = RESULT_NEGATIVE,
  5.3821 +  ResultZero = RESULT_ZERO,
  5.3822 +  ResultPositive = RESULT_POSITIVE
  5.3823 +} INTERLOCKED_RESULT;
  5.3824 +
  5.3825 +NTOSAPI
  5.3826 +KIRQL
  5.3827 +DDKAPI
  5.3828 +KeGetCurrentIrql(
  5.3829 +  VOID);
  5.3830 +
  5.3831 +/*
  5.3832 + * ULONG
  5.3833 + * KeGetCurrentProcessorNumber(
  5.3834 + *   VOID)
  5.3835 + */
  5.3836 +#define KeGetCurrentProcessorNumber() \
  5.3837 +  ((ULONG)KeGetCurrentKPCR()->ProcessorNumber)
  5.3838 +
  5.3839 +
  5.3840 +#if  __USE_NTOSKRNL__
  5.3841 +/* CAREFUL: These are exported from ntoskrnl.exe as __fastcall functions,
  5.3842 +   but are also exported from kernel32.dll and declared in winbase.h as
  5.3843 +   __stdcall */
  5.3844 +#if !defined(__INTERLOCKED_DECLARED)
  5.3845 +#define __INTERLOCKED_DECLARED
  5.3846 +
  5.3847 +NTOSAPI
  5.3848 +LONG
  5.3849 +DDKFASTAPI
  5.3850 +InterlockedIncrement(
  5.3851 +  /*IN*/ long VOLATILE *Addend);
  5.3852 +
  5.3853 +NTOSAPI
  5.3854 +LONG
  5.3855 +DDKFASTAPI
  5.3856 +InterlockedDecrement(
  5.3857 +  /*IN*/ long VOLATILE *Addend);
  5.3858 +
  5.3859 +NTOSAPI
  5.3860 +LONG
  5.3861 +DDKFASTAPI
  5.3862 +InterlockedCompareExchange(
  5.3863 +  /*IN OUT*/ PLONG  VOLATILE  Destination,
  5.3864 +  /*IN*/ LONG  Exchange,
  5.3865 +  /*IN*/ LONG  Comparand);
  5.3866 +
  5.3867 +NTOSAPI
  5.3868 +LONG
  5.3869 +DDKFASTAPI
  5.3870 +InterlockedExchange(
  5.3871 +  /*IN OUT*/ PLONG  VOLATILE  Target,
  5.3872 +  /*IN*/ LONG Value);
  5.3873 +
  5.3874 +NTOSAPI
  5.3875 +LONG
  5.3876 +DDKFASTAPI
  5.3877 +InterlockedExchangeAdd(
  5.3878 +  /*IN OUT*/ PLONG VOLATILE  Addend,
  5.3879 +  /*IN*/ LONG  Value);
  5.3880 +
  5.3881 +/*
  5.3882 + * PVOID
  5.3883 + * InterlockedExchangePointer(
  5.3884 + * IN OUT PVOID VOLATILE  *Target,
  5.3885 + * IN PVOID  Value)
  5.3886 + */
  5.3887 +#define InterlockedExchangePointer(Target, Value) \
  5.3888 +  ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
  5.3889 +
  5.3890 +/*
  5.3891 + * PVOID
  5.3892 + * InterlockedCompareExchangePointer(
  5.3893 + * IN OUT PVOID  *Destination,
  5.3894 + * IN PVOID  Exchange,
  5.3895 + * IN PVOID  Comparand)
  5.3896 + */
  5.3897 +#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
  5.3898 +  ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
  5.3899 +
  5.3900 +#if  (_WIN32_WINNT >= 0x0501)
  5.3901 +PSLIST_ENTRY
  5.3902 +DDKFASTAPI
  5.3903 +InterlockedPopEntrySList(
  5.3904 +  /*IN*/ PSLIST_HEADER  ListHead);
  5.3905 +
  5.3906 +NTOSAPI
  5.3907 +PSLIST_ENTRY
  5.3908 +DDKFASTAPI
  5.3909 +InterlockedPushEntrySList(
  5.3910 +  /*IN*/ PSLIST_HEADER  ListHead,
  5.3911 +  /*IN*/ PSLIST_ENTRY  ListEntry);
  5.3912 +#endif /* _WIN32_WINNT >= 0x0501 */
  5.3913 +
  5.3914 +#endif /* !__INTERLOCKED_DECLARED */
  5.3915 +#endif /*  __USE_NTOSKRNL__ */
  5.3916 +
  5.3917 +NTOSAPI
  5.3918 +VOID
  5.3919 +DDKFASTAPI
  5.3920 +KefAcquireSpinLockAtDpcLevel(
  5.3921 +  /*IN*/ PKSPIN_LOCK  SpinLock);
  5.3922 +
  5.3923 +NTOSAPI
  5.3924 +VOID
  5.3925 +DDKFASTAPI
  5.3926 +KefReleaseSpinLockFromDpcLevel(
  5.3927 +  /*IN*/ PKSPIN_LOCK  SpinLock);
  5.3928 +
  5.3929 +#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
  5.3930 +#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
  5.3931 +
  5.3932 +#define RtlCopyMemoryNonTemporal RtlCopyMemory
  5.3933 +
  5.3934 +#define KeGetDcacheFillSize() 1L
  5.3935 +
  5.3936 +#endif /* _X86_ */
  5.3937 +
  5.3938 +
  5.3939 +
  5.3940 +/*
  5.3941 +** Utillity functions
  5.3942 +*/
  5.3943 +
  5.3944 +#define ARGUMENT_PRESENT(ArgumentPointer) \
  5.3945 +  ((BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL))
  5.3946 +
  5.3947 +/*
  5.3948 + * ULONG
  5.3949 + * BYTE_OFFSET(
  5.3950 + * IN PVOID  Va)
  5.3951 + */
  5.3952 +#define BYTE_OFFSET(Va) \
  5.3953 +  ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
  5.3954 +
  5.3955 +/*
  5.3956 + * ULONG
  5.3957 + * BYTES_TO_PAGES(
  5.3958 + * IN ULONG  Size)
  5.3959 + */
  5.3960 +#define BYTES_TO_PAGES(Size) \
  5.3961 +  ((ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0))
  5.3962 +
  5.3963 +/*
  5.3964 + * PCHAR
  5.3965 + * CONTAINING_RECORD(
  5.3966 + * IN PCHAR  Address,
  5.3967 + * IN TYPE  Type,
  5.3968 + * IN PCHAR  Field);
  5.3969 + */
  5.3970 +#ifndef CONTAINING_RECORD
  5.3971 +#define CONTAINING_RECORD(Address, Type, Field) \
  5.3972 +  ((Type *) (((ULONG_PTR) Address) - FIELD_OFFSET(Type, Field)))
  5.3973 +#endif
  5.3974 +
  5.3975 +/* LONG
  5.3976 + * FIELD_OFFSET(
  5.3977 + * IN TYPE  Type,
  5.3978 + * IN PCHAR  Field);
  5.3979 + */
  5.3980 +#ifndef FIELD_OFFSET
  5.3981 +#define FIELD_OFFSET(Type, Field) \
  5.3982 +  ((LONG) (&(((Type *) 0)->Field)))
  5.3983 +#endif
  5.3984 +
  5.3985 +/*
  5.3986 + * PVOID
  5.3987 + * PAGE_ALIGN(
  5.3988 + * IN PVOID  Va)
  5.3989 + */
  5.3990 +#define PAGE_ALIGN(Va) \
  5.3991 +  ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
  5.3992 +
  5.3993 +/*
  5.3994 + * ULONG_PTR
  5.3995 + * ROUND_TO_PAGES(
  5.3996 + * IN ULONG_PTR  Size)
  5.3997 + */
  5.3998 +#define ROUND_TO_PAGES(Size) \
  5.3999 +  ((ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))
  5.4000 +
  5.4001 +NTOSAPI
  5.4002 +VOID
  5.4003 +DDKAPI
  5.4004 +RtlAssert(
  5.4005 +  /*IN*/ PVOID  FailedAssertion,
  5.4006 +  /*IN*/ PVOID  FileName,
  5.4007 +  /*IN*/ ULONG  LineNumber,
  5.4008 +  /*IN*/ PCHAR  Message);
  5.4009 +
  5.4010 +#ifdef DBG
  5.4011 +
  5.4012 +#define ASSERT(exp) \
  5.4013 +  ((!(exp)) ? \
  5.4014 +    (RtlAssert( #exp, __FILE__, __LINE__, NULL ), FALSE) : TRUE)
  5.4015 +
  5.4016 +#define ASSERTMSG(msg, exp) \
  5.4017 +  ((!(exp)) ? \
  5.4018 +    (RtlAssert( #exp, __FILE__, __LINE__, msg ), FALSE) : TRUE)
  5.4019 +
  5.4020 +#define RTL_SOFT_ASSERT(exp) \
  5.4021 +  ((!(_exp)) ? \
  5.4022 +    (DbgPrint("%s(%d): Soft assertion failed\n   Expression: %s\n", __FILE__, __LINE__, #exp), FALSE) : TRUE)
  5.4023 +
  5.4024 +#define RTL_SOFT_ASSERTMSG(msg, exp) \
  5.4025 +  ((!(exp)) ? \
  5.4026 +    (DbgPrint("%s(%d): Soft assertion failed\n   Expression: %s\n   Message: %s\n", __FILE__, __LINE__, #exp, (msg)), FALSE) : TRUE)
  5.4027 +
  5.4028 +#define RTL_VERIFY(exp) ASSERT(exp)
  5.4029 +#define RTL_VERIFYMSG(msg, exp) ASSERT(msg, exp)
  5.4030 +
  5.4031 +#define RTL_SOFT_VERIFY(exp) RTL_SOFT_ASSERT(exp)
  5.4032 +#define RTL_SOFT_VERIFYMSG(msg, exp) RTL_SOFT_ASSERTMSG(msg, exp)
  5.4033 +
  5.4034 +#else /* !DBG */
  5.4035 +
  5.4036 +#define ASSERT(exp) ((VOID) 0)
  5.4037 +#define ASSERTMSG(msg, exp) ((VOID) 0)
  5.4038 +
  5.4039 +#define RTL_SOFT_ASSERT(exp) ((VOID) 0)
  5.4040 +#define RTL_SOFT_ASSERTMSG(msg, exp) ((VOID) 0)
  5.4041 +
  5.4042 +#define RTL_VERIFY(exp) ((exp) ? TRUE : FALSE)
  5.4043 +#define RTL_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
  5.4044 +
  5.4045 +#define RTL_SOFT_VERIFY(exp) ((exp) ? TRUE : FALSE)
  5.4046 +#define RTL_SOFT_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
  5.4047 +
  5.4048 +#endif /* DBG */
  5.4049 +
  5.4050 +
  5.4051 +/*
  5.4052 +** Driver support routines
  5.4053 +*/
  5.4054 +
  5.4055 +/** Runtime library routines **/
  5.4056 +
  5.4057 +/*
  5.4058 + * VOID
  5.4059 + * InitializeListHead(
  5.4060 + * IN PLIST_ENTRY  ListHead)
  5.4061 + */
  5.4062 +#define InitializeListHead(_ListHead) \
  5.4063 +{ \
  5.4064 +  (_ListHead)->Flink = (_ListHead); \
  5.4065 +  (_ListHead)->Blink = (_ListHead); \
  5.4066 +}
  5.4067 +
  5.4068 +/*
  5.4069 + * VOID
  5.4070 + * InsertHeadList(
  5.4071 + * IN PLIST_ENTRY  ListHead,
  5.4072 + * IN PLIST_ENTRY  Entry)
  5.4073 + */
  5.4074 +#define InsertHeadList(_ListHead, \
  5.4075 +                       _Entry) \
  5.4076 +{ \
  5.4077 +  PLIST_ENTRY _OldFlink; \
  5.4078 +  _OldFlink = (_ListHead)->Flink; \
  5.4079 +  (_Entry)->Flink = _OldFlink; \
  5.4080 +  (_Entry)->Blink = (_ListHead); \
  5.4081 +  _OldFlink->Blink = (_Entry); \
  5.4082 +  (_ListHead)->Flink = (_Entry); \
  5.4083 +}
  5.4084 +
  5.4085 +/*
  5.4086 + * VOID
  5.4087 + * InsertTailList(
  5.4088 + * IN PLIST_ENTRY  ListHead,
  5.4089 + * IN PLIST_ENTRY  Entry)
  5.4090 + */
  5.4091 +#define InsertTailList(_ListHead, \
  5.4092 +                       _Entry) \
  5.4093 +{ \
  5.4094 +	PLIST_ENTRY _OldBlink; \
  5.4095 +	_OldBlink = (_ListHead)->Blink; \
  5.4096 +	(_Entry)->Flink = (_ListHead); \
  5.4097 +	(_Entry)->Blink = _OldBlink; \
  5.4098 +	_OldBlink->Flink = (_Entry); \
  5.4099 +	(_ListHead)->Blink = (_Entry); \
  5.4100 +}
  5.4101 +
  5.4102 +/*
  5.4103 + * BOOLEAN
  5.4104 + * IsListEmpty(
  5.4105 + * IN PLIST_ENTRY  ListHead)
  5.4106 + */
  5.4107 +#define IsListEmpty(_ListHead) \
  5.4108 +  ((_ListHead)->Flink == (_ListHead))
  5.4109 +
  5.4110 +static __inline PSINGLE_LIST_ENTRY 
  5.4111 +PopEntryList(
  5.4112 +  /*IN*/ PSINGLE_LIST_ENTRY  ListHead)
  5.4113 +{
  5.4114 +	PSINGLE_LIST_ENTRY Entry;
  5.4115 +
  5.4116 +	Entry = ListHead->Next;
  5.4117 +	if (Entry != NULL)
  5.4118 +	{
  5.4119 +		ListHead->Next = Entry->Next;
  5.4120 +	}
  5.4121 +  return Entry;
  5.4122 +}
  5.4123 +
  5.4124 +/*
  5.4125 + * VOID
  5.4126 + * PushEntryList(
  5.4127 + * IN PSINGLE_LIST_ENTRY  ListHead,
  5.4128 + * IN PSINGLE_LIST_ENTRY  Entry)
  5.4129 + */
  5.4130 +#define PushEntryList(_ListHead, \
  5.4131 +                      _Entry) \
  5.4132 +{ \
  5.4133 +	(_Entry)->Next = (_ListHead)->Next; \
  5.4134 +	(_ListHead)->Next = (_Entry); \
  5.4135 +}
  5.4136 +
  5.4137 +/*
  5.4138 + * VOID
  5.4139 + * RemoveEntryList(
  5.4140 + * IN PLIST_ENTRY  Entry)
  5.4141 + */
  5.4142 +#define RemoveEntryList(_Entry) \
  5.4143 +{ \
  5.4144 +	PLIST_ENTRY _OldFlink; \
  5.4145 +	PLIST_ENTRY _OldBlink; \
  5.4146 +	_OldFlink = (_Entry)->Flink; \
  5.4147 +	_OldBlink = (_Entry)->Blink; \
  5.4148 +	_OldFlink->Blink = _OldBlink; \
  5.4149 +	_OldBlink->Flink = _OldFlink; \
  5.4150 +  (_Entry)->Flink = NULL; \
  5.4151 +  (_Entry)->Blink = NULL; \
  5.4152 +}
  5.4153 +
  5.4154 +static __inline PLIST_ENTRY 
  5.4155 +RemoveHeadList(
  5.4156 +  /*IN*/ PLIST_ENTRY  ListHead)
  5.4157 +{
  5.4158 +	PLIST_ENTRY OldFlink;
  5.4159 +	PLIST_ENTRY OldBlink;
  5.4160 +	PLIST_ENTRY Entry;
  5.4161 +
  5.4162 +	Entry = ListHead->Flink;
  5.4163 +	OldFlink = ListHead->Flink->Flink;
  5.4164 +	OldBlink = ListHead->Flink->Blink;
  5.4165 +	OldFlink->Blink = OldBlink;
  5.4166 +	OldBlink->Flink = OldFlink;
  5.4167 +
  5.4168 +  if (Entry != ListHead)
  5.4169 +  {
  5.4170 +    Entry->Flink = NULL;
  5.4171 +    Entry->Blink = NULL;
  5.4172 +  }
  5.4173 +
  5.4174 +	return Entry;
  5.4175 +}
  5.4176 +
  5.4177 +static __inline PLIST_ENTRY
  5.4178 +RemoveTailList(
  5.4179 +  /*IN*/ PLIST_ENTRY  ListHead)
  5.4180 +{
  5.4181 +	PLIST_ENTRY OldFlink;
  5.4182 +	PLIST_ENTRY OldBlink;
  5.4183 +	PLIST_ENTRY Entry;
  5.4184 +
  5.4185 +	Entry = ListHead->Blink;
  5.4186 +	OldFlink = ListHead->Blink->Flink;
  5.4187 +	OldBlink = ListHead->Blink->Blink;
  5.4188 +	OldFlink->Blink = OldBlink;
  5.4189 +	OldBlink->Flink = OldFlink;
  5.4190 +
  5.4191 +  if (Entry != ListHead)
  5.4192 +  {
  5.4193 +    Entry->Flink = NULL;
  5.4194 +    Entry->Blink = NULL;
  5.4195 +  }
  5.4196 +   
  5.4197 +  return Entry;
  5.4198 +}
  5.4199 +
  5.4200 +/*
  5.4201 + * USHORT
  5.4202 + * QueryDepthSList(
  5.4203 + * IN PSLIST_HEADER  SListHead)
  5.4204 + */
  5.4205 +#define QueryDepthSList(_SListHead) \
  5.4206 +  ((USHORT) ((_SListHead)->Alignment & 0xffff))
  5.4207 +
  5.4208 +#define InterlockedFlushSList(ListHead) ExInterlockedFlushSList(ListHead)
  5.4209 +
  5.4210 +NTOSAPI
  5.4211 +ULONG
  5.4212 +DDKAPI
  5.4213 +RtlAnsiStringToUnicodeSize(
  5.4214 +  /*IN*/ PANSI_STRING  AnsiString);
  5.4215 +
  5.4216 +NTOSAPI
  5.4217 +NTSTATUS
  5.4218 +DDKAPI
  5.4219 +RtlAddRange(
  5.4220 +  /*IN OUT*/ PRTL_RANGE_LIST  RangeList,
  5.4221 +  /*IN*/ ULONGLONG  Start,
  5.4222 +  /*IN*/ ULONGLONG  End,
  5.4223 +  /*IN*/ UCHAR  Attributes,
  5.4224 +  /*IN*/ ULONG  Flags,
  5.4225 +  /*IN*/ PVOID  UserData  /*OPTIONAL*/,
  5.4226 +  /*IN*/ PVOID  Owner  /*OPTIONAL*/);
  5.4227 +
  5.4228 +NTOSAPI
  5.4229 +NTSTATUS
  5.4230 +DDKAPI
  5.4231 +RtlAnsiStringToUnicodeString(
  5.4232 +  /*IN OUT*/ PUNICODE_STRING  DestinationString,
  5.4233 +  /*IN*/ PANSI_STRING  SourceString,
  5.4234 +  /*IN*/ BOOLEAN  AllocateDestinationString);
  5.4235 +
  5.4236 +NTOSAPI
  5.4237 +NTSTATUS
  5.4238 +DDKAPI
  5.4239 +RtlAppendUnicodeStringToString(
  5.4240 +  /*IN OUT*/ PUNICODE_STRING  Destination,
  5.4241 +  /*IN*/ PUNICODE_STRING  Source);
  5.4242 +
  5.4243 +NTOSAPI
  5.4244 +NTSTATUS
  5.4245 +DDKAPI
  5.4246 +RtlAppendUnicodeToString(
  5.4247 +  /*IN OUT*/ PUNICODE_STRING  Destination,
  5.4248 +  /*IN*/ PCWSTR  Source);
  5.4249 +
  5.4250 +NTOSAPI
  5.4251 +BOOLEAN
  5.4252 +DDKAPI
  5.4253 +RtlAreBitsClear(
  5.4254 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4255 +  /*IN*/ ULONG  StartingIndex,
  5.4256 +  /*IN*/ ULONG  Length); 
  5.4257 +
  5.4258 +NTOSAPI
  5.4259 +BOOLEAN
  5.4260 +DDKAPI
  5.4261 +RtlAreBitsSet(
  5.4262 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4263 +  /*IN*/ ULONG  StartingIndex,
  5.4264 +  /*IN*/ ULONG  Length); 
  5.4265 +
  5.4266 +NTOSAPI
  5.4267 +NTSTATUS
  5.4268 +DDKAPI
  5.4269 +RtlCharToInteger(
  5.4270 +  /*IN*/ PCSZ  String,
  5.4271 +  /*IN*/ ULONG  Base  /*OPTIONAL*/,
  5.4272 +  /*IN OUT*/ PULONG  Value);
  5.4273 +
  5.4274 +NTOSAPI
  5.4275 +ULONG
  5.4276 +DDKAPI
  5.4277 +RtlCheckBit(
  5.4278 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4279 +  /*IN*/ ULONG  BitPosition); 
  5.4280 +
  5.4281 +NTOSAPI
  5.4282 +NTSTATUS
  5.4283 +DDKAPI
  5.4284 +RtlCheckRegistryKey(
  5.4285 +  /*IN*/ ULONG  RelativeTo,
  5.4286 +  /*IN*/ PWSTR  Path);
  5.4287 +
  5.4288 +NTOSAPI
  5.4289 +VOID
  5.4290 +DDKAPI
  5.4291 +RtlClearAllBits(
  5.4292 +  /*IN*/ PRTL_BITMAP  BitMapHeader); 
  5.4293 +
  5.4294 +NTOSAPI
  5.4295 +VOID
  5.4296 +DDKAPI
  5.4297 +RtlClearBit(
  5.4298 +  PRTL_BITMAP  BitMapHeader,
  5.4299 +  ULONG  BitNumber);
  5.4300 +
  5.4301 +NTOSAPI
  5.4302 +VOID
  5.4303 +DDKAPI
  5.4304 +RtlClearBits(
  5.4305 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4306 +  /*IN*/ ULONG  StartingIndex,
  5.4307 +  /*IN*/ ULONG  NumberToClear); 
  5.4308 +
  5.4309 +NTOSAPI
  5.4310 +SIZE_T
  5.4311 +DDKAPI
  5.4312 +RtlCompareMemory(
  5.4313 +  /*IN*/ CONST VOID  *Source1,
  5.4314 +  /*IN*/ CONST VOID  *Source2,
  5.4315 +  /*IN*/ SIZE_T  Length);
  5.4316 +
  5.4317 +NTOSAPI
  5.4318 +LONG
  5.4319 +DDKAPI
  5.4320 +RtlCompareString(
  5.4321 +  /*IN*/ PSTRING  String1,
  5.4322 +  /*IN*/ PSTRING  String2,
  5.4323 +  BOOLEAN  CaseInSensitive);
  5.4324 +
  5.4325 +NTOSAPI
  5.4326 +LONG
  5.4327 +DDKAPI
  5.4328 +RtlCompareUnicodeString(
  5.4329 +  /*IN*/ PUNICODE_STRING  String1,
  5.4330 +  /*IN*/ PUNICODE_STRING  String2,
  5.4331 +  /*IN*/ BOOLEAN  CaseInSensitive);
  5.4332 +
  5.4333 +NTOSAPI
  5.4334 +LARGE_INTEGER
  5.4335 +DDKAPI
  5.4336 +RtlConvertLongToLargeInteger(
  5.4337 +  /*IN*/ LONG  SignedInteger);
  5.4338 +
  5.4339 +NTOSAPI
  5.4340 +LUID
  5.4341 +DDKAPI
  5.4342 +RtlConvertLongToLuid(
  5.4343 +  /*IN*/ LONG  Long);
  5.4344 +
  5.4345 +NTOSAPI
  5.4346 +LARGE_INTEGER
  5.4347 +DDKAPI
  5.4348 +RtlConvertUlongToLargeInteger(
  5.4349 +  /*IN*/ ULONG  UnsignedInteger);
  5.4350 +
  5.4351 +NTOSAPI
  5.4352 +LUID
  5.4353 +DDKAPI
  5.4354 +RtlConvertUlongToLuid(
  5.4355 +  ULONG  Ulong);
  5.4356 +
  5.4357 +/*
  5.4358 + * VOID
  5.4359 + * RtlCopyMemory(
  5.4360 + * IN VOID UNALIGNED  *Destination,
  5.4361 + * IN CONST VOID UNALIGNED  *Source,
  5.4362 + * IN SIZE_T  Length)
  5.4363 + */
  5.4364 +#ifndef RtlCopyMemory
  5.4365 +#define RtlCopyMemory(Destination, Source, Length) \
  5.4366 +  memcpy(Destination, Source, Length);
  5.4367 +#endif
  5.4368 +
  5.4369 +#ifndef RtlCopyBytes
  5.4370 +#define RtlCopyBytes RtlCopyMemory
  5.4371 +#endif
  5.4372 +
  5.4373 +NTOSAPI
  5.4374 +VOID
  5.4375 +DDKAPI
  5.4376 +RtlCopyMemory32(
  5.4377 +  /*IN*/ VOID UNALIGNED  *Destination,
  5.4378 +  /*IN*/ CONST VOID UNALIGNED  *Source,
  5.4379 +  /*IN*/ ULONG  Length);
  5.4380 +
  5.4381 +NTOSAPI
  5.4382 +NTSTATUS
  5.4383 +DDKAPI
  5.4384 +RtlCopyRangeList(
  5.4385 +  /*OUT*/ PRTL_RANGE_LIST  CopyRangeList,
  5.4386 +  /*IN*/ PRTL_RANGE_LIST  RangeList);
  5.4387 +
  5.4388 +NTOSAPI
  5.4389 +VOID
  5.4390 +DDKAPI
  5.4391 +RtlCopyString(
  5.4392 +  /*IN OUT*/ PSTRING  DestinationString,
  5.4393 +  /*IN*/ PSTRING  SourceString  /*OPTIONAL*/);
  5.4394 +
  5.4395 +NTOSAPI
  5.4396 +VOID
  5.4397 +DDKAPI
  5.4398 +RtlCopyUnicodeString(
  5.4399 +  /*IN OUT*/ PUNICODE_STRING  DestinationString,
  5.4400 +  /*IN*/ PUNICODE_STRING  SourceString);
  5.4401 +
  5.4402 +NTOSAPI
  5.4403 +NTSTATUS
  5.4404 +DDKAPI
  5.4405 +RtlCreateRegistryKey(
  5.4406 +  /*IN*/ ULONG  RelativeTo,
  5.4407 +  /*IN*/ PWSTR  Path);
  5.4408 +
  5.4409 +NTOSAPI
  5.4410 +NTSTATUS
  5.4411 +DDKAPI
  5.4412 +RtlCreateSecurityDescriptor(
  5.4413 +  /*IN OUT*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  5.4414 +  /*IN*/ ULONG  Revision);
  5.4415 +
  5.4416 +NTOSAPI
  5.4417 +NTSTATUS
  5.4418 +DDKAPI
  5.4419 +RtlDeleteOwnersRanges(
  5.4420 +  /*IN OUT*/ PRTL_RANGE_LIST  RangeList,
  5.4421 +  /*IN*/ PVOID  Owner);
  5.4422 +
  5.4423 +NTOSAPI
  5.4424 +NTSTATUS
  5.4425 +DDKAPI
  5.4426 +RtlDeleteRange(
  5.4427 +  /*IN OUT*/ PRTL_RANGE_LIST  RangeList,
  5.4428 +  /*IN*/ ULONGLONG  Start,
  5.4429 +  /*IN*/ ULONGLONG  End,
  5.4430 +  /*IN*/ PVOID  Owner);
  5.4431 +
  5.4432 +NTOSAPI
  5.4433 +NTSTATUS
  5.4434 +DDKAPI
  5.4435 +RtlDeleteRegistryValue(
  5.4436 +  /*IN*/ ULONG  RelativeTo,
  5.4437 +  /*IN*/ PCWSTR  Path,
  5.4438 +  /*IN*/ PCWSTR  ValueName);
  5.4439 +
  5.4440 +NTOSAPI
  5.4441 +BOOL
  5.4442 +DDKAPI
  5.4443 +RtlDosPathNameToNtPathName_U(
  5.4444 +  /*IN*/ PCWSTR  DosPathName,
  5.4445 +  /*OUT*/ PUNICODE_STRING  NtPathName,
  5.4446 +  /*OUT*/ PCWSTR  *NtFileNamePart,
  5.4447 +  /*OUT*/ VOID  *DirectoryInfo);
  5.4448 +
  5.4449 +/*
  5.4450 + * BOOLEAN
  5.4451 + * RtlEqualLuid( 
  5.4452 + * IN LUID  Luid1,
  5.4453 + * IN LUID  Luid2)
  5.4454 + */
  5.4455 +#define RtlEqualLuid(_Luid1, \
  5.4456 +                     _Luid2) \
  5.4457 +  ((Luid1.LowPart == Luid2.LowPart) && (Luid1.HighPart == Luid2.HighPart))
  5.4458 +
  5.4459 +/*
  5.4460 + * ULONG
  5.4461 + * RtlEqualMemory(
  5.4462 + * IN VOID UNALIGNED  *Destination,
  5.4463 + * IN CONST VOID UNALIGNED  *Source,
  5.4464 + * IN SIZE_T  Length)
  5.4465 + */
  5.4466 +#define RtlEqualMemory(Destination, Source, Length) (!memcmp(Destination, Source, Length))
  5.4467 +
  5.4468 +NTOSAPI
  5.4469 +BOOLEAN
  5.4470 +DDKAPI
  5.4471 +RtlEqualString(
  5.4472 +  /*IN*/ PSTRING  String1,
  5.4473 +  /*IN*/ PSTRING  String2,
  5.4474 +  /*IN*/ BOOLEAN  CaseInSensitive);
  5.4475 +
  5.4476 +NTOSAPI
  5.4477 +BOOLEAN
  5.4478 +DDKAPI
  5.4479 +RtlEqualUnicodeString(
  5.4480 +  /*IN*/ CONST UNICODE_STRING  *String1,
  5.4481 +  /*IN*/ CONST UNICODE_STRING  *String2,
  5.4482 +  /*IN*/ BOOLEAN  CaseInSensitive);
  5.4483 +
  5.4484 +/*
  5.4485 + * VOID
  5.4486 + * RtlFillMemory(
  5.4487 + * IN VOID UNALIGNED  *Destination,
  5.4488 + * IN SIZE_T  Length,
  5.4489 + * IN UCHAR  Fill)
  5.4490 + */
  5.4491 +#ifndef RtlFillMemory
  5.4492 +#define RtlFillMemory(Destination, Length, Fill) \
  5.4493 +  memset(Destination, Fill, Length)
  5.4494 +#endif
  5.4495 +
  5.4496 +#ifndef RtlFillBytes
  5.4497 +#define RtlFillBytes RtlFillMemory
  5.4498 +#endif
  5.4499 +
  5.4500 +NTOSAPI
  5.4501 +ULONG
  5.4502 +DDKAPI
  5.4503 +RtlFindClearBits(
  5.4504 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4505 +  /*IN*/ ULONG  NumberToFind,
  5.4506 +  /*IN*/ ULONG  HintIndex); 
  5.4507 +
  5.4508 +NTOSAPI
  5.4509 +ULONG
  5.4510 +DDKAPI
  5.4511 +RtlFindClearBitsAndSet(
  5.4512 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4513 +  /*IN*/ ULONG  NumberToFind,
  5.4514 +  /*IN*/ ULONG  HintIndex); 
  5.4515 +
  5.4516 +NTOSAPI
  5.4517 +ULONG
  5.4518 +DDKAPI
  5.4519 +RtlFindClearRuns( 
  5.4520 +  /*IN*/ PRTL_BITMAP  BitMapHeader, 
  5.4521 +  /*OUT*/ PRTL_BITMAP_RUN  RunArray, 
  5.4522 +  /*IN*/ ULONG  SizeOfRunArray, 
  5.4523 +  /*IN*/ BOOLEAN  LocateLongestRuns);
  5.4524 +
  5.4525 +NTOSAPI
  5.4526 +ULONG
  5.4527 +DDKAPI
  5.4528 +RtlFindFirstRunClear(
  5.4529 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4530 +  /*OUT*/ PULONG  StartingIndex);
  5.4531 +
  5.4532 +NTOSAPI
  5.4533 +ULONG
  5.4534 +DDKAPI
  5.4535 +RtlFindLastBackwardRunClear(
  5.4536 +  /*IN*/ PRTL_BITMAP  BitMapHeader, 
  5.4537 +  /*IN*/ ULONG  FromIndex, 
  5.4538 +  /*OUT*/ PULONG  StartingRunIndex); 
  5.4539 +
  5.4540 +NTOSAPI
  5.4541 +CCHAR
  5.4542 +DDKAPI
  5.4543 +RtlFindLeastSignificantBit(
  5.4544 +  /*IN*/ ULONGLONG  Set);
  5.4545 +
  5.4546 +NTOSAPI
  5.4547 +ULONG
  5.4548 +DDKAPI
  5.4549 +RtlFindLongestRunClear(
  5.4550 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4551 +  /*OUT*/ PULONG  StartingIndex); 
  5.4552 +
  5.4553 +NTOSAPI
  5.4554 +CCHAR
  5.4555 +DDKAPI
  5.4556 +RtlFindMostSignificantBit(
  5.4557 +  /*IN*/ ULONGLONG  Set);
  5.4558 +
  5.4559 +NTOSAPI
  5.4560 +ULONG
  5.4561 +DDKAPI
  5.4562 +RtlFindNextForwardRunClear(
  5.4563 +  /*IN*/ PRTL_BITMAP  BitMapHeader, 
  5.4564 +  /*IN*/ ULONG  FromIndex, 
  5.4565 +  /*OUT*/ PULONG  StartingRunIndex);
  5.4566 +
  5.4567 +NTOSAPI
  5.4568 +NTSTATUS
  5.4569 +DDKAPI
  5.4570 +RtlFindRange(
  5.4571 +  /*IN*/ PRTL_RANGE_LIST  RangeList,
  5.4572 +  /*IN*/ ULONGLONG  Minimum,
  5.4573 +  /*IN*/ ULONGLONG  Maximum,
  5.4574 +  /*IN*/ ULONG  Length,
  5.4575 +  /*IN*/ ULONG  Alignment,
  5.4576 +  /*IN*/ ULONG  Flags,
  5.4577 +  /*IN*/ UCHAR  AttributeAvailableMask,
  5.4578 +  /*IN*/ PVOID  Context  /*OPTIONAL*/,
  5.4579 +  /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK  Callback  /*OPTIONAL*/,
  5.4580 +  /*OUT*/ PULONGLONG  Start);
  5.4581 +
  5.4582 +NTOSAPI
  5.4583 +ULONG
  5.4584 +DDKAPI
  5.4585 +RtlFindSetBits(
  5.4586 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4587 +  /*IN*/ ULONG  NumberToFind,
  5.4588 +  /*IN*/ ULONG  HintIndex); 
  5.4589 +
  5.4590 +NTOSAPI
  5.4591 +ULONG
  5.4592 +DDKAPI
  5.4593 +RtlFindSetBitsAndClear(
  5.4594 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4595 +  /*IN*/ ULONG  NumberToFind,
  5.4596 +  /*IN*/ ULONG  HintIndex); 
  5.4597 +
  5.4598 +NTOSAPI
  5.4599 +VOID
  5.4600 +DDKAPI
  5.4601 +RtlFreeAnsiString(
  5.4602 +  /*IN*/ PANSI_STRING  AnsiString);
  5.4603 +
  5.4604 +NTOSAPI
  5.4605 +VOID
  5.4606 +DDKAPI
  5.4607 +RtlFreeRangeList(
  5.4608 +  /*IN*/ PRTL_RANGE_LIST  RangeList);
  5.4609 +
  5.4610 +NTOSAPI
  5.4611 +VOID
  5.4612 +DDKAPI
  5.4613 +RtlFreeUnicodeString(
  5.4614 +  /*IN*/ PUNICODE_STRING  UnicodeString);
  5.4615 +
  5.4616 +NTOSAPI
  5.4617 +VOID
  5.4618 +DDKAPI
  5.4619 +RtlGetCallersAddress(
  5.4620 +  /*OUT*/ PVOID  *CallersAddress,
  5.4621 +  /*OUT*/ PVOID  *CallersCaller);
  5.4622 +
  5.4623 +NTOSAPI
  5.4624 +NTSTATUS
  5.4625 +DDKAPI
  5.4626 +RtlGetVersion(
  5.4627 +  /*IN OUT*/ PRTL_OSVERSIONINFOW  lpVersionInformation);
  5.4628 +
  5.4629 +NTOSAPI
  5.4630 +NTSTATUS
  5.4631 +DDKAPI
  5.4632 +RtlGetFirstRange(
  5.4633 +  /*IN*/ PRTL_RANGE_LIST  RangeList,
  5.4634 +  /*OUT*/ PRTL_RANGE_LIST_ITERATOR  Iterator,
  5.4635 +  /*OUT*/ PRTL_RANGE  *Range);
  5.4636 +
  5.4637 +NTOSAPI
  5.4638 +NTSTATUS
  5.4639 +DDKAPI
  5.4640 +RtlGetNextRange(
  5.4641 +  /*IN OUT*/  PRTL_RANGE_LIST_ITERATOR  Iterator,
  5.4642 +  /*OUT*/ PRTL_RANGE  *Range,
  5.4643 +  /*IN*/ BOOLEAN  MoveForwards);
  5.4644 +
  5.4645 +#define FOR_ALL_RANGES(RangeList, Iterator, Current)          \
  5.4646 +  for (RtlGetFirstRange((RangeList), (Iterator), &(Current)); \
  5.4647 +    (Current) != NULL;                                        \
  5.4648 +    RtlGetNextRange((Iterator), &(Current), TRUE))
  5.4649 +
  5.4650 +#define FOR_ALL_RANGES_BACKWARDS(RangeList, Iterator, Current) \
  5.4651 +  for (RtlGetLastRange((RangeList), (Iterator), &(Current));   \
  5.4652 +    (Current) != NULL;                                         \
  5.4653 +    RtlGetNextRange((Iterator), &(Current), FALSE))
  5.4654 +
  5.4655 +NTOSAPI
  5.4656 +NTSTATUS
  5.4657 +DDKAPI
  5.4658 +RtlGUIDFromString( 
  5.4659 +  /*IN*/ PUNICODE_STRING  GuidString, 
  5.4660 +  /*OUT*/ GUID  *Guid);
  5.4661 +
  5.4662 +NTOSAPI
  5.4663 +NTSTATUS
  5.4664 +DDKAPI
  5.4665 +RtlHashUnicodeString(
  5.4666 +  /*IN*/ CONST UNICODE_STRING  *String,
  5.4667 +  /*IN*/ BOOLEAN  CaseInSensitive,
  5.4668 +  /*IN*/ ULONG  HashAlgorithm,
  5.4669 +  /*OUT*/ PULONG  HashValue);
  5.4670 +
  5.4671 +NTOSAPI
  5.4672 +VOID
  5.4673 +DDKAPI
  5.4674 +RtlInitAnsiString(
  5.4675 +  /*IN OUT*/ PANSI_STRING  DestinationString,
  5.4676 +  /*IN*/ PCSZ  SourceString);
  5.4677 +
  5.4678 +NTOSAPI
  5.4679 +VOID
  5.4680 +DDKAPI
  5.4681 +RtlInitializeBitMap(
  5.4682 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4683 +  /*IN*/ PULONG  BitMapBuffer,
  5.4684 +  /*IN*/ ULONG  SizeOfBitMap); 
  5.4685 +
  5.4686 +NTOSAPI
  5.4687 +VOID
  5.4688 +DDKAPI
  5.4689 +RtlInitializeRangeList(
  5.4690 +  /*IN OUT*/ PRTL_RANGE_LIST  RangeList);
  5.4691 +
  5.4692 +NTOSAPI
  5.4693 +VOID
  5.4694 +DDKAPI
  5.4695 +RtlInitString(
  5.4696 +  /*IN OUT*/ PSTRING  DestinationString,
  5.4697 +  /*IN*/ PCSZ  SourceString);
  5.4698 +
  5.4699 +NTOSAPI
  5.4700 +VOID
  5.4701 +DDKAPI
  5.4702 +RtlInitUnicodeString(
  5.4703 +  /*IN OUT*/ PUNICODE_STRING  DestinationString,
  5.4704 +  /*IN*/ PCWSTR  SourceString);
  5.4705 +
  5.4706 +NTOSAPI
  5.4707 +NTSTATUS
  5.4708 +DDKAPI
  5.4709 +RtlInt64ToUnicodeString(
  5.4710 +  /*IN*/ ULONGLONG  Value,
  5.4711 +  /*IN*/ ULONG  Base /*OPTIONAL*/,
  5.4712 +  /*IN OUT*/ PUNICODE_STRING  String);
  5.4713 +
  5.4714 +NTOSAPI
  5.4715 +NTSTATUS
  5.4716 +DDKAPI
  5.4717 +RtlIntegerToUnicodeString(
  5.4718 +  /*IN*/ ULONG  Value,
  5.4719 +  /*IN*/ ULONG  Base  /*OPTIONAL*/,
  5.4720 +  /*IN OUT*/ PUNICODE_STRING  String);
  5.4721 +
  5.4722 +NTOSAPI
  5.4723 +NTSTATUS
  5.4724 +DDKAPI
  5.4725 +RtlIntPtrToUnicodeString(
  5.4726 +  PLONG  Value,
  5.4727 +  ULONG  Base  /*OPTIONAL*/,
  5.4728 +  PUNICODE_STRING  String);
  5.4729 +
  5.4730 +NTOSAPI
  5.4731 +NTSTATUS
  5.4732 +DDKAPI
  5.4733 +RtlInvertRangeList(
  5.4734 +  /*OUT*/ PRTL_RANGE_LIST  InvertedRangeList,
  5.4735 +  /*IN*/ PRTL_RANGE_LIST  RangeList);
  5.4736 +
  5.4737 +NTOSAPI
  5.4738 +NTSTATUS
  5.4739 +DDKAPI
  5.4740 +RtlIsRangeAvailable(
  5.4741 +  /*IN*/ PRTL_RANGE_LIST  RangeList,
  5.4742 +  /*IN*/ ULONGLONG  Start,
  5.4743 +  /*IN*/ ULONGLONG  End,
  5.4744 +  /*IN*/ ULONG  Flags,
  5.4745 +  /*IN*/ UCHAR  AttributeAvailableMask,
  5.4746 +  /*IN*/ PVOID  Context  /*OPTIONAL*/,
  5.4747 +  /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK  Callback  /*OPTIONAL*/,
  5.4748 +  /*OUT*/ PBOOLEAN  Available);
  5.4749 +
  5.4750 +/*
  5.4751 + * BOOLEAN
  5.4752 + * RtlIsZeroLuid(
  5.4753 + * IN PLUID  L1)
  5.4754 + */
  5.4755 +#define RtlIsZeroLuid(_L1) \
  5.4756 +  ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
  5.4757 +
  5.4758 +NTOSAPI
  5.4759 +ULONG
  5.4760 +DDKAPI
  5.4761 +RtlLengthSecurityDescriptor(
  5.4762 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor);
  5.4763 +
  5.4764 +NTOSAPI
  5.4765 +VOID
  5.4766 +DDKAPI
  5.4767 +RtlMapGenericMask(
  5.4768 +  /*IN OUT*/ PACCESS_MASK  AccessMask,
  5.4769 +  /*IN*/ PGENERIC_MAPPING  GenericMapping);
  5.4770 +
  5.4771 +NTOSAPI
  5.4772 +NTSTATUS
  5.4773 +DDKAPI
  5.4774 +RtlMergeRangeLists(
  5.4775 +  /*OUT*/ PRTL_RANGE_LIST  MergedRangeList,
  5.4776 +  /*IN*/ PRTL_RANGE_LIST  RangeList1,
  5.4777 +  /*IN*/ PRTL_RANGE_LIST  RangeList2,
  5.4778 +  /*IN*/ ULONG  Flags);
  5.4779 +
  5.4780 +/*
  5.4781 + * VOID
  5.4782 + * RtlMoveMemory(
  5.4783 + * IN VOID UNALIGNED  *Destination,
  5.4784 + * IN CONST VOID UNALIGNED  *Source,
  5.4785 + * IN SIZE_T  Length)
  5.4786 + */
  5.4787 +#define RtlMoveMemory memmove
  5.4788 +
  5.4789 +NTOSAPI
  5.4790 +ULONG
  5.4791 +DDKAPI
  5.4792 +RtlNumberOfClearBits(
  5.4793 +  /*IN*/ PRTL_BITMAP  BitMapHeader);
  5.4794 +
  5.4795 +NTOSAPI
  5.4796 +ULONG
  5.4797 +DDKAPI
  5.4798 +RtlNumberOfSetBits(
  5.4799 +  /*IN*/ PRTL_BITMAP  BitMapHeader); 
  5.4800 +
  5.4801 +NTOSAPI
  5.4802 +VOID
  5.4803 +DDKFASTAPI
  5.4804 +RtlPrefetchMemoryNonTemporal(
  5.4805 +  /*IN*/ PVOID  Source,
  5.4806 +  /*IN*/ SIZE_T  Length);
  5.4807 +
  5.4808 +NTOSAPI
  5.4809 +BOOLEAN
  5.4810 +DDKAPI
  5.4811 +RtlPrefixUnicodeString( 
  5.4812 +  /*IN*/ PUNICODE_STRING  String1, 
  5.4813 +  /*IN*/ PUNICODE_STRING  String2, 
  5.4814 +  /*IN*/ BOOLEAN  CaseInSensitive);
  5.4815 +
  5.4816 +NTOSAPI
  5.4817 +NTSTATUS
  5.4818 +DDKAPI
  5.4819 +RtlQueryRegistryValues(
  5.4820 +  /*IN*/ ULONG  RelativeTo,
  5.4821 +  /*IN*/ PCWSTR  Path,
  5.4822 +  /*IN*/ PRTL_QUERY_REGISTRY_TABLE  QueryTable,
  5.4823 +  /*IN*/ PVOID  Context,
  5.4824 +  /*IN*/ PVOID  Environment  /*OPTIONAL*/);
  5.4825 +
  5.4826 +NTOSAPI
  5.4827 +VOID
  5.4828 +DDKAPI
  5.4829 +RtlRetrieveUlong(
  5.4830 +  /*IN OUT*/ PULONG  DestinationAddress,
  5.4831 +  /*IN*/ PULONG  SourceAddress);
  5.4832 +
  5.4833 +NTOSAPI
  5.4834 +VOID
  5.4835 +DDKAPI
  5.4836 +RtlRetrieveUshort(
  5.4837 +  /*IN OUT*/ PUSHORT  DestinationAddress,
  5.4838 +  /*IN*/ PUSHORT  SourceAddress);
  5.4839 +
  5.4840 +NTOSAPI
  5.4841 +VOID
  5.4842 +DDKAPI
  5.4843 +RtlSetAllBits(
  5.4844 +  /*IN*/ PRTL_BITMAP  BitMapHeader); 
  5.4845 +
  5.4846 +NTOSAPI
  5.4847 +VOID
  5.4848 +DDKAPI
  5.4849 +RtlSetBit(
  5.4850 +  PRTL_BITMAP  BitMapHeader,
  5.4851 +  ULONG  BitNumber);
  5.4852 +
  5.4853 +NTOSAPI
  5.4854 +VOID
  5.4855 +DDKAPI
  5.4856 +RtlSetBits(
  5.4857 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4858 +  /*IN*/ ULONG  StartingIndex,
  5.4859 +  /*IN*/ ULONG  NumberToSet); 
  5.4860 +
  5.4861 +NTOSAPI
  5.4862 +NTSTATUS
  5.4863 +DDKAPI
  5.4864 +RtlSetDaclSecurityDescriptor(
  5.4865 +  /*IN OUT*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  5.4866 +  /*IN*/ BOOLEAN  DaclPresent,
  5.4867 +  /*IN*/ PACL  Dacl  /*OPTIONAL*/,
  5.4868 +  /*IN*/ BOOLEAN  DaclDefaulted  /*OPTIONAL*/);
  5.4869 +
  5.4870 +NTOSAPI
  5.4871 +VOID
  5.4872 +DDKAPI
  5.4873 +RtlStoreUlong(
  5.4874 +  /*IN*/ PULONG  Address,
  5.4875 +  /*IN*/ ULONG  Value);
  5.4876 +
  5.4877 +NTOSAPI
  5.4878 +VOID
  5.4879 +DDKAPI
  5.4880 +RtlStoreUlonglong(
  5.4881 +  /*IN OUT*/ PULONGLONG  Address,
  5.4882 +  ULONGLONG  Value);
  5.4883 +
  5.4884 +NTOSAPI
  5.4885 +VOID
  5.4886 +DDKAPI
  5.4887 +RtlStoreUlongPtr(
  5.4888 +  /*IN OUT*/ PULONG_PTR  Address,
  5.4889 +  /*IN*/ ULONG_PTR  Value);
  5.4890 +
  5.4891 +NTOSAPI
  5.4892 +VOID
  5.4893 +DDKAPI
  5.4894 +RtlStoreUshort(
  5.4895 +  /*IN*/ PUSHORT  Address,
  5.4896 +  /*IN*/ USHORT  Value);
  5.4897 +
  5.4898 +NTOSAPI
  5.4899 +NTSTATUS
  5.4900 +DDKAPI
  5.4901 +RtlStringFromGUID( 
  5.4902 +  /*IN*/ REFGUID  Guid, 
  5.4903 +  /*OUT*/ PUNICODE_STRING  GuidString);
  5.4904 +
  5.4905 +NTOSAPI
  5.4906 +BOOLEAN
  5.4907 +DDKAPI
  5.4908 +RtlTestBit(
  5.4909 +  /*IN*/ PRTL_BITMAP  BitMapHeader,
  5.4910 +  /*IN*/ ULONG  BitNumber);
  5.4911 +
  5.4912 +NTOSAPI
  5.4913 +BOOLEAN
  5.4914 +DDKAPI
  5.4915 +RtlTimeFieldsToTime(
  5.4916 +  /*IN*/ PTIME_FIELDS  TimeFields,
  5.4917 +  /*IN*/ PLARGE_INTEGER  Time);
  5.4918 +
  5.4919 +NTOSAPI
  5.4920 +VOID
  5.4921 +DDKAPI
  5.4922 +RtlTimeToTimeFields(
  5.4923 +  /*IN*/ PLARGE_INTEGER  Time,
  5.4924 +  /*IN*/ PTIME_FIELDS  TimeFields);
  5.4925 +
  5.4926 +NTOSAPI
  5.4927 +ULONG
  5.4928 +DDKFASTAPI
  5.4929 +RtlUlongByteSwap(
  5.4930 +  /*IN*/ ULONG  Source);
  5.4931 +
  5.4932 +NTOSAPI
  5.4933 +ULONGLONG
  5.4934 +DDKFASTAPI
  5.4935 +RtlUlonglongByteSwap(
  5.4936 +  /*IN*/ ULONGLONG  Source);
  5.4937 +
  5.4938 +NTOSAPI
  5.4939 +ULONG
  5.4940 +DDKAPI
  5.4941 +RtlUnicodeStringToAnsiSize(
  5.4942 +  /*IN*/ PUNICODE_STRING  UnicodeString);
  5.4943 +
  5.4944 +NTOSAPI
  5.4945 +NTSTATUS
  5.4946 +DDKAPI
  5.4947 +RtlUnicodeStringToAnsiString(
  5.4948 +  /*IN OUT*/ PANSI_STRING  DestinationString,
  5.4949 +  /*IN*/ PUNICODE_STRING  SourceString,
  5.4950 +  /*IN*/ BOOLEAN  AllocateDestinationString);
  5.4951 +
  5.4952 +NTOSAPI
  5.4953 +NTSTATUS
  5.4954 +DDKAPI
  5.4955 +RtlUnicodeStringToInteger(
  5.4956 +  /*IN*/ PUNICODE_STRING  String,
  5.4957 +  /*IN*/ ULONG  Base  /*OPTIONAL*/,
  5.4958 +  /*OUT*/ PULONG  Value);
  5.4959 +
  5.4960 +NTOSAPI
  5.4961 +WCHAR
  5.4962 +DDKAPI
  5.4963 +RtlUpcaseUnicodeChar( 
  5.4964 +  /*IN*/ WCHAR  SourceCharacter);
  5.4965 +
  5.4966 +NTOSAPI
  5.4967 +NTSTATUS
  5.4968 +DDKAPI
  5.4969 +RtlUpcaseUnicodeString(
  5.4970 +  /*IN OUT*/ PUNICODE_STRING  DestinationString  /*OPTIONAL*/,
  5.4971 +  /*IN*/ PCUNICODE_STRING  SourceString,
  5.4972 +  /*IN*/ BOOLEAN  AllocateDestinationString);
  5.4973 +
  5.4974 +NTOSAPI
  5.4975 +CHAR
  5.4976 +DDKAPI
  5.4977 +RtlUpperChar( 
  5.4978 +  /*IN*/ CHAR Character);
  5.4979 +
  5.4980 +NTOSAPI
  5.4981 +VOID
  5.4982 +DDKAPI
  5.4983 +RtlUpperString(
  5.4984 +  /*IN OUT*/ PSTRING  DestinationString,
  5.4985 +  /*IN*/ PSTRING  SourceString);
  5.4986 +
  5.4987 +NTOSAPI
  5.4988 +USHORT
  5.4989 +DDKFASTAPI
  5.4990 +RtlUshortByteSwap(
  5.4991 +  /*IN*/ USHORT  Source);
  5.4992 +
  5.4993 +NTOSAPI
  5.4994 +BOOLEAN
  5.4995 +DDKAPI
  5.4996 +RtlValidRelativeSecurityDescriptor(
  5.4997 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptorInput,
  5.4998 +  /*IN*/ ULONG  SecurityDescriptorLength,
  5.4999 +  /*IN*/ SECURITY_INFORMATION  RequiredInformation);
  5.5000 +
  5.5001 +NTOSAPI
  5.5002 +BOOLEAN
  5.5003 +DDKAPI
  5.5004 +RtlValidSecurityDescriptor(
  5.5005 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor);
  5.5006 +
  5.5007 +NTOSAPI
  5.5008 +NTSTATUS
  5.5009 +DDKAPI
  5.5010 +RtlVerifyVersionInfo(
  5.5011 +  /*IN*/ PRTL_OSVERSIONINFOEXW  VersionInfo,
  5.5012 +  /*IN*/ ULONG  TypeMask,
  5.5013 +  /*IN*/ ULONGLONG  ConditionMask);
  5.5014 +
  5.5015 +NTOSAPI
  5.5016 +NTSTATUS
  5.5017 +DDKAPI
  5.5018 +RtlVolumeDeviceToDosName(
  5.5019 +  /*IN*/ PVOID  VolumeDeviceObject,
  5.5020 +  /*OUT*/ PUNICODE_STRING  DosName);
  5.5021 +
  5.5022 +NTOSAPI
  5.5023 +ULONG
  5.5024 +DDKAPI
  5.5025 +RtlWalkFrameChain(
  5.5026 +  /*OUT*/ PVOID  *Callers,
  5.5027 +  /*IN*/ ULONG  Count,
  5.5028 +  /*IN*/ ULONG  Flags);
  5.5029 +
  5.5030 +NTOSAPI
  5.5031 +NTSTATUS
  5.5032 +DDKAPI
  5.5033 +RtlWriteRegistryValue(
  5.5034 +  /*IN*/ ULONG  RelativeTo,
  5.5035 +  /*IN*/ PCWSTR  Path,
  5.5036 +  /*IN*/ PCWSTR  ValueName,
  5.5037 +  /*IN*/ ULONG  ValueType,
  5.5038 +  /*IN*/ PVOID  ValueData,
  5.5039 +  /*IN*/ ULONG  ValueLength);
  5.5040 +
  5.5041 +NTOSAPI
  5.5042 +ULONG
  5.5043 +DDKAPI
  5.5044 +RtlxUnicodeStringToAnsiSize(
  5.5045 +  /*IN*/ PUNICODE_STRING  UnicodeString);
  5.5046 +
  5.5047 +/*
  5.5048 + * VOID
  5.5049 + * RtlZeroMemory(
  5.5050 + * IN VOID UNALIGNED  *Destination,
  5.5051 + * IN SIZE_T  Length)
  5.5052 + */
  5.5053 +#ifndef RtlZeroMemory
  5.5054 +#define RtlZeroMemory(Destination, Length) \
  5.5055 +  memset(Destination, 0, Length)
  5.5056 +#endif
  5.5057 +
  5.5058 +#ifndef RtlZeroBytes
  5.5059 +#define RtlZeroBytes RtlZeroMemory
  5.5060 +#endif
  5.5061 +
  5.5062 +
  5.5063 +/** Executive support routines **/
  5.5064 +
  5.5065 +NTOSAPI
  5.5066 +VOID
  5.5067 +DDKFASTAPI
  5.5068 +ExAcquireFastMutex(
  5.5069 +  /*IN*/ PFAST_MUTEX  FastMutex);
  5.5070 +
  5.5071 +NTOSAPI
  5.5072 +VOID
  5.5073 +DDKFASTAPI
  5.5074 +ExAcquireFastMutexUnsafe(
  5.5075 +  /*IN*/ PFAST_MUTEX  FastMutex);
  5.5076 +
  5.5077 +NTOSAPI
  5.5078 +BOOLEAN
  5.5079 +DDKAPI
  5.5080 +ExAcquireResourceExclusiveLite(
  5.5081 +  /*IN*/ PERESOURCE  Resource,
  5.5082 +  /*IN*/ BOOLEAN  Wait);
  5.5083 +
  5.5084 +NTOSAPI
  5.5085 +BOOLEAN
  5.5086 +DDKAPI
  5.5087 +ExAcquireResourceSharedLite(
  5.5088 +  /*IN*/ PERESOURCE  Resource,
  5.5089 +  /*IN*/ BOOLEAN  Wait);
  5.5090 +
  5.5091 +NTOSAPI
  5.5092 +BOOLEAN
  5.5093 +DDKAPI
  5.5094 +ExAcquireSharedStarveExclusive(
  5.5095 +  /*IN*/ PERESOURCE  Resource,
  5.5096 +  /*IN*/ BOOLEAN  Wait);
  5.5097 +
  5.5098 +NTOSAPI
  5.5099 +BOOLEAN
  5.5100 +DDKAPI
  5.5101 +ExAcquireSharedWaitForExclusive(
  5.5102 +  /*IN*/ PERESOURCE  Resource,
  5.5103 +  /*IN*/ BOOLEAN  Wait);
  5.5104 +
  5.5105 +
  5.5106 +NTOSAPI
  5.5107 +PSINGLE_LIST_ENTRY
  5.5108 +DDKFASTAPI
  5.5109 +ExInterlockedPopEntrySList(
  5.5110 +  /*IN*/ PSLIST_HEADER  ListHead,
  5.5111 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5112 +
  5.5113 +
  5.5114 +NTOSAPI
  5.5115 +PSINGLE_LIST_ENTRY
  5.5116 +DDKFASTAPI
  5.5117 +ExInterlockedPushEntrySList(
  5.5118 +  /*IN*/ PSLIST_HEADER  ListHead,
  5.5119 +  /*IN*/ PSINGLE_LIST_ENTRY  ListEntry,
  5.5120 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5121 +
  5.5122 +
  5.5123 +#if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
  5.5124 +#define ExInterlockedPopEntrySList(_ListHead, \
  5.5125 +                                   _Lock) \
  5.5126 +  InterlockedPopEntrySList(_ListHead)
  5.5127 +
  5.5128 +#define ExInterlockedPushEntrySList(_ListHead, \
  5.5129 +                                    _ListEntry, \
  5.5130 +                                    _Lock) \
  5.5131 +  InterlockedPushEntrySList(_ListHead, _ListEntry)
  5.5132 +#endif /*  __USE_NTOSKRNL__ */
  5.5133 +
  5.5134 +#define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
  5.5135 +
  5.5136 +static __inline PVOID
  5.5137 +ExAllocateFromNPagedLookasideList(
  5.5138 +  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside)
  5.5139 +{
  5.5140 +  PVOID Entry;
  5.5141 +
  5.5142 +  Lookaside->TotalAllocates++;
  5.5143 +  Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
  5.5144 +				     &Lookaside->Obsoleted);
  5.5145 +  if (Entry == NULL) {
  5.5146 +    Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
  5.5147 +    Entry = (Lookaside->Allocate)(Lookaside->Type,
  5.5148 +				  Lookaside->Size,
  5.5149 +				  Lookaside->Tag);
  5.5150 +  }
  5.5151 +  return Entry;
  5.5152 +}
  5.5153 +
  5.5154 +static __inline VOID
  5.5155 +ExFreeToNPagedLookasideList(
  5.5156 +  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside,
  5.5157 +  /*IN*/ PVOID  Entry)
  5.5158 +{
  5.5159 +  Lookaside->TotalFrees++;
  5.5160 +  if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
  5.5161 +    Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
  5.5162 +    (Lookaside->Free)(Entry);
  5.5163 +  } else {
  5.5164 +    ExInterlockedPushEntrySList(&Lookaside->ListHead,
  5.5165 +				(PSLIST_ENTRY)Entry,
  5.5166 +				&Lookaside->Obsoleted);
  5.5167 +  }
  5.5168 +}
  5.5169 +
  5.5170 +#if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
  5.5171 +
  5.5172 +static __inline PVOID
  5.5173 +ExAllocateFromPagedLookasideList(
  5.5174 +  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside)
  5.5175 +{
  5.5176 +  PVOID Entry;
  5.5177 +
  5.5178 +  Lookaside->TotalAllocates++;
  5.5179 +  Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
  5.5180 +  if (Entry == NULL) {
  5.5181 +    Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
  5.5182 +    Entry = (Lookaside->Allocate)(Lookaside->Type,
  5.5183 +				  Lookaside->Size,
  5.5184 +				  Lookaside->Tag);
  5.5185 +  }
  5.5186 +  return Entry;
  5.5187 +}
  5.5188 +
  5.5189 +static __inline VOID
  5.5190 +ExFreeToPagedLookasideList(
  5.5191 +  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside,
  5.5192 +  /*IN*/ PVOID  Entry)
  5.5193 +{
  5.5194 +  Lookaside->TotalFrees++;
  5.5195 +  if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
  5.5196 +    Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
  5.5197 +    (Lookaside->Free)(Entry);
  5.5198 +  } else {
  5.5199 +    InterlockedPushEntrySList(&Lookaside->ListHead,
  5.5200 +			      (PSLIST_ENTRY)Entry);
  5.5201 +  }
  5.5202 +}
  5.5203 +
  5.5204 +#else /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
  5.5205 +
  5.5206 +NTOSAPI
  5.5207 +PVOID
  5.5208 +DDKAPI
  5.5209 +ExAllocateFromPagedLookasideList(
  5.5210 +  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside);
  5.5211 +
  5.5212 +NTOSAPI
  5.5213 +VOID
  5.5214 +DDKAPI
  5.5215 +ExFreeToPagedLookasideList(
  5.5216 +  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside,
  5.5217 +  /*IN*/ PVOID  Entry);
  5.5218 +
  5.5219 +#endif /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
  5.5220 +
  5.5221 +NTOSAPI
  5.5222 +PVOID
  5.5223 +DDKAPI
  5.5224 +ExAllocatePoolWithQuotaTag(
  5.5225 +  /*IN*/ POOL_TYPE  PoolType,
  5.5226 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.5227 +  /*IN*/ ULONG  Tag);
  5.5228 +
  5.5229 +NTOSAPI
  5.5230 +PVOID
  5.5231 +DDKAPI
  5.5232 +ExAllocatePoolWithTag(
  5.5233 +  /*IN*/ POOL_TYPE  PoolType,
  5.5234 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.5235 +  /*IN*/ ULONG  Tag);
  5.5236 +
  5.5237 +#ifdef POOL_TAGGING
  5.5238 +
  5.5239 +#define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
  5.5240 +#define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
  5.5241 +
  5.5242 +#else /* !POOL_TAGGING */
  5.5243 +
  5.5244 +NTOSAPI
  5.5245 +PVOID
  5.5246 +DDKAPI
  5.5247 +ExAllocatePool(
  5.5248 +  /*IN*/ POOL_TYPE  PoolType,
  5.5249 +  /*IN*/ SIZE_T  NumberOfBytes);
  5.5250 +
  5.5251 +NTOSAPI
  5.5252 +PVOID
  5.5253 +DDKAPI
  5.5254 +ExAllocatePoolWithQuota(
  5.5255 +  /*IN*/ POOL_TYPE  PoolType,
  5.5256 +  /*IN*/ SIZE_T  NumberOfBytes);
  5.5257 +
  5.5258 +#endif /* POOL_TAGGING */
  5.5259 +
  5.5260 +NTOSAPI
  5.5261 +PVOID
  5.5262 +DDKAPI
  5.5263 +ExAllocatePoolWithTagPriority(
  5.5264 +  /*IN*/ POOL_TYPE  PoolType,
  5.5265 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.5266 +  /*IN*/ ULONG  Tag,
  5.5267 +  /*IN*/ EX_POOL_PRIORITY  Priority);
  5.5268 +
  5.5269 +NTOSAPI
  5.5270 +VOID
  5.5271 +DDKAPI
  5.5272 +ExConvertExclusiveToSharedLite(
  5.5273 +  /*IN*/ PERESOURCE  Resource);
  5.5274 +
  5.5275 +NTOSAPI
  5.5276 +NTSTATUS
  5.5277 +DDKAPI
  5.5278 +ExCreateCallback(
  5.5279 +  /*OUT*/ PCALLBACK_OBJECT  *CallbackObject,
  5.5280 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.5281 +  /*IN*/ BOOLEAN  Create,
  5.5282 +  /*IN*/ BOOLEAN  AllowMultipleCallbacks);
  5.5283 +
  5.5284 +NTOSAPI
  5.5285 +VOID
  5.5286 +DDKAPI
  5.5287 +ExDeleteNPagedLookasideList(
  5.5288 +  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside);
  5.5289 +
  5.5290 +NTOSAPI
  5.5291 +VOID
  5.5292 +DDKAPI
  5.5293 +ExDeletePagedLookasideList(
  5.5294 +  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside);
  5.5295 +
  5.5296 +NTOSAPI
  5.5297 +NTSTATUS
  5.5298 +DDKAPI
  5.5299 +ExDeleteResourceLite(
  5.5300 +  /*IN*/ PERESOURCE  Resource);
  5.5301 +
  5.5302 +NTOSAPI
  5.5303 +VOID
  5.5304 +DDKAPI
  5.5305 +ExFreePool(
  5.5306 +  /*IN*/ PVOID  P);
  5.5307 +
  5.5308 +#define PROTECTED_POOL                    0x80000000
  5.5309 +
  5.5310 +#ifdef POOL_TAGGING
  5.5311 +#define ExFreePool(P) ExFreePoolWithTag(P, 0)
  5.5312 +#endif
  5.5313 +
  5.5314 +NTOSAPI
  5.5315 +VOID
  5.5316 +DDKAPI
  5.5317 +ExFreePoolWithTag(
  5.5318 +  /*IN*/ PVOID  P,
  5.5319 +  /*IN*/ ULONG  Tag);
  5.5320 +
  5.5321 +/*
  5.5322 + * ERESOURCE_THREAD
  5.5323 + * ExGetCurrentResourceThread(
  5.5324 + *   VOID);
  5.5325 + */
  5.5326 +#define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
  5.5327 +
  5.5328 +NTOSAPI
  5.5329 +ULONG
  5.5330 +DDKAPI
  5.5331 +ExGetExclusiveWaiterCount(
  5.5332 +  /*IN*/ PERESOURCE  Resource);
  5.5333 +
  5.5334 +NTOSAPI
  5.5335 +KPROCESSOR_MODE
  5.5336 +DDKAPI
  5.5337 +ExGetPreviousMode( 
  5.5338 +  VOID);
  5.5339 +
  5.5340 +NTOSAPI
  5.5341 +ULONG
  5.5342 +DDKAPI
  5.5343 +ExGetSharedWaiterCount(
  5.5344 +  /*IN*/ PERESOURCE  Resource);
  5.5345 +
  5.5346 +NTOSAPI
  5.5347 +VOID
  5.5348 +DDKAPI
  5.5349 +KeInitializeEvent(
  5.5350 +  /*IN*/ PRKEVENT  Event,
  5.5351 +  /*IN*/ EVENT_TYPE  Type,
  5.5352 +  /*IN*/ BOOLEAN  State);
  5.5353 +
  5.5354 +/*
  5.5355 + * VOID DDKAPI
  5.5356 + * ExInitializeFastMutex(
  5.5357 + * IN PFAST_MUTEX  FastMutex)
  5.5358 + */
  5.5359 +#define ExInitializeFastMutex(_FastMutex) \
  5.5360 +{ \
  5.5361 +  (_FastMutex)->Count = 1; \
  5.5362 +  (_FastMutex)->Owner = NULL; \
  5.5363 +  (_FastMutex)->Contention = 0; \
  5.5364 +  KeInitializeEvent(&(_FastMutex)->Event, SynchronizationEvent, FALSE); \
  5.5365 +}
  5.5366 +
  5.5367 +NTOSAPI
  5.5368 +VOID
  5.5369 +DDKAPI
  5.5370 +ExInitializeNPagedLookasideList(
  5.5371 +  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside,
  5.5372 +  /*IN*/ PALLOCATE_FUNCTION  Allocate  /*OPTIONAL*/,
  5.5373 +  /*IN*/ PFREE_FUNCTION  Free  /*OPTIONAL*/,
  5.5374 +  /*IN*/ ULONG  Flags,
  5.5375 +  /*IN*/ SIZE_T  Size,
  5.5376 +  /*IN*/ ULONG  Tag,
  5.5377 +  /*IN*/ USHORT  Depth);
  5.5378 +
  5.5379 +NTOSAPI
  5.5380 +VOID
  5.5381 +DDKAPI
  5.5382 +ExInitializePagedLookasideList(
  5.5383 +  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside,
  5.5384 +  /*IN*/ PALLOCATE_FUNCTION  Allocate  /*OPTIONAL*/,
  5.5385 +  /*IN*/ PFREE_FUNCTION  Free  /*OPTIONAL*/,
  5.5386 +  /*IN*/ ULONG  Flags,
  5.5387 +  /*IN*/ SIZE_T  Size,
  5.5388 +  /*IN*/ ULONG  Tag,
  5.5389 +  /*IN*/ USHORT  Depth);
  5.5390 +
  5.5391 +NTOSAPI
  5.5392 +NTSTATUS
  5.5393 +DDKAPI
  5.5394 +ExInitializeResourceLite(
  5.5395 +  /*IN*/ PERESOURCE  Resource);
  5.5396 +
  5.5397 +/*
  5.5398 + * VOID
  5.5399 + * InitializeSListHead(
  5.5400 + * IN PSLIST_HEADER  SListHead)
  5.5401 + */
  5.5402 +#define InitializeSListHead(_SListHead) \
  5.5403 +	(_SListHead)->Alignment = 0
  5.5404 +
  5.5405 +#define ExInitializeSListHead InitializeSListHead
  5.5406 +
  5.5407 +NTOSAPI
  5.5408 +LARGE_INTEGER
  5.5409 +DDKAPI
  5.5410 +ExInterlockedAddLargeInteger(
  5.5411 +  /*IN*/ PLARGE_INTEGER  Addend,
  5.5412 +  /*IN*/ LARGE_INTEGER  Increment,
  5.5413 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5414 +
  5.5415 +NTOSAPI
  5.5416 +VOID
  5.5417 +DDKFASTAPI
  5.5418 +ExInterlockedAddLargeStatistic(
  5.5419 +  /*IN*/ PLARGE_INTEGER  Addend,
  5.5420 +  /*IN*/ ULONG  Increment);
  5.5421 +
  5.5422 +NTOSAPI
  5.5423 +ULONG
  5.5424 +DDKAPI
  5.5425 +ExInterlockedAddUlong(
  5.5426 +  /*IN*/ PULONG  Addend,
  5.5427 +  /*IN*/ ULONG  Increment,
  5.5428 +  PKSPIN_LOCK  Lock);
  5.5429 +
  5.5430 +NTOSAPI
  5.5431 +ULONG
  5.5432 +DDKFASTAPI
  5.5433 +ExfInterlockedAddUlong(
  5.5434 +  /*IN*/ PULONG  Addend,
  5.5435 +  /*IN*/ ULONG  Increment,
  5.5436 +  PKSPIN_LOCK  Lock);
  5.5437 +
  5.5438 +
  5.5439 +NTOSAPI
  5.5440 +LONGLONG
  5.5441 +DDKFASTAPI
  5.5442 +ExInterlockedCompareExchange64(
  5.5443 +  /*IN OUT*/ PLONGLONG  Destination,
  5.5444 +  /*IN*/ PLONGLONG  Exchange,
  5.5445 +  /*IN*/ PLONGLONG  Comparand,
  5.5446 +  /*IN*/ PKSPIN_LOCK  Lock); 
  5.5447 +
  5.5448 +NTOSAPI
  5.5449 +PSINGLE_LIST_ENTRY
  5.5450 +DDKFASTAPI
  5.5451 +ExInterlockedFlushSList(
  5.5452 +  /*IN*/ PSLIST_HEADER  ListHead);
  5.5453 +
  5.5454 +NTOSAPI
  5.5455 +PLIST_ENTRY
  5.5456 +DDKAPI
  5.5457 +ExInterlockedInsertHeadList(
  5.5458 +  /*IN*/ PLIST_ENTRY  ListHead,
  5.5459 +  /*IN*/ PLIST_ENTRY  ListEntry,
  5.5460 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5461 +
  5.5462 +NTOSAPI
  5.5463 +PLIST_ENTRY
  5.5464 +DDKFASTAPI
  5.5465 +ExfInterlockedInsertHeadList(
  5.5466 +  /*IN*/ PLIST_ENTRY  ListHead,
  5.5467 +  /*IN*/ PLIST_ENTRY  ListEntry,
  5.5468 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5469 +
  5.5470 +NTOSAPI
  5.5471 +PLIST_ENTRY
  5.5472 +DDKAPI
  5.5473 +ExInterlockedInsertTailList(
  5.5474 +  /*IN*/ PLIST_ENTRY  ListHead,
  5.5475 +  /*IN*/ PLIST_ENTRY  ListEntry,
  5.5476 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5477 +
  5.5478 +NTOSAPI
  5.5479 +PLIST_ENTRY
  5.5480 +DDKFASTAPI
  5.5481 +ExfInterlockedInsertTailList(
  5.5482 +  /*IN*/ PLIST_ENTRY  ListHead,
  5.5483 +  /*IN*/ PLIST_ENTRY  ListEntry,
  5.5484 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5485 +
  5.5486 +NTOSAPI
  5.5487 +PSINGLE_LIST_ENTRY
  5.5488 +DDKAPI
  5.5489 +ExInterlockedPopEntryList(
  5.5490 +  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  5.5491 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5492 +
  5.5493 +NTOSAPI
  5.5494 +PSINGLE_LIST_ENTRY
  5.5495 +DDKFASTAPI
  5.5496 +ExfInterlockedPopEntryList(
  5.5497 +  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  5.5498 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5499 +
  5.5500 +
  5.5501 +NTOSAPI
  5.5502 +PSINGLE_LIST_ENTRY
  5.5503 +DDKAPI
  5.5504 +ExInterlockedPushEntryList(
  5.5505 +  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  5.5506 +  /*IN*/ PSINGLE_LIST_ENTRY  ListEntry,
  5.5507 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5508 +
  5.5509 +NTOSAPI
  5.5510 +PSINGLE_LIST_ENTRY
  5.5511 +DDKFASTAPI
  5.5512 +ExfInterlockedPushEntryList(
  5.5513 +  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  5.5514 +  /*IN*/ PSINGLE_LIST_ENTRY  ListEntry,
  5.5515 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5516 +
  5.5517 +
  5.5518 +NTOSAPI
  5.5519 +PLIST_ENTRY
  5.5520 +DDKAPI
  5.5521 +ExInterlockedRemoveHeadList(
  5.5522 +  /*IN*/ PLIST_ENTRY  ListHead,
  5.5523 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5524 +
  5.5525 +NTOSAPI
  5.5526 +PLIST_ENTRY
  5.5527 +DDKFASTAPI
  5.5528 +ExfInterlockedRemoveHeadList(
  5.5529 +  /*IN*/ PLIST_ENTRY  ListHead,
  5.5530 +  /*IN*/ PKSPIN_LOCK  Lock);
  5.5531 +
  5.5532 +
  5.5533 +NTOSAPI
  5.5534 +BOOLEAN
  5.5535 +DDKAPI
  5.5536 +ExIsProcessorFeaturePresent(
  5.5537 +  /*IN*/ ULONG  ProcessorFeature);
  5.5538 +
  5.5539 +NTOSAPI
  5.5540 +BOOLEAN
  5.5541 +DDKAPI
  5.5542 +ExIsResourceAcquiredExclusiveLite(
  5.5543 +  /*IN*/ PERESOURCE  Resource);
  5.5544 +
  5.5545 +NTOSAPI
  5.5546 +USHORT
  5.5547 +DDKAPI
  5.5548 +ExIsResourceAcquiredLite(
  5.5549 +  /*IN*/ PERESOURCE  Resource);
  5.5550 +
  5.5551 +NTOSAPI
  5.5552 +USHORT
  5.5553 +DDKAPI
  5.5554 +ExIsResourceAcquiredSharedLite(
  5.5555 +  /*IN*/ PERESOURCE  Resource);
  5.5556 +
  5.5557 +NTOSAPI
  5.5558 +VOID
  5.5559 +DDKAPI
  5.5560 +ExLocalTimeToSystemTime(
  5.5561 +  /*IN*/ PLARGE_INTEGER  LocalTime,
  5.5562 +  /*OUT*/ PLARGE_INTEGER  SystemTime);
  5.5563 +
  5.5564 +NTOSAPI
  5.5565 +VOID
  5.5566 +DDKAPI
  5.5567 +ExNotifyCallback(
  5.5568 +  /*IN*/ PCALLBACK_OBJECT  CallbackObject,
  5.5569 +  /*IN*/ PVOID  Argument1,
  5.5570 +  /*IN*/ PVOID  Argument2);
  5.5571 +
  5.5572 +NTOSAPI
  5.5573 +VOID
  5.5574 +DDKAPI
  5.5575 +ExRaiseAccessViolation(
  5.5576 +  VOID);
  5.5577 +
  5.5578 +NTOSAPI
  5.5579 +VOID
  5.5580 +DDKAPI
  5.5581 +ExRaiseDatatypeMisalignment(
  5.5582 +  VOID);
  5.5583 +
  5.5584 +NTOSAPI
  5.5585 +VOID
  5.5586 +DDKAPI
  5.5587 +ExRaiseStatus(
  5.5588 +  /*IN*/ NTSTATUS  Status);
  5.5589 +
  5.5590 +NTOSAPI
  5.5591 +PVOID
  5.5592 +DDKAPI
  5.5593 +ExRegisterCallback(
  5.5594 +  /*IN*/ PCALLBACK_OBJECT  CallbackObject,
  5.5595 +  /*IN*/ PCALLBACK_FUNCTION  CallbackFunction,
  5.5596 +  /*IN*/ PVOID  CallbackContext);
  5.5597 +
  5.5598 +NTOSAPI
  5.5599 +VOID
  5.5600 +DDKAPI
  5.5601 +ExReinitializeResourceLite(
  5.5602 +  /*IN*/ PERESOURCE  Resource);
  5.5603 +
  5.5604 +NTOSAPI
  5.5605 +VOID
  5.5606 +DDKFASTAPI
  5.5607 +ExReleaseFastMutex(
  5.5608 +  /*IN*/ PFAST_MUTEX  FastMutex);
  5.5609 +
  5.5610 +NTOSAPI
  5.5611 +VOID
  5.5612 +DDKFASTAPI
  5.5613 +ExReleaseFastMutexUnsafe(
  5.5614 +  /*IN*/ PFAST_MUTEX  FastMutex);
  5.5615 +
  5.5616 +NTOSAPI
  5.5617 +VOID
  5.5618 +DDKAPI
  5.5619 +ExReleaseResourceForThreadLite(
  5.5620 +  /*IN*/ PERESOURCE  Resource,
  5.5621 +  /*IN*/ ERESOURCE_THREAD  ResourceThreadId);
  5.5622 +
  5.5623 +NTOSAPI
  5.5624 +VOID
  5.5625 +DDKFASTAPI
  5.5626 +ExReleaseResourceLite(
  5.5627 +  /*IN*/ PERESOURCE  Resource);
  5.5628 +
  5.5629 +NTOSAPI
  5.5630 +VOID
  5.5631 +DDKAPI
  5.5632 +ExSetResourceOwnerPointer( 
  5.5633 +  /*IN*/ PERESOURCE  Resource,
  5.5634 +  /*IN*/ PVOID  OwnerPointer);
  5.5635 +
  5.5636 +NTOSAPI
  5.5637 +ULONG
  5.5638 +DDKAPI
  5.5639 +ExSetTimerResolution(
  5.5640 +  /*IN*/ ULONG  DesiredTime,
  5.5641 +  /*IN*/ BOOLEAN  SetResolution);
  5.5642 +
  5.5643 +NTOSAPI
  5.5644 +VOID
  5.5645 +DDKAPI
  5.5646 +ExSystemTimeToLocalTime(
  5.5647 +  /*IN*/ PLARGE_INTEGER  SystemTime,
  5.5648 +  /*OUT*/ PLARGE_INTEGER  LocalTime);
  5.5649 +
  5.5650 +NTOSAPI
  5.5651 +BOOLEAN
  5.5652 +DDKFASTAPI
  5.5653 +ExTryToAcquireFastMutex(
  5.5654 +  /*IN*/ PFAST_MUTEX  FastMutex);
  5.5655 +
  5.5656 +NTOSAPI
  5.5657 +BOOLEAN
  5.5658 +DDKAPI
  5.5659 +ExTryToAcquireResourceExclusiveLite(
  5.5660 +  /*IN*/ PERESOURCE  Resource);
  5.5661 +
  5.5662 +NTOSAPI
  5.5663 +VOID
  5.5664 +DDKAPI
  5.5665 +ExUnregisterCallback(
  5.5666 +  /*IN*/ PVOID  CbRegistration);
  5.5667 +
  5.5668 +NTOSAPI
  5.5669 +NTSTATUS
  5.5670 +DDKAPI
  5.5671 +ExUuidCreate(
  5.5672 +  /*OUT*/ UUID  *Uuid);
  5.5673 +
  5.5674 +NTOSAPI
  5.5675 +BOOLEAN
  5.5676 +DDKAPI
  5.5677 +ExVerifySuite(
  5.5678 +  /*IN*/ SUITE_TYPE  SuiteType);
  5.5679 +
  5.5680 +#ifdef DBG
  5.5681 +
  5.5682 +#define PAGED_CODE() { \
  5.5683 +  if (KeGetCurrentIrql() > APC_LEVEL) { \
  5.5684 +    KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
  5.5685 +    ASSERT(FALSE); \
  5.5686 +  } \
  5.5687 +}
  5.5688 +
  5.5689 +#else
  5.5690 +
  5.5691 +#define PAGED_CODE()
  5.5692 +
  5.5693 +#endif
  5.5694 +
  5.5695 +NTOSAPI
  5.5696 +VOID
  5.5697 +DDKAPI
  5.5698 +ProbeForRead(
  5.5699 +  /*IN*/ CONST VOID  *Address,
  5.5700 +  /*IN*/ ULONG  Length,
  5.5701 +  /*IN*/ ULONG  Alignment);
  5.5702 +
  5.5703 +NTOSAPI
  5.5704 +VOID
  5.5705 +DDKAPI
  5.5706 +ProbeForWrite(
  5.5707 +  /*IN*/ CONST VOID  *Address,
  5.5708 +  /*IN*/ ULONG  Length,
  5.5709 +  /*IN*/ ULONG  Alignment);
  5.5710 +
  5.5711 +
  5.5712 +
  5.5713 +/** Configuration manager routines **/
  5.5714 +
  5.5715 +NTOSAPI
  5.5716 +NTSTATUS
  5.5717 +DDKAPI
  5.5718 +CmRegisterCallback(
  5.5719 +  /*IN*/ PEX_CALLBACK_FUNCTION  Function,
  5.5720 +  /*IN*/ PVOID  Context,
  5.5721 +  /*IN OUT*/ PLARGE_INTEGER  Cookie);
  5.5722 +
  5.5723 +NTOSAPI
  5.5724 +NTSTATUS
  5.5725 +DDKAPI
  5.5726 +CmUnRegisterCallback(
  5.5727 +  /*IN*/ LARGE_INTEGER  Cookie);
  5.5728 +
  5.5729 +
  5.5730 +
  5.5731 +/** Filesystem runtime library routines **/
  5.5732 +
  5.5733 +NTOSAPI
  5.5734 +BOOLEAN
  5.5735 +DDKAPI
  5.5736 +FsRtlIsTotalDeviceFailure(
  5.5737 +  /*IN*/ NTSTATUS  Status);
  5.5738 +
  5.5739 +
  5.5740 +
  5.5741 +/** Hardware abstraction layer routines **/
  5.5742 +
  5.5743 +NTOSAPI
  5.5744 +VOID
  5.5745 +DDKFASTAPI
  5.5746 +HalExamineMBR(
  5.5747 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.5748 +  /*IN*/ ULONG  SectorSize,
  5.5749 +  /*IN*/ ULONG  MBRTypeIdentifier,
  5.5750 +  /*OUT*/ PVOID  Buffer);
  5.5751 +
  5.5752 +NTOSAPI
  5.5753 +VOID
  5.5754 +DDKAPI
  5.5755 +READ_PORT_BUFFER_UCHAR(
  5.5756 +  /*IN*/ PUCHAR  Port,
  5.5757 +  /*IN*/ PUCHAR  Buffer,
  5.5758 +  /*IN*/ ULONG  Count);
  5.5759 +
  5.5760 +NTOSAPI
  5.5761 +VOID
  5.5762 +DDKAPI
  5.5763 +READ_PORT_BUFFER_ULONG(
  5.5764 +  /*IN*/ PULONG  Port,
  5.5765 +  /*IN*/ PULONG  Buffer,
  5.5766 +  /*IN*/ ULONG  Count);
  5.5767 +
  5.5768 +NTOSAPI
  5.5769 +VOID
  5.5770 +DDKAPI
  5.5771 +READ_PORT_BUFFER_USHORT(
  5.5772 +  /*IN*/ PUSHORT  Port,
  5.5773 +  /*IN*/ PUSHORT  Buffer,
  5.5774 +  /*IN*/ ULONG  Count);
  5.5775 +
  5.5776 +NTOSAPI
  5.5777 +UCHAR
  5.5778 +DDKAPI
  5.5779 +READ_PORT_UCHAR(
  5.5780 +  /*IN*/ PUCHAR  Port);
  5.5781 +
  5.5782 +NTOSAPI
  5.5783 +ULONG
  5.5784 +DDKAPI
  5.5785 +READ_PORT_ULONG(
  5.5786 +  /*IN*/ PULONG  Port);
  5.5787 +
  5.5788 +NTOSAPI
  5.5789 +USHORT
  5.5790 +DDKAPI
  5.5791 +READ_PORT_USHORT(
  5.5792 +  /*IN*/ PUSHORT  Port);
  5.5793 +
  5.5794 +NTOSAPI
  5.5795 +VOID
  5.5796 +DDKAPI
  5.5797 +READ_REGISTER_BUFFER_UCHAR(
  5.5798 +  /*IN*/ PUCHAR  Register,
  5.5799 +  /*IN*/ PUCHAR  Buffer,
  5.5800 +  /*IN*/ ULONG  Count);
  5.5801 +
  5.5802 +NTOSAPI
  5.5803 +VOID
  5.5804 +DDKAPI
  5.5805 +READ_REGISTER_BUFFER_ULONG(
  5.5806 +  /*IN*/ PULONG  Register,
  5.5807 +  /*IN*/ PULONG  Buffer,
  5.5808 +  /*IN*/ ULONG  Count);
  5.5809 +
  5.5810 +NTOSAPI
  5.5811 +VOID
  5.5812 +DDKAPI
  5.5813 +READ_REGISTER_BUFFER_USHORT(
  5.5814 +  /*IN*/ PUSHORT  Register,
  5.5815 +  /*IN*/ PUSHORT  Buffer,
  5.5816 +  /*IN*/ ULONG  Count);
  5.5817 +
  5.5818 +NTOSAPI
  5.5819 +UCHAR
  5.5820 +DDKAPI
  5.5821 +READ_REGISTER_UCHAR(
  5.5822 +  /*IN*/ PUCHAR  Register);
  5.5823 +
  5.5824 +NTOSAPI
  5.5825 +ULONG
  5.5826 +DDKAPI
  5.5827 +READ_REGISTER_ULONG(
  5.5828 +  /*IN*/ PULONG  Register);
  5.5829 +
  5.5830 +NTOSAPI
  5.5831 +USHORT
  5.5832 +DDKAPI
  5.5833 +READ_REGISTER_USHORT(
  5.5834 +  /*IN*/ PUSHORT  Register);
  5.5835 +
  5.5836 +NTOSAPI
  5.5837 +VOID
  5.5838 +DDKAPI
  5.5839 +WRITE_PORT_BUFFER_UCHAR(
  5.5840 +  /*IN*/ PUCHAR  Port,
  5.5841 +  /*IN*/ PUCHAR  Buffer,
  5.5842 +  /*IN*/ ULONG  Count);
  5.5843 +
  5.5844 +NTOSAPI
  5.5845 +VOID
  5.5846 +DDKAPI
  5.5847 +WRITE_PORT_BUFFER_ULONG(
  5.5848 +  /*IN*/ PULONG  Port,
  5.5849 +  /*IN*/ PULONG  Buffer,
  5.5850 +  /*IN*/ ULONG  Count);
  5.5851 +
  5.5852 +NTOSAPI
  5.5853 +VOID
  5.5854 +DDKAPI
  5.5855 +WRITE_PORT_BUFFER_USHORT(
  5.5856 +  /*IN*/ PUSHORT  Port,
  5.5857 +  /*IN*/ PUSHORT  Buffer,
  5.5858 +  /*IN*/ ULONG  Count);
  5.5859 +
  5.5860 +NTOSAPI
  5.5861 +VOID
  5.5862 +DDKAPI
  5.5863 +WRITE_PORT_UCHAR(
  5.5864 +  /*IN*/ PUCHAR  Port,
  5.5865 +  /*IN*/ UCHAR  Value);
  5.5866 +
  5.5867 +NTOSAPI
  5.5868 +VOID
  5.5869 +DDKAPI
  5.5870 +WRITE_PORT_ULONG(
  5.5871 +  /*IN*/ PULONG  Port,
  5.5872 +  /*IN*/ ULONG  Value);
  5.5873 +
  5.5874 +NTOSAPI
  5.5875 +VOID
  5.5876 +DDKAPI
  5.5877 +WRITE_PORT_USHORT(
  5.5878 +  /*IN*/ PUSHORT  Port,
  5.5879 +  /*IN*/ USHORT  Value);
  5.5880 +
  5.5881 +NTOSAPI
  5.5882 +VOID
  5.5883 +DDKAPI
  5.5884 +WRITE_REGISTER_BUFFER_UCHAR(
  5.5885 +  /*IN*/ PUCHAR  Register,
  5.5886 +  /*IN*/ PUCHAR  Buffer,
  5.5887 +  /*IN*/ ULONG  Count);
  5.5888 +
  5.5889 +NTOSAPI
  5.5890 +VOID
  5.5891 +DDKAPI
  5.5892 +WRITE_REGISTER_BUFFER_ULONG(
  5.5893 +  /*IN*/ PULONG  Register,
  5.5894 +  /*IN*/ PULONG  Buffer,
  5.5895 +  /*IN*/ ULONG  Count);
  5.5896 +
  5.5897 +NTOSAPI
  5.5898 +VOID
  5.5899 +DDKAPI
  5.5900 +WRITE_REGISTER_BUFFER_USHORT(
  5.5901 +  /*IN*/ PUSHORT  Register,
  5.5902 +  /*IN*/ PUSHORT  Buffer,
  5.5903 +  /*IN*/ ULONG  Count);
  5.5904 +
  5.5905 +NTOSAPI
  5.5906 +VOID
  5.5907 +DDKAPI
  5.5908 +WRITE_REGISTER_UCHAR(
  5.5909 +  /*IN*/ PUCHAR  Register,
  5.5910 +  /*IN*/ UCHAR  Value);
  5.5911 +
  5.5912 +NTOSAPI
  5.5913 +VOID
  5.5914 +DDKAPI
  5.5915 +WRITE_REGISTER_ULONG(
  5.5916 +  /*IN*/ PULONG  Register,
  5.5917 +  /*IN*/ ULONG  Value);
  5.5918 +
  5.5919 +NTOSAPI
  5.5920 +VOID
  5.5921 +DDKAPI
  5.5922 +WRITE_REGISTER_USHORT(
  5.5923 +  /*IN*/ PUSHORT  Register,
  5.5924 +  /*IN*/ USHORT  Value);
  5.5925 +
  5.5926 +/** I/O manager routines **/
  5.5927 +
  5.5928 +NTOSAPI
  5.5929 +VOID
  5.5930 +DDKAPI
  5.5931 +IoAcquireCancelSpinLock(
  5.5932 +  /*OUT*/ PKIRQL  Irql);
  5.5933 +
  5.5934 +NTOSAPI
  5.5935 +NTSTATUS
  5.5936 +DDKAPI
  5.5937 +IoAcquireRemoveLockEx(
  5.5938 +  /*IN*/ PIO_REMOVE_LOCK  RemoveLock,
  5.5939 +  /*IN*/ PVOID  Tag  /*OPTIONAL*/,
  5.5940 +  /*IN*/ PCSTR  File,
  5.5941 +  /*IN*/ ULONG  Line,
  5.5942 +  /*IN*/ ULONG  RemlockSize);
  5.5943 +
  5.5944 +/*
  5.5945 + * NTSTATUS
  5.5946 + * IoAcquireRemoveLock(
  5.5947 + * IN PIO_REMOVE_LOCK  RemoveLock,
  5.5948 + * IN PVOID  Tag OPTIONAL)
  5.5949 + */
  5.5950 +#define IoAcquireRemoveLock(_RemoveLock, \
  5.5951 +                            _Tag) \
  5.5952 +  IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK))
  5.5953 +
  5.5954 +/*
  5.5955 + * VOID
  5.5956 + * IoAdjustPagingPathCount(
  5.5957 + * IN PLONG  Count,
  5.5958 + * IN BOOLEAN  Increment)
  5.5959 + */
  5.5960 +#define IoAdjustPagingPathCount(_Count, \
  5.5961 +                                _Increment) \
  5.5962 +{ \
  5.5963 +  if (_Increment) \
  5.5964 +    { \
  5.5965 +      InterlockedIncrement(_Count); \
  5.5966 +    } \
  5.5967 +  else \
  5.5968 +    { \
  5.5969 +      InterlockedDecrement(_Count); \
  5.5970 +    } \
  5.5971 +}
  5.5972 +
  5.5973 +NTOSAPI
  5.5974 +VOID
  5.5975 +DDKAPI
  5.5976 +IoAllocateController(
  5.5977 +  /*IN*/ PCONTROLLER_OBJECT  ControllerObject,
  5.5978 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.5979 +  /*IN*/ PDRIVER_CONTROL  ExecutionRoutine,
  5.5980 +  /*IN*/ PVOID  Context);
  5.5981 +
  5.5982 +NTOSAPI
  5.5983 +NTSTATUS
  5.5984 +DDKAPI
  5.5985 +IoAllocateDriverObjectExtension(
  5.5986 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.5987 +  /*IN*/ PVOID  ClientIdentificationAddress,
  5.5988 +  /*IN*/ ULONG  DriverObjectExtensionSize,
  5.5989 +  /*OUT*/ PVOID  *DriverObjectExtension);
  5.5990 +
  5.5991 +typedef struct _IO_ERROR_LOG_PACKET { 
  5.5992 +	UCHAR  MajorFunctionCode; 
  5.5993 +	UCHAR  RetryCount; 
  5.5994 +	USHORT  DumpDataSize; 
  5.5995 +	USHORT  NumberOfStrings; 
  5.5996 +	USHORT  StringOffset; 
  5.5997 +	USHORT  EventCategory; 
  5.5998 +	NTSTATUS  ErrorCode; 
  5.5999 +	ULONG  UniqueErrorValue; 
  5.6000 +	NTSTATUS  FinalStatus; 
  5.6001 +	ULONG  SequenceNumber; 
  5.6002 +	ULONG  IoControlCode; 
  5.6003 +	LARGE_INTEGER  DeviceOffset; 
  5.6004 +	ULONG  DumpData[1]; 
  5.6005 +} IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET; 
  5.6006 +
  5.6007 +NTOSAPI
  5.6008 +PVOID
  5.6009 +DDKAPI
  5.6010 +IoAllocateErrorLogEntry(
  5.6011 +  /*IN*/ PVOID  IoObject,
  5.6012 +  /*IN*/ UCHAR  EntrySize);
  5.6013 +
  5.6014 +NTOSAPI
  5.6015 +PIRP
  5.6016 +DDKAPI
  5.6017 +IoAllocateIrp(
  5.6018 +  /*IN*/ CCHAR  StackSize,
  5.6019 +  /*IN*/ BOOLEAN  ChargeQuota);
  5.6020 +
  5.6021 +NTOSAPI
  5.6022 +PMDL
  5.6023 +DDKAPI
  5.6024 +IoAllocateMdl(
  5.6025 +  /*IN*/ PVOID  VirtualAddress,
  5.6026 +  /*IN*/ ULONG  Length,
  5.6027 +  /*IN*/ BOOLEAN  SecondaryBuffer,
  5.6028 +  /*IN*/ BOOLEAN  ChargeQuota,
  5.6029 +  /*IN OUT*/ PIRP  Irp  /*OPTIONAL*/);
  5.6030 +
  5.6031 +NTOSAPI
  5.6032 +PIO_WORKITEM
  5.6033 +DDKAPI
  5.6034 +IoAllocateWorkItem(
  5.6035 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.6036 +
  5.6037 +/*
  5.6038 + * VOID IoAssignArcName(
  5.6039 + * IN PUNICODE_STRING  ArcName,
  5.6040 + * IN PUNICODE_STRING  DeviceName);
  5.6041 + */
  5.6042 +#define IoAssignArcName(_ArcName, _DeviceName) ( \
  5.6043 +  IoCreateSymbolicLink((_ArcName), (_DeviceName)))
  5.6044 +
  5.6045 +NTOSAPI
  5.6046 +NTSTATUS
  5.6047 +DDKAPI
  5.6048 +IoAttachDevice(
  5.6049 +  /*IN*/ PDEVICE_OBJECT  SourceDevice,
  5.6050 +  /*IN*/ PUNICODE_STRING  TargetDevice,
  5.6051 +  /*OUT*/ PDEVICE_OBJECT  *AttachedDevice);
  5.6052 +
  5.6053 +NTOSAPI
  5.6054 +PDEVICE_OBJECT
  5.6055 +DDKAPI
  5.6056 +IoAttachDeviceToDeviceStack(
  5.6057 +  /*IN*/ PDEVICE_OBJECT  SourceDevice,
  5.6058 +  /*IN*/ PDEVICE_OBJECT  TargetDevice);
  5.6059 +
  5.6060 +NTOSAPI
  5.6061 +PIRP
  5.6062 +DDKAPI
  5.6063 +IoBuildAsynchronousFsdRequest(
  5.6064 +  /*IN*/ ULONG  MajorFunction,
  5.6065 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6066 +  /*IN OUT*/ PVOID  Buffer  /*OPTIONAL*/,
  5.6067 +  /*IN*/ ULONG  Length  /*OPTIONAL*/,
  5.6068 +  /*IN*/ PLARGE_INTEGER  StartingOffset  /*OPTIONAL*/,
  5.6069 +  /*IN*/ PIO_STATUS_BLOCK  IoStatusBlock  /*OPTIONAL*/);
  5.6070 +
  5.6071 +NTOSAPI
  5.6072 +PIRP
  5.6073 +DDKAPI
  5.6074 +IoBuildDeviceIoControlRequest(
  5.6075 +  /*IN*/ ULONG  IoControlCode,
  5.6076 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6077 +  /*IN*/ PVOID  InputBuffer  /*OPTIONAL*/,
  5.6078 +  /*IN*/ ULONG  InputBufferLength,
  5.6079 +  /*OUT*/ PVOID  OutputBuffer  /*OPTIONAL*/,
  5.6080 +  /*IN*/ ULONG  OutputBufferLength,
  5.6081 +  /*IN*/ BOOLEAN  InternalDeviceIoControl,
  5.6082 +  /*IN*/ PKEVENT  Event,
  5.6083 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock);
  5.6084 +
  5.6085 +NTOSAPI
  5.6086 +VOID
  5.6087 +DDKAPI
  5.6088 +IoBuildPartialMdl(
  5.6089 +  /*IN*/ PMDL  SourceMdl,
  5.6090 +  /*IN OUT*/ PMDL  TargetMdl,
  5.6091 +  /*IN*/ PVOID  VirtualAddress,
  5.6092 +  /*IN*/ ULONG  Length);
  5.6093 +
  5.6094 +NTOSAPI
  5.6095 +PIRP
  5.6096 +DDKAPI
  5.6097 +IoBuildSynchronousFsdRequest(
  5.6098 +  /*IN*/ ULONG  MajorFunction,
  5.6099 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6100 +  /*IN OUT*/ PVOID  Buffer  /*OPTIONAL*/,
  5.6101 +  /*IN*/ ULONG  Length  /*OPTIONAL*/,
  5.6102 +  /*IN*/ PLARGE_INTEGER  StartingOffset  /*OPTIONAL*/,
  5.6103 +  /*IN*/ PKEVENT  Event,
  5.6104 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock);
  5.6105 +
  5.6106 +NTOSAPI
  5.6107 +NTSTATUS
  5.6108 +DDKFASTAPI
  5.6109 +IofCallDriver(
  5.6110 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6111 +  /*IN OUT*/ PIRP  Irp);
  5.6112 +
  5.6113 +/*
  5.6114 + * NTSTATUS
  5.6115 + * IoCallDriver(
  5.6116 + * IN PDEVICE_OBJECT  DeviceObject,
  5.6117 + * IN OUT PIRP  Irp)
  5.6118 + */
  5.6119 +#define IoCallDriver IofCallDriver
  5.6120 +
  5.6121 +NTOSAPI
  5.6122 +VOID
  5.6123 +DDKAPI
  5.6124 +IoCancelFileOpen(
  5.6125 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6126 +  /*IN*/ PFILE_OBJECT  FileObject);
  5.6127 +
  5.6128 +NTOSAPI
  5.6129 +BOOLEAN
  5.6130 +DDKAPI
  5.6131 +IoCancelIrp(
  5.6132 +  /*IN*/ PIRP  Irp);
  5.6133 +
  5.6134 +NTOSAPI
  5.6135 +NTSTATUS
  5.6136 +DDKAPI
  5.6137 +IoCheckShareAccess(
  5.6138 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.6139 +  /*IN*/ ULONG  DesiredShareAccess,
  5.6140 +  /*IN OUT*/ PFILE_OBJECT  FileObject,
  5.6141 +  /*IN OUT*/ PSHARE_ACCESS  ShareAccess,
  5.6142 +  /*IN*/ BOOLEAN  Update);
  5.6143 +
  5.6144 +NTOSAPI
  5.6145 +VOID
  5.6146 +DDKFASTAPI
  5.6147 +IofCompleteRequest(
  5.6148 +  /*IN*/ PIRP  Irp,
  5.6149 +  /*IN*/ CCHAR  PriorityBoost);
  5.6150 +
  5.6151 +/*
  5.6152 + * VOID
  5.6153 + * IoCompleteRequest(
  5.6154 + * IN PIRP  Irp,
  5.6155 + * IN CCHAR  PriorityBoost)
  5.6156 + */
  5.6157 +#define IoCompleteRequest IofCompleteRequest
  5.6158 +
  5.6159 +NTOSAPI
  5.6160 +NTSTATUS
  5.6161 +DDKAPI
  5.6162 +IoConnectInterrupt(
  5.6163 +  /*OUT*/ PKINTERRUPT  *InterruptObject,
  5.6164 +  /*IN*/ PKSERVICE_ROUTINE  ServiceRoutine,
  5.6165 +  /*IN*/ PVOID  ServiceContext,
  5.6166 +  /*IN*/ PKSPIN_LOCK  SpinLock  /*OPTIONAL*/,
  5.6167 +  /*IN*/ ULONG  Vector,
  5.6168 +  /*IN*/ KIRQL  Irql,
  5.6169 +  /*IN*/ KIRQL  SynchronizeIrql,
  5.6170 +  /*IN*/ KINTERRUPT_MODE    InterruptMode,
  5.6171 +  /*IN*/ BOOLEAN  ShareVector,
  5.6172 +  /*IN*/ KAFFINITY  ProcessorEnableMask,
  5.6173 +  /*IN*/ BOOLEAN  FloatingSave);
  5.6174 +
  5.6175 +/*
  5.6176 + * PIO_STACK_LOCATION
  5.6177 + * IoGetCurrentIrpStackLocation(
  5.6178 + * IN PIRP  Irp)
  5.6179 + */
  5.6180 +#define IoGetCurrentIrpStackLocation(_Irp) \
  5.6181 +  ((_Irp)->Tail.Overlay.CurrentStackLocation)
  5.6182 +
  5.6183 +/*
  5.6184 + * PIO_STACK_LOCATION
  5.6185 + * IoGetNextIrpStackLocation(
  5.6186 + * IN PIRP  Irp)
  5.6187 + */
  5.6188 +#define IoGetNextIrpStackLocation(_Irp) \
  5.6189 +  ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
  5.6190 +
  5.6191 +/*
  5.6192 + * VOID
  5.6193 + * IoCopyCurrentIrpStackLocationToNext(
  5.6194 + * IN PIRP  Irp)
  5.6195 + */
  5.6196 +#define IoCopyCurrentIrpStackLocationToNext(_Irp) \
  5.6197 +{ \
  5.6198 +  PIO_STACK_LOCATION _IrpSp; \
  5.6199 +  PIO_STACK_LOCATION _NextIrpSp; \
  5.6200 +  _IrpSp = IoGetCurrentIrpStackLocation(_Irp); \
  5.6201 +  _NextIrpSp = IoGetNextIrpStackLocation(_Irp); \
  5.6202 +  RtlCopyMemory(_NextIrpSp, _IrpSp, \
  5.6203 +    FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
  5.6204 +  _NextIrpSp->Control = 0; \
  5.6205 +}
  5.6206 +
  5.6207 +NTOSAPI
  5.6208 +PCONTROLLER_OBJECT
  5.6209 +DDKAPI
  5.6210 +IoCreateController(
  5.6211 +  /*IN*/ ULONG  Size);
  5.6212 +
  5.6213 +NTOSAPI
  5.6214 +NTSTATUS
  5.6215 +DDKAPI
  5.6216 +IoCreateDevice(
  5.6217 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6218 +  /*IN*/ ULONG  DeviceExtensionSize,
  5.6219 +  /*IN*/ PUNICODE_STRING  DeviceName  /*OPTIONAL*/,
  5.6220 +  /*IN*/ DEVICE_TYPE  DeviceType,
  5.6221 +  /*IN*/ ULONG  DeviceCharacteristics,
  5.6222 +  /*IN*/ BOOLEAN  Exclusive,
  5.6223 +  /*OUT*/ PDEVICE_OBJECT  *DeviceObject);
  5.6224 +
  5.6225 +NTOSAPI
  5.6226 +NTSTATUS
  5.6227 +DDKAPI
  5.6228 +IoCreateDisk(
  5.6229 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6230 +  /*IN*/ PCREATE_DISK  Disk);
  5.6231 +
  5.6232 +NTOSAPI
  5.6233 +NTSTATUS
  5.6234 +DDKAPI
  5.6235 +IoCreateFile(
  5.6236 +  /*OUT*/ PHANDLE FileHandle,
  5.6237 +  /*IN*/ ACCESS_MASK DesiredAccess,
  5.6238 +  /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
  5.6239 +  /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
  5.6240 +  /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
  5.6241 +  /*IN*/ ULONG FileAttributes,
  5.6242 +  /*IN*/ ULONG ShareAccess,
  5.6243 +  /*IN*/ ULONG Disposition,
  5.6244 +  /*IN*/ ULONG CreateOptions,
  5.6245 +  /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
  5.6246 +  /*IN*/ ULONG EaLength,
  5.6247 +  /*IN*/ CREATE_FILE_TYPE CreateFileType,
  5.6248 +  /*IN*/ PVOID ExtraCreateParameters /*OPTIONAL*/,
  5.6249 +  /*IN*/ ULONG Options);
  5.6250 +
  5.6251 +NTOSAPI
  5.6252 +PKEVENT
  5.6253 +DDKAPI
  5.6254 +IoCreateNotificationEvent(
  5.6255 +  /*IN*/ PUNICODE_STRING  EventName,
  5.6256 +  /*OUT*/ PHANDLE  EventHandle);
  5.6257 +
  5.6258 +NTOSAPI
  5.6259 +NTSTATUS
  5.6260 +DDKAPI
  5.6261 +IoCreateSymbolicLink(
  5.6262 +  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  5.6263 +  /*IN*/ PUNICODE_STRING  DeviceName);
  5.6264 +
  5.6265 +NTOSAPI
  5.6266 +PKEVENT
  5.6267 +DDKAPI
  5.6268 +IoCreateSynchronizationEvent(
  5.6269 +  /*IN*/ PUNICODE_STRING  EventName,
  5.6270 +  /*OUT*/ PHANDLE  EventHandle);
  5.6271 +
  5.6272 +NTOSAPI
  5.6273 +NTSTATUS
  5.6274 +DDKAPI
  5.6275 +IoCreateUnprotectedSymbolicLink(
  5.6276 +  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  5.6277 +  /*IN*/ PUNICODE_STRING  DeviceName);
  5.6278 +
  5.6279 +NTOSAPI
  5.6280 +VOID
  5.6281 +DDKAPI
  5.6282 +IoCsqInitialize(
  5.6283 +  PIO_CSQ  Csq,
  5.6284 +  /*IN*/ PIO_CSQ_INSERT_IRP  CsqInsertIrp,
  5.6285 +  /*IN*/ PIO_CSQ_REMOVE_IRP  CsqRemoveIrp,
  5.6286 +  /*IN*/ PIO_CSQ_PEEK_NEXT_IRP  CsqPeekNextIrp,
  5.6287 +  /*IN*/ PIO_CSQ_ACQUIRE_LOCK  CsqAcquireLock,
  5.6288 +  /*IN*/ PIO_CSQ_RELEASE_LOCK  CsqReleaseLock,
  5.6289 +  /*IN*/ PIO_CSQ_COMPLETE_CANCELED_IRP  CsqCompleteCanceledIrp);
  5.6290 +
  5.6291 +NTOSAPI
  5.6292 +VOID
  5.6293 +DDKAPI
  5.6294 +IoCsqInsertIrp(
  5.6295 +  /*IN*/ PIO_CSQ  Csq,
  5.6296 +  /*IN*/ PIRP  Irp,
  5.6297 +  /*IN*/ PIO_CSQ_IRP_CONTEXT  Context);
  5.6298 +
  5.6299 +NTOSAPI
  5.6300 +PIRP
  5.6301 +DDKAPI
  5.6302 +IoCsqRemoveIrp(
  5.6303 +  /*IN*/ PIO_CSQ  Csq,
  5.6304 +  /*IN*/ PIO_CSQ_IRP_CONTEXT  Context);
  5.6305 +
  5.6306 +NTOSAPI
  5.6307 +PIRP
  5.6308 +DDKAPI
  5.6309 +IoCsqRemoveNextIrp(
  5.6310 +  /*IN*/ PIO_CSQ  Csq,
  5.6311 +  /*IN*/ PVOID  PeekContext);
  5.6312 +
  5.6313 +NTOSAPI
  5.6314 +VOID
  5.6315 +DDKAPI
  5.6316 +IoDeleteController(
  5.6317 +  /*IN*/ PCONTROLLER_OBJECT  ControllerObject);
  5.6318 +
  5.6319 +NTOSAPI
  5.6320 +VOID
  5.6321 +DDKAPI
  5.6322 +IoDeleteDevice(
  5.6323 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.6324 +
  5.6325 +NTOSAPI
  5.6326 +NTSTATUS
  5.6327 +DDKAPI
  5.6328 +IoDeleteSymbolicLink(
  5.6329 +  /*IN*/ PUNICODE_STRING  SymbolicLinkName);
  5.6330 +
  5.6331 +/*
  5.6332 + * VOID
  5.6333 + * IoDeassignArcName(
  5.6334 + * IN PUNICODE_STRING  ArcName)
  5.6335 + */
  5.6336 +#define IoDeassignArcName IoDeleteSymbolicLink
  5.6337 +
  5.6338 +NTOSAPI
  5.6339 +VOID
  5.6340 +DDKAPI
  5.6341 +IoDetachDevice(
  5.6342 +  /*IN OUT*/ PDEVICE_OBJECT  TargetDevice);
  5.6343 +
  5.6344 +NTOSAPI
  5.6345 +VOID
  5.6346 +DDKAPI
  5.6347 +IoDisconnectInterrupt(
  5.6348 +  /*IN*/ PKINTERRUPT  InterruptObject);
  5.6349 +
  5.6350 +NTOSAPI
  5.6351 +BOOLEAN
  5.6352 +DDKAPI
  5.6353 +IoForwardIrpSynchronously(
  5.6354 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6355 +  /*IN*/ PIRP  Irp);
  5.6356 +
  5.6357 +#define IoForwardAndCatchIrp IoForwardIrpSynchronously
  5.6358 +
  5.6359 +NTOSAPI
  5.6360 +VOID
  5.6361 +DDKAPI
  5.6362 +IoFreeController(
  5.6363 +  /*IN*/ PCONTROLLER_OBJECT  ControllerObject);
  5.6364 +
  5.6365 +NTOSAPI
  5.6366 +VOID
  5.6367 +DDKAPI
  5.6368 +IoFreeErrorLogEntry(
  5.6369 +  PVOID  ElEntry);
  5.6370 +
  5.6371 +NTOSAPI
  5.6372 +VOID
  5.6373 +DDKAPI
  5.6374 +IoFreeIrp(
  5.6375 +  /*IN*/ PIRP  Irp);
  5.6376 +
  5.6377 +NTOSAPI
  5.6378 +VOID
  5.6379 +DDKAPI
  5.6380 +IoFreeMdl(
  5.6381 +  /*IN*/ PMDL  Mdl);
  5.6382 +
  5.6383 +NTOSAPI
  5.6384 +VOID
  5.6385 +DDKAPI
  5.6386 +IoFreeWorkItem(
  5.6387 +  /*IN*/ PIO_WORKITEM  pIOWorkItem);
  5.6388 +
  5.6389 +NTOSAPI
  5.6390 +PDEVICE_OBJECT
  5.6391 +DDKAPI
  5.6392 +IoGetAttachedDevice(
  5.6393 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.6394 +
  5.6395 +NTOSAPI
  5.6396 +PDEVICE_OBJECT
  5.6397 +DDKAPI
  5.6398 +IoGetAttachedDeviceReference(
  5.6399 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.6400 +
  5.6401 +NTOSAPI
  5.6402 +NTSTATUS
  5.6403 +DDKAPI
  5.6404 +IoGetBootDiskInformation(
  5.6405 +  /*IN OUT*/ PBOOTDISK_INFORMATION  BootDiskInformation,
  5.6406 +  /*IN*/ ULONG  Size);
  5.6407 +
  5.6408 +NTOSAPI
  5.6409 +PCONFIGURATION_INFORMATION
  5.6410 +DDKAPI
  5.6411 +IoGetConfigurationInformation( 
  5.6412 +  VOID);
  5.6413 +
  5.6414 +NTOSAPI
  5.6415 +PEPROCESS
  5.6416 +DDKAPI
  5.6417 +IoGetCurrentProcess(
  5.6418 +  VOID);
  5.6419 +
  5.6420 +NTOSAPI
  5.6421 +NTSTATUS
  5.6422 +DDKAPI
  5.6423 +IoGetDeviceInterfaceAlias(
  5.6424 +  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  5.6425 +  /*IN*/ CONST GUID  *AliasInterfaceClassGuid,
  5.6426 +  /*OUT*/ PUNICODE_STRING  AliasSymbolicLinkName);
  5.6427 +
  5.6428 +NTOSAPI
  5.6429 +NTSTATUS
  5.6430 +DDKAPI
  5.6431 +IoGetDeviceInterfaces(
  5.6432 +  /*IN*/ CONST GUID  *InterfaceClassGuid,
  5.6433 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject  /*OPTIONAL*/,
  5.6434 +  /*IN*/ ULONG  Flags,
  5.6435 +  /*OUT*/ PWSTR  *SymbolicLinkList);
  5.6436 +
  5.6437 +NTOSAPI
  5.6438 +NTSTATUS
  5.6439 +DDKAPI
  5.6440 +IoGetDeviceObjectPointer(
  5.6441 +  /*IN*/ PUNICODE_STRING  ObjectName,
  5.6442 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.6443 +  /*OUT*/ PFILE_OBJECT  *FileObject,
  5.6444 +  /*OUT*/ PDEVICE_OBJECT  *DeviceObject);
  5.6445 +
  5.6446 +NTOSAPI
  5.6447 +NTSTATUS
  5.6448 +DDKAPI
  5.6449 +IoGetDeviceProperty(
  5.6450 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6451 +  /*IN*/ DEVICE_REGISTRY_PROPERTY  DeviceProperty,
  5.6452 +  /*IN*/ ULONG  BufferLength,
  5.6453 +  /*OUT*/ PVOID  PropertyBuffer,
  5.6454 +  /*OUT*/ PULONG  ResultLength);
  5.6455 +
  5.6456 +NTOSAPI
  5.6457 +PDEVICE_OBJECT
  5.6458 +DDKAPI
  5.6459 +IoGetDeviceToVerify(
  5.6460 +  /*IN*/ PETHREAD  Thread);
  5.6461 +
  5.6462 +NTOSAPI
  5.6463 +PDMA_ADAPTER
  5.6464 +DDKAPI
  5.6465 +IoGetDmaAdapter(
  5.6466 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  5.6467 +  /*IN*/ PDEVICE_DESCRIPTION  DeviceDescription,
  5.6468 +  /*IN OUT*/ PULONG  NumberOfMapRegisters);
  5.6469 +
  5.6470 +NTOSAPI
  5.6471 +PVOID
  5.6472 +DDKAPI
  5.6473 +IoGetDriverObjectExtension(
  5.6474 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6475 +  /*IN*/ PVOID  ClientIdentificationAddress);
  5.6476 +
  5.6477 +NTOSAPI
  5.6478 +PGENERIC_MAPPING
  5.6479 +DDKAPI
  5.6480 +IoGetFileObjectGenericMapping(
  5.6481 +  VOID);
  5.6482 +
  5.6483 +/*
  5.6484 + * ULONG
  5.6485 + * IoGetFunctionCodeFromCtlCode(
  5.6486 + * IN ULONG  ControlCode)
  5.6487 + */
  5.6488 +#define IoGetFunctionCodeFromCtlCode(_ControlCode) \
  5.6489 +  (((_ControlCode) >> 2) & 0x00000FFF)
  5.6490 +
  5.6491 +NTOSAPI
  5.6492 +PVOID
  5.6493 +DDKAPI
  5.6494 +IoGetInitialStack(
  5.6495 +  VOID);
  5.6496 +
  5.6497 +NTOSAPI
  5.6498 +PDEVICE_OBJECT
  5.6499 +DDKAPI
  5.6500 +IoGetRelatedDeviceObject(
  5.6501 +  /*IN*/ PFILE_OBJECT  FileObject);
  5.6502 +
  5.6503 +NTOSAPI
  5.6504 +ULONG
  5.6505 +DDKAPI
  5.6506 +IoGetRemainingStackSize(
  5.6507 +  VOID);
  5.6508 +
  5.6509 +NTOSAPI
  5.6510 +VOID
  5.6511 +DDKAPI
  5.6512 +IoGetStackLimits(
  5.6513 +  /*OUT*/ PULONG_PTR  LowLimit,
  5.6514 +  /*OUT*/ PULONG_PTR  HighLimit);
  5.6515 +
  5.6516 +NTOSAPI
  5.6517 +VOID
  5.6518 +DDKAPI
  5.6519 +KeInitializeDpc(
  5.6520 +  /*IN*/ PRKDPC  Dpc,
  5.6521 +  /*IN*/ PKDEFERRED_ROUTINE  DeferredRoutine,
  5.6522 +  /*IN*/ PVOID  DeferredContext);
  5.6523 +
  5.6524 +/*
  5.6525 + * VOID
  5.6526 + * IoInitializeDpcRequest(
  5.6527 + * IN PDEVICE_OBJECT DeviceObject,
  5.6528 + * IN PIO_DPC_ROUTINE DpcRoutine)
  5.6529 + */
  5.6530 +#define IoInitializeDpcRequest(_DeviceObject, \
  5.6531 +                               _DpcRoutine) \
  5.6532 +  KeInitializeDpc(&(_DeviceObject)->Dpc, \
  5.6533 +    (PKDEFERRED_ROUTINE) (_DpcRoutine), \
  5.6534 +    _DeviceObject)
  5.6535 +
  5.6536 +NTOSAPI
  5.6537 +VOID
  5.6538 +DDKAPI
  5.6539 +IoInitializeIrp(
  5.6540 +  /*IN OUT*/ PIRP  Irp,
  5.6541 +  /*IN*/ USHORT  PacketSize,
  5.6542 +  /*IN*/ CCHAR  StackSize);
  5.6543 +
  5.6544 +NTOSAPI
  5.6545 +VOID
  5.6546 +DDKAPI
  5.6547 +IoInitializeRemoveLockEx(
  5.6548 +  /*IN*/ PIO_REMOVE_LOCK Lock,
  5.6549 +  /*IN*/ ULONG   AllocateTag,
  5.6550 +  /*IN*/ ULONG   MaxLockedMinutes,
  5.6551 +  /*IN*/ ULONG   HighWatermark,
  5.6552 +  /*IN*/ ULONG   RemlockSize);
  5.6553 +
  5.6554 +/* VOID
  5.6555 + * IoInitializeRemoveLock(
  5.6556 + * IN PIO_REMOVE_LOCK  Lock,
  5.6557 + * IN ULONG  AllocateTag,
  5.6558 + * IN ULONG  MaxLockedMinutes,
  5.6559 + * IN ULONG  HighWatermark)
  5.6560 + */
  5.6561 +#define IoInitializeRemoveLock( \
  5.6562 +  Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
  5.6563 +  IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
  5.6564 +    HighWatermark, sizeof(IO_REMOVE_LOCK))
  5.6565 +
  5.6566 +NTOSAPI
  5.6567 +NTSTATUS
  5.6568 +DDKAPI
  5.6569 +IoInitializeTimer(
  5.6570 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6571 +  /*IN*/ PIO_TIMER_ROUTINE  TimerRoutine,
  5.6572 +  /*IN*/ PVOID  Context);
  5.6573 +
  5.6574 +NTOSAPI
  5.6575 +VOID
  5.6576 +DDKAPI
  5.6577 +IoInvalidateDeviceRelations(
  5.6578 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6579 +  /*IN*/ DEVICE_RELATION_TYPE  Type);
  5.6580 +
  5.6581 +NTOSAPI
  5.6582 +VOID
  5.6583 +DDKAPI
  5.6584 +IoInvalidateDeviceState(
  5.6585 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject);
  5.6586 +
  5.6587 +NTOSAPI
  5.6588 +BOOLEAN
  5.6589 +DDKAPI
  5.6590 +IoIs32bitProcess(
  5.6591 +  /*IN*/ PIRP  Irp  /*OPTIONAL*/);
  5.6592 +
  5.6593 +/*
  5.6594 + * BOOLEAN
  5.6595 + * IoIsErrorUserInduced(
  5.6596 + * IN NTSTATUS  Status);
  5.6597 + */
  5.6598 +#define IoIsErrorUserInduced(Status) \
  5.6599 +	((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
  5.6600 +   ((Status) == STATUS_IO_TIMEOUT) || \
  5.6601 +   ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
  5.6602 +   ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
  5.6603 +   ((Status) == STATUS_VERIFY_REQUIRED) || \
  5.6604 +   ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
  5.6605 +   ((Status) == STATUS_WRONG_VOLUME)))
  5.6606 +
  5.6607 +NTOSAPI
  5.6608 +BOOLEAN
  5.6609 +DDKAPI
  5.6610 +IoIsWdmVersionAvailable(
  5.6611 +  /*IN*/ UCHAR  MajorVersion,
  5.6612 +  /*IN*/ UCHAR  MinorVersion);
  5.6613 +
  5.6614 +NTOSAPI
  5.6615 +PIRP
  5.6616 +DDKAPI
  5.6617 +IoMakeAssociatedIrp(
  5.6618 +  /*IN*/ PIRP  Irp,
  5.6619 +  /*IN*/ CCHAR  StackSize);
  5.6620 +
  5.6621 +/*
  5.6622 + * VOID
  5.6623 + * IoMarkIrpPending(
  5.6624 + * IN OUT PIRP  Irp)
  5.6625 + */
  5.6626 +#define IoMarkIrpPending(_Irp) \
  5.6627 +  (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
  5.6628 +
  5.6629 +NTOSAPI
  5.6630 +NTSTATUS
  5.6631 +DDKAPI
  5.6632 +IoOpenDeviceInterfaceRegistryKey(
  5.6633 +  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  5.6634 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.6635 +  /*OUT*/ PHANDLE  DeviceInterfaceKey);
  5.6636 +
  5.6637 +NTOSAPI
  5.6638 +NTSTATUS
  5.6639 +DDKAPI
  5.6640 +IoOpenDeviceRegistryKey(
  5.6641 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6642 +  /*IN*/ ULONG  DevInstKeyType,
  5.6643 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.6644 +  /*OUT*/ PHANDLE  DevInstRegKey);
  5.6645 +
  5.6646 +NTOSAPI
  5.6647 +NTSTATUS
  5.6648 +DDKAPI
  5.6649 +IoQueryDeviceDescription(
  5.6650 +  /*IN*/ PINTERFACE_TYPE  BusType  /*OPTIONAL*/,
  5.6651 +  /*IN*/ PULONG  BusNumber  /*OPTIONAL*/,
  5.6652 +  /*IN*/ PCONFIGURATION_TYPE  ControllerType  /*OPTIONAL*/,
  5.6653 +  /*IN*/ PULONG  ControllerNumber  /*OPTIONAL*/,
  5.6654 +  /*IN*/ PCONFIGURATION_TYPE  PeripheralType  /*OPTIONAL*/,
  5.6655 +  /*IN*/ PULONG  PeripheralNumber  /*OPTIONAL*/,
  5.6656 +  /*IN*/ PIO_QUERY_DEVICE_ROUTINE  CalloutRoutine,
  5.6657 +  /*IN*/ PVOID  Context);
  5.6658 +
  5.6659 +NTOSAPI
  5.6660 +VOID
  5.6661 +DDKAPI
  5.6662 +IoQueueWorkItem(
  5.6663 +  /*IN*/ PIO_WORKITEM  pIOWorkItem,
  5.6664 +  /*IN*/ PIO_WORKITEM_ROUTINE  Routine,
  5.6665 +  /*IN*/ WORK_QUEUE_TYPE  QueueType,
  5.6666 +  /*IN*/ PVOID  Context);
  5.6667 +
  5.6668 +NTOSAPI
  5.6669 +VOID
  5.6670 +DDKAPI
  5.6671 +IoRaiseHardError(
  5.6672 +  /*IN*/ PIRP  Irp,
  5.6673 +  /*IN*/ PVPB  Vpb  /*OPTIONAL*/,
  5.6674 +  /*IN*/ PDEVICE_OBJECT  RealDeviceObject);
  5.6675 +
  5.6676 +NTOSAPI
  5.6677 +BOOLEAN
  5.6678 +DDKAPI
  5.6679 +IoRaiseInformationalHardError(
  5.6680 +  /*IN*/ NTSTATUS  ErrorStatus,
  5.6681 +  /*IN*/ PUNICODE_STRING  String  /*OPTIONAL*/,
  5.6682 +  /*IN*/ PKTHREAD  Thread  /*OPTIONAL*/);
  5.6683 +
  5.6684 +NTOSAPI
  5.6685 +NTSTATUS
  5.6686 +DDKAPI
  5.6687 +IoReadDiskSignature(
  5.6688 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6689 +  /*IN*/ ULONG  BytesPerSector,
  5.6690 +  /*OUT*/ PDISK_SIGNATURE  Signature);
  5.6691 +
  5.6692 +NTOSAPI
  5.6693 +NTSTATUS
  5.6694 +DDKAPI
  5.6695 +IoReadPartitionTableEx(
  5.6696 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6697 +  /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX  **PartitionBuffer);
  5.6698 +
  5.6699 +NTOSAPI
  5.6700 +VOID
  5.6701 +DDKAPI
  5.6702 +IoRegisterBootDriverReinitialization(
  5.6703 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6704 +  /*IN*/ PDRIVER_REINITIALIZE  DriverReinitializationRoutine,
  5.6705 +  /*IN*/ PVOID  Context);
  5.6706 +
  5.6707 +NTOSAPI
  5.6708 +VOID
  5.6709 +DDKAPI
  5.6710 +IoRegisterBootDriverReinitialization(
  5.6711 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6712 +  /*IN*/ PDRIVER_REINITIALIZE  DriverReinitializationRoutine,
  5.6713 +  /*IN*/ PVOID  Context);
  5.6714 +
  5.6715 +NTOSAPI
  5.6716 +NTSTATUS
  5.6717 +DDKAPI
  5.6718 +IoRegisterDeviceInterface(
  5.6719 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  5.6720 +  /*IN*/ CONST GUID  *InterfaceClassGuid,
  5.6721 +  /*IN*/ PUNICODE_STRING  ReferenceString  /*OPTIONAL*/,
  5.6722 +  /*OUT*/ PUNICODE_STRING  SymbolicLinkName);
  5.6723 +
  5.6724 +NTOSAPI
  5.6725 +VOID
  5.6726 +DDKAPI
  5.6727 +IoRegisterDriverReinitialization(
  5.6728 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6729 +  /*IN*/ PDRIVER_REINITIALIZE  DriverReinitializationRoutine,
  5.6730 +  /*IN*/ PVOID  Context);
  5.6731 +
  5.6732 +NTOSAPI
  5.6733 +NTSTATUS
  5.6734 +DDKAPI
  5.6735 +IoRegisterPlugPlayNotification(
  5.6736 +  /*IN*/ IO_NOTIFICATION_EVENT_CATEGORY  EventCategory,
  5.6737 +  /*IN*/ ULONG  EventCategoryFlags,
  5.6738 +  /*IN*/ PVOID  EventCategoryData  /*OPTIONAL*/,
  5.6739 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6740 +  /*IN*/ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE  CallbackRoutine,
  5.6741 +  /*IN*/ PVOID  Context,
  5.6742 +  /*OUT*/ PVOID  *NotificationEntry);
  5.6743 +
  5.6744 +NTOSAPI
  5.6745 +NTSTATUS
  5.6746 +DDKAPI
  5.6747 +IoRegisterShutdownNotification(
  5.6748 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.6749 +
  5.6750 +NTOSAPI
  5.6751 +VOID
  5.6752 +DDKAPI
  5.6753 +IoReleaseCancelSpinLock(
  5.6754 +  /*IN*/ KIRQL  Irql);
  5.6755 +
  5.6756 +NTOSAPI
  5.6757 +VOID
  5.6758 +DDKAPI
  5.6759 +IoReleaseRemoveLockAndWaitEx(
  5.6760 +  /*IN*/ PIO_REMOVE_LOCK  RemoveLock,
  5.6761 +  /*IN*/ PVOID  Tag,
  5.6762 +  /*IN*/ ULONG  RemlockSize);
  5.6763 +
  5.6764 +/*
  5.6765 + * VOID
  5.6766 + * IoReleaseRemoveLockAndWait(
  5.6767 + * IN PIO_REMOVE_LOCK  RemoveLock,
  5.6768 + * IN PVOID  Tag)
  5.6769 + */
  5.6770 +#define IoReleaseRemoveLockAndWait(_RemoveLock, \
  5.6771 +                                   _Tag) \
  5.6772 +  IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
  5.6773 +
  5.6774 +NTOSAPI
  5.6775 +VOID
  5.6776 +DDKAPI
  5.6777 +IoReleaseRemoveLockEx(
  5.6778 +  /*IN*/ PIO_REMOVE_LOCK  RemoveLock,
  5.6779 +  /*IN*/ PVOID  Tag,
  5.6780 +  /*IN*/ ULONG  RemlockSize);
  5.6781 +
  5.6782 +/*
  5.6783 + * VOID
  5.6784 + * IoReleaseRemoveLock(
  5.6785 + * IN PIO_REMOVE_LOCK  RemoveLock,
  5.6786 + * IN PVOID  Tag)
  5.6787 + */
  5.6788 +#define IoReleaseRemoveLock(_RemoveLock, \
  5.6789 +                                   _Tag) \
  5.6790 +  IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
  5.6791 +
  5.6792 +NTOSAPI
  5.6793 +VOID
  5.6794 +DDKAPI
  5.6795 +IoRemoveShareAccess(
  5.6796 +  /*IN*/ PFILE_OBJECT  FileObject,
  5.6797 +  /*IN OUT*/ PSHARE_ACCESS  ShareAccess);
  5.6798 +
  5.6799 +NTOSAPI
  5.6800 +NTSTATUS
  5.6801 +DDKAPI
  5.6802 +IoReportDetectedDevice(
  5.6803 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6804 +  /*IN*/ INTERFACE_TYPE  LegacyBusType,
  5.6805 +  /*IN*/ ULONG  BusNumber,
  5.6806 +  /*IN*/ ULONG  SlotNumber,
  5.6807 +  /*IN*/ PCM_RESOURCE_LIST  ResourceList,
  5.6808 +  /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST  ResourceRequirements  /*OPTIONAL*/,
  5.6809 +  /*IN*/ BOOLEAN  ResourceAssigned,
  5.6810 +  /*IN OUT*/ PDEVICE_OBJECT  *DeviceObject);
  5.6811 +
  5.6812 +NTOSAPI
  5.6813 +NTSTATUS
  5.6814 +DDKAPI
  5.6815 +IoReportResourceForDetection(
  5.6816 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6817 +  /*IN*/ PCM_RESOURCE_LIST  DriverList  /*OPTIONAL*/,
  5.6818 +  /*IN*/ ULONG  DriverListSize  /*OPTIONAL*/,
  5.6819 +  /*IN*/ PDEVICE_OBJECT  DeviceObject  /*OPTIONAL*/,
  5.6820 +  /*IN*/ PCM_RESOURCE_LIST  DeviceList  /*OPTIONAL*/,
  5.6821 +  /*IN*/ ULONG  DeviceListSize  /*OPTIONAL*/,
  5.6822 +  /*OUT*/ PBOOLEAN  ConflictDetected);
  5.6823 +
  5.6824 +NTOSAPI
  5.6825 +NTSTATUS
  5.6826 +DDKAPI
  5.6827 +IoReportResourceUsage(
  5.6828 +  /*IN*/ PUNICODE_STRING  DriverClassName  /*OPTIONAL*/,
  5.6829 +  /*IN*/ PDRIVER_OBJECT  DriverObject,
  5.6830 +  /*IN*/ PCM_RESOURCE_LIST  DriverList  /*OPTIONAL*/,
  5.6831 +  /*IN*/ ULONG  DriverListSize  /*OPTIONAL*/,
  5.6832 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6833 +  /*IN*/ PCM_RESOURCE_LIST  DeviceList  /*OPTIONAL*/,
  5.6834 +  /*IN*/ ULONG  DeviceListSize  /*OPTIONAL*/,
  5.6835 +  /*IN*/ BOOLEAN  OverrideConflict,
  5.6836 +  /*OUT*/ PBOOLEAN  ConflictDetected);
  5.6837 +
  5.6838 +NTOSAPI
  5.6839 +NTSTATUS
  5.6840 +DDKAPI
  5.6841 +IoReportTargetDeviceChange(
  5.6842 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  5.6843 +  /*IN*/ PVOID  NotificationStructure);
  5.6844 +
  5.6845 +NTOSAPI
  5.6846 +NTSTATUS
  5.6847 +DDKAPI
  5.6848 +IoReportTargetDeviceChangeAsynchronous(
  5.6849 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  5.6850 +  /*IN*/ PVOID  NotificationStructure,
  5.6851 +  /*IN*/ PDEVICE_CHANGE_COMPLETE_CALLBACK  Callback  /*OPTIONAL*/,
  5.6852 +  /*IN*/ PVOID  Context  /*OPTIONAL*/);
  5.6853 +
  5.6854 +NTOSAPI
  5.6855 +VOID
  5.6856 +DDKAPI
  5.6857 +IoRequestDeviceEject(
  5.6858 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject);
  5.6859 +
  5.6860 +/*
  5.6861 + * VOID
  5.6862 + * IoRequestDpc(
  5.6863 + * IN PDEVICE_OBJECT  DeviceObject,
  5.6864 + * IN PIRP  Irp,
  5.6865 + * IN PVOID  Context);
  5.6866 + */
  5.6867 +#define IoRequestDpc(DeviceObject, Irp, Context)( \
  5.6868 +  KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
  5.6869 +
  5.6870 +NTOSAPI
  5.6871 +VOID
  5.6872 +DDKAPI
  5.6873 +IoReuseIrp(
  5.6874 +  /*IN OUT*/ PIRP  Irp,
  5.6875 +  /*IN*/ NTSTATUS  Status);
  5.6876 +
  5.6877 +/*
  5.6878 + * PDRIVER_CANCEL
  5.6879 + * IoSetCancelRoutine(
  5.6880 + * IN PIRP  Irp,
  5.6881 + * IN PDRIVER_CANCEL  CancelRoutine)
  5.6882 + */
  5.6883 +#define IoSetCancelRoutine(_Irp, \
  5.6884 +                           _CancelRoutine) \
  5.6885 +  ((PDRIVER_CANCEL) InterlockedExchangePointer( \
  5.6886 +    (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)))
  5.6887 +
  5.6888 +/*
  5.6889 + * VOID
  5.6890 + * IoSetCompletionRoutine(
  5.6891 + * IN PIRP  Irp,
  5.6892 + * IN PIO_COMPLETION_ROUTINE  CompletionRoutine,
  5.6893 + * IN PVOID  Context,
  5.6894 + * IN BOOLEAN  InvokeOnSuccess,
  5.6895 + * IN BOOLEAN  InvokeOnError,
  5.6896 + * IN BOOLEAN  InvokeOnCancel)
  5.6897 + */
  5.6898 +#define IoSetCompletionRoutine(_Irp, \
  5.6899 +                               _CompletionRoutine, \
  5.6900 +                               _Context, \
  5.6901 +                               _InvokeOnSuccess, \
  5.6902 +                               _InvokeOnError, \
  5.6903 +                               _InvokeOnCancel) \
  5.6904 +{ \
  5.6905 +  PIO_STACK_LOCATION _IrpSp; \
  5.6906 +  ASSERT(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
  5.6907 +    _CompletionRoutine != NULL : TRUE); \
  5.6908 +  _IrpSp = IoGetNextIrpStackLocation(_Irp); \
  5.6909 +  _IrpSp->CompletionRoutine = (PIO_COMPLETION_ROUTINE)(_CompletionRoutine); \
  5.6910 +	_IrpSp->Context = (_Context); \
  5.6911 +  _IrpSp->Control = 0; \
  5.6912 +  if (_InvokeOnSuccess) _IrpSp->Control = SL_INVOKE_ON_SUCCESS; \
  5.6913 +  if (_InvokeOnError) _IrpSp->Control |= SL_INVOKE_ON_ERROR; \
  5.6914 +  if (_InvokeOnCancel) _IrpSp->Control |= SL_INVOKE_ON_CANCEL; \
  5.6915 +}
  5.6916 +
  5.6917 +NTOSAPI
  5.6918 +VOID
  5.6919 +DDKAPI
  5.6920 +IoSetCompletionRoutineEx(
  5.6921 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6922 +  /*IN*/ PIRP  Irp,
  5.6923 +  /*IN*/ PIO_COMPLETION_ROUTINE  CompletionRoutine,
  5.6924 +  /*IN*/ PVOID  Context,
  5.6925 +  /*IN*/ BOOLEAN    InvokeOnSuccess,
  5.6926 +  /*IN*/ BOOLEAN  InvokeOnError,
  5.6927 +  /*IN*/ BOOLEAN  InvokeOnCancel);
  5.6928 +
  5.6929 +NTOSAPI
  5.6930 +NTSTATUS
  5.6931 +DDKAPI
  5.6932 +IoSetDeviceInterfaceState(
  5.6933 +  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  5.6934 +  /*IN*/ BOOLEAN  Enable);
  5.6935 +
  5.6936 +NTOSAPI
  5.6937 +VOID
  5.6938 +DDKAPI
  5.6939 +IoSetHardErrorOrVerifyDevice(
  5.6940 +  /*IN*/ PIRP  Irp,
  5.6941 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.6942 +
  5.6943 +/*
  5.6944 + * VOID
  5.6945 + * IoSetNextIrpStackLocation(
  5.6946 + * IN OUT PIRP  Irp)
  5.6947 + */
  5.6948 +#define IoSetNextIrpStackLocation(_Irp) \
  5.6949 +{ \
  5.6950 +  (_Irp)->CurrentLocation--; \
  5.6951 +  (_Irp)->Tail.Overlay.CurrentStackLocation--; \
  5.6952 +}
  5.6953 +
  5.6954 +NTOSAPI
  5.6955 +NTSTATUS
  5.6956 +DDKAPI
  5.6957 +IoSetPartitionInformationEx(
  5.6958 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.6959 +  /*IN*/ ULONG  PartitionNumber,
  5.6960 +  /*IN*/ struct _SET_PARTITION_INFORMATION_EX  *PartitionInfo);
  5.6961 +
  5.6962 +NTOSAPI
  5.6963 +VOID
  5.6964 +DDKAPI
  5.6965 +IoSetShareAccess(
  5.6966 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.6967 +  /*IN*/ ULONG  DesiredShareAccess,
  5.6968 +  /*IN OUT*/ PFILE_OBJECT  FileObject,
  5.6969 +  /*OUT*/ PSHARE_ACCESS  ShareAccess);
  5.6970 +
  5.6971 +NTOSAPI
  5.6972 +VOID
  5.6973 +DDKAPI
  5.6974 +IoSetStartIoAttributes(
  5.6975 +  /*IN*/ PDEVICE_OBJECT  DeviceObject, 
  5.6976 +  /*IN*/ BOOLEAN  DeferredStartIo, 
  5.6977 +  /*IN*/ BOOLEAN  NonCancelable); 
  5.6978 +
  5.6979 +NTOSAPI
  5.6980 +NTSTATUS
  5.6981 +DDKAPI
  5.6982 +IoSetSystemPartition(
  5.6983 +  /*IN*/ PUNICODE_STRING  VolumeNameString);
  5.6984 +
  5.6985 +NTOSAPI
  5.6986 +BOOLEAN
  5.6987 +DDKAPI
  5.6988 +IoSetThreadHardErrorMode(
  5.6989 +  /*IN*/ BOOLEAN  EnableHardErrors);
  5.6990 +
  5.6991 +/*
  5.6992 + * USHORT
  5.6993 + * IoSizeOfIrp(
  5.6994 + * IN CCHAR  StackSize)
  5.6995 + */
  5.6996 +#define IoSizeOfIrp(_StackSize) \
  5.6997 +  ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
  5.6998 +
  5.6999 +/*
  5.7000 + * VOID
  5.7001 + * IoSkipCurrentIrpStackLocation(
  5.7002 + * IN PIRP  Irp)
  5.7003 + */
  5.7004 +#define IoSkipCurrentIrpStackLocation(_Irp) \
  5.7005 +{ \
  5.7006 +  (_Irp)->CurrentLocation++; \
  5.7007 +  (_Irp)->Tail.Overlay.CurrentStackLocation++; \
  5.7008 +}
  5.7009 +
  5.7010 +NTOSAPI
  5.7011 +VOID
  5.7012 +DDKAPI
  5.7013 +IoStartNextPacket(
  5.7014 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.7015 +  /*IN*/ BOOLEAN  Cancelable);
  5.7016 +
  5.7017 +NTOSAPI
  5.7018 +VOID
  5.7019 +DDKAPI
  5.7020 +IoStartNextPacketByKey(
  5.7021 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.7022 +  /*IN*/ BOOLEAN  Cancelable,
  5.7023 +  /*IN*/ ULONG  Key);
  5.7024 +
  5.7025 +NTOSAPI
  5.7026 +VOID
  5.7027 +DDKAPI
  5.7028 +IoStartPacket(
  5.7029 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.7030 +  /*IN*/ PIRP  Irp,
  5.7031 +  /*IN*/ PULONG  Key  /*OPTIONAL*/,
  5.7032 +  /*IN*/ PDRIVER_CANCEL  CancelFunction  /*OPTIONAL*/);
  5.7033 +
  5.7034 +NTOSAPI
  5.7035 +VOID
  5.7036 +DDKAPI
  5.7037 +IoStartTimer(
  5.7038 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.7039 +
  5.7040 +NTOSAPI
  5.7041 +VOID
  5.7042 +DDKAPI
  5.7043 +IoStopTimer(
  5.7044 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.7045 +
  5.7046 +NTOSAPI
  5.7047 +NTSTATUS
  5.7048 +DDKAPI
  5.7049 +IoUnregisterPlugPlayNotification(
  5.7050 +  /*IN*/ PVOID  NotificationEntry);
  5.7051 +
  5.7052 +NTOSAPI
  5.7053 +VOID
  5.7054 +DDKAPI
  5.7055 +IoUnregisterShutdownNotification(
  5.7056 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.7057 +
  5.7058 +NTOSAPI
  5.7059 +VOID
  5.7060 +DDKAPI
  5.7061 +IoUpdateShareAccess(
  5.7062 +  /*IN*/ PFILE_OBJECT  FileObject,
  5.7063 +  /*IN OUT*/ PSHARE_ACCESS  ShareAccess);
  5.7064 +
  5.7065 +NTOSAPI
  5.7066 +NTSTATUS
  5.7067 +DDKAPI
  5.7068 +IoVerifyPartitionTable(
  5.7069 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.7070 +  /*IN*/ BOOLEAN  FixErrors);
  5.7071 +
  5.7072 +NTOSAPI
  5.7073 +NTSTATUS
  5.7074 +DDKAPI
  5.7075 +IoVolumeDeviceToDosName(
  5.7076 +  /*IN*/ PVOID  VolumeDeviceObject,
  5.7077 +  /*OUT*/ PUNICODE_STRING  DosName);
  5.7078 +
  5.7079 +NTOSAPI
  5.7080 +NTSTATUS
  5.7081 +DDKAPI
  5.7082 +IoWMIAllocateInstanceIds(
  5.7083 +  /*IN*/ GUID  *Guid,
  5.7084 +  /*IN*/ ULONG  InstanceCount,
  5.7085 +  /*OUT*/ ULONG  *FirstInstanceId);
  5.7086 +
  5.7087 +NTOSAPI
  5.7088 +ULONG
  5.7089 +DDKAPI
  5.7090 +IoWMIDeviceObjectToProviderId(
  5.7091 +  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  5.7092 +
  5.7093 +NTOSAPI
  5.7094 +NTSTATUS
  5.7095 +DDKAPI
  5.7096 +IoWMIDeviceObjectToInstanceName(
  5.7097 +  /*IN*/ PVOID  DataBlockObject,
  5.7098 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.7099 +  /*OUT*/ PUNICODE_STRING  InstanceName);
  5.7100 +
  5.7101 +NTOSAPI
  5.7102 +NTSTATUS
  5.7103 +DDKAPI
  5.7104 +IoWMIExecuteMethod(
  5.7105 +  /*IN*/ PVOID  DataBlockObject,
  5.7106 +  /*IN*/ PUNICODE_STRING  InstanceName,
  5.7107 +  /*IN*/ ULONG  MethodId,
  5.7108 +  /*IN*/ ULONG  InBufferSize,
  5.7109 +  /*IN OUT*/ PULONG  OutBufferSize,
  5.7110 +  /*IN OUT*/  PUCHAR  InOutBuffer);
  5.7111 +
  5.7112 +NTOSAPI
  5.7113 +NTSTATUS
  5.7114 +DDKAPI
  5.7115 +IoWMIHandleToInstanceName(
  5.7116 +  /*IN*/ PVOID  DataBlockObject,
  5.7117 +  /*IN*/ HANDLE  FileHandle,
  5.7118 +  /*OUT*/ PUNICODE_STRING  InstanceName);
  5.7119 +
  5.7120 +NTOSAPI
  5.7121 +NTSTATUS
  5.7122 +DDKAPI
  5.7123 +IoWMIOpenBlock(
  5.7124 +  /*IN*/ GUID  *DataBlockGuid,
  5.7125 +  /*IN*/ ULONG  DesiredAccess,
  5.7126 +  /*OUT*/ PVOID  *DataBlockObject);
  5.7127 +
  5.7128 +NTOSAPI
  5.7129 +NTSTATUS
  5.7130 +DDKAPI
  5.7131 +IoWMIQueryAllData(
  5.7132 +  /*IN*/ PVOID  DataBlockObject,
  5.7133 +  /*IN OUT*/ ULONG  *InOutBufferSize,
  5.7134 +  /*OUT*/ PVOID  OutBuffer);
  5.7135 +
  5.7136 +NTOSAPI
  5.7137 +NTSTATUS
  5.7138 +DDKAPI
  5.7139 +IoWMIQueryAllDataMultiple(
  5.7140 +  /*IN*/ PVOID  *DataBlockObjectList,
  5.7141 +  /*IN*/ ULONG  ObjectCount,
  5.7142 +  /*IN OUT*/ ULONG  *InOutBufferSize,
  5.7143 +  /*OUT*/ PVOID  OutBuffer);
  5.7144 +
  5.7145 +NTOSAPI
  5.7146 +NTSTATUS
  5.7147 +DDKAPI
  5.7148 +IoWMIQuerySingleInstance(
  5.7149 +  /*IN*/ PVOID  DataBlockObject,
  5.7150 +  /*IN*/ PUNICODE_STRING  InstanceName,
  5.7151 +  /*IN OUT*/ ULONG  *InOutBufferSize,
  5.7152 +  /*OUT*/ PVOID OutBuffer);
  5.7153 +
  5.7154 +NTOSAPI
  5.7155 +NTSTATUS
  5.7156 +DDKAPI
  5.7157 +IoWMIQuerySingleInstanceMultiple(
  5.7158 +  /*IN*/ PVOID  *DataBlockObjectList,
  5.7159 +  /*IN*/ PUNICODE_STRING  InstanceNames,
  5.7160 +  /*IN*/ ULONG  ObjectCount,
  5.7161 +  /*IN OUT*/ ULONG  *InOutBufferSize,
  5.7162 +  /*OUT*/ PVOID  OutBuffer);
  5.7163 +
  5.7164 +NTOSAPI
  5.7165 +NTSTATUS
  5.7166 +DDKAPI
  5.7167 +IoWMIRegistrationControl(
  5.7168 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.7169 +  /*IN*/ ULONG  Action);
  5.7170 +
  5.7171 +NTOSAPI
  5.7172 +NTSTATUS
  5.7173 +DDKAPI
  5.7174 +IoWMISetNotificationCallback(
  5.7175 +  /*IN*/ PVOID  Object,
  5.7176 +  /*IN*/ WMI_NOTIFICATION_CALLBACK  Callback,
  5.7177 +  /*IN*/ PVOID  Context);
  5.7178 +
  5.7179 +NTOSAPI
  5.7180 +NTSTATUS
  5.7181 +DDKAPI
  5.7182 +IoWMISetSingleInstance(
  5.7183 +  /*IN*/ PVOID  DataBlockObject,
  5.7184 +  /*IN*/ PUNICODE_STRING  InstanceName,
  5.7185 +  /*IN*/ ULONG  Version,
  5.7186 +  /*IN*/ ULONG  ValueBufferSize,
  5.7187 +  /*IN*/ PVOID  ValueBuffer);
  5.7188 +
  5.7189 +NTOSAPI
  5.7190 +NTSTATUS
  5.7191 +DDKAPI
  5.7192 +IoWMISetSingleItem(
  5.7193 +  /*IN*/ PVOID  DataBlockObject,
  5.7194 +  /*IN*/ PUNICODE_STRING  InstanceName,
  5.7195 +  /*IN*/ ULONG  DataItemId,
  5.7196 +  /*IN*/ ULONG  Version,
  5.7197 +  /*IN*/ ULONG  ValueBufferSize,
  5.7198 +  /*IN*/ PVOID  ValueBuffer);
  5.7199 +
  5.7200 +NTOSAPI
  5.7201 +NTSTATUS
  5.7202 +DDKAPI
  5.7203 +IoWMISuggestInstanceName(
  5.7204 +  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject /*OPTIONAL*/,
  5.7205 +  /*IN*/ PUNICODE_STRING  SymbolicLinkName /*OPTIONAL*/,
  5.7206 +  /*IN*/ BOOLEAN  CombineNames,
  5.7207 +  /*OUT*/ PUNICODE_STRING  SuggestedInstanceName);
  5.7208 +
  5.7209 +NTOSAPI
  5.7210 +NTSTATUS
  5.7211 +DDKAPI
  5.7212 +IoWMIWriteEvent(
  5.7213 +  /*IN*/ PVOID  WnodeEventItem);
  5.7214 +
  5.7215 +NTOSAPI
  5.7216 +VOID
  5.7217 +DDKAPI
  5.7218 +IoWriteErrorLogEntry(
  5.7219 +  /*IN*/ PVOID  ElEntry);
  5.7220 +
  5.7221 +NTOSAPI
  5.7222 +NTSTATUS
  5.7223 +DDKAPI
  5.7224 +IoWritePartitionTableEx(
  5.7225 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.7226 +  /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX  *PartitionBuffer);
  5.7227 +
  5.7228 +
  5.7229 +
  5.7230 +/** Kernel routines **/
  5.7231 +
  5.7232 +NTOSAPI
  5.7233 +VOID
  5.7234 +DDKFASTAPI
  5.7235 +KeAcquireInStackQueuedSpinLock(
  5.7236 +  /*IN*/ PKSPIN_LOCK  SpinLock,
  5.7237 +  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  5.7238 +
  5.7239 +NTOSAPI
  5.7240 +VOID
  5.7241 +DDKFASTAPI
  5.7242 +KeAcquireInStackQueuedSpinLockAtDpcLevel(
  5.7243 +  /*IN*/ PKSPIN_LOCK  SpinLock,
  5.7244 +  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  5.7245 +
  5.7246 +NTOSAPI
  5.7247 +KIRQL
  5.7248 +DDKAPI
  5.7249 +KeAcquireInterruptSpinLock(
  5.7250 +  /*IN*/ PKINTERRUPT  Interrupt);
  5.7251 +
  5.7252 +NTOSAPI
  5.7253 +VOID
  5.7254 +DDKAPI
  5.7255 +KeAcquireSpinLock(
  5.7256 +  /*IN*/ PKSPIN_LOCK  SpinLock,
  5.7257 +  /*OUT*/ PKIRQL  OldIrql);
  5.7258 +
  5.7259 +/* System Service Dispatch Table */
  5.7260 +typedef PVOID (NTAPI * SSDT)(VOID);
  5.7261 +typedef SSDT * PSSDT;
  5.7262 +
  5.7263 +/* System Service Parameters Table */
  5.7264 +typedef UCHAR SSPT, * PSSPT;
  5.7265 +
  5.7266 +typedef struct _SSDT_ENTRY {
  5.7267 +	PSSDT  SSDT;
  5.7268 +	PULONG  ServiceCounterTable;
  5.7269 +	ULONG  NumberOfServices;
  5.7270 +	PSSPT  SSPT;
  5.7271 +} SSDT_ENTRY, *PSSDT_ENTRY;
  5.7272 +
  5.7273 +NTOSAPI
  5.7274 +BOOLEAN
  5.7275 +DDKAPI
  5.7276 +KeAddSystemServiceTable(
  5.7277 +  /*IN*/ PSSDT  SSDT,
  5.7278 +  /*IN*/ PULONG  ServiceCounterTable,
  5.7279 +  /*IN*/ ULONG  NumberOfServices,
  5.7280 +  /*IN*/ PSSPT  SSPT,
  5.7281 +  /*IN*/ ULONG  TableIndex);
  5.7282 +
  5.7283 +NTOSAPI
  5.7284 +BOOLEAN
  5.7285 +DDKAPI
  5.7286 +KeAreApcsDisabled(
  5.7287 +  VOID);
  5.7288 +
  5.7289 +NTOSAPI
  5.7290 +VOID
  5.7291 +DDKAPI
  5.7292 +KeAttachProcess(
  5.7293 +  /*IN*/ PEPROCESS  Process);
  5.7294 +
  5.7295 +NTOSAPI
  5.7296 +VOID
  5.7297 +DDKAPI
  5.7298 +KeBugCheck(
  5.7299 +  /*IN*/ ULONG  BugCheckCode);
  5.7300 +
  5.7301 +NTOSAPI
  5.7302 +VOID
  5.7303 +DDKAPI
  5.7304 +KeBugCheckEx(
  5.7305 +  /*IN*/ ULONG  BugCheckCode,
  5.7306 +  /*IN*/ ULONG_PTR  BugCheckParameter1,
  5.7307 +  /*IN*/ ULONG_PTR  BugCheckParameter2,
  5.7308 +  /*IN*/ ULONG_PTR  BugCheckParameter3,
  5.7309 +  /*IN*/ ULONG_PTR  BugCheckParameter4);
  5.7310 +
  5.7311 +NTOSAPI
  5.7312 +BOOLEAN
  5.7313 +DDKAPI
  5.7314 +KeCancelTimer(
  5.7315 +  /*IN*/ PKTIMER  Timer);
  5.7316 +
  5.7317 +NTOSAPI
  5.7318 +VOID
  5.7319 +DDKAPI
  5.7320 +KeClearEvent(
  5.7321 +  /*IN*/ PRKEVENT  Event);
  5.7322 +
  5.7323 +NTOSAPI
  5.7324 +NTSTATUS
  5.7325 +DDKAPI
  5.7326 +KeDelayExecutionThread(
  5.7327 +  /*IN*/ KPROCESSOR_MODE  WaitMode,
  5.7328 +  /*IN*/ BOOLEAN  Alertable,
  5.7329 +  /*IN*/ PLARGE_INTEGER  Interval);
  5.7330 +
  5.7331 +NTOSAPI
  5.7332 +BOOLEAN
  5.7333 +DDKAPI
  5.7334 +KeDeregisterBugCheckCallback(
  5.7335 +  /*IN*/ PKBUGCHECK_CALLBACK_RECORD  CallbackRecord);
  5.7336 +
  5.7337 +NTOSAPI
  5.7338 +VOID
  5.7339 +DDKAPI
  5.7340 +KeDetachProcess(
  5.7341 +  VOID);
  5.7342 +
  5.7343 +NTOSAPI
  5.7344 +VOID
  5.7345 +DDKAPI
  5.7346 +KeEnterCriticalRegion(
  5.7347 +  VOID);
  5.7348 +
  5.7349 +/*
  5.7350 + * VOID
  5.7351 + * KeFlushIoBuffers(
  5.7352 + * IN PMDL  Mdl,
  5.7353 + * IN BOOLEAN  ReadOperation,
  5.7354 + * IN BOOLEAN  DmaOperation)
  5.7355 + */
  5.7356 +#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
  5.7357 +
  5.7358 +NTOSAPI
  5.7359 +PRKTHREAD
  5.7360 +DDKAPI
  5.7361 +KeGetCurrentThread(
  5.7362 +  VOID);
  5.7363 +
  5.7364 +NTOSAPI
  5.7365 +KPROCESSOR_MODE
  5.7366 +DDKAPI
  5.7367 +KeGetPreviousMode(
  5.7368 +  VOID);
  5.7369 +
  5.7370 +NTOSAPI
  5.7371 +ULONG
  5.7372 +DDKAPI
  5.7373 +KeGetRecommendedSharedDataAlignment(
  5.7374 +  VOID);
  5.7375 +
  5.7376 +NTOSAPI
  5.7377 +VOID
  5.7378 +DDKAPI
  5.7379 +KeInitializeApc(
  5.7380 +  /*IN*/ PKAPC  Apc,
  5.7381 +  /*IN*/ PKTHREAD  Thread,
  5.7382 +  /*IN*/ UCHAR  StateIndex,
  5.7383 +  /*IN*/ PKKERNEL_ROUTINE  KernelRoutine,
  5.7384 +  /*IN*/ PKRUNDOWN_ROUTINE  RundownRoutine,
  5.7385 +  /*IN*/ PKNORMAL_ROUTINE  NormalRoutine,
  5.7386 +  /*IN*/ UCHAR  Mode,
  5.7387 +  /*IN*/ PVOID  Context);
  5.7388 +
  5.7389 +NTOSAPI
  5.7390 +VOID
  5.7391 +DDKAPI
  5.7392 +KeInitializeDeviceQueue(
  5.7393 +  /*IN*/ PKDEVICE_QUEUE  DeviceQueue);
  5.7394 +
  5.7395 +NTOSAPI
  5.7396 +VOID
  5.7397 +DDKAPI
  5.7398 +KeInitializeMutex(
  5.7399 +  /*IN*/ PRKMUTEX  Mutex,
  5.7400 +  /*IN*/ ULONG  Level);
  5.7401 +
  5.7402 +NTOSAPI
  5.7403 +VOID
  5.7404 +DDKAPI
  5.7405 +KeInitializeSemaphore(
  5.7406 +  /*IN*/ PRKSEMAPHORE  Semaphore,
  5.7407 +  /*IN*/ LONG  Count,
  5.7408 +  /*IN*/ LONG  Limit);
  5.7409 +
  5.7410 +NTOSAPI
  5.7411 +VOID
  5.7412 +DDKAPI
  5.7413 +KeInitializeSpinLock(
  5.7414 +  /*IN*/ PKSPIN_LOCK  SpinLock);
  5.7415 +
  5.7416 +NTOSAPI
  5.7417 +VOID
  5.7418 +DDKAPI
  5.7419 +KeInitializeTimer(
  5.7420 +  /*IN*/ PKTIMER  Timer);
  5.7421 +
  5.7422 +NTOSAPI
  5.7423 +VOID
  5.7424 +DDKAPI
  5.7425 +KeInitializeTimerEx(
  5.7426 +  /*IN*/ PKTIMER  Timer,
  5.7427 +  /*IN*/ TIMER_TYPE  Type);
  5.7428 +
  5.7429 +NTOSAPI
  5.7430 +BOOLEAN
  5.7431 +DDKAPI
  5.7432 +KeInsertByKeyDeviceQueue(
  5.7433 +  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  5.7434 +  /*IN*/ PKDEVICE_QUEUE_ENTRY  DeviceQueueEntry,
  5.7435 +  /*IN*/ ULONG  SortKey);
  5.7436 +
  5.7437 +NTOSAPI
  5.7438 +BOOLEAN
  5.7439 +DDKAPI
  5.7440 +KeInsertDeviceQueue(
  5.7441 +  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  5.7442 +  /*IN*/ PKDEVICE_QUEUE_ENTRY  DeviceQueueEntry);
  5.7443 +
  5.7444 +NTOSAPI
  5.7445 +BOOLEAN
  5.7446 +DDKAPI
  5.7447 +KeInsertQueueDpc(
  5.7448 +  /*IN*/ PRKDPC  Dpc,
  5.7449 +  /*IN*/ PVOID  SystemArgument1,
  5.7450 +  /*IN*/ PVOID  SystemArgument2);
  5.7451 +
  5.7452 +NTOSAPI
  5.7453 +VOID
  5.7454 +DDKAPI
  5.7455 +KeLeaveCriticalRegion(
  5.7456 +  VOID);
  5.7457 +
  5.7458 +NTOSAPI
  5.7459 +NTSTATUS
  5.7460 +DDKAPI
  5.7461 +KePulseEvent(
  5.7462 +  /*IN*/ PRKEVENT  Event,
  5.7463 +  /*IN*/ KPRIORITY  Increment,
  5.7464 +  /*IN*/ BOOLEAN  Wait);
  5.7465 +
  5.7466 +NTOSAPI
  5.7467 +ULONGLONG
  5.7468 +DDKAPI
  5.7469 +KeQueryInterruptTime(
  5.7470 +  VOID);
  5.7471 +
  5.7472 +NTOSAPI
  5.7473 +LARGE_INTEGER
  5.7474 +DDKAPI
  5.7475 +KeQueryPerformanceCounter(
  5.7476 +  /*OUT*/ PLARGE_INTEGER  PerformanceFrequency  /*OPTIONAL*/);
  5.7477 +
  5.7478 +NTOSAPI
  5.7479 +KPRIORITY
  5.7480 +DDKAPI
  5.7481 +KeQueryPriorityThread(
  5.7482 +  /*IN*/ PRKTHREAD  Thread);
  5.7483 +
  5.7484 +NTOSAPI
  5.7485 +VOID
  5.7486 +DDKAPI
  5.7487 +KeQuerySystemTime(
  5.7488 +  /*OUT*/ PLARGE_INTEGER  CurrentTime);
  5.7489 +
  5.7490 +NTOSAPI
  5.7491 +VOID
  5.7492 +DDKAPI
  5.7493 +KeQueryTickCount(
  5.7494 +  /*OUT*/ PLARGE_INTEGER  TickCount);
  5.7495 +
  5.7496 +NTOSAPI
  5.7497 +ULONG
  5.7498 +DDKAPI
  5.7499 +KeQueryTimeIncrement(
  5.7500 +  VOID);
  5.7501 +
  5.7502 +NTOSAPI
  5.7503 +LONG
  5.7504 +DDKAPI
  5.7505 +KeReadStateEvent(
  5.7506 +  /*IN*/ PRKEVENT  Event);
  5.7507 +
  5.7508 +NTOSAPI
  5.7509 +LONG
  5.7510 +DDKAPI
  5.7511 +KeReadStateMutex(
  5.7512 +  /*IN*/ PRKMUTEX  Mutex);
  5.7513 +
  5.7514 +NTOSAPI
  5.7515 +LONG
  5.7516 +DDKAPI
  5.7517 +KeReadStateSemaphore(
  5.7518 +  /*IN*/ PRKSEMAPHORE  Semaphore);
  5.7519 +
  5.7520 +NTOSAPI
  5.7521 +BOOLEAN
  5.7522 +DDKAPI
  5.7523 +KeReadStateTimer(
  5.7524 +  /*IN*/ PKTIMER  Timer);
  5.7525 +
  5.7526 +NTOSAPI
  5.7527 +BOOLEAN
  5.7528 +DDKAPI
  5.7529 +KeRegisterBugCheckCallback(
  5.7530 +  /*IN*/ PKBUGCHECK_CALLBACK_RECORD  CallbackRecord,
  5.7531 +  /*IN*/ PKBUGCHECK_CALLBACK_ROUTINE  CallbackRoutine,
  5.7532 +  /*IN*/ PVOID  Buffer,
  5.7533 +  /*IN*/ ULONG  Length,
  5.7534 +  /*IN*/ PUCHAR  Component);
  5.7535 +
  5.7536 +NTOSAPI
  5.7537 +VOID
  5.7538 +DDKFASTAPI
  5.7539 +KeReleaseInStackQueuedSpinLock(
  5.7540 +  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  5.7541 +
  5.7542 +NTOSAPI
  5.7543 +VOID
  5.7544 +DDKFASTAPI
  5.7545 +KeReleaseInStackQueuedSpinLockFromDpcLevel(
  5.7546 +  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  5.7547 +
  5.7548 +NTOSAPI
  5.7549 +VOID
  5.7550 +DDKAPI
  5.7551 +KeReleaseInterruptSpinLock(
  5.7552 +  /*IN*/ PKINTERRUPT  Interrupt,
  5.7553 +  /*IN*/ KIRQL  OldIrql);
  5.7554 +
  5.7555 +NTOSAPI
  5.7556 +LONG
  5.7557 +DDKAPI
  5.7558 +KeReleaseMutex(
  5.7559 +  /*IN*/ PRKMUTEX  Mutex,
  5.7560 +  /*IN*/ BOOLEAN  Wait);
  5.7561 +
  5.7562 +NTOSAPI
  5.7563 +LONG
  5.7564 +DDKAPI
  5.7565 +KeReleaseSemaphore(
  5.7566 +  /*IN*/ PRKSEMAPHORE  Semaphore,
  5.7567 +  /*IN*/ KPRIORITY  Increment,
  5.7568 +  /*IN*/ LONG  Adjustment,
  5.7569 +  /*IN*/ BOOLEAN  Wait);
  5.7570 +
  5.7571 +NTOSAPI
  5.7572 +VOID
  5.7573 +DDKAPI
  5.7574 +KeReleaseSpinLock(
  5.7575 +  /*IN*/ PKSPIN_LOCK  SpinLock,
  5.7576 +  /*IN*/ KIRQL  NewIrql);
  5.7577 +
  5.7578 +NTOSAPI
  5.7579 +PKDEVICE_QUEUE_ENTRY
  5.7580 +DDKAPI 
  5.7581 +KeRemoveByKeyDeviceQueue(
  5.7582 +  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  5.7583 +  /*IN*/ ULONG  SortKey);
  5.7584 +
  5.7585 +NTOSAPI
  5.7586 +PKDEVICE_QUEUE_ENTRY
  5.7587 +DDKAPI
  5.7588 +KeRemoveDeviceQueue(
  5.7589 +  /*IN*/ PKDEVICE_QUEUE  DeviceQueue);
  5.7590 +
  5.7591 +NTOSAPI
  5.7592 +BOOLEAN
  5.7593 +DDKAPI
  5.7594 +KeRemoveEntryDeviceQueue(
  5.7595 +  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  5.7596 +  /*IN*/ PKDEVICE_QUEUE_ENTRY  DeviceQueueEntry);
  5.7597 +
  5.7598 +NTOSAPI
  5.7599 +BOOLEAN
  5.7600 +DDKAPI
  5.7601 +KeRemoveQueueDpc(
  5.7602 +  /*IN*/ PRKDPC  Dpc);
  5.7603 +
  5.7604 +NTOSAPI
  5.7605 +LONG
  5.7606 +DDKAPI
  5.7607 +KeResetEvent(
  5.7608 +  /*IN*/ PRKEVENT  Event);
  5.7609 +
  5.7610 +NTOSAPI
  5.7611 +NTSTATUS
  5.7612 +DDKAPI
  5.7613 +KeRestoreFloatingPointState(
  5.7614 +  /*IN*/ PKFLOATING_SAVE  FloatSave);
  5.7615 +
  5.7616 +NTOSAPI
  5.7617 +NTSTATUS
  5.7618 +DDKAPI
  5.7619 +KeSaveFloatingPointState(
  5.7620 +  /*OUT*/ PKFLOATING_SAVE  FloatSave);
  5.7621 +
  5.7622 +NTOSAPI
  5.7623 +LONG
  5.7624 +DDKAPI
  5.7625 +KeSetBasePriorityThread(
  5.7626 +  /*IN*/ PRKTHREAD  Thread,
  5.7627 +  /*IN*/ LONG  Increment);
  5.7628 +
  5.7629 +NTOSAPI
  5.7630 +LONG
  5.7631 +DDKAPI
  5.7632 +KeSetEvent(
  5.7633 +  /*IN*/ PRKEVENT  Event,
  5.7634 +  /*IN*/ KPRIORITY  Increment,
  5.7635 +  /*IN*/ BOOLEAN  Wait);
  5.7636 +
  5.7637 +NTOSAPI
  5.7638 +VOID
  5.7639 +DDKAPI
  5.7640 +KeSetImportanceDpc(
  5.7641 +  /*IN*/ PRKDPC  Dpc,
  5.7642 +  /*IN*/ KDPC_IMPORTANCE  Importance);
  5.7643 +
  5.7644 +NTOSAPI
  5.7645 +KPRIORITY
  5.7646 +DDKAPI
  5.7647 +KeSetPriorityThread(
  5.7648 +  /*IN*/ PKTHREAD  Thread,
  5.7649 +  /*IN*/ KPRIORITY  Priority);
  5.7650 +
  5.7651 +NTOSAPI
  5.7652 +VOID
  5.7653 +DDKAPI
  5.7654 +KeSetTargetProcessorDpc(
  5.7655 +  /*IN*/ PRKDPC  Dpc,
  5.7656 +  /*IN*/ CCHAR  Number);
  5.7657 +
  5.7658 +NTOSAPI
  5.7659 +BOOLEAN
  5.7660 +DDKAPI
  5.7661 +KeSetTimer(
  5.7662 +  /*IN*/ PKTIMER  Timer,
  5.7663 +  /*IN*/ LARGE_INTEGER  DueTime,
  5.7664 +  /*IN*/ PKDPC  Dpc  /*OPTIONAL*/);
  5.7665 +
  5.7666 +NTOSAPI
  5.7667 +BOOLEAN
  5.7668 +DDKAPI
  5.7669 +KeSetTimerEx(
  5.7670 +  /*IN*/ PKTIMER  Timer,
  5.7671 +  /*IN*/ LARGE_INTEGER  DueTime,
  5.7672 +  /*IN*/ LONG  Period  /*OPTIONAL*/,
  5.7673 +  /*IN*/ PKDPC  Dpc  /*OPTIONAL*/);
  5.7674 +
  5.7675 +NTOSAPI
  5.7676 +VOID
  5.7677 +DDKFASTAPI
  5.7678 +KeSetTimeUpdateNotifyRoutine(
  5.7679 +  /*IN*/ PTIME_UPDATE_NOTIFY_ROUTINE  NotifyRoutine);
  5.7680 +
  5.7681 +NTOSAPI
  5.7682 +VOID
  5.7683 +DDKAPI
  5.7684 +KeStallExecutionProcessor(
  5.7685 +  /*IN*/ ULONG  MicroSeconds);
  5.7686 +
  5.7687 +NTOSAPI
  5.7688 +BOOLEAN
  5.7689 +DDKAPI
  5.7690 +KeSynchronizeExecution(
  5.7691 +  /*IN*/ PKINTERRUPT    Interrupt,
  5.7692 +  /*IN*/ PKSYNCHRONIZE_ROUTINE  SynchronizeRoutine,
  5.7693 +  /*IN*/ PVOID  SynchronizeContext);
  5.7694 +
  5.7695 +NTOSAPI
  5.7696 +NTSTATUS
  5.7697 +DDKAPI
  5.7698 +KeWaitForMultipleObjects(
  5.7699 +  /*IN*/ ULONG  Count,
  5.7700 +  /*IN*/ PVOID  Object[],
  5.7701 +  /*IN*/ WAIT_TYPE  WaitType,
  5.7702 +  /*IN*/ KWAIT_REASON  WaitReason,
  5.7703 +  /*IN*/ KPROCESSOR_MODE  WaitMode,
  5.7704 +  /*IN*/ BOOLEAN  Alertable,
  5.7705 +  /*IN*/ PLARGE_INTEGER  Timeout  /*OPTIONAL */,
  5.7706 +  /*IN*/ PKWAIT_BLOCK  WaitBlockArray  /*OPTIONAL*/);
  5.7707 +
  5.7708 +NTOSAPI
  5.7709 +NTSTATUS
  5.7710 +DDKAPI
  5.7711 +KeWaitForMutexObject(
  5.7712 +  /*IN*/ PRKMUTEX  Mutex,
  5.7713 +  /*IN*/ KWAIT_REASON  WaitReason,
  5.7714 +  /*IN*/ KPROCESSOR_MODE  WaitMode,
  5.7715 +  /*IN*/ BOOLEAN  Alertable,
  5.7716 +  /*IN*/ PLARGE_INTEGER  Timeout  /*OPTIONAL*/);
  5.7717 +
  5.7718 +NTOSAPI
  5.7719 +NTSTATUS
  5.7720 +DDKAPI
  5.7721 +KeWaitForSingleObject(
  5.7722 +  /*IN*/ PVOID  Object,
  5.7723 +  /*IN*/ KWAIT_REASON  WaitReason,
  5.7724 +  /*IN*/ KPROCESSOR_MODE  WaitMode,
  5.7725 +  /*IN*/ BOOLEAN  Alertable,
  5.7726 +  /*IN*/ PLARGE_INTEGER  Timeout  /*OPTIONAL*/);
  5.7727 +
  5.7728 +#if defined(_X86_)
  5.7729 +
  5.7730 +NTOSAPI
  5.7731 +VOID
  5.7732 +FASTCALL
  5.7733 +KfLowerIrql(
  5.7734 +  /*IN*/ KIRQL  NewIrql);
  5.7735 +
  5.7736 +NTOSAPI
  5.7737 +KIRQL
  5.7738 +FASTCALL
  5.7739 +KfRaiseIrql(
  5.7740 +  /*IN*/ KIRQL  NewIrql);
  5.7741 +
  5.7742 +#define KeLowerIrql(a) KfLowerIrql(a)
  5.7743 +#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
  5.7744 +
  5.7745 +#else
  5.7746 +
  5.7747 +NTOSAPI
  5.7748 +VOID
  5.7749 +DDKAPI
  5.7750 +KeLowerIrql(
  5.7751 +  /*IN*/ KIRQL  NewIrql);
  5.7752 +
  5.7753 +NTOSAPI
  5.7754 +KIRQL
  5.7755 +DDKAPI
  5.7756 +KeRaiseIrql(
  5.7757 +  /*IN*/ KIRQL  NewIrql);
  5.7758 +
  5.7759 +#endif
  5.7760 +
  5.7761 +NTOSAPI
  5.7762 +KIRQL
  5.7763 +DDKAPI
  5.7764 +KeRaiseIrqlToDpcLevel(
  5.7765 +  VOID);
  5.7766 +
  5.7767 +/** Memory manager routines **/
  5.7768 +
  5.7769 +NTOSAPI
  5.7770 +NTSTATUS
  5.7771 +DDKAPI
  5.7772 +MmAdvanceMdl(
  5.7773 +  /*IN*/ PMDL  Mdl,
  5.7774 +  /*IN*/ ULONG  NumberOfBytes);
  5.7775 +
  5.7776 +NTOSAPI
  5.7777 +PVOID
  5.7778 +DDKAPI
  5.7779 +MmAllocateContiguousMemory(
  5.7780 +  /*IN*/ ULONG  NumberOfBytes,
  5.7781 +  /*IN*/ PHYSICAL_ADDRESS  HighestAcceptableAddress);
  5.7782 +
  5.7783 +NTOSAPI
  5.7784 +PVOID
  5.7785 +DDKAPI
  5.7786 +MmAllocateContiguousMemorySpecifyCache(
  5.7787 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.7788 +  /*IN*/ PHYSICAL_ADDRESS  LowestAcceptableAddress,
  5.7789 +  /*IN*/ PHYSICAL_ADDRESS  HighestAcceptableAddress,
  5.7790 +  /*IN*/ PHYSICAL_ADDRESS  BoundaryAddressMultiple  /*OPTIONAL*/,
  5.7791 +  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  5.7792 +
  5.7793 +NTOSAPI
  5.7794 +PVOID
  5.7795 +DDKAPI
  5.7796 +MmAllocateMappingAddress(
  5.7797 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.7798 +  /*IN*/ ULONG  PoolTag);
  5.7799 +
  5.7800 +NTOSAPI
  5.7801 +PVOID
  5.7802 +DDKAPI
  5.7803 +MmAllocateNonCachedMemory(
  5.7804 +  /*IN*/ ULONG  NumberOfBytes);
  5.7805 +
  5.7806 +NTOSAPI
  5.7807 +PMDL
  5.7808 +DDKAPI
  5.7809 +MmAllocatePagesForMdl(
  5.7810 +  /*IN*/ PHYSICAL_ADDRESS  LowAddress,
  5.7811 +  /*IN*/ PHYSICAL_ADDRESS  HighAddress,
  5.7812 +  /*IN*/ PHYSICAL_ADDRESS  SkipBytes,
  5.7813 +  /*IN*/ SIZE_T  TotalBytes);
  5.7814 +
  5.7815 +NTOSAPI
  5.7816 +VOID
  5.7817 +DDKAPI
  5.7818 +MmBuildMdlForNonPagedPool(
  5.7819 +  /*IN OUT*/ PMDL  MemoryDescriptorList);
  5.7820 +
  5.7821 +NTOSAPI
  5.7822 +NTSTATUS
  5.7823 +DDKAPI
  5.7824 +MmCreateSection(
  5.7825 +  /*OUT*/ PSECTION_OBJECT  *SectionObject,
  5.7826 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.7827 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes  /*OPTIONAL*/,
  5.7828 +  /*IN*/ PLARGE_INTEGER  MaximumSize,
  5.7829 +  /*IN*/ ULONG  SectionPageProtection,
  5.7830 +  /*IN*/ ULONG  AllocationAttributes,
  5.7831 +  /*IN*/ HANDLE  FileHandle  /*OPTIONAL*/,
  5.7832 +  /*IN*/ PFILE_OBJECT  File  /*OPTIONAL*/);
  5.7833 +
  5.7834 +typedef enum _MMFLUSH_TYPE {
  5.7835 +  MmFlushForDelete,
  5.7836 +  MmFlushForWrite
  5.7837 +} MMFLUSH_TYPE;
  5.7838 +
  5.7839 +NTOSAPI
  5.7840 +BOOLEAN
  5.7841 +DDKAPI
  5.7842 +MmFlushImageSection(
  5.7843 +  /*IN*/ PSECTION_OBJECT_POINTERS  SectionObjectPointer,
  5.7844 +  /*IN*/ MMFLUSH_TYPE  FlushType);
  5.7845 +
  5.7846 +NTOSAPI
  5.7847 +VOID
  5.7848 +DDKAPI
  5.7849 +MmFreeContiguousMemory(
  5.7850 +  /*IN*/ PVOID  BaseAddress);
  5.7851 +
  5.7852 +NTOSAPI
  5.7853 +VOID
  5.7854 +DDKAPI
  5.7855 +MmFreeContiguousMemorySpecifyCache(
  5.7856 +  /*IN*/ PVOID  BaseAddress,
  5.7857 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.7858 +  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  5.7859 +
  5.7860 +NTOSAPI
  5.7861 +VOID
  5.7862 +DDKAPI
  5.7863 +MmFreeMappingAddress(
  5.7864 +  /*IN*/ PVOID  BaseAddress,
  5.7865 +  /*IN*/ ULONG  PoolTag);
  5.7866 +
  5.7867 +NTOSAPI
  5.7868 +VOID
  5.7869 +DDKAPI
  5.7870 +MmFreeNonCachedMemory(
  5.7871 +  /*IN*/ PVOID  BaseAddress,
  5.7872 +  /*IN*/ SIZE_T  NumberOfBytes);
  5.7873 +
  5.7874 +NTOSAPI
  5.7875 +VOID
  5.7876 +DDKAPI
  5.7877 +MmFreePagesFromMdl(
  5.7878 +  /*IN*/ PMDL  MemoryDescriptorList);
  5.7879 +
  5.7880 +/*
  5.7881 + * ULONG
  5.7882 + * MmGetMdlByteCount(
  5.7883 + * IN PMDL  Mdl)
  5.7884 + */
  5.7885 +#define MmGetMdlByteCount(_Mdl) \
  5.7886 +  ((_Mdl)->ByteCount)
  5.7887 +
  5.7888 +/*
  5.7889 + * ULONG
  5.7890 + * MmGetMdlByteOffset(
  5.7891 + * IN PMDL  Mdl)
  5.7892 + */
  5.7893 +#define MmGetMdlByteOffset(_Mdl) \
  5.7894 +  ((_Mdl)->ByteOffset)
  5.7895 +
  5.7896 +/*
  5.7897 + * PPFN_NUMBER
  5.7898 + * MmGetMdlPfnArray(
  5.7899 + * IN PMDL  Mdl)
  5.7900 + */
  5.7901 +#define MmGetMdlPfnArray(_Mdl) \
  5.7902 +  ((PPFN_NUMBER) ((_Mdl) + 1))
  5.7903 +
  5.7904 +/*
  5.7905 + * PVOID
  5.7906 + * MmGetMdlVirtualAddress(
  5.7907 + * IN PMDL  Mdl)
  5.7908 + */
  5.7909 +#define MmGetMdlVirtualAddress(_Mdl) \
  5.7910 +  ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
  5.7911 +
  5.7912 +NTOSAPI
  5.7913 +PHYSICAL_ADDRESS
  5.7914 +DDKAPI
  5.7915 +MmGetPhysicalAddress(
  5.7916 +  /*IN*/ PVOID  BaseAddress);
  5.7917 +
  5.7918 +NTOSAPI
  5.7919 +PPHYSICAL_MEMORY_RANGE
  5.7920 +DDKAPI
  5.7921 +MmGetPhysicalMemoryRanges(
  5.7922 +  VOID);
  5.7923 +
  5.7924 +NTOSAPI
  5.7925 +PVOID
  5.7926 +DDKAPI
  5.7927 +MmGetVirtualForPhysical(
  5.7928 +  /*IN*/ PHYSICAL_ADDRESS  PhysicalAddress);
  5.7929 +
  5.7930 +NTOSAPI
  5.7931 +PVOID
  5.7932 +DDKAPI
  5.7933 +MmMapLockedPagesSpecifyCache(
  5.7934 +  /*IN*/ PMDL  MemoryDescriptorList,
  5.7935 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.7936 +  /*IN*/ MEMORY_CACHING_TYPE  CacheType,
  5.7937 +  /*IN*/ PVOID  BaseAddress,
  5.7938 +  /*IN*/ ULONG  BugCheckOnFailure,
  5.7939 +  /*IN*/ MM_PAGE_PRIORITY  Priority);
  5.7940 +
  5.7941 +NTOSAPI
  5.7942 +PVOID
  5.7943 +DDKAPI
  5.7944 +MmMapLockedPagesWithReservedMapping(
  5.7945 +  /*IN*/ PVOID  MappingAddress,
  5.7946 +  /*IN*/ ULONG  PoolTag,
  5.7947 +  /*IN*/ PMDL  MemoryDescriptorList,
  5.7948 +  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  5.7949 +
  5.7950 +NTOSAPI
  5.7951 +NTSTATUS
  5.7952 +DDKAPI
  5.7953 +MmMapUserAddressesToPage(
  5.7954 +  /*IN*/ PVOID  BaseAddress,
  5.7955 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.7956 +  /*IN*/ PVOID  PageAddress);
  5.7957 +
  5.7958 +NTOSAPI
  5.7959 +PVOID
  5.7960 +DDKAPI
  5.7961 +MmMapVideoDisplay(
  5.7962 +  /*IN*/ PHYSICAL_ADDRESS  PhysicalAddress,
  5.7963 +  /*IN*/ SIZE_T  NumberOfBytes,
  5.7964 +  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  5.7965 +
  5.7966 +NTOSAPI
  5.7967 +NTSTATUS
  5.7968 +DDKAPI
  5.7969 +MmMapViewInSessionSpace(
  5.7970 +  /*IN*/ PVOID  Section,
  5.7971 +  /*OUT*/ PVOID  *MappedBase,
  5.7972 +  /*IN OUT*/ PSIZE_T  ViewSize);
  5.7973 +
  5.7974 +NTOSAPI
  5.7975 +NTSTATUS
  5.7976 +DDKAPI
  5.7977 +MmMapViewInSystemSpace(
  5.7978 +  /*IN*/ PVOID  Section,
  5.7979 +  /*OUT*/ PVOID  *MappedBase,
  5.7980 +  /*IN*/ PSIZE_T  ViewSize);
  5.7981 +
  5.7982 +NTOSAPI
  5.7983 +NTSTATUS
  5.7984 +DDKAPI
  5.7985 +MmMarkPhysicalMemoryAsBad(
  5.7986 +  /*IN*/ PPHYSICAL_ADDRESS  StartAddress,
  5.7987 +  /*IN OUT*/ PLARGE_INTEGER  NumberOfBytes);
  5.7988 +
  5.7989 +NTOSAPI
  5.7990 +NTSTATUS
  5.7991 +DDKAPI
  5.7992 +MmMarkPhysicalMemoryAsGood(
  5.7993 +  /*IN*/ PPHYSICAL_ADDRESS  StartAddress,
  5.7994 +  /*IN OUT*/ PLARGE_INTEGER  NumberOfBytes);
  5.7995 +
  5.7996 +/*
  5.7997 + * PVOID
  5.7998 + * MmGetSystemAddressForMdlSafe(
  5.7999 + * IN PMDL  Mdl,
  5.8000 + * IN MM_PAGE_PRIORITY  Priority)
  5.8001 + */
  5.8002 +#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
  5.8003 +  ((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
  5.8004 +    | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
  5.8005 +    (_Mdl)->MappedSystemVa : \
  5.8006 +    (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
  5.8007 +      KernelMode, MmCached, NULL, FALSE, _Priority)
  5.8008 +
  5.8009 +NTOSAPI
  5.8010 +PVOID
  5.8011 +DDKAPI
  5.8012 +MmGetSystemRoutineAddress(
  5.8013 +  /*IN*/ PUNICODE_STRING  SystemRoutineName);
  5.8014 +
  5.8015 +/*
  5.8016 + * ULONG
  5.8017 + * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
  5.8018 + * IN PVOID  Va,
  5.8019 + * IN ULONG  Size)
  5.8020 + */
  5.8021 +#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, \
  5.8022 +                                       _Size) \
  5.8023 +  ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
  5.8024 +    + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
  5.8025 +
  5.8026 +/*
  5.8027 + * VOID
  5.8028 + * MmInitializeMdl(
  5.8029 + * IN PMDL  MemoryDescriptorList,
  5.8030 + * IN PVOID  BaseVa,
  5.8031 + * IN SIZE_T  Length)
  5.8032 + */
  5.8033 +#define MmInitializeMdl(_MemoryDescriptorList, \
  5.8034 +                        _BaseVa, \
  5.8035 +                        _Length) \
  5.8036 +{ \
  5.8037 +  (_MemoryDescriptorList)->Next = (PMDL) NULL; \
  5.8038 +  (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
  5.8039 +    (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
  5.8040 +  (_MemoryDescriptorList)->MdlFlags = 0; \
  5.8041 +  (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
  5.8042 +  (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
  5.8043 +  (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
  5.8044 +}
  5.8045 +
  5.8046 +NTOSAPI
  5.8047 +BOOLEAN
  5.8048 +DDKAPI
  5.8049 +MmIsAddressValid(
  5.8050 +  /*IN*/ PVOID  VirtualAddress);
  5.8051 +
  5.8052 +NTOSAPI
  5.8053 +LOGICAL
  5.8054 +DDKAPI
  5.8055 +MmIsDriverVerifying(
  5.8056 +  /*IN*/ PDRIVER_OBJECT  DriverObject);
  5.8057 +
  5.8058 +NTOSAPI
  5.8059 +BOOLEAN
  5.8060 +DDKAPI
  5.8061 +MmIsThisAnNtAsSystem(
  5.8062 +  VOID);
  5.8063 +
  5.8064 +NTOSAPI
  5.8065 +NTSTATUS
  5.8066 +DDKAPI
  5.8067 +MmIsVerifierEnabled(
  5.8068 +  /*OUT*/ PULONG  VerifierFlags);
  5.8069 +
  5.8070 +NTOSAPI
  5.8071 +PVOID
  5.8072 +DDKAPI
  5.8073 +MmLockPagableDataSection(
  5.8074 +  /*IN*/ PVOID  AddressWithinSection);
  5.8075 +
  5.8076 +NTOSAPI
  5.8077 +PVOID
  5.8078 +DDKAPI
  5.8079 +MmLockPagableImageSection(
  5.8080 +  /*IN*/ PVOID  AddressWithinSection);
  5.8081 +
  5.8082 +/*
  5.8083 + * PVOID
  5.8084 + * MmLockPagableCodeSection(
  5.8085 + * IN PVOID  AddressWithinSection)
  5.8086 + */
  5.8087 +#define MmLockPagableCodeSection MmLockPagableDataSection
  5.8088 +
  5.8089 +NTOSAPI
  5.8090 +VOID
  5.8091 +DDKAPI
  5.8092 +MmLockPagableSectionByHandle(
  5.8093 +  /*IN*/ PVOID  ImageSectionHandle);
  5.8094 +
  5.8095 +NTOSAPI
  5.8096 +PVOID
  5.8097 +DDKAPI
  5.8098 +MmMapIoSpace(
  5.8099 +  /*IN*/ PHYSICAL_ADDRESS  PhysicalAddress,
  5.8100 +  /*IN*/ ULONG  NumberOfBytes,
  5.8101 +  /*IN*/ MEMORY_CACHING_TYPE  CacheEnable);
  5.8102 +
  5.8103 +NTOSAPI
  5.8104 +PVOID
  5.8105 +DDKAPI
  5.8106 +MmMapLockedPages(
  5.8107 +  /*IN*/ PMDL  MemoryDescriptorList,
  5.8108 +  /*IN*/ KPROCESSOR_MODE  AccessMode);
  5.8109 +
  5.8110 +NTOSAPI
  5.8111 +VOID
  5.8112 +DDKAPI
  5.8113 +MmPageEntireDriver(
  5.8114 +  /*IN*/ PVOID  AddressWithinSection);
  5.8115 +
  5.8116 +NTOSAPI
  5.8117 +VOID
  5.8118 +DDKAPI
  5.8119 +MmProbeAndLockProcessPages(
  5.8120 +  /*IN OUT*/ PMDL  MemoryDescriptorList,
  5.8121 +  /*IN*/ PEPROCESS  Process,
  5.8122 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.8123 +  /*IN*/ LOCK_OPERATION  Operation);
  5.8124 +
  5.8125 +NTOSAPI
  5.8126 +NTSTATUS
  5.8127 +DDKAPI
  5.8128 +MmProtectMdlSystemAddress(
  5.8129 +  /*IN*/ PMDL  MemoryDescriptorList,
  5.8130 +  /*IN*/ ULONG  NewProtect);
  5.8131 +
  5.8132 +NTOSAPI
  5.8133 +VOID
  5.8134 +DDKAPI
  5.8135 +MmUnmapLockedPages(
  5.8136 +  /*IN*/ PVOID  BaseAddress,
  5.8137 +  /*IN*/ PMDL  MemoryDescriptorList);
  5.8138 +
  5.8139 +NTOSAPI
  5.8140 +NTSTATUS
  5.8141 +DDKAPI
  5.8142 +MmUnmapViewInSessionSpace(
  5.8143 +  /*IN*/ PVOID  MappedBase);
  5.8144 +
  5.8145 +NTOSAPI
  5.8146 +NTSTATUS
  5.8147 +DDKAPI
  5.8148 +MmUnmapViewInSystemSpace(
  5.8149 +  /*IN*/ PVOID MappedBase);
  5.8150 +
  5.8151 +NTOSAPI
  5.8152 +VOID
  5.8153 +DDKAPI
  5.8154 +MmUnsecureVirtualMemory(
  5.8155 +  /*IN*/ HANDLE  SecureHandle);
  5.8156 +
  5.8157 +/*
  5.8158 + * VOID
  5.8159 + * MmPrepareMdlForReuse(
  5.8160 + * IN PMDL  Mdl)
  5.8161 + */
  5.8162 +#define MmPrepareMdlForReuse(_Mdl) \
  5.8163 +{ \
  5.8164 +  if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
  5.8165 +    ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
  5.8166 +    MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
  5.8167 +  } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
  5.8168 +    ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
  5.8169 +  } \
  5.8170 +}
  5.8171 +
  5.8172 +NTOSAPI
  5.8173 +VOID
  5.8174 +DDKAPI
  5.8175 +MmProbeAndLockPages(
  5.8176 +  /*IN OUT*/ PMDL  MemoryDescriptorList,
  5.8177 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.8178 +  /*IN*/ LOCK_OPERATION  Operation);
  5.8179 +
  5.8180 +NTOSAPI
  5.8181 +MM_SYSTEM_SIZE
  5.8182 +DDKAPI
  5.8183 +MmQuerySystemSize(
  5.8184 +  VOID);
  5.8185 +
  5.8186 +NTOSAPI
  5.8187 +NTSTATUS
  5.8188 +DDKAPI
  5.8189 +MmRemovePhysicalMemory(
  5.8190 +  /*IN*/ PPHYSICAL_ADDRESS  StartAddress,
  5.8191 +  /*IN OUT*/ PLARGE_INTEGER  NumberOfBytes);
  5.8192 +
  5.8193 +NTOSAPI
  5.8194 +VOID
  5.8195 +DDKAPI
  5.8196 +MmResetDriverPaging(
  5.8197 +  /*IN*/ PVOID  AddressWithinSection);
  5.8198 +
  5.8199 +NTOSAPI
  5.8200 +HANDLE
  5.8201 +DDKAPI
  5.8202 +MmSecureVirtualMemory(
  5.8203 +  /*IN*/ PVOID  Address,
  5.8204 +  /*IN*/ SIZE_T  Size,
  5.8205 +  /*IN*/ ULONG  ProbeMode);
  5.8206 +
  5.8207 +NTOSAPI
  5.8208 +ULONG
  5.8209 +DDKAPI
  5.8210 +MmSizeOfMdl(
  5.8211 +  /*IN*/ PVOID  Base,
  5.8212 +  /*IN*/ SIZE_T  Length);
  5.8213 +
  5.8214 +NTOSAPI
  5.8215 +VOID
  5.8216 +DDKAPI
  5.8217 +MmUnlockPagableImageSection(
  5.8218 +  /*IN*/ PVOID  ImageSectionHandle);
  5.8219 +
  5.8220 +NTOSAPI
  5.8221 +VOID
  5.8222 +DDKAPI
  5.8223 +MmUnlockPages(
  5.8224 +  /*IN*/ PMDL  MemoryDescriptorList);
  5.8225 +
  5.8226 +NTOSAPI
  5.8227 +VOID
  5.8228 +DDKAPI
  5.8229 +MmUnmapIoSpace(
  5.8230 +  /*IN*/ PVOID  BaseAddress,
  5.8231 +  /*IN*/ SIZE_T  NumberOfBytes);
  5.8232 +
  5.8233 +NTOSAPI
  5.8234 +VOID
  5.8235 +DDKAPI
  5.8236 +MmUnmapReservedMapping(
  5.8237 +  /*IN*/ PVOID  BaseAddress,
  5.8238 +  /*IN*/ ULONG  PoolTag,
  5.8239 +  /*IN*/ PMDL  MemoryDescriptorList);
  5.8240 +
  5.8241 +NTOSAPI
  5.8242 +VOID
  5.8243 +DDKAPI
  5.8244 +MmUnmapVideoDisplay(
  5.8245 +  /*IN*/ PVOID  BaseAddress,
  5.8246 +  /*IN*/ SIZE_T  NumberOfBytes);
  5.8247 +
  5.8248 +
  5.8249 +
  5.8250 +/** Object manager routines **/
  5.8251 +
  5.8252 +NTOSAPI
  5.8253 +NTSTATUS
  5.8254 +DDKAPI
  5.8255 +ObAssignSecurity(
  5.8256 +  /*IN*/ PACCESS_STATE  AccessState,
  5.8257 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  5.8258 +  /*IN*/ PVOID  Object,
  5.8259 +  /*IN*/ POBJECT_TYPE  Type);
  5.8260 +
  5.8261 +NTOSAPI
  5.8262 +VOID
  5.8263 +DDKAPI
  5.8264 +ObDereferenceSecurityDescriptor(
  5.8265 +  PSECURITY_DESCRIPTOR  SecurityDescriptor,
  5.8266 +  ULONG  Count);
  5.8267 +
  5.8268 +NTOSAPI
  5.8269 +VOID
  5.8270 +DDKFASTAPI
  5.8271 +ObfDereferenceObject(
  5.8272 +  /*IN*/ PVOID  Object);
  5.8273 +
  5.8274 +/*
  5.8275 + * VOID
  5.8276 + * ObDereferenceObject(
  5.8277 + * IN PVOID  Object)
  5.8278 + */
  5.8279 +#define ObDereferenceObject ObfDereferenceObject
  5.8280 +
  5.8281 +NTOSAPI
  5.8282 +NTSTATUS
  5.8283 +DDKAPI
  5.8284 +ObGetObjectSecurity(
  5.8285 +  /*IN*/ PVOID  Object,
  5.8286 +  /*OUT*/ PSECURITY_DESCRIPTOR  *SecurityDescriptor,
  5.8287 +  /*OUT*/ PBOOLEAN  MemoryAllocated); 
  5.8288 +
  5.8289 +NTOSAPI
  5.8290 +NTSTATUS
  5.8291 +DDKAPI
  5.8292 +ObInsertObject(
  5.8293 +  /*IN*/ PVOID  Object,
  5.8294 +  /*IN*/ PACCESS_STATE  PassedAccessState  /*OPTIONAL*/,
  5.8295 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8296 +  /*IN*/ ULONG  AdditionalReferences,
  5.8297 +  /*OUT*/ PVOID*  ReferencedObject  /*OPTIONAL*/,
  5.8298 +  /*OUT*/ PHANDLE  Handle);
  5.8299 +
  5.8300 +NTOSAPI
  5.8301 +VOID
  5.8302 +DDKFASTAPI
  5.8303 +ObfReferenceObject(
  5.8304 +  /*IN*/ PVOID  Object);
  5.8305 +
  5.8306 +NTOSAPI
  5.8307 +NTSTATUS
  5.8308 +DDKAPI
  5.8309 +ObLogSecurityDescriptor(
  5.8310 +  /*IN*/ PSECURITY_DESCRIPTOR  InputSecurityDescriptor,
  5.8311 +  /*OUT*/ PSECURITY_DESCRIPTOR  *OutputSecurityDescriptor,
  5.8312 +  /*IN*/ ULONG RefBias);
  5.8313 +/*
  5.8314 + * VOID
  5.8315 + * ObReferenceObject(
  5.8316 + * IN PVOID  Object)
  5.8317 + */
  5.8318 +#define ObReferenceObject ObfReferenceObject
  5.8319 +
  5.8320 +NTOSAPI
  5.8321 +VOID
  5.8322 +DDKAPI
  5.8323 +ObMakeTemporaryObject(
  5.8324 +  /*IN*/ PVOID  Object);
  5.8325 +
  5.8326 +NTOSAPI
  5.8327 +NTSTATUS
  5.8328 +DDKAPI
  5.8329 +ObOpenObjectByName(
  5.8330 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8331 +  /*IN*/ POBJECT_TYPE  ObjectType,
  5.8332 +  /*IN OUT*/ PVOID  ParseContext  /*OPTIONAL*/,
  5.8333 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.8334 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8335 +  /*IN*/ PACCESS_STATE  PassedAccessState,
  5.8336 +  /*OUT*/ PHANDLE  Handle);
  5.8337 +
  5.8338 +NTOSAPI
  5.8339 +NTSTATUS
  5.8340 +DDKAPI
  5.8341 +ObOpenObjectByPointer(
  5.8342 +  /*IN*/ PVOID  Object,
  5.8343 +  /*IN*/ ULONG  HandleAttributes,
  5.8344 +  /*IN*/ PACCESS_STATE  PassedAccessState  /*OPTIONAL*/,
  5.8345 +  /*IN*/ ACCESS_MASK  DesiredAccess  /*OPTIONAL*/,
  5.8346 +  /*IN*/ POBJECT_TYPE  ObjectType  /*OPTIONAL*/,
  5.8347 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.8348 +  /*OUT*/ PHANDLE  Handle);
  5.8349 +
  5.8350 +NTOSAPI
  5.8351 +NTSTATUS
  5.8352 +DDKAPI
  5.8353 +ObQueryObjectAuditingByHandle(
  5.8354 +  /*IN*/ HANDLE  Handle,
  5.8355 +  /*OUT*/ PBOOLEAN  GenerateOnClose);
  5.8356 +
  5.8357 +NTOSAPI
  5.8358 +NTSTATUS
  5.8359 +DDKAPI
  5.8360 +ObReferenceObjectByHandle(
  5.8361 +  /*IN*/ HANDLE  Handle,
  5.8362 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8363 +  /*IN*/ POBJECT_TYPE  ObjectType  /*OPTIONAL*/,
  5.8364 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.8365 +  /*OUT*/ PVOID  *Object,
  5.8366 +  /*OUT*/ POBJECT_HANDLE_INFORMATION  HandleInformation  /*OPTIONAL*/);
  5.8367 +
  5.8368 +NTOSAPI
  5.8369 +NTSTATUS
  5.8370 +DDKAPI
  5.8371 +ObReferenceObjectByName(
  5.8372 +  /*IN*/ PUNICODE_STRING  ObjectPath,
  5.8373 +  /*IN*/ ULONG  Attributes,
  5.8374 +  /*IN*/ PACCESS_STATE  PassedAccessState  /*OPTIONAL*/,
  5.8375 +  /*IN*/ ACCESS_MASK  DesiredAccess  /*OPTIONAL*/,
  5.8376 +  /*IN*/ POBJECT_TYPE  ObjectType,
  5.8377 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.8378 +  /*IN OUT*/ PVOID  ParseContext  /*OPTIONAL*/,
  5.8379 +  /*OUT*/ PVOID  *Object);
  5.8380 +
  5.8381 +NTOSAPI
  5.8382 +NTSTATUS
  5.8383 +DDKAPI
  5.8384 +ObReferenceObjectByPointer(
  5.8385 +  /*IN*/ PVOID  Object,
  5.8386 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8387 +  /*IN*/ POBJECT_TYPE  ObjectType,
  5.8388 +  /*IN*/ KPROCESSOR_MODE  AccessMode);
  5.8389 +
  5.8390 +NTOSAPI
  5.8391 +VOID
  5.8392 +DDKAPI
  5.8393 +ObReferenceSecurityDescriptor(
  5.8394 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  5.8395 +  /*IN*/ ULONG  Count);
  5.8396 +
  5.8397 +NTOSAPI
  5.8398 +VOID
  5.8399 +DDKAPI
  5.8400 +ObReleaseObjectSecurity(
  5.8401 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  5.8402 +  /*IN*/ BOOLEAN  MemoryAllocated);
  5.8403 +
  5.8404 +
  5.8405 +
  5.8406 +/** Process manager routines **/
  5.8407 +
  5.8408 +NTOSAPI
  5.8409 +NTSTATUS
  5.8410 +DDKAPI
  5.8411 +PsCreateSystemProcess(
  5.8412 +  /*IN*/ PHANDLE  ProcessHandle,
  5.8413 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8414 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  5.8415 +
  5.8416 +NTOSAPI
  5.8417 +NTSTATUS
  5.8418 +DDKAPI
  5.8419 +PsCreateSystemThread(
  5.8420 +  /*OUT*/ PHANDLE  ThreadHandle,
  5.8421 +  /*IN*/ ULONG  DesiredAccess,
  5.8422 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes  /*OPTIONAL*/,
  5.8423 +  /*IN*/ HANDLE  ProcessHandle  /*OPTIONAL*/,
  5.8424 +  /*OUT*/ PCLIENT_ID  ClientId  /*OPTIONAL*/,
  5.8425 +  /*IN*/ PKSTART_ROUTINE  StartRoutine,
  5.8426 +  /*IN*/ PVOID  StartContext);
  5.8427 +
  5.8428 +/*
  5.8429 + * PEPROCESS
  5.8430 + * PsGetCurrentProcess(VOID)
  5.8431 + */
  5.8432 +#define PsGetCurrentProcess IoGetCurrentProcess
  5.8433 +
  5.8434 +NTOSAPI
  5.8435 +HANDLE
  5.8436 +DDKAPI
  5.8437 +PsGetCurrentProcessId(
  5.8438 +  VOID);
  5.8439 +
  5.8440 +/*
  5.8441 + * PETHREAD
  5.8442 + * PsGetCurrentThread(VOID)
  5.8443 + */
  5.8444 +#define PsGetCurrentThread() \
  5.8445 +  ((PETHREAD) KeGetCurrentThread())
  5.8446 +
  5.8447 +NTOSAPI
  5.8448 +HANDLE
  5.8449 +DDKAPI
  5.8450 +PsGetCurrentThreadId(
  5.8451 +  VOID);
  5.8452 +
  5.8453 +NTOSAPI
  5.8454 +BOOLEAN
  5.8455 +DDKAPI
  5.8456 +PsGetVersion(
  5.8457 +  PULONG  MajorVersion  /*OPTIONAL*/,
  5.8458 +  PULONG  MinorVersion  /*OPTIONAL*/,
  5.8459 +  PULONG  BuildNumber  /*OPTIONAL*/,
  5.8460 +  PUNICODE_STRING  CSDVersion  /*OPTIONAL*/);
  5.8461 +
  5.8462 +NTOSAPI
  5.8463 +NTSTATUS
  5.8464 +DDKAPI
  5.8465 +PsRemoveCreateThreadNotifyRoutine(
  5.8466 +  /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE  NotifyRoutine);
  5.8467 +
  5.8468 +NTOSAPI
  5.8469 +NTSTATUS
  5.8470 +DDKAPI
  5.8471 +PsRemoveLoadImageNotifyRoutine(
  5.8472 +  /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE  NotifyRoutine);
  5.8473 +
  5.8474 +NTOSAPI
  5.8475 +NTSTATUS
  5.8476 +DDKAPI
  5.8477 +PsSetCreateProcessNotifyRoutine(
  5.8478 +  /*IN*/ PCREATE_PROCESS_NOTIFY_ROUTINE  NotifyRoutine,
  5.8479 +  /*IN*/ BOOLEAN  Remove);
  5.8480 +
  5.8481 +NTOSAPI
  5.8482 +NTSTATUS
  5.8483 +DDKAPI
  5.8484 +PsSetCreateThreadNotifyRoutine(
  5.8485 +  /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE  NotifyRoutine);
  5.8486 +
  5.8487 +NTOSAPI
  5.8488 +NTSTATUS
  5.8489 +DDKAPI
  5.8490 +PsSetLoadImageNotifyRoutine(
  5.8491 +  /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE  NotifyRoutine);
  5.8492 +
  5.8493 +NTOSAPI
  5.8494 +NTSTATUS
  5.8495 +DDKAPI
  5.8496 +PsTerminateSystemThread(
  5.8497 +  /*IN*/ NTSTATUS  ExitStatus);
  5.8498 +
  5.8499 +
  5.8500 +
  5.8501 +/** Security reference monitor routines **/
  5.8502 +
  5.8503 +NTOSAPI
  5.8504 +BOOLEAN
  5.8505 +DDKAPI
  5.8506 +SeAccessCheck(
  5.8507 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  5.8508 +  /*IN*/ PSECURITY_SUBJECT_CONTEXT  SubjectSecurityContext,
  5.8509 +  /*IN*/ BOOLEAN  SubjectContextLocked,
  5.8510 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8511 +  /*IN*/ ACCESS_MASK  PreviouslyGrantedAccess,
  5.8512 +  /*OUT*/ PPRIVILEGE_SET  *Privileges  /*OPTIONAL*/,
  5.8513 +  /*IN*/ PGENERIC_MAPPING  GenericMapping,
  5.8514 +  /*IN*/ KPROCESSOR_MODE  AccessMode,
  5.8515 +  /*OUT*/ PACCESS_MASK  GrantedAccess,
  5.8516 +  /*OUT*/ PNTSTATUS  AccessStatus);
  5.8517 +
  5.8518 +NTOSAPI
  5.8519 +NTSTATUS
  5.8520 +DDKAPI
  5.8521 +SeAssignSecurity(
  5.8522 +  /*IN*/ PSECURITY_DESCRIPTOR  ParentDescriptor  /*OPTIONAL*/,
  5.8523 +  /*IN*/ PSECURITY_DESCRIPTOR  ExplicitDescriptor  /*OPTIONAL*/,
  5.8524 +  /*OUT*/ PSECURITY_DESCRIPTOR  *NewDescriptor,
  5.8525 +  /*IN*/ BOOLEAN  IsDirectoryObject,
  5.8526 +  /*IN*/ PSECURITY_SUBJECT_CONTEXT  SubjectContext,
  5.8527 +  /*IN*/ PGENERIC_MAPPING  GenericMapping,
  5.8528 +  /*IN*/ POOL_TYPE  PoolType);
  5.8529 +
  5.8530 +NTOSAPI
  5.8531 +NTSTATUS
  5.8532 +DDKAPI
  5.8533 +SeAssignSecurityEx(
  5.8534 +  /*IN*/ PSECURITY_DESCRIPTOR  ParentDescriptor  /*OPTIONAL*/,
  5.8535 +  /*IN*/ PSECURITY_DESCRIPTOR  ExplicitDescriptor  /*OPTIONAL*/,
  5.8536 +  /*OUT*/ PSECURITY_DESCRIPTOR  *NewDescriptor,
  5.8537 +  /*IN*/ GUID  *ObjectType  /*OPTIONAL*/,
  5.8538 +  /*IN*/ BOOLEAN  IsDirectoryObject,
  5.8539 +  /*IN*/ ULONG  AutoInheritFlags,
  5.8540 +  /*IN*/ PSECURITY_SUBJECT_CONTEXT  SubjectContext,
  5.8541 +  /*IN*/ PGENERIC_MAPPING  GenericMapping,
  5.8542 +  /*IN*/ POOL_TYPE  PoolType);
  5.8543 +
  5.8544 +NTOSAPI
  5.8545 +NTSTATUS
  5.8546 +DDKAPI
  5.8547 +SeDeassignSecurity(
  5.8548 +  /*IN OUT*/ PSECURITY_DESCRIPTOR  *SecurityDescriptor);
  5.8549 +
  5.8550 +NTOSAPI
  5.8551 +BOOLEAN
  5.8552 +DDKAPI
  5.8553 +SeSinglePrivilegeCheck(
  5.8554 +  LUID  PrivilegeValue,
  5.8555 +  KPROCESSOR_MODE  PreviousMode);
  5.8556 +
  5.8557 +NTOSAPI
  5.8558 +BOOLEAN
  5.8559 +DDKAPI
  5.8560 +SeValidSecurityDescriptor(
  5.8561 +  /*IN*/ ULONG  Length,
  5.8562 +  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor);
  5.8563 +
  5.8564 +
  5.8565 +
  5.8566 +/** NtXxx routines **/
  5.8567 +
  5.8568 +NTOSAPI
  5.8569 +NTSTATUS
  5.8570 +DDKAPI
  5.8571 +NtOpenProcess(
  5.8572 +  /*OUT*/ PHANDLE  ProcessHandle,
  5.8573 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8574 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8575 +  /*IN*/ PCLIENT_ID  ClientId  /*OPTIONAL*/);
  5.8576 +
  5.8577 +NTOSAPI
  5.8578 +NTSTATUS
  5.8579 +DDKAPI
  5.8580 +NtQueryInformationProcess(
  5.8581 +  /*IN*/ HANDLE  ProcessHandle,
  5.8582 +  /*IN*/ PROCESSINFOCLASS  ProcessInformationClass,
  5.8583 +  /*OUT*/ PVOID  ProcessInformation,
  5.8584 +  /*IN*/ ULONG  ProcessInformationLength,
  5.8585 +  /*OUT*/ PULONG  ReturnLength /*OPTIONAL*/);
  5.8586 +
  5.8587 +
  5.8588 +
  5.8589 +/** NtXxx and ZwXxx routines **/
  5.8590 +
  5.8591 +NTOSAPI
  5.8592 +NTSTATUS
  5.8593 +DDKAPI
  5.8594 +ZwCancelTimer(
  5.8595 +  /*IN*/ HANDLE  TimerHandle,
  5.8596 +  /*OUT*/ PBOOLEAN  CurrentState  /*OPTIONAL*/);
  5.8597 +
  5.8598 +NTOSAPI
  5.8599 +NTSTATUS
  5.8600 +DDKAPI
  5.8601 +NtClose(
  5.8602 +  /*IN*/ HANDLE  Handle);
  5.8603 +
  5.8604 +NTOSAPI
  5.8605 +NTSTATUS
  5.8606 +DDKAPI
  5.8607 +ZwClose(
  5.8608 +  /*IN*/ HANDLE  Handle);
  5.8609 +
  5.8610 +NTOSAPI
  5.8611 +NTSTATUS
  5.8612 +DDKAPI
  5.8613 +ZwCreateDirectoryObject(
  5.8614 +  /*OUT*/ PHANDLE  DirectoryHandle,
  5.8615 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8616 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  5.8617 +
  5.8618 +NTOSAPI
  5.8619 +NTSTATUS
  5.8620 +DDKAPI
  5.8621 +NtCreateEvent(
  5.8622 +  /*OUT*/ PHANDLE  EventHandle,
  5.8623 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8624 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8625 +  /*IN*/ BOOLEAN  ManualReset,
  5.8626 +  /*IN*/ BOOLEAN  InitialState);
  5.8627 +
  5.8628 +NTOSAPI
  5.8629 +NTSTATUS
  5.8630 +DDKAPI
  5.8631 +ZwCreateEvent(
  5.8632 +  /*OUT*/ PHANDLE  EventHandle,
  5.8633 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8634 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8635 +  /*IN*/ BOOLEAN  ManualReset,
  5.8636 +  /*IN*/ BOOLEAN  InitialState);
  5.8637 +
  5.8638 +NTOSAPI
  5.8639 +NTSTATUS
  5.8640 +DDKAPI
  5.8641 +ZwCreateFile(
  5.8642 +  /*OUT*/ PHANDLE  FileHandle,
  5.8643 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8644 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8645 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.8646 +  /*IN*/ PLARGE_INTEGER  AllocationSize  /*OPTIONAL*/,
  5.8647 +  /*IN*/ ULONG  FileAttributes,
  5.8648 +  /*IN*/ ULONG  ShareAccess,
  5.8649 +  /*IN*/ ULONG  CreateDisposition,
  5.8650 +  /*IN*/ ULONG  CreateOptions,
  5.8651 +  /*IN*/ PVOID  EaBuffer  /*OPTIONAL*/,
  5.8652 +  /*IN*/ ULONG  EaLength);
  5.8653 +
  5.8654 +NTOSAPI
  5.8655 +NTSTATUS
  5.8656 +DDKAPI
  5.8657 +ZwCreateKey(
  5.8658 +  /*OUT*/ PHANDLE  KeyHandle,
  5.8659 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8660 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8661 +  /*IN*/ ULONG  TitleIndex,
  5.8662 +  /*IN*/ PUNICODE_STRING  Class  /*OPTIONAL*/,
  5.8663 +  /*IN*/ ULONG  CreateOptions,
  5.8664 +  /*OUT*/ PULONG  Disposition  /*OPTIONAL*/);
  5.8665 +
  5.8666 +NTOSAPI
  5.8667 +NTSTATUS
  5.8668 +DDKAPI
  5.8669 +ZwCreateTimer(
  5.8670 +  /*OUT*/ PHANDLE  TimerHandle,
  5.8671 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8672 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes  /*OPTIONAL*/,
  5.8673 +  /*IN*/ TIMER_TYPE  TimerType);
  5.8674 +
  5.8675 +NTOSAPI
  5.8676 +NTSTATUS
  5.8677 +DDKAPI
  5.8678 +ZwDeleteKey(
  5.8679 +  /*IN*/ HANDLE  KeyHandle);
  5.8680 +
  5.8681 +NTOSAPI
  5.8682 +NTSTATUS
  5.8683 +DDKAPI
  5.8684 +ZwDeleteValueKey(
  5.8685 +  /*IN*/ HANDLE  KeyHandle,
  5.8686 +  /*IN*/ PUNICODE_STRING  ValueName);
  5.8687 +
  5.8688 +NTOSAPI
  5.8689 +NTSTATUS
  5.8690 +DDKAPI
  5.8691 +NtDeviceIoControlFile(
  5.8692 +  /*IN*/ HANDLE  DeviceHandle,
  5.8693 +  /*IN*/ HANDLE  Event  /*OPTIONAL*/, 
  5.8694 +  /*IN*/ PIO_APC_ROUTINE  UserApcRoutine  /*OPTIONAL*/, 
  5.8695 +  /*IN*/ PVOID  UserApcContext  /*OPTIONAL*/, 
  5.8696 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock, 
  5.8697 +  /*IN*/ ULONG  IoControlCode,
  5.8698 +  /*IN*/ PVOID  InputBuffer, 
  5.8699 +  /*IN*/ ULONG  InputBufferSize,
  5.8700 +  /*OUT*/ PVOID  OutputBuffer,
  5.8701 +  /*IN*/ ULONG  OutputBufferSize);
  5.8702 +
  5.8703 +NTOSAPI
  5.8704 +NTSTATUS
  5.8705 +DDKAPI
  5.8706 +ZwDeviceIoControlFile(
  5.8707 +  /*IN*/ HANDLE  DeviceHandle,
  5.8708 +  /*IN*/ HANDLE  Event  /*OPTIONAL*/, 
  5.8709 +  /*IN*/ PIO_APC_ROUTINE  UserApcRoutine  /*OPTIONAL*/, 
  5.8710 +  /*IN*/ PVOID  UserApcContext  /*OPTIONAL*/, 
  5.8711 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock, 
  5.8712 +  /*IN*/ ULONG  IoControlCode,
  5.8713 +  /*IN*/ PVOID  InputBuffer, 
  5.8714 +  /*IN*/ ULONG  InputBufferSize,
  5.8715 +  /*OUT*/ PVOID  OutputBuffer,
  5.8716 +  /*IN*/ ULONG  OutputBufferSize);
  5.8717 +
  5.8718 +NTOSAPI
  5.8719 +NTSTATUS
  5.8720 +DDKAPI
  5.8721 +ZwEnumerateKey(
  5.8722 +  /*IN*/ HANDLE  KeyHandle,
  5.8723 +  /*IN*/ ULONG  Index,
  5.8724 +  /*IN*/ KEY_INFORMATION_CLASS  KeyInformationClass,
  5.8725 +  /*OUT*/ PVOID  KeyInformation,
  5.8726 +  /*IN*/ ULONG  Length,
  5.8727 +  /*OUT*/ PULONG  ResultLength);
  5.8728 +
  5.8729 +NTOSAPI
  5.8730 +NTSTATUS
  5.8731 +DDKAPI
  5.8732 +ZwEnumerateValueKey(
  5.8733 +  /*IN*/ HANDLE  KeyHandle,
  5.8734 +  /*IN*/ ULONG  Index,
  5.8735 +  /*IN*/ KEY_VALUE_INFORMATION_CLASS  KeyValueInformationClass,
  5.8736 +  /*OUT*/ PVOID  KeyValueInformation,
  5.8737 +  /*IN*/ ULONG  Length,
  5.8738 +  /*OUT*/ PULONG  ResultLength);
  5.8739 +
  5.8740 +NTOSAPI
  5.8741 +NTSTATUS
  5.8742 +DDKAPI
  5.8743 +ZwFlushKey(
  5.8744 +  /*IN*/ HANDLE  KeyHandle);
  5.8745 +
  5.8746 +NTOSAPI
  5.8747 +NTSTATUS
  5.8748 +DDKAPI
  5.8749 +ZwMakeTemporaryObject(
  5.8750 +  /*IN*/ HANDLE  Handle);
  5.8751 +
  5.8752 +NTOSAPI
  5.8753 +NTSTATUS
  5.8754 +DDKAPI
  5.8755 +NtMapViewOfSection(
  5.8756 +  /*IN*/ HANDLE  SectionHandle,
  5.8757 +  /*IN*/ HANDLE  ProcessHandle,
  5.8758 +  /*IN OUT*/ PVOID  *BaseAddress,
  5.8759 +  /*IN*/ ULONG  ZeroBits,
  5.8760 +  /*IN*/ ULONG  CommitSize,
  5.8761 +  /*IN OUT*/ PLARGE_INTEGER  SectionOffset  /*OPTIONAL*/,
  5.8762 +  /*IN OUT*/ PSIZE_T  ViewSize,
  5.8763 +  /*IN*/ SECTION_INHERIT  InheritDisposition,
  5.8764 +  /*IN*/ ULONG  AllocationType,
  5.8765 +  /*IN*/ ULONG  Protect);
  5.8766 +
  5.8767 +NTOSAPI
  5.8768 +NTSTATUS
  5.8769 +DDKAPI
  5.8770 +ZwMapViewOfSection(
  5.8771 +  /*IN*/ HANDLE  SectionHandle,
  5.8772 +  /*IN*/ HANDLE  ProcessHandle,
  5.8773 +  /*IN OUT*/ PVOID  *BaseAddress,
  5.8774 +  /*IN*/ ULONG  ZeroBits,
  5.8775 +  /*IN*/ ULONG  CommitSize,
  5.8776 +  /*IN OUT*/ PLARGE_INTEGER  SectionOffset  /*OPTIONAL*/,
  5.8777 +  /*IN OUT*/ PSIZE_T  ViewSize,
  5.8778 +  /*IN*/ SECTION_INHERIT  InheritDisposition,
  5.8779 +  /*IN*/ ULONG  AllocationType,
  5.8780 +  /*IN*/ ULONG  Protect);
  5.8781 +
  5.8782 +NTOSAPI
  5.8783 +NTSTATUS
  5.8784 +DDKAPI
  5.8785 +NtOpenFile(
  5.8786 +  /*OUT*/ PHANDLE  FileHandle,
  5.8787 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8788 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8789 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.8790 +  /*IN*/ ULONG  ShareAccess,
  5.8791 +  /*IN*/ ULONG  OpenOptions);
  5.8792 +
  5.8793 +NTOSAPI
  5.8794 +NTSTATUS
  5.8795 +DDKAPI
  5.8796 +ZwOpenFile(
  5.8797 +  /*OUT*/ PHANDLE  FileHandle,
  5.8798 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8799 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  5.8800 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.8801 +  /*IN*/ ULONG  ShareAccess,
  5.8802 +  /*IN*/ ULONG  OpenOptions);
  5.8803 +
  5.8804 +NTOSAPI
  5.8805 +NTSTATUS
  5.8806 +DDKAPI
  5.8807 +ZwOpenKey(
  5.8808 +  /*OUT*/ PHANDLE  KeyHandle,
  5.8809 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8810 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  5.8811 +
  5.8812 +NTOSAPI
  5.8813 +NTSTATUS
  5.8814 +DDKAPI
  5.8815 +ZwOpenSection(
  5.8816 +  /*OUT*/ PHANDLE  SectionHandle,
  5.8817 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8818 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  5.8819 +
  5.8820 +NTOSAPI
  5.8821 +NTSTATUS
  5.8822 +DDKAPI
  5.8823 +ZwOpenSymbolicLinkObject(
  5.8824 +  /*OUT*/ PHANDLE  LinkHandle,
  5.8825 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8826 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  5.8827 +
  5.8828 +NTOSAPI
  5.8829 +NTSTATUS
  5.8830 +DDKAPI
  5.8831 +ZwOpenTimer(
  5.8832 +  /*OUT*/ PHANDLE  TimerHandle,
  5.8833 +  /*IN*/ ACCESS_MASK  DesiredAccess,
  5.8834 +  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  5.8835 +
  5.8836 +NTOSAPI
  5.8837 +NTSTATUS
  5.8838 +DDKAPI
  5.8839 +ZwQueryInformationFile(
  5.8840 +  /*IN*/ HANDLE  FileHandle,
  5.8841 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.8842 +  /*OUT*/ PVOID  FileInformation,
  5.8843 +  /*IN*/ ULONG  Length,
  5.8844 +  /*IN*/ FILE_INFORMATION_CLASS  FileInformationClass);
  5.8845 +
  5.8846 +NTOSAPI
  5.8847 +NTSTATUS
  5.8848 +DDKAPI
  5.8849 +ZwQueryKey(
  5.8850 +  /*IN*/ HANDLE  KeyHandle,
  5.8851 +  /*IN*/ KEY_INFORMATION_CLASS  KeyInformationClass,
  5.8852 +  /*OUT*/ PVOID  KeyInformation,
  5.8853 +  /*IN*/ ULONG  Length,
  5.8854 +  /*OUT*/ PULONG  ResultLength);
  5.8855 +
  5.8856 +NTOSAPI
  5.8857 +NTSTATUS
  5.8858 +DDKAPI
  5.8859 +ZwQuerySymbolicLinkObject(
  5.8860 +  /*IN*/ HANDLE  LinkHandle,
  5.8861 +  /*IN OUT*/ PUNICODE_STRING  LinkTarget,
  5.8862 +  /*OUT*/ PULONG  ReturnedLength  /*OPTIONAL*/);
  5.8863 +
  5.8864 +NTOSAPI
  5.8865 +NTSTATUS
  5.8866 +DDKAPI
  5.8867 +ZwQueryValueKey(
  5.8868 +  /*IN*/ HANDLE  KeyHandle,
  5.8869 +  /*IN*/ PUNICODE_STRING  ValueName,
  5.8870 +  /*IN*/ KEY_VALUE_INFORMATION_CLASS  KeyValueInformationClass,
  5.8871 +  /*OUT*/ PVOID  KeyValueInformation,
  5.8872 +  /*IN*/ ULONG  Length,
  5.8873 +  /*OUT*/ PULONG  ResultLength);
  5.8874 +
  5.8875 +NTOSAPI
  5.8876 +NTSTATUS
  5.8877 +DDKAPI
  5.8878 +NtReadFile(
  5.8879 +  /*IN*/ HANDLE  FileHandle,
  5.8880 +  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  5.8881 +  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  5.8882 +  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  5.8883 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.8884 +  /*OUT*/ PVOID  Buffer,
  5.8885 +  /*IN*/ ULONG  Length,
  5.8886 +  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  5.8887 +  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  5.8888 +
  5.8889 +NTOSAPI
  5.8890 +NTSTATUS
  5.8891 +DDKAPI
  5.8892 +ZwReadFile(
  5.8893 +  /*IN*/ HANDLE  FileHandle,
  5.8894 +  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  5.8895 +  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  5.8896 +  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  5.8897 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.8898 +  /*OUT*/ PVOID  Buffer,
  5.8899 +  /*IN*/ ULONG  Length,
  5.8900 +  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  5.8901 +  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  5.8902 +
  5.8903 +NTOSAPI
  5.8904 +NTSTATUS
  5.8905 +DDKAPI
  5.8906 +NtSetEvent(
  5.8907 +  /*IN*/ HANDLE  EventHandle,
  5.8908 +  /*IN*/ PULONG  NumberOfThreadsReleased);
  5.8909 +
  5.8910 +NTOSAPI
  5.8911 +NTSTATUS
  5.8912 +DDKAPI
  5.8913 +ZwSetEvent(
  5.8914 +  /*IN*/ HANDLE  EventHandle,
  5.8915 +  /*IN*/ PULONG  NumberOfThreadsReleased);
  5.8916 +
  5.8917 +NTOSAPI
  5.8918 +NTSTATUS
  5.8919 +DDKAPI
  5.8920 +ZwSetInformationFile(
  5.8921 +  /*IN*/ HANDLE  FileHandle,
  5.8922 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.8923 +  /*IN*/ PVOID  FileInformation,
  5.8924 +  /*IN*/ ULONG  Length,
  5.8925 +  /*IN*/ FILE_INFORMATION_CLASS  FileInformationClass);
  5.8926 +
  5.8927 +NTOSAPI
  5.8928 +NTSTATUS
  5.8929 +DDKAPI
  5.8930 +ZwSetInformationThread(
  5.8931 +  /*IN*/ HANDLE  ThreadHandle,
  5.8932 +  /*IN*/ THREADINFOCLASS  ThreadInformationClass,
  5.8933 +  /*IN*/ PVOID  ThreadInformation,
  5.8934 +  /*IN*/ ULONG  ThreadInformationLength);
  5.8935 +
  5.8936 +NTOSAPI
  5.8937 +NTSTATUS
  5.8938 +DDKAPI
  5.8939 +ZwSetTimer(
  5.8940 +  /*IN*/ HANDLE  TimerHandle,
  5.8941 +  /*IN*/ PLARGE_INTEGER  DueTime,
  5.8942 +  /*IN*/ PTIMER_APC_ROUTINE  TimerApcRoutine  /*OPTIONAL*/,
  5.8943 +  /*IN*/ PVOID  TimerContext  /*OPTIONAL*/,
  5.8944 +  /*IN*/ BOOLEAN  WakeTimer,
  5.8945 +  /*IN*/ LONG  Period  /*OPTIONAL*/,
  5.8946 +  /*OUT*/ PBOOLEAN  PreviousState  /*OPTIONAL*/);
  5.8947 +
  5.8948 +NTOSAPI
  5.8949 +NTSTATUS
  5.8950 +DDKAPI
  5.8951 +ZwSetValueKey(
  5.8952 +  /*IN*/ HANDLE  KeyHandle,
  5.8953 +  /*IN*/ PUNICODE_STRING  ValueName,
  5.8954 +  /*IN*/ ULONG  TitleIndex  /*OPTIONAL*/,
  5.8955 +  /*IN*/ ULONG  Type,
  5.8956 +  /*IN*/ PVOID  Data,
  5.8957 +  /*IN*/ ULONG  DataSize);
  5.8958 +
  5.8959 +/* [Nt|Zw]MapViewOfSection.InheritDisposition constants */
  5.8960 +#define AT_EXTENDABLE_FILE                0x00002000
  5.8961 +#define SEC_NO_CHANGE                     0x00400000
  5.8962 +#define AT_RESERVED                       0x20000000
  5.8963 +#define AT_ROUND_TO_PAGE                  0x40000000
  5.8964 +
  5.8965 +NTOSAPI
  5.8966 +NTSTATUS
  5.8967 +DDKAPI
  5.8968 +NtUnmapViewOfSection(
  5.8969 +  /*IN*/ HANDLE  ProcessHandle,
  5.8970 +  /*IN*/ PVOID  BaseAddress);
  5.8971 +
  5.8972 +NTOSAPI
  5.8973 +NTSTATUS
  5.8974 +DDKAPI
  5.8975 +ZwUnmapViewOfSection(
  5.8976 +  /*IN*/ HANDLE  ProcessHandle,
  5.8977 +  /*IN*/ PVOID  BaseAddress);
  5.8978 +
  5.8979 +NTOSAPI
  5.8980 +NTSTATUS
  5.8981 +DDKAPI
  5.8982 +NtWaitForSingleObject(
  5.8983 +  /*IN*/ HANDLE  Object,
  5.8984 +  /*IN*/ BOOLEAN  Alertable,
  5.8985 +  /*IN*/ PLARGE_INTEGER  Time);
  5.8986 +
  5.8987 +NTOSAPI
  5.8988 +NTSTATUS
  5.8989 +DDKAPI
  5.8990 +ZwWaitForSingleObject(
  5.8991 +  /*IN*/ HANDLE  Object,
  5.8992 +  /*IN*/ BOOLEAN  Alertable,
  5.8993 +  /*IN*/ PLARGE_INTEGER  Time);
  5.8994 +
  5.8995 +NTOSAPI
  5.8996 +NTSTATUS
  5.8997 +DDKAPI
  5.8998 +NtWriteFile(
  5.8999 +  /*IN*/ HANDLE  FileHandle,
  5.9000 +  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  5.9001 +  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  5.9002 +  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  5.9003 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.9004 +  /*IN*/ PVOID  Buffer,
  5.9005 +  /*IN*/ ULONG  Length,
  5.9006 +  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  5.9007 +  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  5.9008 +
  5.9009 +NTOSAPI
  5.9010 +NTSTATUS
  5.9011 +DDKAPI
  5.9012 +ZwWriteFile(
  5.9013 +  /*IN*/ HANDLE  FileHandle,
  5.9014 +  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  5.9015 +  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  5.9016 +  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  5.9017 +  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  5.9018 +  /*IN*/ PVOID  Buffer,
  5.9019 +  /*IN*/ ULONG  Length,
  5.9020 +  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  5.9021 +  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  5.9022 +
  5.9023 +
  5.9024 +
  5.9025 +/** Power management support routines **/
  5.9026 +
  5.9027 +NTOSAPI
  5.9028 +NTSTATUS
  5.9029 +DDKAPI
  5.9030 +PoCallDriver(
  5.9031 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.9032 +  /*IN OUT*/ PIRP  Irp);
  5.9033 +
  5.9034 +NTOSAPI
  5.9035 +PULONG
  5.9036 +DDKAPI
  5.9037 +PoRegisterDeviceForIdleDetection(
  5.9038 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.9039 +  /*IN*/ ULONG  ConservationIdleTime,
  5.9040 +  /*IN*/ ULONG  PerformanceIdleTime,
  5.9041 +  /*IN*/ DEVICE_POWER_STATE  State);
  5.9042 +
  5.9043 +NTOSAPI
  5.9044 +PVOID
  5.9045 +DDKAPI
  5.9046 +PoRegisterSystemState(
  5.9047 +  /*IN*/ PVOID  StateHandle,
  5.9048 +  /*IN*/ EXECUTION_STATE  Flags);
  5.9049 +
  5.9050 +NTOSAPI
  5.9051 +NTSTATUS
  5.9052 +DDKAPI
  5.9053 +PoRequestPowerIrp(
  5.9054 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.9055 +  /*IN*/ UCHAR  MinorFunction,  
  5.9056 +  /*IN*/ POWER_STATE  PowerState,
  5.9057 +  /*IN*/ PREQUEST_POWER_COMPLETE  CompletionFunction,
  5.9058 +  /*IN*/ PVOID  Context,
  5.9059 +  /*OUT*/ PIRP  *Irp /*OPTIONAL*/);
  5.9060 +
  5.9061 +NTOSAPI
  5.9062 +NTSTATUS
  5.9063 +DDKAPI
  5.9064 +PoRequestShutdownEvent(
  5.9065 +  /*OUT*/ PVOID  *Event);
  5.9066 +
  5.9067 +NTOSAPI
  5.9068 +VOID
  5.9069 +DDKAPI
  5.9070 +PoSetDeviceBusy(
  5.9071 +  PULONG  IdlePointer); 
  5.9072 +
  5.9073 +NTOSAPI
  5.9074 +POWER_STATE
  5.9075 +DDKAPI
  5.9076 +PoSetPowerState(
  5.9077 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.9078 +  /*IN*/ POWER_STATE_TYPE  Type,
  5.9079 +  /*IN*/ POWER_STATE  State);
  5.9080 +
  5.9081 +NTOSAPI
  5.9082 +VOID
  5.9083 +DDKAPI
  5.9084 +PoSetSystemState(
  5.9085 +  /*IN*/ EXECUTION_STATE  Flags);
  5.9086 +
  5.9087 +NTOSAPI
  5.9088 +VOID
  5.9089 +DDKAPI
  5.9090 +PoStartNextPowerIrp(
  5.9091 +  /*IN*/ PIRP  Irp);
  5.9092 +
  5.9093 +NTOSAPI
  5.9094 +VOID
  5.9095 +DDKAPI
  5.9096 +PoUnregisterSystemState(
  5.9097 +  /*IN*/ PVOID  StateHandle);
  5.9098 +
  5.9099 +
  5.9100 +
  5.9101 +/** WMI library support routines **/
  5.9102 +
  5.9103 +NTOSAPI
  5.9104 +NTSTATUS
  5.9105 +DDKAPI
  5.9106 +WmiCompleteRequest(
  5.9107 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.9108 +  /*IN*/ PIRP  Irp,
  5.9109 +  /*IN*/ NTSTATUS  Status,
  5.9110 +  /*IN*/ ULONG  BufferUsed,
  5.9111 +  /*IN*/ CCHAR  PriorityBoost);
  5.9112 +
  5.9113 +NTOSAPI
  5.9114 +NTSTATUS
  5.9115 +DDKAPI
  5.9116 +WmiFireEvent(
  5.9117 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.9118 +  /*IN*/ LPGUID  Guid, 
  5.9119 +  /*IN*/ ULONG  InstanceIndex,
  5.9120 +  /*IN*/ ULONG  EventDataSize,
  5.9121 +  /*IN*/ PVOID  EventData); 
  5.9122 +
  5.9123 +NTOSAPI
  5.9124 +NTSTATUS
  5.9125 +DDKAPI
  5.9126 +WmiQueryTraceInformation(
  5.9127 +  /*IN*/ TRACE_INFORMATION_CLASS  TraceInformationClass,
  5.9128 +  /*OUT*/ PVOID  TraceInformation,
  5.9129 +  /*IN*/ ULONG  TraceInformationLength,
  5.9130 +  /*OUT*/ PULONG  RequiredLength /*OPTIONAL*/,
  5.9131 +  /*IN*/ PVOID  Buffer /*OPTIONAL*/);
  5.9132 +
  5.9133 +NTOSAPI
  5.9134 +NTSTATUS
  5.9135 +DDKAPI
  5.9136 +WmiSystemControl(
  5.9137 +  /*IN*/ PWMILIB_CONTEXT  WmiLibInfo,
  5.9138 +  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  5.9139 +  /*IN*/ PIRP  Irp,
  5.9140 +  /*OUT*/ PSYSCTL_IRP_DISPOSITION  IrpDisposition);
  5.9141 +
  5.9142 +NTOSAPI
  5.9143 +NTSTATUS
  5.9144 +DDKCDECLAPI
  5.9145 +WmiTraceMessage(
  5.9146 +  /*IN*/ TRACEHANDLE  LoggerHandle,
  5.9147 +  /*IN*/ ULONG  MessageFlags,
  5.9148 +  /*IN*/ LPGUID  MessageGuid,
  5.9149 +  /*IN*/ USHORT  MessageNumber,
  5.9150 +  /*IN*/ ...);
  5.9151 +
  5.9152 +#if 0
  5.9153 +/* FIXME: Get va_list from where? */
  5.9154 +NTOSAPI
  5.9155 +NTSTATUS
  5.9156 +DDKCDECLAPI
  5.9157 +WmiTraceMessageVa(
  5.9158 +  /*IN*/ TRACEHANDLE  LoggerHandle,
  5.9159 +  /*IN*/ ULONG  MessageFlags,
  5.9160 +  /*IN*/ LPGUID  MessageGuid,
  5.9161 +  /*IN*/ USHORT  MessageNumber,
  5.9162 +  /*IN*/ va_list  MessageArgList);
  5.9163 +#endif
  5.9164 +
  5.9165 +
  5.9166 +/** Kernel debugger routines **/
  5.9167 +
  5.9168 +NTOSAPI
  5.9169 +VOID
  5.9170 +DDKAPI
  5.9171 +KdDisableDebugger(
  5.9172 +  VOID);
  5.9173 +
  5.9174 +NTOSAPI
  5.9175 +VOID
  5.9176 +DDKAPI
  5.9177 +KdEnableDebugger(
  5.9178 +  VOID);
  5.9179 +
  5.9180 +NTOSAPI
  5.9181 +VOID
  5.9182 +DDKAPI
  5.9183 +DbgBreakPoint(
  5.9184 +  VOID);
  5.9185 +
  5.9186 +NTOSAPI
  5.9187 +VOID
  5.9188 +DDKAPI
  5.9189 +DbgBreakPointWithStatus(
  5.9190 +  /*IN*/ ULONG  Status);
  5.9191 +
  5.9192 +NTOSAPI
  5.9193 +ULONG
  5.9194 +DDKCDECLAPI
  5.9195 +DbgPrint(
  5.9196 +  /*IN*/ PCH  Format,
  5.9197 +  /*IN*/ ...);
  5.9198 +
  5.9199 +NTOSAPI
  5.9200 +ULONG
  5.9201 +DDKCDECLAPI
  5.9202 +DbgPrintEx(
  5.9203 +  /*IN*/ ULONG  ComponentId,
  5.9204 +  /*IN*/ ULONG  Level,
  5.9205 +  /*IN*/ PCH  Format,
  5.9206 +  /*IN*/ ...);
  5.9207 +
  5.9208 +NTOSAPI
  5.9209 +ULONG
  5.9210 +DDKCDECLAPI
  5.9211 +DbgPrintReturnControlC(
  5.9212 +  /*IN*/ PCH  Format,
  5.9213 +  /*IN*/ ...);
  5.9214 +
  5.9215 +NTOSAPI
  5.9216 +NTSTATUS
  5.9217 +DDKAPI
  5.9218 +DbgQueryDebugFilterState(
  5.9219 +  /*IN*/ ULONG  ComponentId,
  5.9220 +  /*IN*/ ULONG  Level);
  5.9221 +
  5.9222 +NTOSAPI
  5.9223 +NTSTATUS
  5.9224 +DDKAPI
  5.9225 +DbgSetDebugFilterState(
  5.9226 +  /*IN*/ ULONG  ComponentId,
  5.9227 +  /*IN*/ ULONG  Level,
  5.9228 +  /*IN*/ BOOLEAN  State);
  5.9229 +
  5.9230 +#ifdef DBG
  5.9231 +
  5.9232 +#define KdPrint(_x_) DbgPrint _x_
  5.9233 +#define KdPrintEx(_x_) DbgPrintEx _x_
  5.9234 +#define KdBreakPoint() DbgBreakPoint()
  5.9235 +#define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
  5.9236 +
  5.9237 +#else /* !DBG */
  5.9238 +
  5.9239 +#define KdPrint(_x_)
  5.9240 +#define KdPrintEx(_x_)
  5.9241 +#define KdBreakPoint()
  5.9242 +#define KdBreakPointWithStatus(s)
  5.9243 +
  5.9244 +#endif /* !DBG */
  5.9245 +
  5.9246 +extern NTOSAPI PBOOLEAN KdDebuggerNotPresent;
  5.9247 +extern NTOSAPI PBOOLEAN KdDebuggerEnabled;
  5.9248 +#define KD_DEBUGGER_ENABLED     *KdDebuggerEnabled
  5.9249 +#define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
  5.9250 +
  5.9251 +#ifdef __cplusplus
  5.9252 +}
  5.9253 +#endif
  5.9254 +
  5.9255 +#endif /* __WINDDK_H */
     6.1 --- a/xenpci/hypercall_x86_mingw.h	Wed Jul 02 09:54:40 2008 +1000
     6.2 +++ b/xenpci/hypercall_x86_mingw.h	Wed Jul 02 09:57:59 2008 +1000
     6.3 @@ -22,67 +22,40 @@
     6.4  
     6.5  #define __STR(x) #x
     6.6  #define STR(x) __STR(x)
     6.7 +
     6.8 +#if 0
     6.9 +#define HYPERCALL_STR(name)                                     \
    6.10 +	"mov $stub_addr,%%eax; "                                      \
    6.11 +	"add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "              \
    6.12 +	"call *%%eax"
    6.13 +#endif
    6.14  
    6.15 -#define HYPERCALL_STR(name)					\
    6.16 -	"mov $stub_addr,%%eax; "			    \
    6.17 -	"add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "	\
    6.18 +#define HYPERCALL_STR(name)                                     \
    6.19 +	"mov %3,%%eax; "                                      \
    6.20 +	"add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "              \
    6.21  	"call *%%eax"
    6.22  
    6.23  #define _hypercall2(type, name, a1, a2)                         \
    6.24  ({                                                              \
    6.25 -        long __res, __ign1, __ign2;                             \
    6.26 -        char *stub_addr;                                        \
    6.27 -        stub_addr = xpdd->hypercall_stubs;                      \
    6.28 -        asm volatile (                                          \
    6.29 -                HYPERCALL_STR(name)                             \
    6.30 -                : "=a" (__res), "=b" (__ign1), "=c" (__ign2)    \
    6.31 -                : "1" ((long)(a1)), "2" ((long)(a2))            \
    6.32 -                : "memory" );                                   \
    6.33 -        (type)__res;                                            \
    6.34 +  long __res, __ign1, __ign2;                                   \
    6.35 +  asm volatile (                                                \
    6.36 +    HYPERCALL_STR(name)                                         \
    6.37 +    : "=a" (__res), "=b" (__ign1), "=c" (__ign2)                \
    6.38 +    : "1" ((long)(a1)), "2" ((long)(a2)), "r" (xpdd->hypercall_stubs) \
    6.39 +    : "memory" );                                               \
    6.40 +  (type)__res;                                                  \
    6.41  })
    6.42 -
    6.43 -#define _hypercall3(type, name, a1, a2, a3)			\
    6.44 -({								\
    6.45 -	long __res, __ign1, __ign2, __ign3;			\
    6.46 -	asm volatile (						\
    6.47 -		HYPERCALL_STR(name)				\
    6.48 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2), 	\
    6.49 -		"=d" (__ign3)					\
    6.50 -		: "1" ((long)(a1)), "2" ((long)(a2)),		\
    6.51 -		"3" ((long)(a3))				\
    6.52 -		: "memory" );					\
    6.53 -	(type)__res;						\
    6.54 -})
    6.55 -
    6.56 -#define _hypercall4(type, name, a1, a2, a3, a4)			\
    6.57 -({								\
    6.58 -	long __res, __ign1, __ign2, __ign3, __ign4;		\
    6.59 -	asm volatile (						\
    6.60 -		HYPERCALL_STR(name)				\
    6.61 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),	\
    6.62 -		"=d" (__ign3), "=S" (__ign4)			\
    6.63 -		: "1" ((long)(a1)), "2" ((long)(a2)),		\
    6.64 -		"3" ((long)(a3)), "4" ((long)(a4))		\
    6.65 -		: "memory" );					\
    6.66 -	(type)__res;						\
    6.67 -})
    6.68 -
    6.69 -static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx,
    6.70 -                         unsigned int *ecx, unsigned int *edx)
    6.71 +
    6.72 +static __inline void __cpuid(uint32_t output[4], uint32_t op)
    6.73  {
    6.74    __asm__("cpuid"
    6.75 -          : "=a" (*eax),
    6.76 -            "=b" (*ebx),
    6.77 -            "=c" (*ecx),
    6.78 -            "=d" (*edx)
    6.79 +          : "=a" (output[0]),
    6.80 +            "=b" (output[1]),
    6.81 +            "=c" (output[2]),
    6.82 +            "=d" (output[3])
    6.83            : "0" (op));
    6.84  }
    6.85  
    6.86 -static __inline void __cpuid(uint32_t output[4], uint32_t op)
    6.87 -{
    6.88 -  cpuid(op, &output[0], &output[1], &output[2], &output[3]);
    6.89 -}
    6.90 -
    6.91  static __inline void __writemsr(uint32_t msr, uint64_t value)
    6.92  {
    6.93    uint32_t hi, lo;
    6.94 @@ -104,32 +77,8 @@ static __inline int
    6.95  HYPERVISOR_sched_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
    6.96  {
    6.97    return _hypercall2(int, sched_op, cmd, arg);
    6.98 -}
    6.99 -
   6.100 -static __inline int
   6.101 -HYPERVISOR_xen_version(PXENPCI_DEVICE_DATA xpdd, int cmd, void *arg)
   6.102 -{
   6.103 -  return _hypercall2(int, xen_version, cmd, arg);
   6.104 -}
   6.105 -
   6.106 -static __inline int
   6.107 -HYPERVISOR_grant_table_op(PXENPCI_DEVICE_DATA xpdd, int cmd, void *uop, unsigned int count)
   6.108 -{
   6.109 -	return _hypercall3(int, grant_table_op, cmd, uop, count);
   6.110 -}
   6.111 -
   6.112 -static __inline int
   6.113 -HYPERVISOR_mmu_update(PXENPCI_DEVICE_DATA xpdd, mmu_update_t *req, int count, int *success_count, domid_t domid)
   6.114 -{
   6.115 -	return _hypercall4(int, mmu_update, req, count, success_count, domid);
   6.116 -}
   6.117 -
   6.118 -static __inline int
   6.119 -HYPERVISOR_console_io(PXENPCI_DEVICE_DATA xpdd, int cmd, int count, char *string)
   6.120 -{
   6.121 -	return _hypercall3(int, console_io, cmd, count, string);
   6.122 -}
   6.123 -
   6.124 +}
   6.125 +
   6.126  static __inline int
   6.127  HYPERVISOR_hvm_op(PXENPCI_DEVICE_DATA xpdd, int op, struct xen_hvm_param *arg)
   6.128  {
   6.129 @@ -141,4 +90,4 @@ HYPERVISOR_event_channel_op(PXENPCI_DEVI
   6.130  {
   6.131  	return _hypercall2(int, event_channel_op, cmd, arg);
   6.132  }
   6.133 -
   6.134 +
     7.1 --- a/xenpci/makefile.mingw	Wed Jul 02 09:54:40 2008 +1000
     7.2 +++ b/xenpci/makefile.mingw	Wed Jul 02 09:57:59 2008 +1000
     7.3 @@ -1,6 +1,8 @@
     7.4 -CFLAGS = -Wall -I/usr/i586-mingw32msvc/include/ddk/ -I../common/include -I../common/include/public -Wno-multichar -Wno-unknown-pragmas
     7.5 +W32API_PATH=/home/agrover/temp/w32api-3.11/lib/ddk
     7.6  
     7.7 -xenpci.sys: xenpci.c xenbus.c evtchn.c gnttbl.c xenpci_fdo.c
     7.8 +CFLAGS = -Wall -L$(W32API_PATH) -I../mingw/inc -I/usr/i586-mingw32msvc/include/ddk/ -I../common/include -I../common/include/public -Wno-multichar -Wno-unknown-pragmas
     7.9 +
    7.10 +xenpci.sys: xenpci.c xenbus.c evtchn.c gnttbl.c xenpci_fdo.c xenpci_pdo.c memory.c mingw_extras.c
    7.11  	i586-mingw32msvc-gcc $(CFLAGS) -o $@ -s -shared -Wl,--entry,_load@8 -nostdlib $^ -lntoskrnl -lhal
    7.12  
    7.13  test.exe: test.c kexec.h
     8.1 --- a/xenpci/memory.c	Wed Jul 02 09:54:40 2008 +1000
     8.2 +++ b/xenpci/memory.c	Wed Jul 02 09:57:59 2008 +1000
     8.3 @@ -1,7 +1,7 @@
     8.4  #include "xenpci.h"
     8.5  
     8.6  //static pgentry_t *demand_map_pgt;
     8.7 -static void *demand_map_area_start;
     8.8 +//static void *demand_map_area_start;
     8.9  
    8.10  NTSTATUS
    8.11  hvm_get_stubs(PXENPCI_DEVICE_DATA xpdd)
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/xenpci/mingw_extras.c	Wed Jul 02 09:57:59 2008 +1000
     9.3 @@ -0,0 +1,568 @@
     9.4 +/*
     9.5 + * Provide missing std functions needed by the driver but not provided by
     9.6 + * MinGW. Code mostly taken from Linux or as noted.
     9.7 + *
     9.8 + * Remaining code is
     9.9 + * Copyright Andy Grover <andy.grover@oracle.com> 
    9.10 + * and licensed under the GPLv2.
    9.11 + */
    9.12 +
    9.13 +#include "xenpci.h"
    9.14 +
    9.15 +NTSTATUS
    9.16 +RtlStringCbPrintfW(
    9.17 +  win_wchar_t *dest_str,
    9.18 +  size_t dest_size,
    9.19 +  win_wchar_t *format,
    9.20 +  ...)
    9.21 +{
    9.22 +  /* TODO: fixme */
    9.23 +  return STATUS_SUCCESS;
    9.24 +}
    9.25 +
    9.26 +/* ----- BEGIN Other people's code --------- */
    9.27 +
    9.28 +/* from arch/x86/boot/string.c, used under GPLv2 */
    9.29 +/* Copyright (C) 1991, 1992 Linus Torvalds
    9.30 + * Copyright 2007 rPath, Inc. - All Rights Reserved
    9.31 + */
    9.32 +size_t strnlen(const char *s, size_t maxlen)
    9.33 +{
    9.34 +  const char *es = s;
    9.35 +  while (*es && maxlen) {
    9.36 +    es++;
    9.37 +    maxlen--;
    9.38 +  }
    9.39 +
    9.40 +  return (es - s);
    9.41 +}
    9.42 +
    9.43 +/* from arch/x86/boot/boot.h, used under GPLv2 */
    9.44 +/* Copyright (C) 1991, 1992 Linus Torvalds
    9.45 + * Copyright 2007 rPath, Inc. - All Rights Reserved
    9.46 + */
    9.47 +static int isdigit(int ch)
    9.48 +{
    9.49 +        return (ch >= '0') && (ch <= '9');
    9.50 +}
    9.51 +
    9.52 +/* from K&Rv2 p. 43 */
    9.53 +int atoi(const char s[])
    9.54 +{
    9.55 +  int i, n;
    9.56 +
    9.57 +  n = 0;
    9.58 +  for(i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
    9.59 +    n = 10 * n + (s[i] - '0');
    9.60 +  return n;
    9.61 +}
    9.62 +
    9.63 +/* from linux/lib/vsprintf.c, used under GPLv2 */
    9.64 +/* Copyright (C) 1991, 1992  Linus Torvalds
    9.65 + * Wirzenius wrote this portably, Torvalds fucked it up :-)
    9.66 + */
    9.67 +static int skip_atoi(const char **s)
    9.68 +{
    9.69 +	int i=0;
    9.70 +
    9.71 +	while (isdigit(**s))
    9.72 +		i = i*10 + *((*s)++) - '0';
    9.73 +	return i;
    9.74 +}
    9.75 +
    9.76 +int snprintf(char * buf, size_t size, const char *fmt, ...)
    9.77 +{
    9.78 +  va_list args;
    9.79 +  int i;
    9.80 +
    9.81 +  va_start(args, fmt);
    9.82 +  i = vsnprintf(buf,size,fmt,args);
    9.83 +  va_end(args);
    9.84 +  return i;
    9.85 +}
    9.86 +
    9.87 +#define do_div(n,base) ({ \
    9.88 +int __res; \
    9.89 +__res = ((unsigned long) n) % (unsigned) base; \
    9.90 +n = ((unsigned long) n) / (unsigned) base; \
    9.91 +__res; })
    9.92 +
    9.93 +
    9.94 +/* Decimal conversion is by far the most typical, and is used
    9.95 + * for /proc and /sys data. This directly impacts e.g. top performance
    9.96 + * with many processes running. We optimize it for speed
    9.97 + * using code from
    9.98 + * http://www.cs.uiowa.edu/~jones/bcd/decimal.html
    9.99 + * (with permission from the author, Douglas W. Jones). */
   9.100 +
   9.101 +/* Formats correctly any integer in [0,99999].
   9.102 + * Outputs from one to five digits depending on input.
   9.103 + * On i386 gcc 4.1.2 -O2: ~250 bytes of code. */
   9.104 +static char* put_dec_trunc(char *buf, unsigned q)
   9.105 +{
   9.106 +	unsigned d3, d2, d1, d0;
   9.107 +	d1 = (q>>4) & 0xf;
   9.108 +	d2 = (q>>8) & 0xf;
   9.109 +	d3 = (q>>12);
   9.110 +
   9.111 +	d0 = 6*(d3 + d2 + d1) + (q & 0xf);
   9.112 +	q = (d0 * 0xcd) >> 11;
   9.113 +	d0 = d0 - 10*q;
   9.114 +	*buf++ = d0 + '0'; /* least significant digit */
   9.115 +	d1 = q + 9*d3 + 5*d2 + d1;
   9.116 +	if (d1 != 0) {
   9.117 +		q = (d1 * 0xcd) >> 11;
   9.118 +		d1 = d1 - 10*q;
   9.119 +		*buf++ = d1 + '0'; /* next digit */
   9.120 +
   9.121 +		d2 = q + 2*d2;
   9.122 +		if ((d2 != 0) || (d3 != 0)) {
   9.123 +			q = (d2 * 0xd) >> 7;
   9.124 +			d2 = d2 - 10*q;
   9.125 +			*buf++ = d2 + '0'; /* next digit */
   9.126 +
   9.127 +			d3 = q + 4*d3;
   9.128 +			if (d3 != 0) {
   9.129 +				q = (d3 * 0xcd) >> 11;
   9.130 +				d3 = d3 - 10*q;
   9.131 +				*buf++ = d3 + '0';  /* next digit */
   9.132 +				if (q != 0)
   9.133 +					*buf++ = q + '0';  /* most sign. digit */
   9.134 +			}
   9.135 +		}
   9.136 +	}
   9.137 +	return buf;
   9.138 +}
   9.139 +/* Same with if's removed. Always emits five digits */
   9.140 +static char* put_dec_full(char *buf, unsigned q)
   9.141 +{
   9.142 +	/* BTW, if q is in [0,9999], 8-bit ints will be enough, */
   9.143 +	/* but anyway, gcc produces better code with full-sized ints */
   9.144 +	unsigned d3, d2, d1, d0;
   9.145 +	d1 = (q>>4) & 0xf;
   9.146 +	d2 = (q>>8) & 0xf;
   9.147 +	d3 = (q>>12);
   9.148 +
   9.149 +	/* Possible ways to approx. divide by 10 */
   9.150 +	/* gcc -O2 replaces multiply with shifts and adds */
   9.151 +	// (x * 0xcd) >> 11: 11001101 - shorter code than * 0x67 (on i386)
   9.152 +	// (x * 0x67) >> 10:  1100111
   9.153 +	// (x * 0x34) >> 9:    110100 - same
   9.154 +	// (x * 0x1a) >> 8:     11010 - same
   9.155 +	// (x * 0x0d) >> 7:      1101 - same, shortest code (on i386)
   9.156 +
   9.157 +	d0 = 6*(d3 + d2 + d1) + (q & 0xf);
   9.158 +	q = (d0 * 0xcd) >> 11;
   9.159 +	d0 = d0 - 10*q;
   9.160 +	*buf++ = d0 + '0';
   9.161 +	d1 = q + 9*d3 + 5*d2 + d1;
   9.162 +		q = (d1 * 0xcd) >> 11;
   9.163 +		d1 = d1 - 10*q;
   9.164 +		*buf++ = d1 + '0';
   9.165 +
   9.166 +		d2 = q + 2*d2;
   9.167 +			q = (d2 * 0xd) >> 7;
   9.168 +			d2 = d2 - 10*q;
   9.169 +			*buf++ = d2 + '0';
   9.170 +
   9.171 +			d3 = q + 4*d3;
   9.172 +				q = (d3 * 0xcd) >> 11; /* - shorter code */
   9.173 +				/* q = (d3 * 0x67) >> 10; - would also work */
   9.174 +				d3 = d3 - 10*q;
   9.175 +				*buf++ = d3 + '0';
   9.176 +					*buf++ = q + '0';
   9.177 +	return buf;
   9.178 +}
   9.179 +
   9.180 +static char* put_dec(char *buf, unsigned long long num)
   9.181 +{
   9.182 +	while (1) {
   9.183 +		unsigned rem;
   9.184 +		if (num < 100000)
   9.185 +			return put_dec_trunc(buf, num);
   9.186 +		rem = do_div(num, 100000);
   9.187 +		buf = put_dec_full(buf, rem);
   9.188 +	}
   9.189 +}
   9.190 +
   9.191 +
   9.192 +#define ZEROPAD	1		/* pad with zero */
   9.193 +#define SIGN	2		/* unsigned/signed long */
   9.194 +#define PLUS	4		/* show plus */
   9.195 +#define SPACE	8		/* space if plus */
   9.196 +#define LEFT	16		/* left justified */
   9.197 +#define SMALL	32		/* Must be 32 == 0x20 */
   9.198 +#define SPECIAL	64		/* 0x */
   9.199 +
   9.200 +static char *number(char *buf, char *end, unsigned long long num, int base, int size, int precision, int type)
   9.201 +{
   9.202 +	/* we are called with base 8, 10 or 16, only, thus don't need "G..."  */
   9.203 +	static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
   9.204 +
   9.205 +	char tmp[66];
   9.206 +	char sign;
   9.207 +	char locase;
   9.208 +	int need_pfx = ((type & SPECIAL) && base != 10);
   9.209 +	int i;
   9.210 +
   9.211 +	/* locase = 0 or 0x20. ORing digits or letters with 'locase'
   9.212 +	 * produces same digits or (maybe lowercased) letters */
   9.213 +	locase = (type & SMALL);
   9.214 +	if (type & LEFT)
   9.215 +		type &= ~ZEROPAD;
   9.216 +	sign = 0;
   9.217 +	if (type & SIGN) {
   9.218 +		if ((signed long long) num < 0) {
   9.219 +			sign = '-';
   9.220 +			num = - (signed long long) num;
   9.221 +			size--;
   9.222 +		} else if (type & PLUS) {
   9.223 +			sign = '+';
   9.224 +			size--;
   9.225 +		} else if (type & SPACE) {
   9.226 +			sign = ' ';
   9.227 +			size--;
   9.228 +		}
   9.229 +	}
   9.230 +	if (need_pfx) {
   9.231 +		size--;
   9.232 +		if (base == 16)
   9.233 +			size--;
   9.234 +	}
   9.235 +
   9.236 +	/* generate full string in tmp[], in reverse order */
   9.237 +	i = 0;
   9.238 +	if (num == 0)
   9.239 +		tmp[i++] = '0';
   9.240 +	/* Generic code, for any base:
   9.241 +	else do {
   9.242 +		tmp[i++] = (digits[do_div(num,base)] | locase);
   9.243 +	} while (num != 0);
   9.244 +	*/
   9.245 +	else if (base != 10) { /* 8 or 16 */
   9.246 +		int mask = base - 1;
   9.247 +		int shift = 3;
   9.248 +		if (base == 16) shift = 4;
   9.249 +		do {
   9.250 +			tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
   9.251 +			num >>= shift;
   9.252 +		} while (num);
   9.253 +	} else { /* base 10 */
   9.254 +		i = put_dec(tmp, num) - tmp;
   9.255 +	}
   9.256 +
   9.257 +	/* printing 100 using %2d gives "100", not "00" */
   9.258 +	if (i > precision)
   9.259 +		precision = i;
   9.260 +	/* leading space padding */
   9.261 +	size -= precision;
   9.262 +	if (!(type & (ZEROPAD+LEFT))) {
   9.263 +		while(--size >= 0) {
   9.264 +			if (buf < end)
   9.265 +				*buf = ' ';
   9.266 +			++buf;
   9.267 +		}
   9.268 +	}
   9.269 +	/* sign */
   9.270 +	if (sign) {
   9.271 +		if (buf < end)
   9.272 +			*buf = sign;
   9.273 +		++buf;
   9.274 +	}
   9.275 +	/* "0x" / "0" prefix */
   9.276 +	if (need_pfx) {
   9.277 +		if (buf < end)
   9.278 +			*buf = '0';
   9.279 +		++buf;
   9.280 +		if (base == 16) {
   9.281 +			if (buf < end)
   9.282 +				*buf = ('X' | locase);
   9.283 +			++buf;
   9.284 +		}
   9.285 +	}
   9.286 +	/* zero or space padding */
   9.287 +	if (!(type & LEFT)) {
   9.288 +		char c = (type & ZEROPAD) ? '0' : ' ';
   9.289 +		while (--size >= 0) {
   9.290 +			if (buf < end)
   9.291 +				*buf = c;
   9.292 +			++buf;
   9.293 +		}
   9.294 +	}
   9.295 +	/* hmm even more zero padding? */
   9.296 +	while (i <= --precision) {
   9.297 +		if (buf < end)
   9.298 +			*buf = '0';
   9.299 +		++buf;
   9.300 +	}
   9.301 +	/* actual digits of result */
   9.302 +	while (--i >= 0) {
   9.303 +		if (buf < end)
   9.304 +			*buf = tmp[i];
   9.305 +		++buf;
   9.306 +	}
   9.307 +	/* trailing space padding */
   9.308 +	while (--size >= 0) {
   9.309 +		if (buf < end)
   9.310 +			*buf = ' ';
   9.311 +		++buf;
   9.312 +	}
   9.313 +	return buf;
   9.314 +}
   9.315 +
   9.316 +/**
   9.317 + * vsnprintf - Format a string and place it in a buffer
   9.318 + * @buf: The buffer to place the result into
   9.319 + * @size: The size of the buffer, including the trailing null space
   9.320 + * @fmt: The format string to use
   9.321 + * @args: Arguments for the format string
   9.322 + *
   9.323 + * The return value is the number of characters which would
   9.324 + * be generated for the given input, excluding the trailing
   9.325 + * '\0', as per ISO C99. If you want to have the exact
   9.326 + * number of characters written into @buf as return value
   9.327 + * (not including the trailing '\0'), use vscnprintf(). If the
   9.328 + * return is greater than or equal to @size, the resulting
   9.329 + * string is truncated.
   9.330 + *
   9.331 + * Call this function if you are already dealing with a va_list.
   9.332 + * You probably want snprintf() instead.
   9.333 + */
   9.334 +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
   9.335 +{
   9.336 +	int len;
   9.337 +	unsigned long long num;
   9.338 +	int i, base;
   9.339 +	char *str, *end, c;
   9.340 +	const char *s;
   9.341 +
   9.342 +	int flags;		/* flags to number() */
   9.343 +
   9.344 +	int field_width;	/* width of output field */
   9.345 +	int precision;		/* min. # of digits for integers; max
   9.346 +				   number of chars for from string */
   9.347 +	int qualifier;		/* 'h', 'l', or 'L' for integer fields */
   9.348 +				/* 'z' support added 23/7/1999 S.H.    */
   9.349 +				/* 'z' changed to 'Z' --davidm 1/25/99 */
   9.350 +				/* 't' added for ptrdiff_t */
   9.351 +
   9.352 +	/* Reject out-of-range values early.  Large positive sizes are
   9.353 +	   used for unknown buffer sizes. */
   9.354 +	if ((int) size < 0)
   9.355 +		return 0;
   9.356 +
   9.357 +	str = buf;
   9.358 +	end = buf + size;
   9.359 +
   9.360 +	/* Make sure end is always >= buf */
   9.361 +	if (end < buf) {
   9.362 +		end = ((void *)-1);
   9.363 +		size = end - buf;
   9.364 +	}
   9.365 +
   9.366 +	for (; *fmt ; ++fmt) {
   9.367 +		if (*fmt != '%') {
   9.368 +			if (str < end)
   9.369 +				*str = *fmt;
   9.370 +			++str;
   9.371 +			continue;
   9.372 +		}
   9.373 +
   9.374 +		/* process flags */
   9.375 +		flags = 0;
   9.376 +		repeat:
   9.377 +			++fmt;		/* this also skips first '%' */
   9.378 +			switch (*fmt) {
   9.379 +				case '-': flags |= LEFT; goto repeat;
   9.380 +				case '+': flags |= PLUS; goto repeat;
   9.381 +				case ' ': flags |= SPACE; goto repeat;
   9.382 +				case '#': flags |= SPECIAL; goto repeat;
   9.383 +				case '0': flags |= ZEROPAD; goto repeat;
   9.384 +			}
   9.385 +
   9.386 +		/* get field width */
   9.387 +		field_width = -1;
   9.388 +		if (isdigit(*fmt))
   9.389 +			field_width = skip_atoi(&fmt);
   9.390 +		else if (*fmt == '*') {
   9.391 +			++fmt;
   9.392 +			/* it's the next argument */
   9.393 +			field_width = va_arg(args, int);
   9.394 +			if (field_width < 0) {
   9.395 +				field_width = -field_width;
   9.396 +				flags |= LEFT;
   9.397 +			}
   9.398 +		}
   9.399 +
   9.400 +		/* get the precision */
   9.401 +		precision = -1;
   9.402 +		if (*fmt == '.') {
   9.403 +			++fmt;	
   9.404 +			if (isdigit(*fmt))
   9.405 +				precision = skip_atoi(&fmt);
   9.406 +			else if (*fmt == '*') {
   9.407 +				++fmt;
   9.408 +				/* it's the next argument */
   9.409 +				precision = va_arg(args, int);
   9.410 +			}
   9.411 +			if (precision < 0)
   9.412 +				precision = 0;
   9.413 +		}
   9.414 +
   9.415 +		/* get the conversion qualifier */
   9.416 +		qualifier = -1;
   9.417 +		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
   9.418 +		    *fmt =='Z' || *fmt == 'z' || *fmt == 't') {
   9.419 +			qualifier = *fmt;
   9.420 +			++fmt;
   9.421 +			if (qualifier == 'l' && *fmt == 'l') {
   9.422 +				qualifier = 'L';
   9.423 +				++fmt;
   9.424 +			}
   9.425 +		}
   9.426 +
   9.427 +		/* default base */
   9.428 +		base = 10;
   9.429 +
   9.430 +		switch (*fmt) {
   9.431 +			case 'c':
   9.432 +				if (!(flags & LEFT)) {
   9.433 +					while (--field_width > 0) {
   9.434 +						if (str < end)
   9.435 +							*str = ' ';
   9.436 +						++str;
   9.437 +					}
   9.438 +				}
   9.439 +				c = (unsigned char) va_arg(args, int);
   9.440 +				if (str < end)
   9.441 +					*str = c;
   9.442 +				++str;
   9.443 +				while (--field_width > 0) {
   9.444 +					if (str < end)
   9.445 +						*str = ' ';
   9.446 +					++str;
   9.447 +				}
   9.448 +				continue;
   9.449 +
   9.450 +			case 's':
   9.451 +				s = va_arg(args, char *);
   9.452 +				if ((unsigned long)s < PAGE_SIZE)
   9.453 +					s = "<NULL>";
   9.454 +
   9.455 +				len = strnlen(s, precision);
   9.456 +
   9.457 +				if (!(flags & LEFT)) {
   9.458 +					while (len < field_width--) {
   9.459 +						if (str < end)
   9.460 +							*str = ' ';
   9.461 +						++str;
   9.462 +					}
   9.463 +				}
   9.464 +				for (i = 0; i < len; ++i) {
   9.465 +					if (str < end)
   9.466 +						*str = *s;
   9.467 +					++str; ++s;
   9.468 +				}
   9.469 +				while (len < field_width--) {
   9.470 +					if (str < end)
   9.471 +						*str = ' ';
   9.472 +					++str;
   9.473 +				}
   9.474 +				continue;
   9.475 +
   9.476 +			case 'p':
   9.477 +				flags |= SMALL;
   9.478 +				if (field_width == -1) {
   9.479 +					field_width = 2*sizeof(void *);
   9.480 +					flags |= ZEROPAD;
   9.481 +				}
   9.482 +				str = number(str, end,
   9.483 +						(unsigned long) va_arg(args, void *),
   9.484 +						16, field_width, precision, flags);
   9.485 +				continue;
   9.486 +
   9.487 +
   9.488 +			case 'n':
   9.489 +				/* FIXME:
   9.490 +				* What does C99 say about the overflow case here? */
   9.491 +				if (qualifier == 'l') {
   9.492 +					long * ip = va_arg(args, long *);
   9.493 +					*ip = (str - buf);
   9.494 +				} else if (qualifier == 'Z' || qualifier == 'z') {
   9.495 +					size_t * ip = va_arg(args, size_t *);
   9.496 +					*ip = (str - buf);
   9.497 +				} else {
   9.498 +					int * ip = va_arg(args, int *);
   9.499 +					*ip = (str - buf);
   9.500 +				}
   9.501 +				continue;
   9.502 +
   9.503 +			case '%':
   9.504 +				if (str < end)
   9.505 +					*str = '%';
   9.506 +				++str;
   9.507 +				continue;
   9.508 +
   9.509 +				/* integer number formats - set up the flags and "break" */
   9.510 +			case 'o':
   9.511 +				base = 8;
   9.512 +				break;
   9.513 +
   9.514 +			case 'x':
   9.515 +				flags |= SMALL;
   9.516 +			case 'X':
   9.517 +				base = 16;
   9.518 +				break;
   9.519 +
   9.520 +			case 'd':
   9.521 +			case 'i':
   9.522 +				flags |= SIGN;
   9.523 +			case 'u':
   9.524 +				break;
   9.525 +
   9.526 +			default:
   9.527 +				if (str < end)
   9.528 +					*str = '%';
   9.529 +				++str;
   9.530 +				if (*fmt) {
   9.531 +					if (str < end)
   9.532 +						*str = *fmt;
   9.533 +					++str;
   9.534 +				} else {
   9.535 +					--fmt;
   9.536 +				}
   9.537 +				continue;
   9.538 +		}
   9.539 +		if (qualifier == 'L')
   9.540 +			num = va_arg(args, long long);
   9.541 +		else if (qualifier == 'l') {
   9.542 +			num = va_arg(args, unsigned long);
   9.543 +			if (flags & SIGN)
   9.544 +				num = (signed long) num;
   9.545 +		} else if (qualifier == 'Z' || qualifier == 'z') {
   9.546 +			num = va_arg(args, size_t);
   9.547 +		} else if (qualifier == 't') {
   9.548 +			num = va_arg(args, ptrdiff_t);
   9.549 +		} else if (qualifier == 'h') {
   9.550 +			num = (unsigned short) va_arg(args, int);
   9.551 +			if (flags & SIGN)
   9.552 +				num = (signed short) num;
   9.553 +		} else {
   9.554 +			num = va_arg(args, unsigned int);
   9.555 +			if (flags & SIGN)
   9.556 +				num = (signed int) num;
   9.557 +		}
   9.558 +		str = number(str, end, num, base,
   9.559 +				field_width, precision, flags);
   9.560 +	}
   9.561 +	if (size > 0) {
   9.562 +		if (str < end)
   9.563 +			*str = '\0';
   9.564 +		else
   9.565 +			end[-1] = '\0';
   9.566 +	}
   9.567 +	/* the trailing null byte doesn't count towards the total */
   9.568 +	return str-buf;
   9.569 +}
   9.570 +/* ----- END Other people's code --------- */
   9.571 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/xenpci/mingw_extras.h	Wed Jul 02 09:57:59 2008 +1000
    10.3 @@ -0,0 +1,43 @@
    10.4 +#include <stdio.h>
    10.5 +#include <stdlib.h>
    10.6 +
    10.7 +#define KeMemoryBarrier() asm("mfence;")
    10.8 +/* mingw-runtime 3.13 is buggy #1 */
    10.9 +#undef KeGetCurrentProcessorNumber
   10.10 +#define KeGetCurrentProcessorNumber() \
   10.11 +  ((ULONG)KeGetCurrentKPCR()->Number)
   10.12 +
   10.13 +/* mingw-runtime 3.13 is buggy #2 */
   10.14 +#undef KeRaiseIrql
   10.15 +#undef KeLowerIrql
   10.16 +
   10.17 +NTOSAPI
   10.18 +VOID
   10.19 +DDKAPI
   10.20 +KeRaiseIrql(IN KIRQL new_irql, OUT PKIRQL old_irql);
   10.21 +
   10.22 +NTOSAPI
   10.23 +VOID
   10.24 +DDKAPI
   10.25 +KeLowerIrql(IN KIRQL irql);
   10.26 +
   10.27 +extern NTOSAPI CCHAR KeNumberProcessors;
   10.28 +
   10.29 +NTOSAPI
   10.30 +VOID
   10.31 +DDKAPI
   10.32 +KeFlushQueuedDpcs(VOID);
   10.33 +
   10.34 +#define RtlStringCbCopyA(dst, dst_len, src) strncpy(dst, src, dst_len)
   10.35 +#define RtlStringCbPrintfA(args...) snprintf(args)
   10.36 +#define RtlStringCbVPrintfA(args...) vsnprintf(args)
   10.37 +
   10.38 +/* windows wchar 2 bytes, Linux's is 4! */
   10.39 +typedef unsigned short win_wchar_t;
   10.40 +
   10.41 +NTSTATUS
   10.42 +RtlStringCbPrintfW(
   10.43 +  win_wchar_t *dest_str,
   10.44 +  size_t dest_size,
   10.45 +  win_wchar_t *format,
   10.46 +  ...);
    11.1 --- a/xenpci/xenpci.c	Wed Jul 02 09:54:40 2008 +1000
    11.2 +++ b/xenpci/xenpci.c	Wed Jul 02 09:57:59 2008 +1000
    11.3 @@ -17,6 +17,7 @@ along with this program; if not, write t
    11.4  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    11.5  */
    11.6  
    11.7 +#define INITGUID
    11.8  #include "xenpci.h"
    11.9  #include <stdlib.h>
   11.10  
   11.11 @@ -169,7 +170,7 @@ XenPci_AddDevice(PDRIVER_OBJECT DriverOb
   11.12  
   11.13    status = IoRegisterDeviceInterface(
   11.14      PhysicalDeviceObject,
   11.15 -    (LPGUID)&GUID_XEN_IFACE,
   11.16 +    &GUID_XEN_IFACE,
   11.17      NULL,
   11.18      &xpdd->interface_name);
   11.19  
    12.1 --- a/xenpci/xenpci.h	Wed Jul 02 09:54:40 2008 +1000
    12.2 +++ b/xenpci/xenpci.h	Wed Jul 02 09:57:59 2008 +1000
    12.3 @@ -26,11 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fi
    12.4  #include <ntddk.h>
    12.5  
    12.6  #ifdef __MINGW32__
    12.7 -#define KeMemoryBarrier() asm("mfence;")
    12.8 -/* mingw-runtime 3.13 is buggy */
    12.9 -#undef KeGetCurrentProcessorNumber
   12.10 -#define KeGetCurrentProcessorNumber() \
   12.11 -  ((ULONG)KeGetCurrentKPCR()->Number)
   12.12 +#include "mingw_extras.h"
   12.13  #else
   12.14  #define DDKAPI
   12.15  #include <wdm.h>
    13.1 --- a/xenpci/xenpci.inx	Wed Jul 02 09:54:40 2008 +1000
    13.2 +++ b/xenpci/xenpci.inx	Wed Jul 02 09:57:59 2008 +1000
    13.3 @@ -55,7 +55,8 @@ ServiceType    = 1
    13.4  StartType      = 0
    13.5  ErrorControl   = 1
    13.6  LoadOrderGroup = System Bus Extender
    13.7 -ServiceBinary  = %12%\xenpci.sys                            
    13.8 +ServiceBinary  = %12%\xenpci.sys
    13.9 +AddReg         = XenPCI_Service_AddReg
   13.10  
   13.11  [XenHide_Service]
   13.12  DisplayName    = %XenHide.SVCDESC%
   13.13 @@ -68,6 +69,9 @@ AddReg         = XenHide_Service_AddReg
   13.14  
   13.15  [XenHide_Service_AddReg]
   13.16  HKLM,SYSTEM\CurrentControlSet\Control\Class\{4D36E97D-E325-11CE-BFC1-08002BE10318},UpperFilters,0x00010008,XenHide
   13.17 +
   13.18 +[XenPCI_Service_AddReg]
   13.19 +HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GA;;;BA)"   ; SDDL_DEVOBJ_SYS_ALL_ADM_ALL
   13.20  
   13.21  [Strings]
   13.22  XenGplPv = "Xen GPL PV Driver Developers"
    14.1 --- a/xenpci/xenpci_fdo.c	Wed Jul 02 09:54:40 2008 +1000
    14.2 +++ b/xenpci/xenpci_fdo.c	Wed Jul 02 09:57:59 2008 +1000
    14.3 @@ -18,15 +18,17 @@ Foundation, Inc., 51 Franklin Street, Fi
    14.4  */
    14.5  
    14.6  #include "xenpci.h"
    14.7 -#include <wdmsec.h>
    14.8 +//#include <wdmsec.h>
    14.9  #include <stdlib.h>
   14.10  
   14.11  #define SYSRQ_PATH "control/sysrq"
   14.12  #define SHUTDOWN_PATH "control/shutdown"
   14.13  #define BALLOON_PATH "memory/target"
   14.14  
   14.15 +#if 0
   14.16  static VOID
   14.17  XenBus_BalloonHandler(char *Path, PVOID Data);
   14.18 +#endif
   14.19  
   14.20  /*
   14.21  static VOID
   14.22 @@ -301,7 +303,7 @@ XenBus_ShutdownIoCancel(PDEVICE_OBJECT d
   14.23    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   14.24  }
   14.25  
   14.26 -static VOID
   14.27 +static DDKAPI VOID
   14.28  XenPci_CompleteResume(PDEVICE_OBJECT device_object, PVOID context)
   14.29  {
   14.30    PXENPCI_DEVICE_DATA xpdd;
   14.31 @@ -332,7 +334,7 @@ struct {
   14.32  } typedef SUSPEND_INFO, *PSUSPEND_INFO;
   14.33  
   14.34  /* Called at DISPATCH_LEVEL */
   14.35 -static VOID
   14.36 +static DDKAPI VOID
   14.37  XenPci_Suspend(
   14.38    PRKDPC Dpc,
   14.39    PVOID Context,
   14.40 @@ -600,7 +602,7 @@ XenPci_DeviceWatchHandler(char *path, PV
   14.41  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   14.42  }
   14.43  
   14.44 -static VOID
   14.45 +static DDKAPI VOID
   14.46  XenPci_Pnp_StartDeviceCallback(PDEVICE_OBJECT device_object, PVOID context)
   14.47  {
   14.48    NTSTATUS status = STATUS_SUCCESS;
   14.49 @@ -787,7 +789,7 @@ XenPci_Pnp_RemoveDevice(PDEVICE_OBJECT d
   14.50    return status;
   14.51  }
   14.52  
   14.53 -static VOID
   14.54 +static DDKAPI VOID
   14.55  XenPci_Pnp_QueryBusRelationsCallback(PDEVICE_OBJECT device_object, PVOID context)
   14.56  {
   14.57    NTSTATUS status = STATUS_SUCCESS;
   14.58 @@ -844,15 +846,13 @@ XenPci_Pnp_QueryBusRelationsCallback(PDE
   14.59              KdPrint((__DRIVER_NAME "     New device %s\n", path));
   14.60              child = ExAllocatePoolWithTag(NonPagedPool, sizeof(XEN_CHILD), XENPCI_POOL_TAG);
   14.61              child->state = CHILD_STATE_ADDED;
   14.62 -            status = IoCreateDeviceSecure(
   14.63 +            status = IoCreateDevice(
   14.64                xpdd->common.fdo->DriverObject,
   14.65                sizeof(XENPCI_PDO_DEVICE_DATA),
   14.66                NULL,
   14.67                FILE_DEVICE_UNKNOWN,
   14.68                FILE_AUTOGENERATED_DEVICE_NAME | FILE_DEVICE_SECURE_OPEN,
   14.69                FALSE,
   14.70 -              &SDDL_DEVOBJ_SYS_ALL_ADM_ALL,
   14.71 -              (LPCGUID)&GUID_XENPCI_DEVCLASS,
   14.72                &pdo);
   14.73              if (!NT_SUCCESS(status))
   14.74                KdPrint((__DRIVER_NAME "     IoCreateDevice status = %08X\n", status));
   14.75 @@ -951,7 +951,7 @@ XenPci_Pnp_QueryBusRelations(PDEVICE_OBJ
   14.76    return STATUS_PENDING;
   14.77  }
   14.78  
   14.79 -static VOID
   14.80 +static DDKAPI VOID
   14.81  XenPci_Pnp_FilterResourceRequirementsCallback(PDEVICE_OBJECT device_object, PVOID context)
   14.82  {
   14.83    NTSTATUS status = STATUS_SUCCESS;
   14.84 @@ -1042,6 +1042,10 @@ XenPci_Pnp_DeviceUsageNotification(PDEVI
   14.85        else
   14.86          xpdd->common.device_usage_hibernation++;      
   14.87        break;
   14.88 +    default:
   14.89 +      KdPrint((__DRIVER_NAME " Unknown usage type %x\n",
   14.90 +        stack->Parameters.UsageNotification.Type));
   14.91 +      break;
   14.92      }
   14.93      if (xpdd->common.device_usage_paging
   14.94        || xpdd->common.device_usage_dump
    15.1 --- a/xenpci/xenpci_pdo.c	Wed Jul 02 09:54:40 2008 +1000
    15.2 +++ b/xenpci/xenpci_pdo.c	Wed Jul 02 09:57:59 2008 +1000
    15.3 @@ -121,7 +121,7 @@ XenPci_BackEndStateHandler(char *Path, P
    15.4      KdPrint((__DRIVER_NAME "     state unchanged\n"));
    15.5      //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    15.6      return;
    15.7 -  }    
    15.8 +  }
    15.9  
   15.10    xppdd->backend_state = new_backend_state;
   15.11  
   15.12 @@ -459,7 +459,7 @@ XenPci_XenConfigDeviceSpecifyBuffers(PVO
   15.13    ADD_XEN_INIT_RSP(&out_ptr, XEN_INIT_TYPE_STATE_PTR, NULL, &xppdd->device_state);
   15.14  
   15.15    // first pass, possibly before state == Connected
   15.16 -  while((type = GET_XEN_INIT_REQ(&in_ptr, &setting, &value)) != XEN_INIT_TYPE_END)
   15.17 +  while((type = GET_XEN_INIT_REQ(&in_ptr, (PVOID)&setting, (PVOID)&value)) != XEN_INIT_TYPE_END)
   15.18    {
   15.19      if (!done_xenbus_init)
   15.20      {
   15.21 @@ -549,7 +549,7 @@ XenPci_XenConfigDeviceSpecifyBuffers(PVO
   15.22  
   15.23    // second pass, possibly after state == Connected
   15.24    in_ptr = src;
   15.25 -  while((type = GET_XEN_INIT_REQ(&in_ptr, &setting, &value)) != XEN_INIT_TYPE_END)
   15.26 +  while((type = GET_XEN_INIT_REQ(&in_ptr, (PVOID)&setting, (PVOID)&value)) != XEN_INIT_TYPE_END)
   15.27    {
   15.28      switch(type)
   15.29      {
   15.30 @@ -998,6 +998,10 @@ XenPci_Pnp_Pdo(PDEVICE_OBJECT device_obj
   15.31        KdPrint((__DRIVER_NAME "     type = DeviceUsageTypeHibernation\n"));
   15.32        usage_type = &xppdd->common.device_usage_hibernation;
   15.33        break;
   15.34 +    default:
   15.35 +      KdPrint((__DRIVER_NAME " Unknown usage type %x\n",
   15.36 +        stack->Parameters.UsageNotification.Type));
   15.37 +      break;
   15.38      }
   15.39      KdPrint((__DRIVER_NAME "     inpath = %d\n", stack->Parameters.UsageNotification.InPath));
   15.40      if (usage_type)