win-pvdrivers

changeset 373:6b1c00d218e9

merge with head
author James Harper <james.harper@bendigoit.com.au>
date Wed Jul 09 20:17:22 2008 +1000 (2008-07-09)
parents 649b05070ede f7fa99be363d
children 25814a68e426
files mingw/inc/ntddk.h mingw/inc/winddk.h xenpci/mingw_extras.c xenpci/mingw_extras.h
line diff
     1.1 --- a/common/include/public/io/netif.h	Wed Jul 09 20:16:36 2008 +1000
     1.2 +++ b/common/include/public/io/netif.h	Wed Jul 09 20:17:22 2008 +1000
     1.3 @@ -181,4 +181,5 @@ DEFINE_RING_TYPES(netif_rx, struct netif
     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/doc/BUILDING_mingw.txt	Wed Jul 09 20:16:36 2008 +1000
     2.2 +++ b/doc/BUILDING_mingw.txt	Wed Jul 09 20:17:22 2008 +1000
     2.3 @@ -9,24 +9,26 @@ 1. sudo apt-get install mingw mingw-binu
     2.4  2. mingw-runtime headers need to be modified. Download the latest w32api-src.tar.gz
     2.5     package from mingw.sf.net.
     2.6  
     2.7 -3. Untar, then edit lib/ddk/ntoskrnl.def. Remove ";" from line ~545, which says
     2.8 -   "KeNumberProcessors DATA". Add a line "KeFlushQueuedDpcs@0"
     2.9 +3. Untar to a directory.
    2.10  
    2.11 -4. Type: "./configure i586-mingw32-msvc;make"
    2.12 -
    2.13 -2. Use Mercurial and type:
    2.14 +4. Use Mercurial and type:
    2.15     "hg clone http://xenbits.xensource.com/ext/win-pvdrivers.hg"
    2.16  
    2.17 -4. Change to the win-pvdrivers.hg/xenpci dir.
    2.18 +5. Apply the patch "w32api.diff" in the mingw directory to the untarred w32api
    2.19 +   source: "cd w32api-<version>;patch -p1 < ~/hg/win-pvdrivers.hg/mingw/w32api.diff"
    2.20  
    2.21 -5. Modify the W32API_PATH at the top of makefile.mingw to point to the lib/ddk
    2.22 +6. Type: "./configure i586-mingw32-msvc;make"
    2.23 +
    2.24 +7. Change to the win-pvdrivers.hg/xenpci dir.
    2.25 +
    2.26 +8. Modify the W32API_PATH at the top of makefile.mingw to point to the lib/ddk
    2.27     directory of the w32api package compiled above.
    2.28  
    2.29 -6. Type: "make -f makefile.mingw"
    2.30 +9. Type: "make -f makefile.mingw"
    2.31  
    2.32 -7. Building the shutdown monitor is not supported (maybe using Mono is an option
    2.33 +10. Building the shutdown monitor is not supported (maybe using Mono is an option
    2.34     here?)
    2.35 -
    2.36 -8. This is still an extremely alpha build method, so this will give you a
    2.37 +
    2.38 +11. This is still an extremely alpha build method, so this will give you a
    2.39     .sys file but you're on your own for the rest!
    2.40  
     3.1 --- a/mingw/inc/ntddk.h	Wed Jul 09 20:16:36 2008 +1000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,93 +0,0 @@
     3.4 -/* Private copy because we needed tweak winddk.h */
     3.5 -
     3.6 -/*
     3.7 - * ntddk.h
     3.8 - *
     3.9 - * Windows Device Driver Kit
    3.10 - *
    3.11 - * This file is part of the w32api package.
    3.12 - *
    3.13 - * Contributors:
    3.14 - *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
    3.15 - *
    3.16 - * THIS SOFTWARE IS NOT COPYRIGHTED
    3.17 - *
    3.18 - * This source code is offered for use in the public domain. You may
    3.19 - * use, modify or distribute it freely.
    3.20 - *
    3.21 - * This code is distributed in the hope that it will be useful but
    3.22 - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
    3.23 - * DISCLAIMED. This includes but is not limited to warranties of
    3.24 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    3.25 - *
    3.26 - * DEFINES:
    3.27 - *    DBG             - Debugging enabled/disabled (0/1)
    3.28 - *    POOL_TAGGING    - Enable pool tagging
    3.29 - *    _X86_           - X86 environment
    3.30 - *   __USE_NTOSKRNL__ - Use ntoskrnl.exe exports instead of kernel32.dll
    3.31 - */
    3.32 -
    3.33 -#ifndef __NTDDK_H
    3.34 -#define __NTDDK_H
    3.35 -
    3.36 -#if __GNUC__ >= 3
    3.37 -#pragma GCC system_header
    3.38 -#endif
    3.39 -
    3.40 -#ifndef __USE_NTOSKRNL__
    3.41 -#define __USE_NTOSKRNL__ 1
    3.42 -#endif
    3.43 -
    3.44 -#ifdef __cplusplus
    3.45 -extern "C" {
    3.46 -#endif
    3.47 -
    3.48 -#include <stdarg.h>
    3.49 -#include <windef.h>
    3.50 -#include <ntdef.h>
    3.51 -#include <basetyps.h>
    3.52 -
    3.53 -/* Base types, structures and definitions */
    3.54 -typedef short CSHORT;
    3.55 -typedef CONST int CINT;
    3.56 -typedef CONST char *PCSZ;
    3.57 -
    3.58 -#ifndef STATIC
    3.59 -#define STATIC static
    3.60 -#endif
    3.61 -
    3.62 -#ifndef CALLBACK
    3.63 -#define CALLBACK
    3.64 -#endif
    3.65 -
    3.66 -#ifndef DECL_IMPORT
    3.67 -#define DECL_IMPORT __declspec(dllimport)
    3.68 -#endif
    3.69 -
    3.70 -#ifndef DECL_EXPORT
    3.71 -#define DECL_EXPORT __declspec(dllexport)
    3.72 -#endif
    3.73 -
    3.74 -/* Windows NT status codes */
    3.75 -#include "ntstatus.h"
    3.76 -
    3.77 -/* Windows NT definitions exported to user mode */
    3.78 -#include <winnt.h>
    3.79 -
    3.80 -/* Windows Device Driver Kit */
    3.81 -#include "winddk.h"
    3.82 -
    3.83 -/* Definitions only in Windows XP */
    3.84 -#include "winxp.h"
    3.85 -
    3.86 -/* Definitions only in Windows 2000 */
    3.87 -#include "win2k.h"
    3.88 -
    3.89 -/* Definitions only in Windows NT 4 */
    3.90 -#include "winnt4.h"
    3.91 -
    3.92 -#ifdef __cplusplus
    3.93 -}
    3.94 -#endif
    3.95 -
    3.96 -#endif /* __NTDDK_H */
     4.1 --- a/mingw/inc/winddk.h	Wed Jul 09 20:16:36 2008 +1000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,9252 +0,0 @@
     4.4 -/* Private copy of header because Interlocked{Increment,Decrement} were wrong.
     4.5 -   Please check for corrected headers and ditch these when possible. */
     4.6 -
     4.7 -/*
     4.8 - * winddk.h
     4.9 - *
    4.10 - * Windows Device Driver Kit
    4.11 - *
    4.12 - * This file is part of the w32api package.
    4.13 - *
    4.14 - * Contributors:
    4.15 - *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
    4.16 - *
    4.17 - * THIS SOFTWARE IS NOT COPYRIGHTED
    4.18 - *
    4.19 - * This source code is offered for use in the public domain. You may
    4.20 - * use, modify or distribute it freely.
    4.21 - *
    4.22 - * This code is distributed in the hope that it will be useful but
    4.23 - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
    4.24 - * DISCLAIMED. This includes but is not limited to warranties of
    4.25 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    4.26 - *
    4.27 - */
    4.28 -
    4.29 -#ifndef __WINDDK_H
    4.30 -#define __WINDDK_H
    4.31 -
    4.32 -#if __GNUC__ >= 3
    4.33 -#pragma GCC system_header
    4.34 -#endif
    4.35 -
    4.36 -#ifdef __cplusplus
    4.37 -extern "C" {
    4.38 -#endif
    4.39 -
    4.40 -/*
    4.41 -** Definitions specific to this Device Driver Kit
    4.42 -*/
    4.43 -#define DDKAPI __stdcall
    4.44 -#define DDKFASTAPI __fastcall
    4.45 -#define DDKCDECLAPI __cdecl
    4.46 -
    4.47 -#if defined(_NTOSKRNL_)
    4.48 -#ifndef NTOSAPI
    4.49 -#define NTOSAPI DECL_EXPORT
    4.50 -#endif
    4.51 -#define DECLARE_INTERNAL_OBJECT(x) typedef struct _##x; typedef struct _##x *P##x;
    4.52 -#define DECLARE_INTERNAL_OBJECT2(x,y) typedef struct _##x; typedef struct _##x *P##y;
    4.53 -#else
    4.54 -#ifndef NTOSAPI
    4.55 -#define NTOSAPI DECL_IMPORT
    4.56 -#endif
    4.57 -#define DECLARE_INTERNAL_OBJECT(x) struct _##x; typedef struct _##x *P##x;
    4.58 -#define DECLARE_INTERNAL_OBJECT2(x,y) struct _##x; typedef struct _##x *P##y;
    4.59 -#endif
    4.60 -
    4.61 -/* Pseudo modifiers for parameters 
    4.62 -   We don't use these unnecessary defines in the w32api headers. Define
    4.63 -   them by default since that is what people expect, but allow users
    4.64 -   to avoid the pollution.  */
    4.65 -#ifndef _NO_W32_PSEUDO_MODIFIERS
    4.66 -#define IN
    4.67 -#define OUT
    4.68 -#define OPTIONAL
    4.69 -#define UNALLIGNED
    4.70 -#endif
    4.71 -
    4.72 -#define CONST const
    4.73 -#define VOLATILE volatile
    4.74 -
    4.75 -#define RESTRICTED_POINTER
    4.76 -#define POINTER_ALIGNMENT
    4.77 -
    4.78 -#ifdef NONAMELESSUNION
    4.79 -# define _DDK_DUMMYUNION_MEMBER(name) DUMMYUNIONNAME.name
    4.80 -# define _DDK_DUMMYUNION_N_MEMBER(n, name) DUMMYUNIONNAME##n.name
    4.81 -#else
    4.82 -# define _DDK_DUMMYUNION_MEMBER(name) name
    4.83 -# define _DDK_DUMMYUNION_N_MEMBER(n, name) name
    4.84 -#endif
    4.85 -
    4.86 -/*
    4.87 -** Forward declarations
    4.88 -*/
    4.89 -
    4.90 -struct _IRP;
    4.91 -struct _MDL;
    4.92 -struct _KAPC;
    4.93 -struct _KDPC;
    4.94 -struct _KPCR;
    4.95 -struct _KPRCB;
    4.96 -struct _KTSS;
    4.97 -struct _FILE_OBJECT;
    4.98 -struct _DMA_ADAPTER;
    4.99 -struct _DEVICE_OBJECT;
   4.100 -struct _DRIVER_OBJECT;
   4.101 -struct _SECTION_OBJECT;
   4.102 -struct _IO_STATUS_BLOCK;
   4.103 -struct _DEVICE_DESCRIPTION;
   4.104 -struct _SCATTER_GATHER_LIST;
   4.105 -
   4.106 -DECLARE_INTERNAL_OBJECT(ADAPTER_OBJECT)
   4.107 -DECLARE_INTERNAL_OBJECT(DMA_ADAPTER)
   4.108 -DECLARE_INTERNAL_OBJECT(IO_STATUS_BLOCK)
   4.109 -DECLARE_INTERNAL_OBJECT(SECTION_OBJECT)
   4.110 -
   4.111 -#if 1
   4.112 -/* FIXME: Unknown definitions */
   4.113 -struct _SET_PARTITION_INFORMATION_EX;
   4.114 -typedef ULONG WAIT_TYPE;
   4.115 -typedef HANDLE TRACEHANDLE;
   4.116 -typedef PVOID PWMILIB_CONTEXT;
   4.117 -typedef PVOID PSYSCTL_IRP_DISPOSITION;
   4.118 -typedef ULONG LOGICAL;
   4.119 -#endif
   4.120 -
   4.121 -/*
   4.122 -** Routines specific to this DDK
   4.123 -*/
   4.124 -
   4.125 -#define TAG(_a, _b, _c, _d) (ULONG) \
   4.126 -	(((_a) << 0) + ((_b) << 8) + ((_c) << 16) + ((_d) << 24))
   4.127 -
   4.128 -#ifdef __GNUC__
   4.129 -static __inline struct _KPCR * KeGetCurrentKPCR(
   4.130 -  VOID)
   4.131 -{
   4.132 -  ULONG Value;
   4.133 -
   4.134 -  __asm__ __volatile__ (
   4.135 -#if (__GNUC__ >= 3)
   4.136 -    /* support -masm=intel */
   4.137 -    "mov{l} {%%fs:0x18, %0|%0, %%fs:0x18}\n\t"
   4.138 -#else
   4.139 -    "movl %%fs:0x18, %0\n\t"
   4.140 -#endif
   4.141 -     : "=r" (Value)
   4.142 -     : /* no inputs */
   4.143 -  );
   4.144 -  return (struct _KPCR *) Value;
   4.145 -}
   4.146 -
   4.147 -#elif defined( __WATCOMC__ )
   4.148 -
   4.149 -extern struct _KPCR * KeGetCurrentKPCR( void );
   4.150 -#pragma aux KeGetCurrentKPCR = \
   4.151 -  "mov eax, fs:[0x18]" \
   4.152 -  value [ eax ];
   4.153 -
   4.154 -#endif
   4.155 -
   4.156 -/*
   4.157 -** Simple structures
   4.158 -*/
   4.159 -
   4.160 -typedef LONG KPRIORITY;
   4.161 -typedef UCHAR KIRQL, *PKIRQL;
   4.162 -typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
   4.163 -typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
   4.164 -typedef CCHAR KPROCESSOR_MODE;
   4.165 -
   4.166 -typedef enum _MODE {
   4.167 -  KernelMode,
   4.168 -  UserMode,
   4.169 -  MaximumMode
   4.170 -} MODE;
   4.171 -
   4.172 -
   4.173 -/* Structures not exposed to drivers */
   4.174 -typedef struct _IO_TIMER *PIO_TIMER;
   4.175 -typedef struct _EPROCESS *PEPROCESS;
   4.176 -typedef struct _ETHREAD *PETHREAD;
   4.177 -typedef struct _KINTERRUPT *PKINTERRUPT;
   4.178 -typedef struct _OBJECT_TYPE *POBJECT_TYPE;
   4.179 -typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
   4.180 -typedef struct _COMPRESSED_DATA_INFO *PCOMPRESSED_DATA_INFO;
   4.181 -typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
   4.182 -typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
   4.183 -typedef struct _DRIVE_LAYOUT_INFORMATION *PDRIVE_LAYOUT_INFORMATION;
   4.184 -typedef struct _DRIVE_LAYOUT_INFORMATION_EX *PDRIVE_LAYOUT_INFORMATION_EX;
   4.185 -
   4.186 -/* Constants */
   4.187 -#define	MAXIMUM_PROCESSORS                32
   4.188 -
   4.189 -#define MAXIMUM_WAIT_OBJECTS              64
   4.190 -
   4.191 -#define METHOD_BUFFERED                   0
   4.192 -#define METHOD_IN_DIRECT                  1
   4.193 -#define METHOD_OUT_DIRECT                 2
   4.194 -#define METHOD_NEITHER                    3
   4.195 -
   4.196 -#define LOW_PRIORITY                      0
   4.197 -#define LOW_REALTIME_PRIORITY             16
   4.198 -#define HIGH_PRIORITY                     31
   4.199 -#define MAXIMUM_PRIORITY                  32
   4.200 -
   4.201 -#define FILE_SUPERSEDED                   0x00000000
   4.202 -#define FILE_OPENED                       0x00000001
   4.203 -#define FILE_CREATED                      0x00000002
   4.204 -#define FILE_OVERWRITTEN                  0x00000003
   4.205 -#define FILE_EXISTS                       0x00000004
   4.206 -#define FILE_DOES_NOT_EXIST               0x00000005
   4.207 -
   4.208 -/* also in winnt.h */
   4.209 -#define FILE_LIST_DIRECTORY               0x00000001
   4.210 -#define FILE_READ_DATA                    0x00000001
   4.211 -#define FILE_ADD_FILE                     0x00000002
   4.212 -#define FILE_WRITE_DATA                   0x00000002
   4.213 -#define FILE_ADD_SUBDIRECTORY             0x00000004
   4.214 -#define FILE_APPEND_DATA                  0x00000004
   4.215 -#define FILE_CREATE_PIPE_INSTANCE         0x00000004
   4.216 -#define FILE_READ_EA                      0x00000008
   4.217 -#define FILE_WRITE_EA                     0x00000010
   4.218 -#define FILE_EXECUTE                      0x00000020
   4.219 -#define FILE_TRAVERSE                     0x00000020
   4.220 -#define FILE_DELETE_CHILD                 0x00000040
   4.221 -#define FILE_READ_ATTRIBUTES              0x00000080
   4.222 -#define FILE_WRITE_ATTRIBUTES             0x00000100
   4.223 -
   4.224 -#define FILE_SHARE_READ                   0x00000001
   4.225 -#define FILE_SHARE_WRITE                  0x00000002
   4.226 -#define FILE_SHARE_DELETE                 0x00000004
   4.227 -#define FILE_SHARE_VALID_FLAGS            0x00000007
   4.228 -
   4.229 -#define FILE_ATTRIBUTE_READONLY           0x00000001
   4.230 -#define FILE_ATTRIBUTE_HIDDEN             0x00000002
   4.231 -#define FILE_ATTRIBUTE_SYSTEM             0x00000004
   4.232 -#define FILE_ATTRIBUTE_DIRECTORY          0x00000010
   4.233 -#define FILE_ATTRIBUTE_ARCHIVE            0x00000020
   4.234 -#define FILE_ATTRIBUTE_DEVICE             0x00000040
   4.235 -#define FILE_ATTRIBUTE_NORMAL             0x00000080
   4.236 -#define FILE_ATTRIBUTE_TEMPORARY          0x00000100
   4.237 -#define FILE_ATTRIBUTE_SPARSE_FILE        0x00000200
   4.238 -#define FILE_ATTRIBUTE_REPARSE_POINT      0x00000400
   4.239 -#define FILE_ATTRIBUTE_COMPRESSED         0x00000800
   4.240 -#define FILE_ATTRIBUTE_OFFLINE            0x00001000
   4.241 -#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
   4.242 -#define FILE_ATTRIBUTE_ENCRYPTED          0x00004000
   4.243 -
   4.244 -#define FILE_ATTRIBUTE_VALID_FLAGS        0x00007fb7
   4.245 -#define FILE_ATTRIBUTE_VALID_SET_FLAGS    0x000031a7
   4.246 -
   4.247 -#define FILE_COPY_STRUCTURED_STORAGE      0x00000041
   4.248 -#define FILE_STRUCTURED_STORAGE           0x00000441
   4.249 -
   4.250 -#define FILE_VALID_OPTION_FLAGS           0x00ffffff
   4.251 -#define FILE_VALID_PIPE_OPTION_FLAGS      0x00000032
   4.252 -#define FILE_VALID_MAILSLOT_OPTION_FLAGS  0x00000032
   4.253 -#define FILE_VALID_SET_FLAGS              0x00000036
   4.254 -
   4.255 -#define FILE_SUPERSEDE                    0x00000000
   4.256 -#define FILE_OPEN                         0x00000001
   4.257 -#define FILE_CREATE                       0x00000002
   4.258 -#define FILE_OPEN_IF                      0x00000003
   4.259 -#define FILE_OVERWRITE                    0x00000004
   4.260 -#define FILE_OVERWRITE_IF                 0x00000005
   4.261 -#define FILE_MAXIMUM_DISPOSITION          0x00000005
   4.262 -
   4.263 -#define FILE_DIRECTORY_FILE               0x00000001
   4.264 -#define FILE_WRITE_THROUGH                0x00000002
   4.265 -#define FILE_SEQUENTIAL_ONLY              0x00000004
   4.266 -#define FILE_NO_INTERMEDIATE_BUFFERING    0x00000008
   4.267 -#define FILE_SYNCHRONOUS_IO_ALERT         0x00000010
   4.268 -#define FILE_SYNCHRONOUS_IO_NONALERT      0x00000020
   4.269 -#define FILE_NON_DIRECTORY_FILE           0x00000040
   4.270 -#define FILE_CREATE_TREE_CONNECTION       0x00000080
   4.271 -#define FILE_COMPLETE_IF_OPLOCKED         0x00000100
   4.272 -#define FILE_NO_EA_KNOWLEDGE              0x00000200
   4.273 -#define FILE_OPEN_FOR_RECOVERY            0x00000400
   4.274 -#define FILE_RANDOM_ACCESS                0x00000800
   4.275 -#define FILE_DELETE_ON_CLOSE              0x00001000
   4.276 -#define FILE_OPEN_BY_FILE_ID              0x00002000
   4.277 -#define FILE_OPEN_FOR_BACKUP_INTENT       0x00004000
   4.278 -#define FILE_NO_COMPRESSION               0x00008000
   4.279 -#define FILE_RESERVE_OPFILTER             0x00100000
   4.280 -#define FILE_OPEN_REPARSE_POINT           0x00200000
   4.281 -#define FILE_OPEN_NO_RECALL               0x00400000
   4.282 -#define FILE_OPEN_FOR_FREE_SPACE_QUERY    0x00800000
   4.283 -
   4.284 -#define FILE_ANY_ACCESS                   0x00000000
   4.285 -#define FILE_SPECIAL_ACCESS               FILE_ANY_ACCESS
   4.286 -#define FILE_READ_ACCESS                  0x00000001
   4.287 -#define FILE_WRITE_ACCESS                 0x00000002
   4.288 -
   4.289 -#define FILE_ALL_ACCESS \
   4.290 -  (STANDARD_RIGHTS_REQUIRED | \
   4.291 -   SYNCHRONIZE | \
   4.292 -   0x1FF)
   4.293 -
   4.294 -#define FILE_GENERIC_EXECUTE \
   4.295 -  (STANDARD_RIGHTS_EXECUTE | \
   4.296 -   FILE_READ_ATTRIBUTES | \
   4.297 -   FILE_EXECUTE | \
   4.298 -   SYNCHRONIZE)
   4.299 -
   4.300 -#define FILE_GENERIC_READ \
   4.301 -  (STANDARD_RIGHTS_READ | \
   4.302 -   FILE_READ_DATA | \
   4.303 -   FILE_READ_ATTRIBUTES | \
   4.304 -   FILE_READ_EA | \
   4.305 -   SYNCHRONIZE)
   4.306 -
   4.307 -#define FILE_GENERIC_WRITE \
   4.308 -  (STANDARD_RIGHTS_WRITE | \
   4.309 -   FILE_WRITE_DATA | \
   4.310 -   FILE_WRITE_ATTRIBUTES | \
   4.311 -   FILE_WRITE_EA | \
   4.312 -   FILE_APPEND_DATA | \
   4.313 -   SYNCHRONIZE)
   4.314 -/* end winnt.h */
   4.315 -
   4.316 -#define DIRECTORY_QUERY (0x0001)
   4.317 -#define DIRECTORY_TRAVERSE (0x0002)
   4.318 -#define DIRECTORY_CREATE_OBJECT (0x0004)
   4.319 -#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
   4.320 -#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
   4.321 -  
   4.322 -/* Exported object types */
   4.323 -extern NTOSAPI POBJECT_TYPE ExDesktopObjectType;
   4.324 -extern NTOSAPI POBJECT_TYPE ExEventObjectType;
   4.325 -extern NTOSAPI POBJECT_TYPE ExSemaphoreObjectType;
   4.326 -extern NTOSAPI POBJECT_TYPE ExWindowStationObjectType;
   4.327 -extern NTOSAPI POBJECT_TYPE IoAdapterObjectType;
   4.328 -extern NTOSAPI ULONG IoDeviceHandlerObjectSize;
   4.329 -extern NTOSAPI POBJECT_TYPE IoDeviceHandlerObjectType;
   4.330 -extern NTOSAPI POBJECT_TYPE IoDeviceObjectType;
   4.331 -extern NTOSAPI POBJECT_TYPE IoDriverObjectType;
   4.332 -extern NTOSAPI POBJECT_TYPE IoFileObjectType;
   4.333 -extern NTOSAPI POBJECT_TYPE LpcPortObjectType;
   4.334 -extern NTOSAPI POBJECT_TYPE MmSectionObjectType;
   4.335 -extern NTOSAPI POBJECT_TYPE SeTokenObjectType;
   4.336 -
   4.337 -extern NTOSAPI CCHAR KeNumberProcessors;
   4.338 -extern NTOSAPI PHAL_DISPATCH_TABLE HalDispatchTable;
   4.339 -extern NTOSAPI PHAL_PRIVATE_DISPATCH_TABLE HalPrivateDispatchTable;
   4.340 -
   4.341 -
   4.342 -/*
   4.343 -** IRP function codes
   4.344 -*/
   4.345 -
   4.346 -#define IRP_MJ_CREATE                     0x00
   4.347 -#define IRP_MJ_CREATE_NAMED_PIPE          0x01
   4.348 -#define IRP_MJ_CLOSE                      0x02
   4.349 -#define IRP_MJ_READ                       0x03
   4.350 -#define IRP_MJ_WRITE                      0x04
   4.351 -#define IRP_MJ_QUERY_INFORMATION          0x05
   4.352 -#define IRP_MJ_SET_INFORMATION            0x06
   4.353 -#define IRP_MJ_QUERY_EA                   0x07
   4.354 -#define IRP_MJ_SET_EA                     0x08
   4.355 -#define IRP_MJ_FLUSH_BUFFERS              0x09
   4.356 -#define IRP_MJ_QUERY_VOLUME_INFORMATION   0x0a
   4.357 -#define IRP_MJ_SET_VOLUME_INFORMATION     0x0b
   4.358 -#define IRP_MJ_DIRECTORY_CONTROL          0x0c
   4.359 -#define IRP_MJ_FILE_SYSTEM_CONTROL        0x0d
   4.360 -#define IRP_MJ_DEVICE_CONTROL             0x0e
   4.361 -#define IRP_MJ_INTERNAL_DEVICE_CONTROL    0x0f
   4.362 -#define IRP_MJ_SCSI                       0x0f
   4.363 -#define IRP_MJ_SHUTDOWN                   0x10
   4.364 -#define IRP_MJ_LOCK_CONTROL               0x11
   4.365 -#define IRP_MJ_CLEANUP                    0x12
   4.366 -#define IRP_MJ_CREATE_MAILSLOT            0x13
   4.367 -#define IRP_MJ_QUERY_SECURITY             0x14
   4.368 -#define IRP_MJ_SET_SECURITY               0x15
   4.369 -#define IRP_MJ_POWER                      0x16
   4.370 -#define IRP_MJ_SYSTEM_CONTROL             0x17
   4.371 -#define IRP_MJ_DEVICE_CHANGE              0x18
   4.372 -#define IRP_MJ_QUERY_QUOTA                0x19
   4.373 -#define IRP_MJ_SET_QUOTA                  0x1a
   4.374 -#define IRP_MJ_PNP                        0x1b
   4.375 -#define IRP_MJ_PNP_POWER                  0x1b
   4.376 -#define IRP_MJ_MAXIMUM_FUNCTION           0x1b
   4.377 -
   4.378 -#define IRP_MN_QUERY_DIRECTORY            0x01
   4.379 -#define IRP_MN_NOTIFY_CHANGE_DIRECTORY    0x02
   4.380 -
   4.381 -#define IRP_MN_USER_FS_REQUEST            0x00
   4.382 -#define IRP_MN_MOUNT_VOLUME               0x01
   4.383 -#define IRP_MN_VERIFY_VOLUME              0x02
   4.384 -#define IRP_MN_LOAD_FILE_SYSTEM           0x03
   4.385 -#define IRP_MN_TRACK_LINK                 0x04
   4.386 -#define IRP_MN_KERNEL_CALL                0x04
   4.387 -
   4.388 -#define IRP_MN_LOCK                       0x01
   4.389 -#define IRP_MN_UNLOCK_SINGLE              0x02
   4.390 -#define IRP_MN_UNLOCK_ALL                 0x03
   4.391 -#define IRP_MN_UNLOCK_ALL_BY_KEY          0x04
   4.392 -
   4.393 -#define IRP_MN_NORMAL                     0x00
   4.394 -#define IRP_MN_DPC                        0x01
   4.395 -#define IRP_MN_MDL                        0x02
   4.396 -#define IRP_MN_COMPLETE                   0x04
   4.397 -#define IRP_MN_COMPRESSED                 0x08
   4.398 -
   4.399 -#define IRP_MN_MDL_DPC                    (IRP_MN_MDL | IRP_MN_DPC)
   4.400 -#define IRP_MN_COMPLETE_MDL               (IRP_MN_COMPLETE | IRP_MN_MDL)
   4.401 -#define IRP_MN_COMPLETE_MDL_DPC           (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
   4.402 -
   4.403 -#define IRP_MN_SCSI_CLASS                 0x01
   4.404 -
   4.405 -#define IRP_MN_START_DEVICE               0x00
   4.406 -#define IRP_MN_QUERY_REMOVE_DEVICE        0x01
   4.407 -#define IRP_MN_REMOVE_DEVICE              0x02
   4.408 -#define IRP_MN_CANCEL_REMOVE_DEVICE       0x03
   4.409 -#define IRP_MN_STOP_DEVICE                0x04
   4.410 -#define IRP_MN_QUERY_STOP_DEVICE          0x05
   4.411 -#define IRP_MN_CANCEL_STOP_DEVICE         0x06
   4.412 -
   4.413 -#define IRP_MN_QUERY_DEVICE_RELATIONS       0x07
   4.414 -#define IRP_MN_QUERY_INTERFACE              0x08
   4.415 -#define IRP_MN_QUERY_CAPABILITIES           0x09
   4.416 -#define IRP_MN_QUERY_RESOURCES              0x0A
   4.417 -#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS  0x0B
   4.418 -#define IRP_MN_QUERY_DEVICE_TEXT            0x0C
   4.419 -#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
   4.420 -
   4.421 -#define IRP_MN_READ_CONFIG                  0x0F
   4.422 -#define IRP_MN_WRITE_CONFIG                 0x10
   4.423 -#define IRP_MN_EJECT                        0x11
   4.424 -#define IRP_MN_SET_LOCK                     0x12
   4.425 -#define IRP_MN_QUERY_ID                     0x13
   4.426 -#define IRP_MN_QUERY_PNP_DEVICE_STATE       0x14
   4.427 -#define IRP_MN_QUERY_BUS_INFORMATION        0x15
   4.428 -#define IRP_MN_DEVICE_USAGE_NOTIFICATION    0x16
   4.429 -#define IRP_MN_SURPRISE_REMOVAL             0x17
   4.430 -#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
   4.431 -
   4.432 -#define IRP_MN_WAIT_WAKE                  0x00
   4.433 -#define IRP_MN_POWER_SEQUENCE             0x01
   4.434 -#define IRP_MN_SET_POWER                  0x02
   4.435 -#define IRP_MN_QUERY_POWER                0x03
   4.436 -
   4.437 -#define IRP_MN_QUERY_ALL_DATA             0x00
   4.438 -#define IRP_MN_QUERY_SINGLE_INSTANCE      0x01
   4.439 -#define IRP_MN_CHANGE_SINGLE_INSTANCE     0x02
   4.440 -#define IRP_MN_CHANGE_SINGLE_ITEM         0x03
   4.441 -#define IRP_MN_ENABLE_EVENTS              0x04
   4.442 -#define IRP_MN_DISABLE_EVENTS             0x05
   4.443 -#define IRP_MN_ENABLE_COLLECTION          0x06
   4.444 -#define IRP_MN_DISABLE_COLLECTION         0x07
   4.445 -#define IRP_MN_REGINFO                    0x08
   4.446 -#define IRP_MN_EXECUTE_METHOD             0x09
   4.447 -
   4.448 -#define IRP_MN_REGINFO_EX                 0x0b
   4.449 -
   4.450 -typedef enum _IO_ALLOCATION_ACTION {
   4.451 -  KeepObject = 1,
   4.452 -  DeallocateObject,
   4.453 -  DeallocateObjectKeepRegisters
   4.454 -} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
   4.455 -
   4.456 -typedef IO_ALLOCATION_ACTION
   4.457 -(DDKAPI *PDRIVER_CONTROL)(
   4.458 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.459 -  /*IN*/ struct _IRP  *Irp,
   4.460 -  /*IN*/ PVOID  MapRegisterBase,
   4.461 -  /*IN*/ PVOID  Context);
   4.462 -
   4.463 -typedef VOID
   4.464 -(DDKAPI *PDRIVER_LIST_CONTROL)(
   4.465 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.466 -  /*IN*/ struct _IRP  *Irp,
   4.467 -  /*IN*/ struct _SCATTER_GATHER_LIST  *ScatterGather,
   4.468 -  /*IN*/ PVOID  Context);
   4.469 -
   4.470 -typedef NTSTATUS
   4.471 -(DDKAPI *PDRIVER_ADD_DEVICE)(
   4.472 -  /*IN*/ struct _DRIVER_OBJECT  *DriverObject,
   4.473 -  /*IN*/ struct _DEVICE_OBJECT  *PhysicalDeviceObject);
   4.474 -
   4.475 -typedef NTSTATUS
   4.476 -(DDKAPI *PIO_COMPLETION_ROUTINE)(
   4.477 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.478 -  /*IN*/ struct _IRP  *Irp,
   4.479 -  /*IN*/ PVOID  Context);
   4.480 -
   4.481 -typedef VOID
   4.482 -(DDKAPI *PDRIVER_CANCEL)(
   4.483 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.484 -  /*IN*/ struct _IRP  *Irp);
   4.485 -
   4.486 -typedef VOID
   4.487 -(DDKAPI *PKDEFERRED_ROUTINE)(
   4.488 -  /*IN*/ struct _KDPC  *Dpc,
   4.489 -  /*IN*/ PVOID  DeferredContext,
   4.490 -  /*IN*/ PVOID  SystemArgument1,
   4.491 -  /*IN*/ PVOID  SystemArgument2);
   4.492 -
   4.493 -typedef NTSTATUS
   4.494 -(DDKAPI *PDRIVER_DISPATCH)(
   4.495 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.496 -  /*IN*/ struct _IRP  *Irp);
   4.497 -
   4.498 -typedef VOID
   4.499 -(DDKAPI *PIO_DPC_ROUTINE)(
   4.500 -  /*IN*/ struct _KDPC  *Dpc,
   4.501 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.502 -  /*IN*/ struct _IRP  *Irp,
   4.503 -  /*IN*/ PVOID  Context);
   4.504 -
   4.505 -typedef NTSTATUS
   4.506 -(DDKAPI *PMM_DLL_INITIALIZE)(
   4.507 -  /*IN*/ PUNICODE_STRING  RegistryPath);
   4.508 -
   4.509 -typedef NTSTATUS
   4.510 -(DDKAPI *PMM_DLL_UNLOAD)(
   4.511 -  VOID);
   4.512 -
   4.513 -typedef NTSTATUS
   4.514 -(DDKAPI *PDRIVER_ENTRY)( 
   4.515 -  /*IN*/ struct _DRIVER_OBJECT  *DriverObject, 
   4.516 -  /*IN*/ PUNICODE_STRING  RegistryPath); 
   4.517 -
   4.518 -typedef NTSTATUS
   4.519 -(DDKAPI *PDRIVER_INITIALIZE)(
   4.520 -  /*IN*/ struct _DRIVER_OBJECT  *DriverObject, 
   4.521 -  /*IN*/ PUNICODE_STRING  RegistryPath);
   4.522 -
   4.523 -typedef BOOLEAN
   4.524 -(DDKAPI *PKSERVICE_ROUTINE)(
   4.525 -  /*IN*/ struct _KINTERRUPT  *Interrupt,
   4.526 -  /*IN*/ PVOID  ServiceContext);
   4.527 -
   4.528 -typedef VOID
   4.529 -(DDKAPI *PIO_TIMER_ROUTINE)(
   4.530 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.531 -  /*IN*/ PVOID  Context);
   4.532 -
   4.533 -typedef VOID
   4.534 -(DDKAPI *PDRIVER_REINITIALIZE)( 
   4.535 -  /*IN*/ struct _DRIVER_OBJECT  *DriverObject, 
   4.536 -  /*IN*/ PVOID  Context, 
   4.537 -  /*IN*/ ULONG  Count); 
   4.538 -
   4.539 -typedef NTSTATUS
   4.540 -(DDKAPI *PDRIVER_STARTIO)(
   4.541 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject,
   4.542 -  /*IN*/ struct _IRP  *Irp);
   4.543 -
   4.544 -typedef BOOLEAN
   4.545 -(DDKAPI *PKSYNCHRONIZE_ROUTINE)(
   4.546 -  /*IN*/ PVOID  SynchronizeContext);
   4.547 -
   4.548 -typedef VOID
   4.549 -(DDKAPI *PDRIVER_UNLOAD)( 
   4.550 -  /*IN*/ struct _DRIVER_OBJECT  *DriverObject); 
   4.551 -
   4.552 -
   4.553 -
   4.554 -/*
   4.555 -** Plug and Play structures
   4.556 -*/
   4.557 -
   4.558 -typedef VOID DDKAPI
   4.559 -(*PINTERFACE_REFERENCE)(
   4.560 -  PVOID  Context);
   4.561 -
   4.562 -typedef VOID DDKAPI
   4.563 -(*PINTERFACE_DEREFERENCE)(
   4.564 -  PVOID Context);
   4.565 -
   4.566 -typedef BOOLEAN DDKAPI
   4.567 -(*PTRANSLATE_BUS_ADDRESS)(
   4.568 -  /*IN*/ PVOID  Context,
   4.569 -  /*IN*/ PHYSICAL_ADDRESS  BusAddress,
   4.570 -  /*IN*/ ULONG  Length,
   4.571 -  /*IN OUT*/ PULONG  AddressSpace,
   4.572 -  /*OUT*/ PPHYSICAL_ADDRESS  TranslatedAddress);
   4.573 -
   4.574 -typedef struct _DMA_ADAPTER* DDKAPI
   4.575 -(*PGET_DMA_ADAPTER)(
   4.576 -  /*IN*/ PVOID  Context,
   4.577 -  /*IN*/ struct _DEVICE_DESCRIPTION  *DeviceDescriptor,
   4.578 -  /*OUT*/ PULONG  NumberOfMapRegisters);
   4.579 -
   4.580 -typedef ULONG DDKAPI
   4.581 -(*PGET_SET_DEVICE_DATA)(
   4.582 -  /*IN*/ PVOID  Context,
   4.583 -  /*IN*/ ULONG  DataType,
   4.584 -  /*IN*/ PVOID  Buffer,
   4.585 -  /*IN*/ ULONG  Offset,
   4.586 -  /*IN*/ ULONG  Length);
   4.587 -
   4.588 -typedef union _POWER_STATE {
   4.589 -  SYSTEM_POWER_STATE  SystemState;
   4.590 -  DEVICE_POWER_STATE  DeviceState;
   4.591 -} POWER_STATE, *PPOWER_STATE;
   4.592 -
   4.593 -typedef enum _POWER_STATE_TYPE {
   4.594 -  SystemPowerState,
   4.595 -  DevicePowerState
   4.596 -} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
   4.597 -
   4.598 -typedef struct _BUS_INTERFACE_STANDARD {
   4.599 -  USHORT  Size;
   4.600 -  USHORT  Version;
   4.601 -  PVOID  Context;
   4.602 -  PINTERFACE_REFERENCE  InterfaceReference;
   4.603 -  PINTERFACE_DEREFERENCE  InterfaceDereference;
   4.604 -  PTRANSLATE_BUS_ADDRESS  TranslateBusAddress;
   4.605 -  PGET_DMA_ADAPTER  GetDmaAdapter;
   4.606 -  PGET_SET_DEVICE_DATA  SetBusData;
   4.607 -  PGET_SET_DEVICE_DATA  GetBusData;
   4.608 -} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
   4.609 -
   4.610 -typedef struct _DEVICE_CAPABILITIES {
   4.611 -  USHORT  Size;
   4.612 -  USHORT  Version;
   4.613 -  ULONG  DeviceD1 : 1;
   4.614 -  ULONG  DeviceD2 : 1;
   4.615 -  ULONG  LockSupported : 1;
   4.616 -  ULONG  EjectSupported : 1;
   4.617 -  ULONG  Removable : 1;
   4.618 -  ULONG  DockDevice : 1;
   4.619 -  ULONG  UniqueID : 1;
   4.620 -  ULONG  SilentInstall : 1;
   4.621 -  ULONG  RawDeviceOK : 1;
   4.622 -  ULONG  SurpriseRemovalOK : 1;
   4.623 -  ULONG  WakeFromD0 : 1;
   4.624 -  ULONG  WakeFromD1 : 1;
   4.625 -  ULONG  WakeFromD2 : 1;
   4.626 -  ULONG  WakeFromD3 : 1;
   4.627 -  ULONG  HardwareDisabled : 1;
   4.628 -  ULONG  NonDynamic : 1;
   4.629 -  ULONG  WarmEjectSupported : 1;
   4.630 -  ULONG  NoDisplayInUI : 1;
   4.631 -  ULONG  Reserved : 14;
   4.632 -  ULONG  Address;
   4.633 -  ULONG  UINumber;
   4.634 -  DEVICE_POWER_STATE  DeviceState[PowerSystemMaximum];
   4.635 -  SYSTEM_POWER_STATE  SystemWake;
   4.636 -  DEVICE_POWER_STATE  DeviceWake;
   4.637 -  ULONG  D1Latency;
   4.638 -  ULONG  D2Latency;
   4.639 -  ULONG  D3Latency;
   4.640 -} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
   4.641 -
   4.642 -typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
   4.643 -  USHORT  Version;
   4.644 -  USHORT  Size;
   4.645 -  GUID  Event;
   4.646 -  GUID  InterfaceClassGuid;
   4.647 -  PUNICODE_STRING  SymbolicLinkName;
   4.648 -} DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
   4.649 -
   4.650 -typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
   4.651 -  USHORT  Version;
   4.652 -  USHORT  Size;
   4.653 -  GUID  Event;
   4.654 -} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
   4.655 -
   4.656 -#undef INTERFACE
   4.657 -
   4.658 -typedef struct _INTERFACE {
   4.659 -  USHORT  Size;
   4.660 -  USHORT  Version;
   4.661 -  PVOID  Context;
   4.662 -  PINTERFACE_REFERENCE  InterfaceReference;
   4.663 -  PINTERFACE_DEREFERENCE  InterfaceDereference;
   4.664 -} INTERFACE, *PINTERFACE; 
   4.665 -
   4.666 -typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
   4.667 -  USHORT  Version; 
   4.668 -  USHORT  Size; 
   4.669 -  GUID  Event;
   4.670 -} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
   4.671 -
   4.672 -typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
   4.673 -
   4.674 -/* PNP_DEVICE_STATE */
   4.675 -
   4.676 -#define PNP_DEVICE_DISABLED                      0x00000001
   4.677 -#define PNP_DEVICE_DONT_DISPLAY_IN_UI            0x00000002
   4.678 -#define PNP_DEVICE_FAILED                        0x00000004
   4.679 -#define PNP_DEVICE_REMOVED                       0x00000008
   4.680 -#define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
   4.681 -#define PNP_DEVICE_NOT_DISABLEABLE               0x00000020
   4.682 -
   4.683 -typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
   4.684 -  USHORT  Version;
   4.685 -  USHORT  Size;
   4.686 -  GUID  Event;
   4.687 -  struct _FILE_OBJECT  *FileObject;
   4.688 -  LONG  NameBufferOffset;
   4.689 -  UCHAR  CustomDataBuffer[1];
   4.690 -} TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
   4.691 -
   4.692 -typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
   4.693 -  USHORT  Version;
   4.694 -  USHORT  Size;
   4.695 -  GUID  Event;
   4.696 -  struct _FILE_OBJECT  *FileObject;
   4.697 -} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
   4.698 -
   4.699 -typedef enum _BUS_QUERY_ID_TYPE {
   4.700 -  BusQueryDeviceID,
   4.701 -  BusQueryHardwareIDs,
   4.702 -  BusQueryCompatibleIDs,
   4.703 -  BusQueryInstanceID,
   4.704 -  BusQueryDeviceSerialNumber
   4.705 -} BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
   4.706 -
   4.707 -typedef enum _DEVICE_TEXT_TYPE {
   4.708 -  DeviceTextDescription,
   4.709 -  DeviceTextLocationInformation
   4.710 -} DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
   4.711 -
   4.712 -typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
   4.713 -  DeviceUsageTypeUndefined,
   4.714 -  DeviceUsageTypePaging,
   4.715 -  DeviceUsageTypeHibernation,
   4.716 -  DeviceUsageTypeDumpFile
   4.717 -} DEVICE_USAGE_NOTIFICATION_TYPE;
   4.718 -
   4.719 -typedef struct _POWER_SEQUENCE {
   4.720 -  ULONG  SequenceD1;
   4.721 -  ULONG  SequenceD2;
   4.722 -  ULONG  SequenceD3;
   4.723 -} POWER_SEQUENCE, *PPOWER_SEQUENCE;
   4.724 -
   4.725 -typedef enum {
   4.726 -  DevicePropertyDeviceDescription,
   4.727 -  DevicePropertyHardwareID,
   4.728 -  DevicePropertyCompatibleIDs,
   4.729 -  DevicePropertyBootConfiguration,
   4.730 -  DevicePropertyBootConfigurationTranslated,
   4.731 -  DevicePropertyClassName,
   4.732 -  DevicePropertyClassGuid,
   4.733 -  DevicePropertyDriverKeyName,
   4.734 -  DevicePropertyManufacturer,
   4.735 -  DevicePropertyFriendlyName,
   4.736 -  DevicePropertyLocationInformation,
   4.737 -  DevicePropertyPhysicalDeviceObjectName,
   4.738 -  DevicePropertyBusTypeGuid,
   4.739 -  DevicePropertyLegacyBusType,
   4.740 -  DevicePropertyBusNumber,
   4.741 -  DevicePropertyEnumeratorName,
   4.742 -  DevicePropertyAddress,
   4.743 -  DevicePropertyUINumber,
   4.744 -  DevicePropertyInstallState,
   4.745 -  DevicePropertyRemovalPolicy
   4.746 -} DEVICE_REGISTRY_PROPERTY;
   4.747 -
   4.748 -typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
   4.749 -  EventCategoryReserved,
   4.750 -  EventCategoryHardwareProfileChange,
   4.751 -  EventCategoryDeviceInterfaceChange,
   4.752 -  EventCategoryTargetDeviceChange
   4.753 -} IO_NOTIFICATION_EVENT_CATEGORY;
   4.754 -
   4.755 -#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES    0x00000001
   4.756 -
   4.757 -typedef NTSTATUS DDKAPI
   4.758 -(*PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
   4.759 -  /*IN*/ PVOID NotificationStructure,
   4.760 -  /*IN*/ PVOID Context);
   4.761 -
   4.762 -typedef VOID DDKAPI
   4.763 -(*PDEVICE_CHANGE_COMPLETE_CALLBACK)(
   4.764 -  /*IN*/ PVOID Context);
   4.765 -
   4.766 -
   4.767 -
   4.768 -/*
   4.769 -** System structures
   4.770 -*/
   4.771 -
   4.772 -#define SYMBOLIC_LINK_QUERY               0x0001
   4.773 -#define SYMBOLIC_LINK_ALL_ACCESS          (STANDARD_RIGHTS_REQUIRED | 0x1)
   4.774 -
   4.775 -/* also in winnt,h */
   4.776 -#define DUPLICATE_CLOSE_SOURCE            0x00000001
   4.777 -#define DUPLICATE_SAME_ACCESS             0x00000002
   4.778 -#define DUPLICATE_SAME_ATTRIBUTES         0x00000004
   4.779 -/* end winnt.h */
   4.780 -
   4.781 -typedef struct _OBJECT_NAME_INFORMATION {               
   4.782 -  UNICODE_STRING  Name;                                
   4.783 -} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;   
   4.784 -
   4.785 -typedef VOID DDKAPI
   4.786 -(*PIO_APC_ROUTINE)(
   4.787 -  /*IN*/ PVOID ApcContext,
   4.788 -  /*IN*/ PIO_STATUS_BLOCK IoStatusBlock,
   4.789 -  /*IN*/ ULONG Reserved);
   4.790 -
   4.791 -typedef struct _IO_STATUS_BLOCK {
   4.792 -  _ANONYMOUS_UNION union {
   4.793 -    NTSTATUS  Status;
   4.794 -    PVOID  Pointer;
   4.795 -  } DUMMYUNIONNAME;
   4.796 -  ULONG_PTR  Information;
   4.797 -} IO_STATUS_BLOCK;
   4.798 -
   4.799 -typedef VOID DDKAPI
   4.800 -(*PKNORMAL_ROUTINE)(
   4.801 -  /*IN*/ PVOID  NormalContext,
   4.802 -  /*IN*/ PVOID  SystemArgument1,
   4.803 -  /*IN*/ PVOID  SystemArgument2);
   4.804 -
   4.805 -typedef VOID DDKAPI
   4.806 -(*PKKERNEL_ROUTINE)(
   4.807 -  /*IN*/ struct _KAPC  *Apc,
   4.808 -  /*IN OUT*/ PKNORMAL_ROUTINE  *NormalRoutine,
   4.809 -  /*IN OUT*/ PVOID  *NormalContext,
   4.810 -  /*IN OUT*/ PVOID  *SystemArgument1,
   4.811 -  /*IN OUT*/ PVOID  *SystemArgument2);
   4.812 -
   4.813 -typedef VOID DDKAPI
   4.814 -(*PKRUNDOWN_ROUTINE)(
   4.815 -  /*IN*/ struct _KAPC  *Apc);
   4.816 -
   4.817 -typedef BOOLEAN DDKAPI
   4.818 -(*PKTRANSFER_ROUTINE)(
   4.819 -  VOID);
   4.820 -
   4.821 -typedef struct _KAPC {
   4.822 -  CSHORT  Type;
   4.823 -  CSHORT  Size;
   4.824 -  ULONG  Spare0;
   4.825 -  struct _KTHREAD  *Thread;
   4.826 -  LIST_ENTRY  ApcListEntry;
   4.827 -  PKKERNEL_ROUTINE  KernelRoutine;
   4.828 -  PKRUNDOWN_ROUTINE  RundownRoutine;
   4.829 -  PKNORMAL_ROUTINE  NormalRoutine;
   4.830 -  PVOID  NormalContext;
   4.831 -  PVOID  SystemArgument1;
   4.832 -  PVOID  SystemArgument2;
   4.833 -  CCHAR  ApcStateIndex;
   4.834 -  KPROCESSOR_MODE  ApcMode;
   4.835 -  BOOLEAN  Inserted;
   4.836 -} KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
   4.837 -
   4.838 -typedef struct _KDEVICE_QUEUE {
   4.839 -  CSHORT  Type;
   4.840 -  CSHORT  Size;
   4.841 -  LIST_ENTRY  DeviceListHead;
   4.842 -  KSPIN_LOCK  Lock;
   4.843 -  BOOLEAN  Busy;
   4.844 -} KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
   4.845 -
   4.846 -typedef struct _KDEVICE_QUEUE_ENTRY {
   4.847 -  LIST_ENTRY  DeviceListEntry;
   4.848 -  ULONG  SortKey;
   4.849 -  BOOLEAN  Inserted;
   4.850 -} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
   4.851 -*RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
   4.852 -
   4.853 -#define LOCK_QUEUE_WAIT                   1
   4.854 -#define LOCK_QUEUE_OWNER                  2
   4.855 -
   4.856 -typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
   4.857 -  LockQueueDispatcherLock,
   4.858 -  LockQueueContextSwapLock,
   4.859 -  LockQueuePfnLock,
   4.860 -  LockQueueSystemSpaceLock,
   4.861 -  LockQueueVacbLock,
   4.862 -  LockQueueMasterLock,
   4.863 -  LockQueueNonPagedPoolLock,
   4.864 -  LockQueueIoCancelLock,
   4.865 -  LockQueueWorkQueueLock,
   4.866 -  LockQueueIoVpbLock,
   4.867 -  LockQueueIoDatabaseLock,
   4.868 -  LockQueueIoCompletionLock,
   4.869 -  LockQueueNtfsStructLock,
   4.870 -  LockQueueAfdWorkQueueLock,
   4.871 -  LockQueueBcbLock,
   4.872 -  LockQueueMaximumLock
   4.873 -} KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
   4.874 -
   4.875 -typedef struct _KSPIN_LOCK_QUEUE {
   4.876 -  struct _KSPIN_LOCK_QUEUE  *VOLATILE Next;
   4.877 -  PKSPIN_LOCK VOLATILE  Lock;
   4.878 -} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
   4.879 -
   4.880 -typedef struct _KLOCK_QUEUE_HANDLE {
   4.881 -  KSPIN_LOCK_QUEUE  LockQueue;
   4.882 -  KIRQL  OldIrql;
   4.883 -} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
   4.884 -
   4.885 -typedef struct _KDPC {
   4.886 -  CSHORT  Type;
   4.887 -  UCHAR  Number;
   4.888 -  UCHAR  Importance;
   4.889 -  LIST_ENTRY  DpcListEntry;
   4.890 -  PKDEFERRED_ROUTINE  DeferredRoutine;
   4.891 -  PVOID  DeferredContext;
   4.892 -  PVOID  SystemArgument1;
   4.893 -  PVOID  SystemArgument2;
   4.894 -  PULONG_PTR  Lock;
   4.895 -} KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
   4.896 -
   4.897 -typedef struct _WAIT_CONTEXT_BLOCK {
   4.898 -  KDEVICE_QUEUE_ENTRY  WaitQueueEntry;
   4.899 -  struct _DRIVER_CONTROL  *DeviceRoutine;
   4.900 -  PVOID  DeviceContext;
   4.901 -  ULONG  NumberOfMapRegisters;
   4.902 -  PVOID  DeviceObject;
   4.903 -  PVOID  CurrentIrp;
   4.904 -  PKDPC  BufferChainingDpc;
   4.905 -} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
   4.906 -
   4.907 -typedef struct _DISPATCHER_HEADER {
   4.908 -  UCHAR  Type;
   4.909 -  UCHAR  Absolute;
   4.910 -  UCHAR  Size;
   4.911 -  UCHAR  Inserted;
   4.912 -  LONG  SignalState;
   4.913 -  LIST_ENTRY  WaitListHead;
   4.914 -} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
   4.915 -
   4.916 -typedef struct _KEVENT {
   4.917 -  DISPATCHER_HEADER  Header;
   4.918 -} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
   4.919 -
   4.920 -typedef struct _KSEMAPHORE {
   4.921 -    DISPATCHER_HEADER Header;
   4.922 -    LONG Limit;
   4.923 -} KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
   4.924 -
   4.925 -typedef struct _FAST_MUTEX {
   4.926 -  LONG  Count;
   4.927 -  struct _KTHREAD  *Owner;
   4.928 -  ULONG  Contention;
   4.929 -  KEVENT  Event;
   4.930 -  ULONG  OldIrql;
   4.931 -} FAST_MUTEX, *PFAST_MUTEX;
   4.932 -
   4.933 -typedef struct _KTIMER {
   4.934 -  DISPATCHER_HEADER  Header;
   4.935 -  ULARGE_INTEGER  DueTime;
   4.936 -  LIST_ENTRY  TimerListEntry;
   4.937 -  struct _KDPC  *Dpc;
   4.938 -  LONG  Period;
   4.939 -} KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
   4.940 -
   4.941 -typedef struct _KMUTANT {
   4.942 -  DISPATCHER_HEADER  Header;
   4.943 -  LIST_ENTRY  MutantListEntry;
   4.944 -  struct _KTHREAD  *RESTRICTED_POINTER OwnerThread;
   4.945 -  BOOLEAN  Abandoned;
   4.946 -  UCHAR  ApcDisable;
   4.947 -} KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
   4.948 -
   4.949 -typedef enum _TIMER_TYPE {
   4.950 -  NotificationTimer,
   4.951 -  SynchronizationTimer
   4.952 -} TIMER_TYPE;
   4.953 -
   4.954 -#define EVENT_INCREMENT                   1
   4.955 -#define IO_NO_INCREMENT                   0
   4.956 -#define IO_CD_ROM_INCREMENT               1
   4.957 -#define IO_DISK_INCREMENT                 1
   4.958 -#define IO_KEYBOARD_INCREMENT             6
   4.959 -#define IO_MAILSLOT_INCREMENT             2
   4.960 -#define IO_MOUSE_INCREMENT                6
   4.961 -#define IO_NAMED_PIPE_INCREMENT           2
   4.962 -#define IO_NETWORK_INCREMENT              2
   4.963 -#define IO_PARALLEL_INCREMENT             1
   4.964 -#define IO_SERIAL_INCREMENT               2
   4.965 -#define IO_SOUND_INCREMENT                8
   4.966 -#define IO_VIDEO_INCREMENT                1
   4.967 -#define SEMAPHORE_INCREMENT               1
   4.968 -
   4.969 -typedef struct _IRP {
   4.970 -  CSHORT  Type;
   4.971 -  USHORT  Size;
   4.972 -  struct _MDL  *MdlAddress;
   4.973 -  ULONG  Flags;
   4.974 -  union {
   4.975 -    struct _IRP  *MasterIrp;
   4.976 -    LONG  IrpCount;
   4.977 -    PVOID  SystemBuffer;
   4.978 -  } AssociatedIrp;
   4.979 -  LIST_ENTRY  ThreadListEntry;
   4.980 -  IO_STATUS_BLOCK  IoStatus;
   4.981 -  KPROCESSOR_MODE  RequestorMode;
   4.982 -  BOOLEAN  PendingReturned;
   4.983 -  CHAR  StackCount;
   4.984 -  CHAR  CurrentLocation;
   4.985 -  BOOLEAN  Cancel;
   4.986 -  KIRQL  CancelIrql;
   4.987 -  CCHAR  ApcEnvironment;
   4.988 -  UCHAR  AllocationFlags;
   4.989 -  PIO_STATUS_BLOCK  UserIosb;
   4.990 -  PKEVENT  UserEvent;
   4.991 -  union {
   4.992 -    struct {
   4.993 -      PIO_APC_ROUTINE  UserApcRoutine;
   4.994 -      PVOID  UserApcContext;
   4.995 -    } AsynchronousParameters;
   4.996 -    LARGE_INTEGER  AllocationSize;
   4.997 -  } Overlay;
   4.998 -  PDRIVER_CANCEL  CancelRoutine;
   4.999 -  PVOID  UserBuffer;
  4.1000 -  union {
  4.1001 -    struct {
  4.1002 -      _ANONYMOUS_UNION union {
  4.1003 -        KDEVICE_QUEUE_ENTRY  DeviceQueueEntry;
  4.1004 -        _ANONYMOUS_STRUCT struct {
  4.1005 -          PVOID  DriverContext[4];
  4.1006 -        } DUMMYSTRUCTNAME;
  4.1007 -      } DUMMYUNIONNAME;
  4.1008 -      PETHREAD  Thread;
  4.1009 -      PCHAR  AuxiliaryBuffer;
  4.1010 -      _ANONYMOUS_STRUCT struct {
  4.1011 -        LIST_ENTRY  ListEntry;
  4.1012 -        _ANONYMOUS_UNION union {
  4.1013 -          struct _IO_STACK_LOCATION  *CurrentStackLocation;
  4.1014 -          ULONG  PacketType;
  4.1015 -        } DUMMYUNIONNAME;
  4.1016 -      } DUMMYSTRUCTNAME;
  4.1017 -      struct _FILE_OBJECT  *OriginalFileObject;
  4.1018 -    } Overlay;
  4.1019 -    KAPC  Apc;
  4.1020 -    PVOID  CompletionKey;
  4.1021 -  } Tail;
  4.1022 -} IRP;
  4.1023 -typedef struct _IRP *PIRP;
  4.1024 -
  4.1025 -/* IRP.Flags */
  4.1026 -
  4.1027 -#define SL_FORCE_ACCESS_CHECK             0x01
  4.1028 -#define SL_OPEN_PAGING_FILE               0x02
  4.1029 -#define SL_OPEN_TARGET_DIRECTORY          0x04
  4.1030 -#define SL_CASE_SENSITIVE                 0x80
  4.1031 -
  4.1032 -#define SL_KEY_SPECIFIED                  0x01
  4.1033 -#define SL_OVERRIDE_VERIFY_VOLUME         0x02
  4.1034 -#define SL_WRITE_THROUGH                  0x04
  4.1035 -#define SL_FT_SEQUENTIAL_WRITE            0x08
  4.1036 -
  4.1037 -#define SL_FAIL_IMMEDIATELY               0x01
  4.1038 -#define SL_EXCLUSIVE_LOCK                 0x02
  4.1039 -
  4.1040 -#define SL_RESTART_SCAN                   0x01
  4.1041 -#define SL_RETURN_SINGLE_ENTRY            0x02
  4.1042 -#define SL_INDEX_SPECIFIED                0x04
  4.1043 -
  4.1044 -#define SL_WATCH_TREE                     0x01
  4.1045 -
  4.1046 -#define SL_ALLOW_RAW_MOUNT                0x01
  4.1047 -
  4.1048 -#define CTL_CODE(DeviceType, Function, Method, Access)( \
  4.1049 -  ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
  4.1050 -
  4.1051 -#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
  4.1052 -
  4.1053 -enum
  4.1054 -{
  4.1055 -   IRP_NOCACHE = 0x1,
  4.1056 -   IRP_PAGING_IO = 0x2,
  4.1057 -   IRP_MOUNT_COMPLETION = 0x2,
  4.1058 -   IRP_SYNCHRONOUS_API = 0x4,
  4.1059 -   IRP_ASSOCIATED_IRP = 0x8,
  4.1060 -   IRP_BUFFERED_IO = 0x10,
  4.1061 -   IRP_DEALLOCATE_BUFFER = 0x20,
  4.1062 -   IRP_INPUT_OPERATION = 0x40,
  4.1063 -   IRP_SYNCHRONOUS_PAGING_IO = 0x40,
  4.1064 -   IRP_CREATE_OPERATION = 0x80,
  4.1065 -   IRP_READ_OPERATION = 0x100,
  4.1066 -   IRP_WRITE_OPERATION = 0x200,
  4.1067 -   IRP_CLOSE_OPERATION = 0x400,
  4.1068 -   IRP_DEFER_IO_COMPLETION = 0x800,
  4.1069 -   IRP_OB_QUERY_NAME = 0x1000,
  4.1070 -   IRP_HOLD_DEVICE_QUEUE = 0x2000,
  4.1071 -   IRP_RETRY_IO_COMPLETION = 0x4000
  4.1072 -};
  4.1073 -
  4.1074 -
  4.1075 -typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
  4.1076 -  ULONG  Signature;
  4.1077 -} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
  4.1078 -
  4.1079 -typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
  4.1080 -  GUID  DiskId;
  4.1081 -  LARGE_INTEGER  StartingUsableOffset;
  4.1082 -  LARGE_INTEGER  UsableLength;
  4.1083 -  ULONG  MaxPartitionCount;
  4.1084 -} DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
  4.1085 -
  4.1086 -typedef struct _PARTITION_INFORMATION_MBR {
  4.1087 -  UCHAR  PartitionType;
  4.1088 -  BOOLEAN  BootIndicator;
  4.1089 -  BOOLEAN  RecognizedPartition;
  4.1090 -  ULONG  HiddenSectors;
  4.1091 -} PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
  4.1092 -
  4.1093 -
  4.1094 -typedef struct _BOOTDISK_INFORMATION {
  4.1095 -  LONGLONG  BootPartitionOffset;
  4.1096 -  LONGLONG  SystemPartitionOffset;
  4.1097 -  ULONG  BootDeviceSignature;
  4.1098 -  ULONG  SystemDeviceSignature;
  4.1099 -} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
  4.1100 -
  4.1101 -typedef struct _BOOTDISK_INFORMATION_EX {
  4.1102 -  LONGLONG  BootPartitionOffset;
  4.1103 -  LONGLONG  SystemPartitionOffset;
  4.1104 -  ULONG  BootDeviceSignature;
  4.1105 -  ULONG  SystemDeviceSignature;
  4.1106 -  GUID  BootDeviceGuid;
  4.1107 -  GUID  SystemDeviceGuid;
  4.1108 -  BOOLEAN  BootDeviceIsGpt;
  4.1109 -  BOOLEAN  SystemDeviceIsGpt;
  4.1110 -} BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
  4.1111 -
  4.1112 -typedef struct _EISA_MEMORY_TYPE {
  4.1113 -  UCHAR  ReadWrite : 1;
  4.1114 -  UCHAR  Cached : 1;
  4.1115 -  UCHAR  Reserved0 : 1;
  4.1116 -  UCHAR  Type : 2;
  4.1117 -  UCHAR  Shared : 1;
  4.1118 -  UCHAR  Reserved1 : 1;
  4.1119 -  UCHAR  MoreEntries : 1;
  4.1120 -} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
  4.1121 -
  4.1122 -#include <pshpack1.h>
  4.1123 -typedef struct _EISA_MEMORY_CONFIGURATION {
  4.1124 -  EISA_MEMORY_TYPE  ConfigurationByte;
  4.1125 -  UCHAR  DataSize;
  4.1126 -  USHORT  AddressLowWord;
  4.1127 -  UCHAR  AddressHighByte;
  4.1128 -  USHORT  MemorySize;
  4.1129 -} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
  4.1130 -#include <poppack.h>
  4.1131 -
  4.1132 -typedef struct _EISA_IRQ_DESCRIPTOR {
  4.1133 -  UCHAR  Interrupt : 4;
  4.1134 -  UCHAR  Reserved : 1;
  4.1135 -  UCHAR  LevelTriggered : 1;
  4.1136 -  UCHAR  Shared : 1;
  4.1137 -  UCHAR  MoreEntries : 1;
  4.1138 -} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
  4.1139 -
  4.1140 -typedef struct _EISA_IRQ_CONFIGURATION {
  4.1141 -  EISA_IRQ_DESCRIPTOR  ConfigurationByte;
  4.1142 -  UCHAR  Reserved;
  4.1143 -} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
  4.1144 -
  4.1145 -typedef struct _DMA_CONFIGURATION_BYTE0 {
  4.1146 -  UCHAR Channel : 3;
  4.1147 -  UCHAR Reserved : 3;
  4.1148 -  UCHAR Shared : 1;
  4.1149 -  UCHAR MoreEntries : 1;
  4.1150 -} DMA_CONFIGURATION_BYTE0;
  4.1151 -
  4.1152 -typedef struct _DMA_CONFIGURATION_BYTE1 {
  4.1153 -  UCHAR  Reserved0 : 2;
  4.1154 -  UCHAR  TransferSize : 2;
  4.1155 -  UCHAR  Timing : 2;
  4.1156 -  UCHAR  Reserved1 : 2;
  4.1157 -} DMA_CONFIGURATION_BYTE1;
  4.1158 -
  4.1159 -typedef struct _EISA_DMA_CONFIGURATION {
  4.1160 -  DMA_CONFIGURATION_BYTE0  ConfigurationByte0;
  4.1161 -  DMA_CONFIGURATION_BYTE1  ConfigurationByte1;
  4.1162 -} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
  4.1163 -
  4.1164 -#include <pshpack1.h>
  4.1165 -typedef struct _EISA_PORT_DESCRIPTOR {
  4.1166 -  UCHAR  NumberPorts : 5;
  4.1167 -  UCHAR  Reserved : 1;
  4.1168 -  UCHAR  Shared : 1;
  4.1169 -  UCHAR  MoreEntries : 1;
  4.1170 -} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
  4.1171 -
  4.1172 -typedef struct _EISA_PORT_CONFIGURATION {
  4.1173 -  EISA_PORT_DESCRIPTOR  Configuration;
  4.1174 -  USHORT  PortAddress;
  4.1175 -} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
  4.1176 -#include <poppack.h>
  4.1177 -
  4.1178 -typedef struct _CM_EISA_FUNCTION_INFORMATION {
  4.1179 -  ULONG  CompressedId;
  4.1180 -  UCHAR  IdSlotFlags1;
  4.1181 -  UCHAR  IdSlotFlags2;
  4.1182 -  UCHAR  MinorRevision;
  4.1183 -  UCHAR  MajorRevision;
  4.1184 -  UCHAR  Selections[26];
  4.1185 -  UCHAR  FunctionFlags;
  4.1186 -  UCHAR  TypeString[80];
  4.1187 -  EISA_MEMORY_CONFIGURATION  EisaMemory[9];
  4.1188 -  EISA_IRQ_CONFIGURATION  EisaIrq[7];
  4.1189 -  EISA_DMA_CONFIGURATION  EisaDma[4];
  4.1190 -  EISA_PORT_CONFIGURATION  EisaPort[20];
  4.1191 -  UCHAR  InitializationData[60];
  4.1192 -} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
  4.1193 -
  4.1194 -/* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
  4.1195 -
  4.1196 -#define EISA_FUNCTION_ENABLED           0x80
  4.1197 -#define EISA_FREE_FORM_DATA             0x40
  4.1198 -#define EISA_HAS_PORT_INIT_ENTRY        0x20
  4.1199 -#define EISA_HAS_PORT_RANGE             0x10
  4.1200 -#define EISA_HAS_DMA_ENTRY              0x08
  4.1201 -#define EISA_HAS_IRQ_ENTRY              0x04
  4.1202 -#define EISA_HAS_MEMORY_ENTRY           0x02
  4.1203 -#define EISA_HAS_TYPE_ENTRY             0x01
  4.1204 -#define EISA_HAS_INFORMATION \
  4.1205 -  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
  4.1206 -  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
  4.1207 -
  4.1208 -typedef struct _CM_EISA_SLOT_INFORMATION {
  4.1209 -  UCHAR  ReturnCode;
  4.1210 -  UCHAR  ReturnFlags;
  4.1211 -  UCHAR  MajorRevision;
  4.1212 -  UCHAR  MinorRevision;
  4.1213 -  USHORT  Checksum;
  4.1214 -  UCHAR  NumberFunctions;
  4.1215 -  UCHAR  FunctionInformation;
  4.1216 -  ULONG  CompressedId;
  4.1217 -} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
  4.1218 -
  4.1219 -/* CM_EISA_SLOT_INFORMATION.ReturnCode */
  4.1220 -
  4.1221 -#define EISA_INVALID_SLOT               0x80
  4.1222 -#define EISA_INVALID_FUNCTION           0x81
  4.1223 -#define EISA_INVALID_CONFIGURATION      0x82
  4.1224 -#define EISA_EMPTY_SLOT                 0x83
  4.1225 -#define EISA_INVALID_BIOS_CALL          0x86
  4.1226 -
  4.1227 -typedef struct _CM_FLOPPY_DEVICE_DATA {
  4.1228 -  USHORT  Version;
  4.1229 -  USHORT  Revision;
  4.1230 -  CHAR  Size[8];
  4.1231 -  ULONG  MaxDensity;
  4.1232 -  ULONG  MountDensity;
  4.1233 -  UCHAR  StepRateHeadUnloadTime;
  4.1234 -  UCHAR  HeadLoadTime;
  4.1235 -  UCHAR  MotorOffTime;
  4.1236 -  UCHAR  SectorLengthCode;
  4.1237 -  UCHAR  SectorPerTrack;
  4.1238 -  UCHAR  ReadWriteGapLength;
  4.1239 -  UCHAR  DataTransferLength;
  4.1240 -  UCHAR  FormatGapLength;
  4.1241 -  UCHAR  FormatFillCharacter;
  4.1242 -  UCHAR  HeadSettleTime;
  4.1243 -  UCHAR  MotorSettleTime;
  4.1244 -  UCHAR  MaximumTrackValue;
  4.1245 -  UCHAR  DataTransferRate;
  4.1246 -} CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
  4.1247 -
  4.1248 -typedef enum _INTERFACE_TYPE {
  4.1249 -  InterfaceTypeUndefined = -1,
  4.1250 -  Internal,
  4.1251 -  Isa,
  4.1252 -  Eisa,
  4.1253 -  MicroChannel,
  4.1254 -  TurboChannel,
  4.1255 -  PCIBus,
  4.1256 -  VMEBus,
  4.1257 -  NuBus,
  4.1258 -  PCMCIABus,
  4.1259 -  CBus,
  4.1260 -  MPIBus,
  4.1261 -  MPSABus,
  4.1262 -  ProcessorInternal,
  4.1263 -  InternalPowerBus,
  4.1264 -  PNPISABus,
  4.1265 -  PNPBus,
  4.1266 -  MaximumInterfaceType
  4.1267 -} INTERFACE_TYPE, *PINTERFACE_TYPE;
  4.1268 -
  4.1269 -typedef struct _PNP_BUS_INFORMATION {
  4.1270 -  GUID  BusTypeGuid;
  4.1271 -  INTERFACE_TYPE  LegacyBusType;
  4.1272 -  ULONG  BusNumber;
  4.1273 -} PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
  4.1274 -
  4.1275 -#include <pshpack1.h>
  4.1276 -typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
  4.1277 -  UCHAR Type;
  4.1278 -  UCHAR ShareDisposition;
  4.1279 -  USHORT Flags;
  4.1280 -  union {
  4.1281 -    struct {
  4.1282 -      PHYSICAL_ADDRESS Start;
  4.1283 -      ULONG Length;
  4.1284 -    } Generic;
  4.1285 -    struct {
  4.1286 -      PHYSICAL_ADDRESS Start;
  4.1287 -      ULONG Length;
  4.1288 -    } Port;
  4.1289 -    struct {
  4.1290 -      ULONG Level;
  4.1291 -      ULONG Vector;
  4.1292 -      ULONG Affinity;
  4.1293 -    } Interrupt;
  4.1294 -    struct {
  4.1295 -      PHYSICAL_ADDRESS Start;
  4.1296 -      ULONG Length;
  4.1297 -    } Memory;
  4.1298 -    struct {
  4.1299 -      ULONG Channel;
  4.1300 -      ULONG Port;
  4.1301 -      ULONG Reserved1;
  4.1302 -    } Dma;
  4.1303 -    struct {
  4.1304 -      ULONG Data[3];
  4.1305 -    } DevicePrivate;
  4.1306 -    struct {
  4.1307 -      ULONG Start;
  4.1308 -      ULONG Length;
  4.1309 -      ULONG Reserved;
  4.1310 -    } BusNumber;
  4.1311 -    struct {
  4.1312 -      ULONG DataSize;
  4.1313 -      ULONG Reserved1;
  4.1314 -      ULONG Reserved2;
  4.1315 -    } DeviceSpecificData;
  4.1316 -  } u;
  4.1317 -} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
  4.1318 -
  4.1319 -/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
  4.1320 -
  4.1321 -#define CmResourceTypeNull                0
  4.1322 -#define CmResourceTypePort                1
  4.1323 -#define CmResourceTypeInterrupt           2
  4.1324 -#define CmResourceTypeMemory              3
  4.1325 -#define CmResourceTypeDma                 4
  4.1326 -#define CmResourceTypeDeviceSpecific      5
  4.1327 -#define CmResourceTypeBusNumber           6
  4.1328 -#define CmResourceTypeMaximum             7
  4.1329 -#define CmResourceTypeNonArbitrated     128
  4.1330 -#define CmResourceTypeConfigData        128
  4.1331 -#define CmResourceTypeDevicePrivate     129
  4.1332 -#define CmResourceTypePcCardConfig      130
  4.1333 -#define CmResourceTypeMfCardConfig      131
  4.1334 -
  4.1335 -/* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
  4.1336 -
  4.1337 -typedef enum _CM_SHARE_DISPOSITION {
  4.1338 -  CmResourceShareUndetermined,
  4.1339 -  CmResourceShareDeviceExclusive,
  4.1340 -  CmResourceShareDriverExclusive,
  4.1341 -  CmResourceShareShared
  4.1342 -} CM_SHARE_DISPOSITION;
  4.1343 -
  4.1344 -/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
  4.1345 -
  4.1346 -#define CM_RESOURCE_PORT_MEMORY           0x0000
  4.1347 -#define CM_RESOURCE_PORT_IO               0x0001
  4.1348 -#define CM_RESOURCE_PORT_10_BIT_DECODE    0x0004
  4.1349 -#define CM_RESOURCE_PORT_12_BIT_DECODE    0x0008
  4.1350 -#define CM_RESOURCE_PORT_16_BIT_DECODE    0x0010
  4.1351 -#define CM_RESOURCE_PORT_POSITIVE_DECODE  0x0020
  4.1352 -#define CM_RESOURCE_PORT_PASSIVE_DECODE   0x0040
  4.1353 -#define CM_RESOURCE_PORT_WINDOW_DECODE    0x0080
  4.1354 -
  4.1355 -/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
  4.1356 -
  4.1357 -#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
  4.1358 -#define CM_RESOURCE_INTERRUPT_LATCHED         0x0001
  4.1359 -
  4.1360 -/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
  4.1361 -
  4.1362 -#define CM_RESOURCE_MEMORY_READ_WRITE     0x0000
  4.1363 -#define CM_RESOURCE_MEMORY_READ_ONLY      0x0001
  4.1364 -#define CM_RESOURCE_MEMORY_WRITE_ONLY     0x0002
  4.1365 -#define CM_RESOURCE_MEMORY_PREFETCHABLE   0x0004
  4.1366 -#define CM_RESOURCE_MEMORY_COMBINEDWRITE  0x0008
  4.1367 -#define CM_RESOURCE_MEMORY_24             0x0010
  4.1368 -#define CM_RESOURCE_MEMORY_CACHEABLE      0x0020
  4.1369 -
  4.1370 -/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
  4.1371 -
  4.1372 -#define CM_RESOURCE_DMA_8                 0x0000
  4.1373 -#define CM_RESOURCE_DMA_16                0x0001
  4.1374 -#define CM_RESOURCE_DMA_32                0x0002
  4.1375 -#define CM_RESOURCE_DMA_8_AND_16          0x0004
  4.1376 -#define CM_RESOURCE_DMA_BUS_MASTER        0x0008
  4.1377 -#define CM_RESOURCE_DMA_TYPE_A            0x0010
  4.1378 -#define CM_RESOURCE_DMA_TYPE_B            0x0020
  4.1379 -#define CM_RESOURCE_DMA_TYPE_F            0x0040
  4.1380 -
  4.1381 -typedef struct _CM_PARTIAL_RESOURCE_LIST {
  4.1382 -  USHORT  Version;
  4.1383 -  USHORT  Revision;
  4.1384 -  ULONG  Count;
  4.1385 -  CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
  4.1386 -} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
  4.1387 -
  4.1388 -typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
  4.1389 -  INTERFACE_TYPE  InterfaceType;
  4.1390 -  ULONG  BusNumber;
  4.1391 -  CM_PARTIAL_RESOURCE_LIST  PartialResourceList;
  4.1392 -} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
  4.1393 -
  4.1394 -typedef struct _CM_RESOURCE_LIST {
  4.1395 -  ULONG  Count;
  4.1396 -  CM_FULL_RESOURCE_DESCRIPTOR  List[1];
  4.1397 -} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
  4.1398 -
  4.1399 -typedef struct _CM_INT13_DRIVE_PARAMETER {
  4.1400 -  USHORT  DriveSelect;
  4.1401 -  ULONG  MaxCylinders;
  4.1402 -  USHORT  SectorsPerTrack;
  4.1403 -  USHORT  MaxHeads;
  4.1404 -  USHORT  NumberDrives;
  4.1405 -} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
  4.1406 -#include <poppack.h>
  4.1407 -
  4.1408 -typedef struct _CM_KEYBOARD_DEVICE_DATA {
  4.1409 -  USHORT  Version;
  4.1410 -  USHORT  Revision;
  4.1411 -  UCHAR  Type;
  4.1412 -  UCHAR  Subtype;
  4.1413 -  USHORT  KeyboardFlags;
  4.1414 -} CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
  4.1415 -
  4.1416 -#define KEYBOARD_INSERT_ON                0x80
  4.1417 -#define KEYBOARD_CAPS_LOCK_ON             0x40
  4.1418 -#define KEYBOARD_NUM_LOCK_ON              0x20
  4.1419 -#define KEYBOARD_SCROLL_LOCK_ON           0x10
  4.1420 -#define KEYBOARD_ALT_KEY_DOWN             0x08
  4.1421 -#define KEYBOARD_CTRL_KEY_DOWN            0x04
  4.1422 -#define KEYBOARD_LEFT_SHIFT_DOWN          0x02
  4.1423 -#define KEYBOARD_RIGHT_SHIFT_DOWN         0x01
  4.1424 -
  4.1425 -typedef struct _CM_MCA_POS_DATA {
  4.1426 -  USHORT  AdapterId;
  4.1427 -  UCHAR  PosData1;
  4.1428 -  UCHAR  PosData2;
  4.1429 -  UCHAR  PosData3;
  4.1430 -  UCHAR  PosData4;
  4.1431 -} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
  4.1432 -
  4.1433 -typedef struct CM_Power_Data_s {
  4.1434 -  ULONG  PD_Size;
  4.1435 -  DEVICE_POWER_STATE  PD_MostRecentPowerState;
  4.1436 -  ULONG  PD_Capabilities;
  4.1437 -  ULONG  PD_D1Latency;
  4.1438 -  ULONG  PD_D2Latency;
  4.1439 -  ULONG  PD_D3Latency;
  4.1440 -  DEVICE_POWER_STATE  PD_PowerStateMapping[PowerSystemMaximum];
  4.1441 -} CM_POWER_DATA, *PCM_POWER_DATA;
  4.1442 -
  4.1443 -#define PDCAP_D0_SUPPORTED                0x00000001
  4.1444 -#define PDCAP_D1_SUPPORTED                0x00000002
  4.1445 -#define PDCAP_D2_SUPPORTED                0x00000004
  4.1446 -#define PDCAP_D3_SUPPORTED                0x00000008
  4.1447 -#define PDCAP_WAKE_FROM_D0_SUPPORTED      0x00000010
  4.1448 -#define PDCAP_WAKE_FROM_D1_SUPPORTED      0x00000020
  4.1449 -#define PDCAP_WAKE_FROM_D2_SUPPORTED      0x00000040
  4.1450 -#define PDCAP_WAKE_FROM_D3_SUPPORTED      0x00000080
  4.1451 -#define PDCAP_WARM_EJECT_SUPPORTED        0x00000100
  4.1452 -
  4.1453 -typedef struct _CM_SCSI_DEVICE_DATA {
  4.1454 -  USHORT  Version;
  4.1455 -  USHORT  Revision;
  4.1456 -  UCHAR  HostIdentifier;
  4.1457 -} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
  4.1458 -
  4.1459 -typedef struct _CM_SERIAL_DEVICE_DATA {
  4.1460 -  USHORT  Version;
  4.1461 -  USHORT  Revision;
  4.1462 -  ULONG  BaudClock;
  4.1463 -} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
  4.1464 -
  4.1465 -/* IO_RESOURCE_DESCRIPTOR.Option */
  4.1466 -
  4.1467 -#define IO_RESOURCE_PREFERRED             0x01
  4.1468 -#define IO_RESOURCE_DEFAULT               0x02
  4.1469 -#define IO_RESOURCE_ALTERNATIVE           0x08
  4.1470 -
  4.1471 -typedef struct _IO_RESOURCE_DESCRIPTOR {
  4.1472 -  UCHAR  Option;
  4.1473 -  UCHAR  Type;
  4.1474 -  UCHAR  ShareDisposition;
  4.1475 -  UCHAR  Spare1;
  4.1476 -  USHORT  Flags;
  4.1477 -  USHORT  Spare2;
  4.1478 -  union {
  4.1479 -    struct {
  4.1480 -      ULONG  Length;
  4.1481 -      ULONG  Alignment;
  4.1482 -      PHYSICAL_ADDRESS  MinimumAddress;
  4.1483 -      PHYSICAL_ADDRESS  MaximumAddress;
  4.1484 -    } Port;
  4.1485 -    struct {
  4.1486 -      ULONG  Length;
  4.1487 -      ULONG  Alignment;
  4.1488 -      PHYSICAL_ADDRESS  MinimumAddress;
  4.1489 -      PHYSICAL_ADDRESS  MaximumAddress;
  4.1490 -    } Memory;
  4.1491 -    struct {
  4.1492 -      ULONG  MinimumVector;
  4.1493 -      ULONG  MaximumVector;
  4.1494 -    } Interrupt;
  4.1495 -    struct {
  4.1496 -      ULONG  MinimumChannel;
  4.1497 -      ULONG  MaximumChannel;
  4.1498 -    } Dma;
  4.1499 -    struct {
  4.1500 -      ULONG  Length;
  4.1501 -      ULONG  Alignment;
  4.1502 -      PHYSICAL_ADDRESS  MinimumAddress;
  4.1503 -      PHYSICAL_ADDRESS  MaximumAddress;
  4.1504 -    } Generic;
  4.1505 -    struct {
  4.1506 -      ULONG  Data[3];
  4.1507 -    } DevicePrivate;
  4.1508 -    struct {
  4.1509 -      ULONG  Length;
  4.1510 -      ULONG  MinBusNumber;
  4.1511 -      ULONG  MaxBusNumber;
  4.1512 -      ULONG  Reserved;
  4.1513 -    } BusNumber;
  4.1514 -    struct {
  4.1515 -      ULONG  Priority;
  4.1516 -      ULONG  Reserved1;
  4.1517 -      ULONG  Reserved2;
  4.1518 -    } ConfigData;
  4.1519 -  } u;
  4.1520 -} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
  4.1521 -
  4.1522 -typedef struct _IO_RESOURCE_LIST {
  4.1523 -  USHORT  Version;
  4.1524 -  USHORT  Revision;
  4.1525 -  ULONG  Count;
  4.1526 -  IO_RESOURCE_DESCRIPTOR  Descriptors[1];
  4.1527 -} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
  4.1528 -
  4.1529 -typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
  4.1530 -  ULONG  ListSize;
  4.1531 -  INTERFACE_TYPE  InterfaceType;
  4.1532 -  ULONG  BusNumber;
  4.1533 -  ULONG  SlotNumber;
  4.1534 -  ULONG  Reserved[3];
  4.1535 -  ULONG  AlternativeLists;
  4.1536 -  IO_RESOURCE_LIST  List[1];
  4.1537 -} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
  4.1538 -
  4.1539 -typedef struct _CONTROLLER_OBJECT {
  4.1540 -  CSHORT  Type;
  4.1541 -  CSHORT  Size;
  4.1542 -  PVOID  ControllerExtension;
  4.1543 -  KDEVICE_QUEUE  DeviceWaitQueue;
  4.1544 -  ULONG  Spare1;
  4.1545 -  LARGE_INTEGER  Spare2;
  4.1546 -} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
  4.1547 -
  4.1548 -typedef enum _DMA_WIDTH {
  4.1549 -  Width8Bits,
  4.1550 -  Width16Bits,
  4.1551 -  Width32Bits,
  4.1552 -  MaximumDmaWidth
  4.1553 -} DMA_WIDTH, *PDMA_WIDTH;
  4.1554 -
  4.1555 -typedef enum _DMA_SPEED {
  4.1556 -  Compatible,
  4.1557 -  TypeA,
  4.1558 -  TypeB,
  4.1559 -  TypeC,
  4.1560 -  TypeF,
  4.1561 -  MaximumDmaSpeed
  4.1562 -} DMA_SPEED, *PDMA_SPEED;
  4.1563 -
  4.1564 -/* DEVICE_DESCRIPTION.Version */
  4.1565 -
  4.1566 -#define DEVICE_DESCRIPTION_VERSION        0x0000
  4.1567 -#define DEVICE_DESCRIPTION_VERSION1       0x0001
  4.1568 -#define DEVICE_DESCRIPTION_VERSION2       0x0002
  4.1569 -
  4.1570 -typedef struct _DEVICE_DESCRIPTION {
  4.1571 -  ULONG  Version;
  4.1572 -  BOOLEAN  Master;
  4.1573 -  BOOLEAN  ScatterGather;
  4.1574 -  BOOLEAN  DemandMode;
  4.1575 -  BOOLEAN  AutoInitialize;
  4.1576 -  BOOLEAN  Dma32BitAddresses;
  4.1577 -  BOOLEAN  IgnoreCount;
  4.1578 -  BOOLEAN  Reserved1;
  4.1579 -  BOOLEAN  Dma64BitAddresses;
  4.1580 -  ULONG  BusNumber; 
  4.1581 -  ULONG  DmaChannel;
  4.1582 -  INTERFACE_TYPE  InterfaceType;
  4.1583 -  DMA_WIDTH  DmaWidth;
  4.1584 -  DMA_SPEED  DmaSpeed;
  4.1585 -  ULONG  MaximumLength;
  4.1586 -  ULONG  DmaPort;
  4.1587 -} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
  4.1588 -
  4.1589 -/* VPB.Flags */
  4.1590 -#define VPB_MOUNTED                       0x0001
  4.1591 -#define VPB_LOCKED                        0x0002
  4.1592 -#define VPB_PERSISTENT                    0x0004
  4.1593 -#define VPB_REMOVE_PENDING                0x0008
  4.1594 -#define VPB_RAW_MOUNT                     0x0010
  4.1595 -
  4.1596 -#define MAXIMUM_VOLUME_LABEL_LENGTH       (32 * sizeof(WCHAR))
  4.1597 -
  4.1598 -typedef struct _VPB {
  4.1599 -  CSHORT  Type;
  4.1600 -  CSHORT  Size;
  4.1601 -  USHORT  Flags;
  4.1602 -  USHORT  VolumeLabelLength;
  4.1603 -  struct _DEVICE_OBJECT  *DeviceObject;
  4.1604 -  struct _DEVICE_OBJECT  *RealDevice;
  4.1605 -  ULONG  SerialNumber;
  4.1606 -  ULONG  ReferenceCount;
  4.1607 -  WCHAR  VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
  4.1608 -} VPB, *PVPB;
  4.1609 -
  4.1610 -/* DEVICE_OBJECT.Flags */
  4.1611 -
  4.1612 -#define DO_VERIFY_VOLUME                  0x00000002      
  4.1613 -#define DO_BUFFERED_IO                    0x00000004      
  4.1614 -#define DO_EXCLUSIVE                      0x00000008      
  4.1615 -#define DO_DIRECT_IO                      0x00000010      
  4.1616 -#define DO_MAP_IO_BUFFER                  0x00000020      
  4.1617 -#define DO_DEVICE_HAS_NAME                0x00000040      
  4.1618 -#define DO_DEVICE_INITIALIZING            0x00000080      
  4.1619 -#define DO_SYSTEM_BOOT_PARTITION          0x00000100      
  4.1620 -#define DO_LONG_TERM_REQUESTS             0x00000200      
  4.1621 -#define DO_NEVER_LAST_DEVICE              0x00000400      
  4.1622 -#define DO_SHUTDOWN_REGISTERED            0x00000800      
  4.1623 -#define DO_BUS_ENUMERATED_DEVICE          0x00001000      
  4.1624 -#define DO_POWER_PAGABLE                  0x00002000      
  4.1625 -#define DO_POWER_INRUSH                   0x00004000      
  4.1626 -#define DO_LOW_PRIORITY_FILESYSTEM        0x00010000      
  4.1627 -
  4.1628 -/* DEVICE_OBJECT.Characteristics */
  4.1629 -
  4.1630 -#define FILE_REMOVABLE_MEDIA            0x00000001
  4.1631 -#define FILE_READ_ONLY_DEVICE           0x00000002
  4.1632 -#define FILE_FLOPPY_DISKETTE            0x00000004
  4.1633 -#define FILE_WRITE_ONCE_MEDIA           0x00000008
  4.1634 -#define FILE_REMOTE_DEVICE              0x00000010
  4.1635 -#define FILE_DEVICE_IS_MOUNTED          0x00000020
  4.1636 -#define FILE_VIRTUAL_VOLUME             0x00000040
  4.1637 -#define FILE_AUTOGENERATED_DEVICE_NAME  0x00000080
  4.1638 -#define FILE_DEVICE_SECURE_OPEN         0x00000100
  4.1639 -
  4.1640 -/* DEVICE_OBJECT.AlignmentRequirement */
  4.1641 -
  4.1642 -#define FILE_BYTE_ALIGNMENT             0x00000000
  4.1643 -#define FILE_WORD_ALIGNMENT             0x00000001
  4.1644 -#define FILE_LONG_ALIGNMENT             0x00000003
  4.1645 -#define FILE_QUAD_ALIGNMENT             0x00000007
  4.1646 -#define FILE_OCTA_ALIGNMENT             0x0000000f
  4.1647 -#define FILE_32_BYTE_ALIGNMENT          0x0000001f
  4.1648 -#define FILE_64_BYTE_ALIGNMENT          0x0000003f
  4.1649 -#define FILE_128_BYTE_ALIGNMENT         0x0000007f
  4.1650 -#define FILE_256_BYTE_ALIGNMENT         0x000000ff
  4.1651 -#define FILE_512_BYTE_ALIGNMENT         0x000001ff
  4.1652 -
  4.1653 -/* DEVICE_OBJECT.DeviceType */
  4.1654 -
  4.1655 -#define DEVICE_TYPE ULONG
  4.1656 -
  4.1657 -#define FILE_DEVICE_BEEP                  0x00000001
  4.1658 -#define FILE_DEVICE_CD_ROM                0x00000002
  4.1659 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM    0x00000003
  4.1660 -#define FILE_DEVICE_CONTROLLER            0x00000004
  4.1661 -#define FILE_DEVICE_DATALINK              0x00000005
  4.1662 -#define FILE_DEVICE_DFS                   0x00000006
  4.1663 -#define FILE_DEVICE_DISK                  0x00000007
  4.1664 -#define FILE_DEVICE_DISK_FILE_SYSTEM      0x00000008
  4.1665 -#define FILE_DEVICE_FILE_SYSTEM           0x00000009
  4.1666 -#define FILE_DEVICE_INPORT_PORT           0x0000000a
  4.1667 -#define FILE_DEVICE_KEYBOARD              0x0000000b
  4.1668 -#define FILE_DEVICE_MAILSLOT              0x0000000c
  4.1669 -#define FILE_DEVICE_MIDI_IN               0x0000000d
  4.1670 -#define FILE_DEVICE_MIDI_OUT              0x0000000e
  4.1671 -#define FILE_DEVICE_MOUSE                 0x0000000f
  4.1672 -#define FILE_DEVICE_MULTI_UNC_PROVIDER    0x00000010
  4.1673 -#define FILE_DEVICE_NAMED_PIPE            0x00000011
  4.1674 -#define FILE_DEVICE_NETWORK               0x00000012
  4.1675 -#define FILE_DEVICE_NETWORK_BROWSER       0x00000013
  4.1676 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM   0x00000014
  4.1677 -#define FILE_DEVICE_NULL                  0x00000015
  4.1678 -#define FILE_DEVICE_PARALLEL_PORT         0x00000016
  4.1679 -#define FILE_DEVICE_PHYSICAL_NETCARD      0x00000017
  4.1680 -#define FILE_DEVICE_PRINTER               0x00000018
  4.1681 -#define FILE_DEVICE_SCANNER               0x00000019
  4.1682 -#define FILE_DEVICE_SERIAL_MOUSE_PORT     0x0000001a
  4.1683 -#define FILE_DEVICE_SERIAL_PORT           0x0000001b
  4.1684 -#define FILE_DEVICE_SCREEN                0x0000001c
  4.1685 -#define FILE_DEVICE_SOUND                 0x0000001d
  4.1686 -#define FILE_DEVICE_STREAMS               0x0000001e
  4.1687 -#define FILE_DEVICE_TAPE                  0x0000001f
  4.1688 -#define FILE_DEVICE_TAPE_FILE_SYSTEM      0x00000020
  4.1689 -#define FILE_DEVICE_TRANSPORT             0x00000021
  4.1690 -#define FILE_DEVICE_UNKNOWN               0x00000022
  4.1691 -#define FILE_DEVICE_VIDEO                 0x00000023
  4.1692 -#define FILE_DEVICE_VIRTUAL_DISK          0x00000024
  4.1693 -#define FILE_DEVICE_WAVE_IN               0x00000025
  4.1694 -#define FILE_DEVICE_WAVE_OUT              0x00000026
  4.1695 -#define FILE_DEVICE_8042_PORT             0x00000027
  4.1696 -#define FILE_DEVICE_NETWORK_REDIRECTOR    0x00000028
  4.1697 -#define FILE_DEVICE_BATTERY               0x00000029
  4.1698 -#define FILE_DEVICE_BUS_EXTENDER          0x0000002a
  4.1699 -#define FILE_DEVICE_MODEM                 0x0000002b
  4.1700 -#define FILE_DEVICE_VDM                   0x0000002c
  4.1701 -#define FILE_DEVICE_MASS_STORAGE          0x0000002d
  4.1702 -#define FILE_DEVICE_SMB                   0x0000002e
  4.1703 -#define FILE_DEVICE_KS                    0x0000002f
  4.1704 -#define FILE_DEVICE_CHANGER               0x00000030
  4.1705 -#define FILE_DEVICE_SMARTCARD             0x00000031
  4.1706 -#define FILE_DEVICE_ACPI                  0x00000032
  4.1707 -#define FILE_DEVICE_DVD                   0x00000033
  4.1708 -#define FILE_DEVICE_FULLSCREEN_VIDEO      0x00000034
  4.1709 -#define FILE_DEVICE_DFS_FILE_SYSTEM       0x00000035
  4.1710 -#define FILE_DEVICE_DFS_VOLUME            0x00000036
  4.1711 -#define FILE_DEVICE_SERENUM               0x00000037
  4.1712 -#define FILE_DEVICE_TERMSRV               0x00000038
  4.1713 -#define FILE_DEVICE_KSEC                  0x00000039
  4.1714 -#define FILE_DEVICE_FIPS		              0x0000003a
  4.1715 -
  4.1716 -typedef struct _DEVICE_OBJECT {
  4.1717 -  CSHORT  Type;
  4.1718 -  USHORT  Size;
  4.1719 -  LONG  ReferenceCount;
  4.1720 -  struct _DRIVER_OBJECT  *DriverObject;
  4.1721 -  struct _DEVICE_OBJECT  *NextDevice;
  4.1722 -  struct _DEVICE_OBJECT  *AttachedDevice;
  4.1723 -  struct _IRP  *CurrentIrp;
  4.1724 -  PIO_TIMER  Timer;
  4.1725 -  ULONG  Flags;
  4.1726 -  ULONG  Characteristics;
  4.1727 -  PVPB  Vpb;
  4.1728 -  PVOID  DeviceExtension;
  4.1729 -  DEVICE_TYPE  DeviceType;
  4.1730 -  CCHAR  StackSize;
  4.1731 -  union {
  4.1732 -    LIST_ENTRY  ListEntry;
  4.1733 -    WAIT_CONTEXT_BLOCK  Wcb;
  4.1734 -  } Queue;
  4.1735 -  ULONG  AlignmentRequirement;
  4.1736 -  KDEVICE_QUEUE  DeviceQueue;
  4.1737 -  KDPC  Dpc;
  4.1738 -  ULONG  ActiveThreadCount;
  4.1739 -  PSECURITY_DESCRIPTOR  SecurityDescriptor;
  4.1740 -  KEVENT  DeviceLock;
  4.1741 -  USHORT  SectorSize;
  4.1742 -  USHORT  Spare1;
  4.1743 -  struct _DEVOBJ_EXTENSION  *DeviceObjectExtension;
  4.1744 -  PVOID  Reserved;
  4.1745 -} DEVICE_OBJECT;
  4.1746 -typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
  4.1747 -
  4.1748 -typedef enum _DEVICE_RELATION_TYPE {
  4.1749 -  BusRelations,
  4.1750 -  EjectionRelations,
  4.1751 -  PowerRelations,
  4.1752 -  RemovalRelations,
  4.1753 -  TargetDeviceRelation,
  4.1754 -  SingleBusRelations
  4.1755 -} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
  4.1756 -
  4.1757 -typedef struct _DEVICE_RELATIONS {
  4.1758 -  ULONG  Count;
  4.1759 -  PDEVICE_OBJECT Objects[1];
  4.1760 -} DEVICE_RELATIONS, *PDEVICE_RELATIONS;
  4.1761 -
  4.1762 -typedef struct _SCATTER_GATHER_ELEMENT {
  4.1763 -  PHYSICAL_ADDRESS  Address;   
  4.1764 -  ULONG  Length;          
  4.1765 -  ULONG_PTR  Reserved;
  4.1766 -} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
  4.1767 -
  4.1768 -typedef struct _SCATTER_GATHER_LIST {
  4.1769 -  ULONG  NumberOfElements;
  4.1770 -  ULONG_PTR  Reserved;
  4.1771 -  SCATTER_GATHER_ELEMENT  Elements[0];
  4.1772 -} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
  4.1773 -
  4.1774 -typedef struct _MDL {
  4.1775 -  struct _MDL  *Next;
  4.1776 -  CSHORT  Size;
  4.1777 -  CSHORT  MdlFlags;
  4.1778 -  struct _EPROCESS  *Process;
  4.1779 -  PVOID  MappedSystemVa;
  4.1780 -  PVOID  StartVa;
  4.1781 -  ULONG  ByteCount;
  4.1782 -  ULONG  ByteOffset;
  4.1783 -} MDL, *PMDL;
  4.1784 -
  4.1785 -#define MDL_MAPPED_TO_SYSTEM_VA           0x0001
  4.1786 -#define MDL_PAGES_LOCKED                  0x0002
  4.1787 -#define MDL_SOURCE_IS_NONPAGED_POOL       0x0004
  4.1788 -#define MDL_ALLOCATED_FIXED_SIZE          0x0008
  4.1789 -#define MDL_PARTIAL                       0x0010
  4.1790 -#define MDL_PARTIAL_HAS_BEEN_MAPPED       0x0020
  4.1791 -#define MDL_IO_PAGE_READ                  0x0040
  4.1792 -#define MDL_WRITE_OPERATION               0x0080
  4.1793 -#define MDL_PARENT_MAPPED_SYSTEM_VA       0x0100
  4.1794 -#define MDL_FREE_EXTRA_PTES               0x0200
  4.1795 -#define MDL_IO_SPACE                      0x0800
  4.1796 -#define MDL_NETWORK_HEADER                0x1000
  4.1797 -#define MDL_MAPPING_CAN_FAIL              0x2000
  4.1798 -#define MDL_ALLOCATED_MUST_SUCCEED        0x4000
  4.1799 -
  4.1800 -#define MDL_MAPPING_FLAGS ( \
  4.1801 -  MDL_MAPPED_TO_SYSTEM_VA     | \
  4.1802 -  MDL_PAGES_LOCKED            | \
  4.1803 -  MDL_SOURCE_IS_NONPAGED_POOL | \
  4.1804 -  MDL_PARTIAL_HAS_BEEN_MAPPED | \
  4.1805 -  MDL_PARENT_MAPPED_SYSTEM_VA | \
  4.1806 -  MDL_SYSTEM_VA               | \
  4.1807 -  MDL_IO_SPACE)
  4.1808 -
  4.1809 -typedef VOID DDKAPI
  4.1810 -(*PPUT_DMA_ADAPTER)(
  4.1811 -  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  4.1812 -
  4.1813 -typedef PVOID DDKAPI
  4.1814 -(*PALLOCATE_COMMON_BUFFER)(
  4.1815 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1816 -  /*IN*/ ULONG  Length,
  4.1817 -  /*OUT*/ PPHYSICAL_ADDRESS  LogicalAddress,
  4.1818 -  /*IN*/ BOOLEAN  CacheEnabled);
  4.1819 -
  4.1820 -typedef VOID DDKAPI
  4.1821 -(*PFREE_COMMON_BUFFER)(
  4.1822 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1823 -  /*IN*/ ULONG  Length,
  4.1824 -  /*IN*/ PHYSICAL_ADDRESS  LogicalAddress,
  4.1825 -  /*IN*/ PVOID  VirtualAddress,
  4.1826 -  /*IN*/ BOOLEAN  CacheEnabled);
  4.1827 -
  4.1828 -typedef NTSTATUS DDKAPI
  4.1829 -(*PALLOCATE_ADAPTER_CHANNEL)(
  4.1830 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1831 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.1832 -  /*IN*/ ULONG  NumberOfMapRegisters,
  4.1833 -  /*IN*/ PDRIVER_CONTROL  ExecutionRoutine,
  4.1834 -  /*IN*/ PVOID  Context);
  4.1835 -
  4.1836 -typedef BOOLEAN DDKAPI
  4.1837 -(*PFLUSH_ADAPTER_BUFFERS)(
  4.1838 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1839 -  /*IN*/ PMDL  Mdl,
  4.1840 -  /*IN*/ PVOID  MapRegisterBase,
  4.1841 -  /*IN*/ PVOID  CurrentVa,
  4.1842 -  /*IN*/ ULONG  Length,
  4.1843 -  /*IN*/ BOOLEAN  WriteToDevice);
  4.1844 -
  4.1845 -typedef VOID DDKAPI
  4.1846 -(*PFREE_ADAPTER_CHANNEL)(
  4.1847 -  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  4.1848 -
  4.1849 -typedef VOID DDKAPI
  4.1850 -(*PFREE_MAP_REGISTERS)(
  4.1851 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1852 -  PVOID  MapRegisterBase,
  4.1853 -  ULONG  NumberOfMapRegisters);
  4.1854 -
  4.1855 -typedef PHYSICAL_ADDRESS DDKAPI
  4.1856 -(*PMAP_TRANSFER)(
  4.1857 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1858 -  /*IN*/ PMDL  Mdl,
  4.1859 -  /*IN*/ PVOID  MapRegisterBase,
  4.1860 -  /*IN*/ PVOID  CurrentVa,
  4.1861 -  /*IN OUT*/ PULONG  Length,
  4.1862 -  /*IN*/ BOOLEAN  WriteToDevice);
  4.1863 -
  4.1864 -typedef ULONG DDKAPI
  4.1865 -(*PGET_DMA_ALIGNMENT)(
  4.1866 -  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  4.1867 -
  4.1868 -typedef ULONG DDKAPI
  4.1869 -(*PREAD_DMA_COUNTER)(
  4.1870 -  /*IN*/ PDMA_ADAPTER  DmaAdapter);
  4.1871 -
  4.1872 -typedef NTSTATUS DDKAPI
  4.1873 -(*PGET_SCATTER_GATHER_LIST)(
  4.1874 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1875 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.1876 -  /*IN*/ PMDL  Mdl,
  4.1877 -  /*IN*/ PVOID  CurrentVa,
  4.1878 -  /*IN*/ ULONG  Length,
  4.1879 -  /*IN*/ PDRIVER_LIST_CONTROL  ExecutionRoutine,
  4.1880 -  /*IN*/ PVOID  Context,
  4.1881 -  /*IN*/ BOOLEAN  WriteToDevice);
  4.1882 -
  4.1883 -typedef VOID DDKAPI
  4.1884 -(*PPUT_SCATTER_GATHER_LIST)(
  4.1885 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1886 -  /*IN*/ PSCATTER_GATHER_LIST  ScatterGather,
  4.1887 -  /*IN*/ BOOLEAN  WriteToDevice);
  4.1888 -
  4.1889 -typedef NTSTATUS DDKAPI
  4.1890 -(*PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
  4.1891 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1892 -  /*IN*/ PMDL  Mdl  /*OPTIONAL*/,
  4.1893 -  /*IN*/ PVOID  CurrentVa,
  4.1894 -  /*IN*/ ULONG  Length,
  4.1895 -  /*OUT*/ PULONG  ScatterGatherListSize,
  4.1896 -  /*OUT*/ PULONG  pNumberOfMapRegisters  /*OPTIONAL*/);
  4.1897 -
  4.1898 -typedef NTSTATUS DDKAPI
  4.1899 -(*PBUILD_SCATTER_GATHER_LIST)(
  4.1900 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1901 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.1902 -  /*IN*/ PMDL  Mdl,
  4.1903 -  /*IN*/ PVOID  CurrentVa,
  4.1904 -  /*IN*/ ULONG  Length,
  4.1905 -  /*IN*/ PDRIVER_LIST_CONTROL  ExecutionRoutine,
  4.1906 -  /*IN*/ PVOID  Context,
  4.1907 -  /*IN*/ BOOLEAN  WriteToDevice,
  4.1908 -  /*IN*/ PVOID  ScatterGatherBuffer,
  4.1909 -  /*IN*/ ULONG  ScatterGatherLength);
  4.1910 -
  4.1911 -typedef NTSTATUS DDKAPI
  4.1912 -(*PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
  4.1913 -  /*IN*/ PDMA_ADAPTER  DmaAdapter,
  4.1914 -  /*IN*/ PSCATTER_GATHER_LIST  ScatterGather,
  4.1915 -  /*IN*/ PMDL  OriginalMdl,
  4.1916 -  /*OUT*/ PMDL  *TargetMdl);
  4.1917 -
  4.1918 -typedef struct _DMA_OPERATIONS {
  4.1919 -  ULONG  Size;
  4.1920 -  PPUT_DMA_ADAPTER  PutDmaAdapter;
  4.1921 -  PALLOCATE_COMMON_BUFFER  AllocateCommonBuffer;
  4.1922 -  PFREE_COMMON_BUFFER  FreeCommonBuffer;
  4.1923 -  PALLOCATE_ADAPTER_CHANNEL  AllocateAdapterChannel;
  4.1924 -  PFLUSH_ADAPTER_BUFFERS  FlushAdapterBuffers;
  4.1925 -  PFREE_ADAPTER_CHANNEL  FreeAdapterChannel;
  4.1926 -  PFREE_MAP_REGISTERS  FreeMapRegisters;
  4.1927 -  PMAP_TRANSFER  MapTransfer;
  4.1928 -  PGET_DMA_ALIGNMENT  GetDmaAlignment;
  4.1929 -  PREAD_DMA_COUNTER  ReadDmaCounter;
  4.1930 -  PGET_SCATTER_GATHER_LIST  GetScatterGatherList;
  4.1931 -  PPUT_SCATTER_GATHER_LIST  PutScatterGatherList;
  4.1932 -  PCALCULATE_SCATTER_GATHER_LIST_SIZE  CalculateScatterGatherList;
  4.1933 -  PBUILD_SCATTER_GATHER_LIST  BuildScatterGatherList;
  4.1934 -  PBUILD_MDL_FROM_SCATTER_GATHER_LIST  BuildMdlFromScatterGatherList;
  4.1935 -} DMA_OPERATIONS, *PDMA_OPERATIONS;
  4.1936 -
  4.1937 -typedef struct _DMA_ADAPTER {
  4.1938 -  USHORT  Version;
  4.1939 -  USHORT  Size;
  4.1940 -  PDMA_OPERATIONS  DmaOperations;
  4.1941 -} DMA_ADAPTER;
  4.1942 -
  4.1943 -typedef enum _FILE_INFORMATION_CLASS {
  4.1944 -  FileDirectoryInformation = 1,
  4.1945 -  FileFullDirectoryInformation,
  4.1946 -  FileBothDirectoryInformation,
  4.1947 -  FileBasicInformation,
  4.1948 -  FileStandardInformation,
  4.1949 -  FileInternalInformation,
  4.1950 -  FileEaInformation,
  4.1951 -  FileAccessInformation,
  4.1952 -  FileNameInformation,
  4.1953 -  FileRenameInformation,
  4.1954 -  FileLinkInformation,
  4.1955 -  FileNamesInformation,
  4.1956 -  FileDispositionInformation,
  4.1957 -  FilePositionInformation,
  4.1958 -  FileFullEaInformation,
  4.1959 -  FileModeInformation,
  4.1960 -  FileAlignmentInformation,
  4.1961 -  FileAllInformation,
  4.1962 -  FileAllocationInformation,
  4.1963 -  FileEndOfFileInformation,
  4.1964 -  FileAlternateNameInformation,
  4.1965 -  FileStreamInformation,
  4.1966 -  FilePipeInformation,
  4.1967 -  FilePipeLocalInformation,
  4.1968 -  FilePipeRemoteInformation,
  4.1969 -  FileMailslotQueryInformation,
  4.1970 -  FileMailslotSetInformation,
  4.1971 -  FileCompressionInformation,
  4.1972 -  FileObjectIdInformation,
  4.1973 -  FileCompletionInformation,
  4.1974 -  FileMoveClusterInformation,
  4.1975 -  FileQuotaInformation,
  4.1976 -  FileReparsePointInformation,
  4.1977 -  FileNetworkOpenInformation,
  4.1978 -  FileAttributeTagInformation,
  4.1979 -  FileTrackingInformation,
  4.1980 -  FileIdBothDirectoryInformation,
  4.1981 -  FileIdFullDirectoryInformation,
  4.1982 -  FileValidDataLengthInformation,
  4.1983 -  FileShortNameInformation,
  4.1984 -  FileMaximumInformation
  4.1985 -} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
  4.1986 -
  4.1987 -typedef struct _FILE_POSITION_INFORMATION {                 
  4.1988 -  LARGE_INTEGER  CurrentByteOffset;                        
  4.1989 -} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;   
  4.1990 -
  4.1991 -typedef struct _FILE_ALIGNMENT_INFORMATION {
  4.1992 -  ULONG  AlignmentRequirement;
  4.1993 -} FILE_ALIGNMENT_INFORMATION;
  4.1994 -
  4.1995 -typedef struct _FILE_NAME_INFORMATION {                     
  4.1996 -  ULONG  FileNameLength;                                   
  4.1997 -  WCHAR  FileName[1];                                      
  4.1998 -} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;           
  4.1999 -
  4.2000 -typedef struct _FILE_BASIC_INFORMATION {
  4.2001 -  LARGE_INTEGER  CreationTime;
  4.2002 -  LARGE_INTEGER  LastAccessTime;
  4.2003 -  LARGE_INTEGER  LastWriteTime;
  4.2004 -  LARGE_INTEGER  ChangeTime;
  4.2005 -  ULONG  FileAttributes;
  4.2006 -} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
  4.2007 -
  4.2008 -typedef struct _FILE_STANDARD_INFORMATION {
  4.2009 -  LARGE_INTEGER  AllocationSize;
  4.2010 -  LARGE_INTEGER  EndOfFile;
  4.2011 -  ULONG  NumberOfLinks;
  4.2012 -  BOOLEAN  DeletePending;
  4.2013 -  BOOLEAN  Directory;
  4.2014 -} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
  4.2015 -
  4.2016 -typedef struct _FILE_NETWORK_OPEN_INFORMATION {                 
  4.2017 -  LARGE_INTEGER  CreationTime;                                 
  4.2018 -  LARGE_INTEGER  LastAccessTime;                               
  4.2019 -  LARGE_INTEGER  LastWriteTime;                                
  4.2020 -  LARGE_INTEGER  ChangeTime;                                   
  4.2021 -  LARGE_INTEGER  AllocationSize;                               
  4.2022 -  LARGE_INTEGER  EndOfFile;                                    
  4.2023 -  ULONG  FileAttributes;                                       
  4.2024 -} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;   
  4.2025 -
  4.2026 -typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION {               
  4.2027 -  ULONG  FileAttributes;                                       
  4.2028 -  ULONG  ReparseTag;                                           
  4.2029 -} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
  4.2030 -
  4.2031 -typedef struct _FILE_DISPOSITION_INFORMATION {                  
  4.2032 -  BOOLEAN  DoDeleteFile;                                         
  4.2033 -} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; 
  4.2034 -                                                                
  4.2035 -typedef struct _FILE_END_OF_FILE_INFORMATION {                  
  4.2036 -  LARGE_INTEGER  EndOfFile;                                    
  4.2037 -} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; 
  4.2038 -                                                                
  4.2039 -typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION {                                    
  4.2040 -  LARGE_INTEGER  ValidDataLength;                                                      
  4.2041 -} FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;             
  4.2042 -
  4.2043 -typedef enum _FSINFOCLASS {
  4.2044 -  FileFsVolumeInformation = 1,
  4.2045 -  FileFsLabelInformation,
  4.2046 -  FileFsSizeInformation,
  4.2047 -  FileFsDeviceInformation,
  4.2048 -  FileFsAttributeInformation,
  4.2049 -  FileFsControlInformation,
  4.2050 -  FileFsFullSizeInformation,
  4.2051 -  FileFsObjectIdInformation,
  4.2052 -  FileFsDriverPathInformation,
  4.2053 -  FileFsMaximumInformation
  4.2054 -} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
  4.2055 -
  4.2056 -typedef struct _FILE_FS_DEVICE_INFORMATION {
  4.2057 -  DEVICE_TYPE  DeviceType;
  4.2058 -  ULONG  Characteristics;
  4.2059 -} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
  4.2060 -
  4.2061 -typedef struct _FILE_FULL_EA_INFORMATION {
  4.2062 -  ULONG  NextEntryOffset;
  4.2063 -  UCHAR  Flags;
  4.2064 -  UCHAR  EaNameLength;
  4.2065 -  USHORT  EaValueLength;
  4.2066 -  CHAR  EaName[1];
  4.2067 -} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
  4.2068 -
  4.2069 -typedef ULONG_PTR ERESOURCE_THREAD;
  4.2070 -typedef ERESOURCE_THREAD *PERESOURCE_THREAD;
  4.2071 -
  4.2072 -typedef struct _OWNER_ENTRY {
  4.2073 -  ERESOURCE_THREAD  OwnerThread;
  4.2074 -  _ANONYMOUS_UNION union {
  4.2075 -      LONG  OwnerCount;
  4.2076 -      ULONG  TableSize;
  4.2077 -  } DUMMYUNIONNAME;
  4.2078 -} OWNER_ENTRY, *POWNER_ENTRY;
  4.2079 -
  4.2080 -/* ERESOURCE.Flag */
  4.2081 -
  4.2082 -#define ResourceNeverExclusive            0x0010
  4.2083 -#define ResourceReleaseByOtherThread      0x0020
  4.2084 -#define ResourceOwnedExclusive            0x0080
  4.2085 -
  4.2086 -#define RESOURCE_HASH_TABLE_SIZE          64
  4.2087 -
  4.2088 -typedef struct _ERESOURCE {
  4.2089 -  LIST_ENTRY  SystemResourcesList;
  4.2090 -  POWNER_ENTRY  OwnerTable;
  4.2091 -  SHORT  ActiveCount;
  4.2092 -  USHORT  Flag;
  4.2093 -  PKSEMAPHORE  SharedWaiters;
  4.2094 -  PKEVENT  ExclusiveWaiters;
  4.2095 -  OWNER_ENTRY  OwnerThreads[2];
  4.2096 -  ULONG  ContentionCount;
  4.2097 -  USHORT  NumberOfSharedWaiters;
  4.2098 -  USHORT  NumberOfExclusiveWaiters;
  4.2099 -  _ANONYMOUS_UNION union {
  4.2100 -    PVOID  Address;
  4.2101 -    ULONG_PTR  CreatorBackTraceIndex;
  4.2102 -  } DUMMYUNIONNAME;
  4.2103 -  KSPIN_LOCK  SpinLock;
  4.2104 -} ERESOURCE, *PERESOURCE;
  4.2105 -
  4.2106 -/* NOTE: PVOID for methods to avoid 'assignment from incompatible pointer type' warning */
  4.2107 -typedef struct _DRIVER_EXTENSION {
  4.2108 -  struct _DRIVER_OBJECT  *DriverObject;
  4.2109 -  PVOID  AddDevice;
  4.2110 -  ULONG  Count;
  4.2111 -  UNICODE_STRING  ServiceKeyName;
  4.2112 -} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
  4.2113 -
  4.2114 -typedef BOOLEAN DDKAPI
  4.2115 -(*PFAST_IO_CHECK_IF_POSSIBLE)(
  4.2116 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2117 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2118 -  /*IN*/ ULONG  Length,
  4.2119 -  /*IN*/ BOOLEAN  Wait,
  4.2120 -  /*IN*/ ULONG  LockKey,
  4.2121 -  /*IN*/ BOOLEAN  CheckForReadOperation,
  4.2122 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2123 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2124 -
  4.2125 -typedef BOOLEAN DDKAPI
  4.2126 -(*PFAST_IO_READ)(
  4.2127 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2128 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2129 -  /*IN*/ ULONG  Length,
  4.2130 -  /*IN*/ BOOLEAN  Wait,
  4.2131 -  /*IN*/ ULONG  LockKey,
  4.2132 -  /*OUT*/ PVOID  Buffer,
  4.2133 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2134 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2135 -
  4.2136 -typedef BOOLEAN DDKAPI
  4.2137 -(*PFAST_IO_WRITE)(
  4.2138 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2139 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2140 -  /*IN*/ ULONG  Length,
  4.2141 -  /*IN*/ BOOLEAN  Wait,
  4.2142 -  /*IN*/ ULONG  LockKey,
  4.2143 -  /*IN*/ PVOID  Buffer,
  4.2144 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2145 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2146 -
  4.2147 -typedef BOOLEAN DDKAPI
  4.2148 -(*PFAST_IO_QUERY_BASIC_INFO)(
  4.2149 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2150 -  /*IN*/ BOOLEAN  Wait,
  4.2151 -  /*OUT*/ PFILE_BASIC_INFORMATION  Buffer,
  4.2152 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2153 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2154 -
  4.2155 -typedef BOOLEAN DDKAPI
  4.2156 -(*PFAST_IO_QUERY_STANDARD_INFO)(
  4.2157 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2158 -  /*IN*/ BOOLEAN  Wait,
  4.2159 -  /*OUT*/ PFILE_STANDARD_INFORMATION  Buffer,
  4.2160 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2161 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2162 -
  4.2163 -typedef BOOLEAN DDKAPI
  4.2164 -(*PFAST_IO_LOCK)(
  4.2165 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2166 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2167 -  /*IN*/ PLARGE_INTEGER  Length,
  4.2168 -  PEPROCESS  ProcessId,
  4.2169 -  ULONG  Key,
  4.2170 -  BOOLEAN  FailImmediately,
  4.2171 -  BOOLEAN  ExclusiveLock,
  4.2172 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2173 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2174 -
  4.2175 -typedef BOOLEAN DDKAPI
  4.2176 -(*PFAST_IO_UNLOCK_SINGLE)(
  4.2177 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2178 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2179 -  /*IN*/ PLARGE_INTEGER  Length,
  4.2180 -  PEPROCESS  ProcessId,
  4.2181 -  ULONG  Key,
  4.2182 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2183 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2184 -
  4.2185 -typedef BOOLEAN DDKAPI
  4.2186 -(*PFAST_IO_UNLOCK_ALL)(
  4.2187 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2188 -  PEPROCESS  ProcessId,
  4.2189 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2190 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2191 -
  4.2192 -typedef BOOLEAN DDKAPI
  4.2193 -(*PFAST_IO_UNLOCK_ALL_BY_KEY)(
  4.2194 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2195 -  PVOID  ProcessId,
  4.2196 -  ULONG  Key,
  4.2197 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2198 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2199 -
  4.2200 -typedef BOOLEAN DDKAPI
  4.2201 -(*PFAST_IO_DEVICE_CONTROL)(
  4.2202 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2203 -  /*IN*/ BOOLEAN  Wait,
  4.2204 -  /*IN*/ PVOID  InputBuffer  /*OPTIONAL*/,
  4.2205 -  /*IN*/ ULONG  InputBufferLength,
  4.2206 -  /*OUT*/ PVOID  OutputBuffer  /*OPTIONAL*/,
  4.2207 -  /*IN*/ ULONG  OutputBufferLength,
  4.2208 -  /*IN*/ ULONG  IoControlCode,
  4.2209 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2210 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2211 -
  4.2212 -typedef VOID DDKAPI
  4.2213 -(*PFAST_IO_ACQUIRE_FILE)(
  4.2214 -  /*IN*/ struct _FILE_OBJECT  *FileObject);
  4.2215 -
  4.2216 -typedef VOID DDKAPI
  4.2217 -(*PFAST_IO_RELEASE_FILE)(
  4.2218 -  /*IN*/ struct _FILE_OBJECT  *FileObject);
  4.2219 -
  4.2220 -typedef VOID DDKAPI
  4.2221 -(*PFAST_IO_DETACH_DEVICE)(
  4.2222 -  /*IN*/ struct _DEVICE_OBJECT  *SourceDevice,
  4.2223 -  /*IN*/ struct _DEVICE_OBJECT  *TargetDevice);
  4.2224 -
  4.2225 -typedef BOOLEAN DDKAPI
  4.2226 -(*PFAST_IO_QUERY_NETWORK_OPEN_INFO)(
  4.2227 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2228 -  /*IN*/ BOOLEAN  Wait,
  4.2229 -  /*OUT*/ struct _FILE_NETWORK_OPEN_INFORMATION  *Buffer,
  4.2230 -  /*OUT*/ struct _IO_STATUS_BLOCK  *IoStatus,
  4.2231 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2232 -
  4.2233 -typedef NTSTATUS DDKAPI
  4.2234 -(*PFAST_IO_ACQUIRE_FOR_MOD_WRITE)(
  4.2235 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2236 -  /*IN*/ PLARGE_INTEGER  EndingOffset,
  4.2237 -  /*OUT*/ struct _ERESOURCE  **ResourceToRelease,
  4.2238 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2239 -
  4.2240 -typedef BOOLEAN DDKAPI
  4.2241 -(*PFAST_IO_MDL_READ)(
  4.2242 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2243 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2244 -  /*IN*/ ULONG  Length,
  4.2245 -  /*IN*/ ULONG  LockKey,
  4.2246 -  /*OUT*/ PMDL  *MdlChain,
  4.2247 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2248 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2249 -
  4.2250 -typedef BOOLEAN DDKAPI
  4.2251 -(*PFAST_IO_MDL_READ_COMPLETE)(
  4.2252 -  /*IN*/ struct _FILE_OBJECT *FileObject,
  4.2253 -  /*IN*/ PMDL MdlChain,
  4.2254 -  /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
  4.2255 -
  4.2256 -typedef BOOLEAN DDKAPI
  4.2257 -(*PFAST_IO_PREPARE_MDL_WRITE)(
  4.2258 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2259 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2260 -  /*IN*/ ULONG  Length,
  4.2261 -  /*IN*/ ULONG  LockKey,
  4.2262 -  /*OUT*/ PMDL  *MdlChain,
  4.2263 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2264 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2265 -
  4.2266 -typedef BOOLEAN DDKAPI
  4.2267 -(*PFAST_IO_MDL_WRITE_COMPLETE)(
  4.2268 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2269 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2270 -  /*IN*/ PMDL  MdlChain,
  4.2271 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2272 -
  4.2273 -typedef BOOLEAN DDKAPI
  4.2274 -(*PFAST_IO_READ_COMPRESSED)(
  4.2275 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2276 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2277 -  /*IN*/ ULONG  Length,
  4.2278 -  /*IN*/ ULONG  LockKey,
  4.2279 -  /*OUT*/ PVOID  Buffer,
  4.2280 -  /*OUT*/ PMDL  *MdlChain,
  4.2281 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2282 -  /*OUT*/ struct _COMPRESSED_DATA_INFO  *CompressedDataInfo,
  4.2283 -  /*IN*/ ULONG  CompressedDataInfoLength,
  4.2284 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2285 -
  4.2286 -typedef BOOLEAN DDKAPI
  4.2287 -(*PFAST_IO_WRITE_COMPRESSED)(
  4.2288 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2289 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2290 -  /*IN*/ ULONG  Length,
  4.2291 -  /*IN*/ ULONG  LockKey,
  4.2292 -  /*IN*/ PVOID  Buffer,
  4.2293 -  /*OUT*/ PMDL  *MdlChain,
  4.2294 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatus,
  4.2295 -  /*IN*/ struct _COMPRESSED_DATA_INFO  *CompressedDataInfo,
  4.2296 -  /*IN*/ ULONG  CompressedDataInfoLength,
  4.2297 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2298 -
  4.2299 -typedef BOOLEAN DDKAPI
  4.2300 -(*PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
  4.2301 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2302 -  /*IN*/ PMDL  MdlChain,
  4.2303 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2304 -
  4.2305 -typedef BOOLEAN DDKAPI
  4.2306 -(*PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
  4.2307 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2308 -  /*IN*/ PLARGE_INTEGER  FileOffset,
  4.2309 -  /*IN*/ PMDL  MdlChain,
  4.2310 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2311 -
  4.2312 -typedef BOOLEAN DDKAPI
  4.2313 -(*PFAST_IO_QUERY_OPEN)(
  4.2314 -  /*IN*/ struct _IRP  *Irp,
  4.2315 -  /*OUT*/ PFILE_NETWORK_OPEN_INFORMATION  NetworkInformation,
  4.2316 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2317 -
  4.2318 -typedef NTSTATUS DDKAPI
  4.2319 -(*PFAST_IO_RELEASE_FOR_MOD_WRITE)(
  4.2320 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2321 -  /*IN*/ struct _ERESOURCE  *ResourceToRelease,
  4.2322 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2323 -
  4.2324 -typedef NTSTATUS DDKAPI
  4.2325 -(*PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
  4.2326 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2327 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2328 -
  4.2329 -typedef NTSTATUS DDKAPI
  4.2330 -(*PFAST_IO_RELEASE_FOR_CCFLUSH) (
  4.2331 -  /*IN*/ struct _FILE_OBJECT  *FileObject,
  4.2332 -  /*IN*/ struct _DEVICE_OBJECT  *DeviceObject);
  4.2333 -
  4.2334 -typedef struct _FAST_IO_DISPATCH {
  4.2335 -  ULONG  SizeOfFastIoDispatch;
  4.2336 -  PFAST_IO_CHECK_IF_POSSIBLE  FastIoCheckIfPossible;
  4.2337 -  PFAST_IO_READ  FastIoRead;
  4.2338 -  PFAST_IO_WRITE  FastIoWrite;
  4.2339 -  PFAST_IO_QUERY_BASIC_INFO  FastIoQueryBasicInfo;
  4.2340 -  PFAST_IO_QUERY_STANDARD_INFO  FastIoQueryStandardInfo;
  4.2341 -  PFAST_IO_LOCK  FastIoLock;
  4.2342 -  PFAST_IO_UNLOCK_SINGLE  FastIoUnlockSingle;
  4.2343 -  PFAST_IO_UNLOCK_ALL  FastIoUnlockAll;
  4.2344 -  PFAST_IO_UNLOCK_ALL_BY_KEY  FastIoUnlockAllByKey;
  4.2345 -  PFAST_IO_DEVICE_CONTROL  FastIoDeviceControl;
  4.2346 -  PFAST_IO_ACQUIRE_FILE  AcquireFileForNtCreateSection;
  4.2347 -  PFAST_IO_RELEASE_FILE  ReleaseFileForNtCreateSection;
  4.2348 -  PFAST_IO_DETACH_DEVICE  FastIoDetachDevice;
  4.2349 -  PFAST_IO_QUERY_NETWORK_OPEN_INFO  FastIoQueryNetworkOpenInfo;
  4.2350 -  PFAST_IO_ACQUIRE_FOR_MOD_WRITE  AcquireForModWrite;
  4.2351 -  PFAST_IO_MDL_READ  MdlRead;
  4.2352 -  PFAST_IO_MDL_READ_COMPLETE  MdlReadComplete;
  4.2353 -  PFAST_IO_PREPARE_MDL_WRITE  PrepareMdlWrite;
  4.2354 -  PFAST_IO_MDL_WRITE_COMPLETE  MdlWriteComplete;
  4.2355 -  PFAST_IO_READ_COMPRESSED  FastIoReadCompressed;
  4.2356 -  PFAST_IO_WRITE_COMPRESSED  FastIoWriteCompressed;
  4.2357 -  PFAST_IO_MDL_READ_COMPLETE_COMPRESSED  MdlReadCompleteCompressed;
  4.2358 -  PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED  MdlWriteCompleteCompressed;
  4.2359 -  PFAST_IO_QUERY_OPEN  FastIoQueryOpen;
  4.2360 -  PFAST_IO_RELEASE_FOR_MOD_WRITE  ReleaseForModWrite;
  4.2361 -  PFAST_IO_ACQUIRE_FOR_CCFLUSH  AcquireForCcFlush;
  4.2362 -  PFAST_IO_RELEASE_FOR_CCFLUSH  ReleaseForCcFlush;
  4.2363 -} FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
  4.2364 -
  4.2365 -typedef struct _DRIVER_OBJECT {
  4.2366 -  CSHORT  Type;
  4.2367 -  CSHORT  Size;
  4.2368 -  PDEVICE_OBJECT  DeviceObject;
  4.2369 -  ULONG  Flags;
  4.2370 -  PVOID  DriverStart;
  4.2371 -  ULONG  DriverSize;
  4.2372 -  PVOID  DriverSection;
  4.2373 -  PDRIVER_EXTENSION  DriverExtension;
  4.2374 -  UNICODE_STRING  DriverName;
  4.2375 -  PUNICODE_STRING  HardwareDatabase;
  4.2376 -  PFAST_IO_DISPATCH  FastIoDispatch;
  4.2377 -  PDRIVER_INITIALIZE  DriverInit;
  4.2378 -  PDRIVER_STARTIO  DriverStartIo;
  4.2379 -  PDRIVER_UNLOAD  DriverUnload;
  4.2380 -  PDRIVER_DISPATCH  MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
  4.2381 -} DRIVER_OBJECT;
  4.2382 -typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
  4.2383 -
  4.2384 -typedef struct _SECTION_OBJECT_POINTERS {
  4.2385 -  PVOID  DataSectionObject;
  4.2386 -  PVOID  SharedCacheMap;
  4.2387 -  PVOID  ImageSectionObject;
  4.2388 -} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
  4.2389 -
  4.2390 -typedef struct _IO_COMPLETION_CONTEXT {
  4.2391 -  PVOID  Port;
  4.2392 -  PVOID  Key;
  4.2393 -} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
  4.2394 -
  4.2395 -/* FILE_OBJECT.Flags */
  4.2396 -
  4.2397 -#define FO_FILE_OPEN                      0x00000001
  4.2398 -#define FO_SYNCHRONOUS_IO                 0x00000002
  4.2399 -#define FO_ALERTABLE_IO                   0x00000004
  4.2400 -#define FO_NO_INTERMEDIATE_BUFFERING      0x00000008
  4.2401 -#define FO_WRITE_THROUGH                  0x00000010
  4.2402 -#define FO_SEQUENTIAL_ONLY                0x00000020
  4.2403 -#define FO_CACHE_SUPPORTED                0x00000040
  4.2404 -#define FO_NAMED_PIPE                     0x00000080
  4.2405 -#define FO_STREAM_FILE                    0x00000100
  4.2406 -#define FO_MAILSLOT                       0x00000200
  4.2407 -#define FO_GENERATE_AUDIT_ON_CLOSE        0x00000400
  4.2408 -#define FO_DIRECT_DEVICE_OPEN             0x00000800
  4.2409 -#define FO_FILE_MODIFIED                  0x00001000
  4.2410 -#define FO_FILE_SIZE_CHANGED              0x00002000
  4.2411 -#define FO_CLEANUP_COMPLETE               0x00004000
  4.2412 -#define FO_TEMPORARY_FILE                 0x00008000
  4.2413 -#define FO_DELETE_ON_CLOSE                0x00010000
  4.2414 -#define FO_OPENED_CASE_SENSITIVE          0x00020000
  4.2415 -#define FO_HANDLE_CREATED                 0x00040000
  4.2416 -#define FO_FILE_FAST_IO_READ              0x00080000
  4.2417 -#define FO_RANDOM_ACCESS                  0x00100000
  4.2418 -#define FO_FILE_OPEN_CANCELLED            0x00200000
  4.2419 -#define FO_VOLUME_OPEN                    0x00400000
  4.2420 -#define FO_FILE_OBJECT_HAS_EXTENSION      0x00800000
  4.2421 -#define FO_REMOTE_ORIGIN                  0x01000000
  4.2422 -
  4.2423 -typedef struct _FILE_OBJECT {
  4.2424 -  CSHORT  Type;
  4.2425 -  CSHORT  Size;
  4.2426 -  PDEVICE_OBJECT  DeviceObject;
  4.2427 -  PVPB  Vpb;
  4.2428 -  PVOID  FsContext;
  4.2429 -  PVOID  FsContext2;
  4.2430 -  PSECTION_OBJECT_POINTERS  SectionObjectPointer;
  4.2431 -  PVOID  PrivateCacheMap;
  4.2432 -  NTSTATUS  FinalStatus;
  4.2433 -  struct _FILE_OBJECT  *RelatedFileObject;
  4.2434 -  BOOLEAN  LockOperation;
  4.2435 -  BOOLEAN  DeletePending;
  4.2436 -  BOOLEAN  ReadAccess;
  4.2437 -  BOOLEAN  WriteAccess;
  4.2438 -  BOOLEAN  DeleteAccess;
  4.2439 -  BOOLEAN  SharedRead;
  4.2440 -  BOOLEAN  SharedWrite;
  4.2441 -  BOOLEAN  SharedDelete;
  4.2442 -  ULONG  Flags;
  4.2443 -  UNICODE_STRING  FileName;
  4.2444 -  LARGE_INTEGER  CurrentByteOffset;
  4.2445 -  ULONG  Waiters;
  4.2446 -  ULONG  Busy;
  4.2447 -  PVOID  LastLock;
  4.2448 -  KEVENT  Lock;
  4.2449 -  KEVENT  Event;
  4.2450 -  PIO_COMPLETION_CONTEXT  CompletionContext;
  4.2451 -} FILE_OBJECT;
  4.2452 -typedef struct _FILE_OBJECT *PFILE_OBJECT;
  4.2453 -
  4.2454 -typedef enum _SECURITY_OPERATION_CODE {
  4.2455 -  SetSecurityDescriptor,
  4.2456 -  QuerySecurityDescriptor,
  4.2457 -  DeleteSecurityDescriptor,
  4.2458 -  AssignSecurityDescriptor
  4.2459 -} SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
  4.2460 -
  4.2461 -#define INITIAL_PRIVILEGE_COUNT           3
  4.2462 -
  4.2463 -typedef struct _INITIAL_PRIVILEGE_SET {
  4.2464 -  ULONG  PrivilegeCount;
  4.2465 -  ULONG  Control;
  4.2466 -  LUID_AND_ATTRIBUTES  Privilege[INITIAL_PRIVILEGE_COUNT];
  4.2467 -} INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
  4.2468 -
  4.2469 -typedef struct _SECURITY_SUBJECT_CONTEXT {
  4.2470 -  PACCESS_TOKEN  ClientToken;
  4.2471 -  SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel;
  4.2472 -  PACCESS_TOKEN  PrimaryToken;
  4.2473 -  PVOID  ProcessAuditId;
  4.2474 -} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
  4.2475 -
  4.2476 -#include <pshpack4.h>
  4.2477 -typedef struct _ACCESS_STATE {
  4.2478 -  LUID  OperationID;
  4.2479 -  BOOLEAN  SecurityEvaluated;
  4.2480 -  BOOLEAN  GenerateAudit;
  4.2481 -  BOOLEAN  GenerateOnClose;
  4.2482 -  BOOLEAN  PrivilegesAllocated;
  4.2483 -  ULONG  Flags;
  4.2484 -  ACCESS_MASK  RemainingDesiredAccess;
  4.2485 -  ACCESS_MASK  PreviouslyGrantedAccess;
  4.2486 -  ACCESS_MASK  OriginalDesiredAccess;
  4.2487 -  SECURITY_SUBJECT_CONTEXT  SubjectSecurityContext;
  4.2488 -  PSECURITY_DESCRIPTOR  SecurityDescriptor;
  4.2489 -  PVOID  AuxData;
  4.2490 -  union {
  4.2491 -    INITIAL_PRIVILEGE_SET  InitialPrivilegeSet;
  4.2492 -    PRIVILEGE_SET  PrivilegeSet;
  4.2493 -  } Privileges;
  4.2494 -
  4.2495 -  BOOLEAN  AuditPrivileges;
  4.2496 -  UNICODE_STRING  ObjectName;
  4.2497 -  UNICODE_STRING  ObjectTypeName;
  4.2498 -} ACCESS_STATE, *PACCESS_STATE;
  4.2499 -#include <poppack.h>
  4.2500 -
  4.2501 -typedef struct _IO_SECURITY_CONTEXT {
  4.2502 -  PSECURITY_QUALITY_OF_SERVICE  SecurityQos;
  4.2503 -  PACCESS_STATE  AccessState;
  4.2504 -  ACCESS_MASK  DesiredAccess;
  4.2505 -  ULONG  FullCreateOptions;
  4.2506 -} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
  4.2507 -
  4.2508 -struct _IO_CSQ;
  4.2509 -
  4.2510 -typedef struct _IO_CSQ_IRP_CONTEXT {
  4.2511 -  ULONG  Type;
  4.2512 -  struct _IRP  *Irp;
  4.2513 -  struct _IO_CSQ  *Csq;
  4.2514 -} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
  4.2515 -
  4.2516 -typedef VOID DDKAPI
  4.2517 -(*PIO_CSQ_INSERT_IRP)(
  4.2518 -  /*IN*/ struct _IO_CSQ  *Csq,
  4.2519 -  /*IN*/ PIRP  Irp);
  4.2520 -
  4.2521 -typedef VOID DDKAPI
  4.2522 -(*PIO_CSQ_REMOVE_IRP)(
  4.2523 -  /*IN*/ struct _IO_CSQ  *Csq,
  4.2524 -  /*IN*/ PIRP  Irp);
  4.2525 -
  4.2526 -typedef PIRP DDKAPI
  4.2527 -(*PIO_CSQ_PEEK_NEXT_IRP)(
  4.2528 -  /*IN*/ struct _IO_CSQ  *Csq,
  4.2529 -  /*IN*/ PIRP  Irp,
  4.2530 -  /*IN*/ PVOID  PeekContext);
  4.2531 -
  4.2532 -typedef VOID DDKAPI
  4.2533 -(*PIO_CSQ_ACQUIRE_LOCK)(
  4.2534 -  /*IN*/ struct _IO_CSQ  *Csq,
  4.2535 -  /*OUT*/ PKIRQL  Irql);
  4.2536 -
  4.2537 -typedef VOID DDKAPI
  4.2538 -(*PIO_CSQ_RELEASE_LOCK)(
  4.2539 -  /*IN*/ struct _IO_CSQ  *Csq,
  4.2540 -  /*IN*/ KIRQL  Irql);
  4.2541 -
  4.2542 -typedef VOID DDKAPI
  4.2543 -(*PIO_CSQ_COMPLETE_CANCELED_IRP)(
  4.2544 -  /*IN*/ struct _IO_CSQ  *Csq,
  4.2545 -  /*IN*/ PIRP  Irp);
  4.2546 -
  4.2547 -typedef struct _IO_CSQ {
  4.2548 -  ULONG  Type;
  4.2549 -  PIO_CSQ_INSERT_IRP  CsqInsertIrp;
  4.2550 -  PIO_CSQ_REMOVE_IRP  CsqRemoveIrp;
  4.2551 -  PIO_CSQ_PEEK_NEXT_IRP  CsqPeekNextIrp;
  4.2552 -  PIO_CSQ_ACQUIRE_LOCK  CsqAcquireLock;
  4.2553 -  PIO_CSQ_RELEASE_LOCK  CsqReleaseLock;
  4.2554 -  PIO_CSQ_COMPLETE_CANCELED_IRP  CsqCompleteCanceledIrp;
  4.2555 -  PVOID  ReservePointer;
  4.2556 -} IO_CSQ, *PIO_CSQ;
  4.2557 -
  4.2558 -#include <pshpack4.h>
  4.2559 -typedef struct _IO_STACK_LOCATION {
  4.2560 -  UCHAR  MajorFunction;
  4.2561 -  UCHAR  MinorFunction;
  4.2562 -  UCHAR  Flags;
  4.2563 -  UCHAR  Control;
  4.2564 -  union {
  4.2565 -    struct {
  4.2566 -      PIO_SECURITY_CONTEXT  SecurityContext;
  4.2567 -      ULONG  Options;
  4.2568 -      USHORT POINTER_ALIGNMENT  FileAttributes;
  4.2569 -      USHORT  ShareAccess;
  4.2570 -      ULONG POINTER_ALIGNMENT  EaLength;
  4.2571 -    } Create;
  4.2572 -    struct {
  4.2573 -      ULONG  Length;
  4.2574 -      ULONG POINTER_ALIGNMENT  Key;
  4.2575 -      LARGE_INTEGER  ByteOffset;
  4.2576 -    } Read;
  4.2577 -    struct {
  4.2578 -      ULONG  Length;
  4.2579 -      ULONG POINTER_ALIGNMENT  Key;
  4.2580 -      LARGE_INTEGER  ByteOffset;
  4.2581 -    } Write;
  4.2582 -    struct {
  4.2583 -      ULONG  Length;
  4.2584 -      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
  4.2585 -    } QueryFile;
  4.2586 -    struct {
  4.2587 -      ULONG  Length;
  4.2588 -      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
  4.2589 -      PFILE_OBJECT  FileObject;
  4.2590 -      _ANONYMOUS_UNION union {
  4.2591 -        _ANONYMOUS_STRUCT struct {
  4.2592 -          BOOLEAN  ReplaceIfExists;
  4.2593 -          BOOLEAN  AdvanceOnly;
  4.2594 -        } DUMMYSTRUCTNAME;
  4.2595 -        ULONG  ClusterCount;
  4.2596 -        HANDLE  DeleteHandle;
  4.2597 -      } DUMMYUNIONNAME;
  4.2598 -    } SetFile;
  4.2599 -    struct {
  4.2600 -      ULONG  Length;
  4.2601 -      FS_INFORMATION_CLASS POINTER_ALIGNMENT  FsInformationClass;
  4.2602 -    } QueryVolume;
  4.2603 -    struct {
  4.2604 -      ULONG  OutputBufferLength;
  4.2605 -      ULONG POINTER_ALIGNMENT  InputBufferLength;
  4.2606 -      ULONG POINTER_ALIGNMENT  IoControlCode;
  4.2607 -      PVOID  Type3InputBuffer;
  4.2608 -    } DeviceIoControl;
  4.2609 -    struct {
  4.2610 -      SECURITY_INFORMATION  SecurityInformation;
  4.2611 -      ULONG POINTER_ALIGNMENT  Length;
  4.2612 -    } QuerySecurity;
  4.2613 -    struct {
  4.2614 -      SECURITY_INFORMATION  SecurityInformation;
  4.2615 -      PSECURITY_DESCRIPTOR  SecurityDescriptor;
  4.2616 -    } SetSecurity;
  4.2617 -    struct {
  4.2618 -      PVPB  Vpb;
  4.2619 -      PDEVICE_OBJECT  DeviceObject;
  4.2620 -    } MountVolume;
  4.2621 -    struct {
  4.2622 -      PVPB  Vpb;
  4.2623 -      PDEVICE_OBJECT  DeviceObject;
  4.2624 -    } VerifyVolume;
  4.2625 -    struct {
  4.2626 -      struct _SCSI_REQUEST_BLOCK  *Srb;
  4.2627 -    } Scsi;
  4.2628 -    struct {
  4.2629 -      DEVICE_RELATION_TYPE  Type;
  4.2630 -    } QueryDeviceRelations;
  4.2631 -    struct {
  4.2632 -      CONST GUID  *InterfaceType;
  4.2633 -      USHORT  Size;
  4.2634 -      USHORT  Version;
  4.2635 -      PINTERFACE  Interface;
  4.2636 -      PVOID  InterfaceSpecificData;
  4.2637 -    } QueryInterface;
  4.2638 -    struct {
  4.2639 -      PDEVICE_CAPABILITIES  Capabilities;
  4.2640 -    } DeviceCapabilities;
  4.2641 -    struct {
  4.2642 -      PIO_RESOURCE_REQUIREMENTS_LIST  IoResourceRequirementList;
  4.2643 -    } FilterResourceRequirements;
  4.2644 -    struct {
  4.2645 -      ULONG  WhichSpace;
  4.2646 -      PVOID  Buffer;
  4.2647 -      ULONG  Offset;
  4.2648 -      ULONG POINTER_ALIGNMENT  Length;
  4.2649 -    } ReadWriteConfig;
  4.2650 -    struct {
  4.2651 -      BOOLEAN  Lock;
  4.2652 -    } SetLock;
  4.2653 -    struct {
  4.2654 -      BUS_QUERY_ID_TYPE  IdType;
  4.2655 -    } QueryId;
  4.2656 -    struct {
  4.2657 -      DEVICE_TEXT_TYPE  DeviceTextType;
  4.2658 -      LCID POINTER_ALIGNMENT  LocaleId;
  4.2659 -    } QueryDeviceText;
  4.2660 -    struct {
  4.2661 -      BOOLEAN  InPath;
  4.2662 -      BOOLEAN  Reserved[3];
  4.2663 -      DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT  Type;
  4.2664 -    } UsageNotification;
  4.2665 -    struct {
  4.2666 -      SYSTEM_POWER_STATE  PowerState;
  4.2667 -    } WaitWake;
  4.2668 -    struct {
  4.2669 -      PPOWER_SEQUENCE  PowerSequence;
  4.2670 -    } PowerSequence;
  4.2671 -    struct {
  4.2672 -      ULONG  SystemContext;
  4.2673 -      POWER_STATE_TYPE POINTER_ALIGNMENT  Type;
  4.2674 -      POWER_STATE POINTER_ALIGNMENT  State;
  4.2675 -      POWER_ACTION POINTER_ALIGNMENT  ShutdownType;
  4.2676 -    } Power;
  4.2677 -    struct {
  4.2678 -      PCM_RESOURCE_LIST  AllocatedResources;
  4.2679 -      PCM_RESOURCE_LIST  AllocatedResourcesTranslated;
  4.2680 -    } StartDevice;
  4.2681 -    struct {
  4.2682 -      ULONG_PTR  ProviderId;
  4.2683 -      PVOID  DataPath;
  4.2684 -      ULONG  BufferSize;
  4.2685 -      PVOID  Buffer;
  4.2686 -    } WMI;
  4.2687 -    struct {
  4.2688 -      PVOID  Argument1;
  4.2689 -      PVOID  Argument2;
  4.2690 -      PVOID  Argument3;
  4.2691 -      PVOID  Argument4;
  4.2692 -    } Others;
  4.2693 -  } Parameters;
  4.2694 -  PDEVICE_OBJECT  DeviceObject;
  4.2695 -  PFILE_OBJECT  FileObject;
  4.2696 -  PIO_COMPLETION_ROUTINE  CompletionRoutine;
  4.2697 -  PVOID  Context;
  4.2698 -} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
  4.2699 -#include <poppack.h>
  4.2700 -
  4.2701 -/* IO_STACK_LOCATION.Control */
  4.2702 -
  4.2703 -#define SL_PENDING_RETURNED               0x01
  4.2704 -#define SL_INVOKE_ON_CANCEL               0x20
  4.2705 -#define SL_INVOKE_ON_SUCCESS              0x40
  4.2706 -#define SL_INVOKE_ON_ERROR                0x80
  4.2707 -
  4.2708 -typedef enum _KEY_INFORMATION_CLASS {
  4.2709 -  KeyBasicInformation,
  4.2710 -  KeyNodeInformation,
  4.2711 -  KeyFullInformation,
  4.2712 -  KeyNameInformation,
  4.2713 -  KeyCachedInformation,
  4.2714 -  KeyFlagsInformation
  4.2715 -} KEY_INFORMATION_CLASS;
  4.2716 -
  4.2717 -typedef struct _KEY_BASIC_INFORMATION {
  4.2718 -  LARGE_INTEGER  LastWriteTime;
  4.2719 -  ULONG  TitleIndex;
  4.2720 -  ULONG  NameLength;
  4.2721 -  WCHAR  Name[1];
  4.2722 -} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
  4.2723 -
  4.2724 -typedef struct _KEY_FULL_INFORMATION {
  4.2725 -  LARGE_INTEGER  LastWriteTime;
  4.2726 -  ULONG  TitleIndex;
  4.2727 -  ULONG  ClassOffset;
  4.2728 -  ULONG  ClassLength;
  4.2729 -  ULONG  SubKeys;
  4.2730 -  ULONG  MaxNameLen;
  4.2731 -  ULONG  MaxClassLen;
  4.2732 -  ULONG  Values;
  4.2733 -  ULONG  MaxValueNameLen;
  4.2734 -  ULONG  MaxValueDataLen;
  4.2735 -  WCHAR  Class[1];
  4.2736 -} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
  4.2737 -
  4.2738 -typedef struct _KEY_NODE_INFORMATION {
  4.2739 -  LARGE_INTEGER  LastWriteTime;
  4.2740 -  ULONG  TitleIndex;
  4.2741 -  ULONG  ClassOffset;
  4.2742 -  ULONG  ClassLength;
  4.2743 -  ULONG  NameLength;
  4.2744 -  WCHAR  Name[1];
  4.2745 -} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
  4.2746 -
  4.2747 -typedef struct _KEY_VALUE_BASIC_INFORMATION {
  4.2748 -  ULONG  TitleIndex;
  4.2749 -  ULONG  Type;
  4.2750 -  ULONG  NameLength;
  4.2751 -  WCHAR  Name[1];
  4.2752 -} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
  4.2753 -
  4.2754 -typedef struct _KEY_VALUE_FULL_INFORMATION {
  4.2755 -  ULONG  TitleIndex;
  4.2756 -  ULONG  Type;
  4.2757 -  ULONG  DataOffset;
  4.2758 -  ULONG  DataLength;
  4.2759 -  ULONG  NameLength;
  4.2760 -  WCHAR  Name[1];
  4.2761 -} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
  4.2762 -
  4.2763 -typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
  4.2764 -  ULONG  TitleIndex;
  4.2765 -  ULONG  Type;
  4.2766 -  ULONG  DataLength;
  4.2767 -  UCHAR  Data[1];
  4.2768 -} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
  4.2769 -
  4.2770 -typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
  4.2771 -  ULONG  Type;
  4.2772 -  ULONG  DataLength;
  4.2773 -  UCHAR  Data[1];
  4.2774 -} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
  4.2775 -
  4.2776 -typedef struct _KEY_VALUE_ENTRY {
  4.2777 -  PUNICODE_STRING  ValueName;
  4.2778 -  ULONG  DataLength;
  4.2779 -  ULONG  DataOffset;
  4.2780 -  ULONG  Type;
  4.2781 -} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
  4.2782 -
  4.2783 -typedef enum _KEY_VALUE_INFORMATION_CLASS {
  4.2784 -  KeyValueBasicInformation,
  4.2785 -  KeyValueFullInformation,
  4.2786 -  KeyValuePartialInformation,
  4.2787 -  KeyValueFullInformationAlign64,
  4.2788 -  KeyValuePartialInformationAlign64
  4.2789 -} KEY_VALUE_INFORMATION_CLASS;
  4.2790 -
  4.2791 -/* KEY_VALUE_Xxx.Type */
  4.2792 -
  4.2793 -#define REG_NONE                           0
  4.2794 -#define REG_SZ                             1
  4.2795 -#define REG_EXPAND_SZ                      2
  4.2796 -#define REG_BINARY                         3
  4.2797 -#define REG_DWORD                          4
  4.2798 -#define REG_DWORD_LITTLE_ENDIAN            4
  4.2799 -#define REG_DWORD_BIG_ENDIAN               5
  4.2800 -#define REG_LINK                           6
  4.2801 -#define REG_MULTI_SZ                       7
  4.2802 -#define REG_RESOURCE_LIST                  8
  4.2803 -#define REG_FULL_RESOURCE_DESCRIPTOR       9
  4.2804 -#define REG_RESOURCE_REQUIREMENTS_LIST    10
  4.2805 -#define REG_QWORD                         11
  4.2806 -#define REG_QWORD_LITTLE_ENDIAN           11
  4.2807 -
  4.2808 -#define PCI_TYPE0_ADDRESSES               6
  4.2809 -#define PCI_TYPE1_ADDRESSES               2
  4.2810 -#define PCI_TYPE2_ADDRESSES               5
  4.2811 -
  4.2812 -typedef struct _PCI_COMMON_CONFIG {
  4.2813 -  USHORT  VendorID;
  4.2814 -  USHORT  DeviceID;
  4.2815 -  USHORT  Command;
  4.2816 -  USHORT  Status;
  4.2817 -  UCHAR  RevisionID;
  4.2818 -  UCHAR  ProgIf;
  4.2819 -  UCHAR  SubClass;
  4.2820 -  UCHAR  BaseClass;
  4.2821 -  UCHAR  CacheLineSize;
  4.2822 -  UCHAR  LatencyTimer;
  4.2823 -  UCHAR  HeaderType;
  4.2824 -  UCHAR  BIST;
  4.2825 -  union {
  4.2826 -    struct _PCI_HEADER_TYPE_0 {
  4.2827 -      ULONG  BaseAddresses[PCI_TYPE0_ADDRESSES];
  4.2828 -      ULONG  CIS;
  4.2829 -      USHORT  SubVendorID;
  4.2830 -      USHORT  SubSystemID;
  4.2831 -      ULONG  ROMBaseAddress;
  4.2832 -      UCHAR  CapabilitiesPtr;
  4.2833 -      UCHAR  Reserved1[3];
  4.2834 -      ULONG  Reserved2;
  4.2835 -      UCHAR  InterruptLine;
  4.2836 -      UCHAR  InterruptPin;
  4.2837 -      UCHAR  MinimumGrant;
  4.2838 -      UCHAR  MaximumLatency;
  4.2839 -    } type0;
  4.2840 -      struct _PCI_HEADER_TYPE_1 {
  4.2841 -        ULONG  BaseAddresses[PCI_TYPE1_ADDRESSES];
  4.2842 -        UCHAR  PrimaryBus;
  4.2843 -        UCHAR  SecondaryBus;
  4.2844 -        UCHAR  SubordinateBus;
  4.2845 -        UCHAR  SecondaryLatency;
  4.2846 -        UCHAR  IOBase;
  4.2847 -        UCHAR  IOLimit;
  4.2848 -        USHORT  SecondaryStatus;
  4.2849 -        USHORT  MemoryBase;
  4.2850 -        USHORT  MemoryLimit;
  4.2851 -        USHORT  PrefetchBase;
  4.2852 -        USHORT  PrefetchLimit;
  4.2853 -        ULONG  PrefetchBaseUpper32;
  4.2854 -        ULONG  PrefetchLimitUpper32;
  4.2855 -        USHORT  IOBaseUpper16;
  4.2856 -        USHORT  IOLimitUpper16;
  4.2857 -        UCHAR  CapabilitiesPtr;
  4.2858 -        UCHAR  Reserved1[3];
  4.2859 -        ULONG  ROMBaseAddress;
  4.2860 -        UCHAR  InterruptLine;
  4.2861 -        UCHAR  InterruptPin;
  4.2862 -        USHORT  BridgeControl;
  4.2863 -      } type1;
  4.2864 -      struct _PCI_HEADER_TYPE_2 {
  4.2865 -        ULONG  SocketRegistersBaseAddress;
  4.2866 -        UCHAR  CapabilitiesPtr;
  4.2867 -        UCHAR  Reserved;
  4.2868 -        USHORT  SecondaryStatus;
  4.2869 -        UCHAR  PrimaryBus;
  4.2870 -        UCHAR  SecondaryBus;
  4.2871 -        UCHAR  SubordinateBus;
  4.2872 -        UCHAR  SecondaryLatency;
  4.2873 -        struct {
  4.2874 -          ULONG  Base;
  4.2875 -          ULONG  Limit;
  4.2876 -        } Range[PCI_TYPE2_ADDRESSES - 1];
  4.2877 -        UCHAR  InterruptLine;
  4.2878 -        UCHAR  InterruptPin;
  4.2879 -        USHORT  BridgeControl;
  4.2880 -      } type2;
  4.2881 -  } u;
  4.2882 -  UCHAR  DeviceSpecific[192];
  4.2883 -} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
  4.2884 -
  4.2885 -/* PCI_COMMON_CONFIG.Command */
  4.2886 -
  4.2887 -#define PCI_ENABLE_IO_SPACE               0x0001
  4.2888 -#define PCI_ENABLE_MEMORY_SPACE           0x0002
  4.2889 -#define PCI_ENABLE_BUS_MASTER             0x0004
  4.2890 -#define PCI_ENABLE_SPECIAL_CYCLES         0x0008
  4.2891 -#define PCI_ENABLE_WRITE_AND_INVALIDATE   0x0010
  4.2892 -#define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
  4.2893 -#define PCI_ENABLE_PARITY                 0x0040
  4.2894 -#define PCI_ENABLE_WAIT_CYCLE             0x0080
  4.2895 -#define PCI_ENABLE_SERR                   0x0100
  4.2896 -#define PCI_ENABLE_FAST_BACK_TO_BACK      0x0200
  4.2897 -
  4.2898 -/* PCI_COMMON_CONFIG.Status */
  4.2899 -
  4.2900 -#define PCI_STATUS_CAPABILITIES_LIST      0x0010
  4.2901 -#define PCI_STATUS_66MHZ_CAPABLE          0x0020
  4.2902 -#define PCI_STATUS_UDF_SUPPORTED          0x0040
  4.2903 -#define PCI_STATUS_FAST_BACK_TO_BACK      0x0080
  4.2904 -#define PCI_STATUS_DATA_PARITY_DETECTED   0x0100
  4.2905 -#define PCI_STATUS_DEVSEL                 0x0600
  4.2906 -#define PCI_STATUS_SIGNALED_TARGET_ABORT  0x0800
  4.2907 -#define PCI_STATUS_RECEIVED_TARGET_ABORT  0x1000
  4.2908 -#define PCI_STATUS_RECEIVED_MASTER_ABORT  0x2000
  4.2909 -#define PCI_STATUS_SIGNALED_SYSTEM_ERROR  0x4000
  4.2910 -#define PCI_STATUS_DETECTED_PARITY_ERROR  0x8000
  4.2911 -
  4.2912 -/* PCI_COMMON_CONFIG.HeaderType */
  4.2913 -
  4.2914 -#define PCI_MULTIFUNCTION                 0x80
  4.2915 -#define PCI_DEVICE_TYPE                   0x00
  4.2916 -#define PCI_BRIDGE_TYPE                   0x01
  4.2917 -#define PCI_CARDBUS_BRIDGE_TYPE           0x02
  4.2918 -
  4.2919 -#define PCI_CONFIGURATION_TYPE(PciData) \
  4.2920 -  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
  4.2921 -
  4.2922 -#define PCI_MULTIFUNCTION_DEVICE(PciData) \
  4.2923 -  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
  4.2924 -
  4.2925 -typedef struct _PCI_SLOT_NUMBER {
  4.2926 -  union {
  4.2927 -    struct {
  4.2928 -      ULONG  DeviceNumber : 5;
  4.2929 -      ULONG  FunctionNumber : 3;
  4.2930 -      ULONG  Reserved : 24;
  4.2931 -    } bits;
  4.2932 -    ULONG  AsULONG;
  4.2933 -  } u;
  4.2934 -} PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
  4.2935 -
  4.2936 -typedef enum _POOL_TYPE {
  4.2937 -  NonPagedPool,
  4.2938 -  PagedPool,
  4.2939 -  NonPagedPoolMustSucceed,
  4.2940 -  DontUseThisType,
  4.2941 -  NonPagedPoolCacheAligned,
  4.2942 -  PagedPoolCacheAligned,
  4.2943 -  NonPagedPoolCacheAlignedMustS,
  4.2944 -	MaxPoolType,
  4.2945 -	NonPagedPoolSession = 32,
  4.2946 -	PagedPoolSession,
  4.2947 -	NonPagedPoolMustSucceedSession,
  4.2948 -	DontUseThisTypeSession,
  4.2949 -	NonPagedPoolCacheAlignedSession,
  4.2950 -	PagedPoolCacheAlignedSession,
  4.2951 -	NonPagedPoolCacheAlignedMustSSession
  4.2952 -} POOL_TYPE;
  4.2953 -
  4.2954 -typedef enum _EX_POOL_PRIORITY {
  4.2955 -  LowPoolPriority,
  4.2956 -  LowPoolPrioritySpecialPoolOverrun = 8,
  4.2957 -  LowPoolPrioritySpecialPoolUnderrun = 9,
  4.2958 -  NormalPoolPriority = 16,
  4.2959 -  NormalPoolPrioritySpecialPoolOverrun = 24,
  4.2960 -  NormalPoolPrioritySpecialPoolUnderrun = 25,
  4.2961 -  HighPoolPriority = 32,
  4.2962 -  HighPoolPrioritySpecialPoolOverrun = 40,
  4.2963 -  HighPoolPrioritySpecialPoolUnderrun = 41
  4.2964 -} EX_POOL_PRIORITY;
  4.2965 -
  4.2966 -/* PRIVILEGE_SET.Control */
  4.2967 -
  4.2968 -#define PRIVILEGE_SET_ALL_NECESSARY       1
  4.2969 -
  4.2970 -typedef struct _RTL_OSVERSIONINFOW {
  4.2971 -  ULONG  dwOSVersionInfoSize;
  4.2972 -  ULONG  dwMajorVersion;
  4.2973 -  ULONG  dwMinorVersion;
  4.2974 -  ULONG  dwBuildNumber;
  4.2975 -  ULONG  dwPlatformId;
  4.2976 -  WCHAR  szCSDVersion[128];
  4.2977 -} RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
  4.2978 -
  4.2979 -typedef struct _RTL_OSVERSIONINFOEXW {
  4.2980 -  ULONG  dwOSVersionInfoSize;
  4.2981 -  ULONG  dwMajorVersion;
  4.2982 -  ULONG  dwMinorVersion;
  4.2983 -  ULONG  dwBuildNumber;
  4.2984 -  ULONG  dwPlatformId;
  4.2985 -  WCHAR  szCSDVersion[128];
  4.2986 -  USHORT  wServicePackMajor;
  4.2987 -  USHORT  wServicePackMinor;
  4.2988 -  USHORT  wSuiteMask;
  4.2989 -  UCHAR  wProductType;
  4.2990 -  UCHAR  wReserved;
  4.2991 -} RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
  4.2992 -
  4.2993 -NTOSAPI
  4.2994 -ULONGLONG
  4.2995 -DDKAPI
  4.2996 -VerSetConditionMask(
  4.2997 -  /*IN*/ ULONGLONG  ConditionMask,
  4.2998 -  /*IN*/ ULONG  TypeMask,
  4.2999 -  /*IN*/ UCHAR  Condition);
  4.3000 -
  4.3001 -#define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType)  \
  4.3002 -        ((ConditionMask) = VerSetConditionMask((ConditionMask), \
  4.3003 -        (TypeBitMask), (ComparisonType)))
  4.3004 -
  4.3005 -/* RtlVerifyVersionInfo() TypeMask */
  4.3006 -
  4.3007 -#define VER_MINORVERSION                  0x0000001
  4.3008 -#define VER_MAJORVERSION                  0x0000002
  4.3009 -#define VER_BUILDNUMBER                   0x0000004
  4.3010 -#define VER_PLATFORMID                    0x0000008
  4.3011 -#define VER_SERVICEPACKMINOR              0x0000010
  4.3012 -#define VER_SERVICEPACKMAJOR              0x0000020
  4.3013 -#define VER_SUITENAME                     0x0000040
  4.3014 -#define VER_PRODUCT_TYPE                  0x0000080
  4.3015 -
  4.3016 -/* RtlVerifyVersionInfo() ComparisonType */
  4.3017 -
  4.3018 -#define VER_EQUAL                       1
  4.3019 -#define VER_GREATER                     2
  4.3020 -#define VER_GREATER_EQUAL               3
  4.3021 -#define VER_LESS                        4
  4.3022 -#define VER_LESS_EQUAL                  5
  4.3023 -#define VER_AND                         6
  4.3024 -#define VER_OR                          7
  4.3025 -
  4.3026 -#define VER_CONDITION_MASK              7
  4.3027 -#define VER_NUM_BITS_PER_CONDITION_MASK 3
  4.3028 -
  4.3029 -typedef struct _RTL_BITMAP {
  4.3030 -  ULONG  SizeOfBitMap;
  4.3031 -  PULONG  Buffer;
  4.3032 -} RTL_BITMAP, *PRTL_BITMAP;
  4.3033 -
  4.3034 -typedef struct _RTL_BITMAP_RUN {
  4.3035 -    ULONG  StartingIndex;
  4.3036 -    ULONG  NumberOfBits;
  4.3037 -} RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
  4.3038 -
  4.3039 -typedef NTSTATUS DDKAPI
  4.3040 -(*PRTL_QUERY_REGISTRY_ROUTINE)(
  4.3041 -  /*IN*/ PWSTR  ValueName,
  4.3042 -  /*IN*/ ULONG  ValueType,
  4.3043 -  /*IN*/ PVOID  ValueData,
  4.3044 -  /*IN*/ ULONG  ValueLength,
  4.3045 -  /*IN*/ PVOID  Context,
  4.3046 -  /*IN*/ PVOID  EntryContext);
  4.3047 -
  4.3048 -#define RTL_REGISTRY_ABSOLUTE             0
  4.3049 -#define RTL_REGISTRY_SERVICES             1
  4.3050 -#define RTL_REGISTRY_CONTROL              2
  4.3051 -#define RTL_REGISTRY_WINDOWS_NT           3
  4.3052 -#define RTL_REGISTRY_DEVICEMAP            4
  4.3053 -#define RTL_REGISTRY_USER                 5
  4.3054 -
  4.3055 -/* RTL_QUERY_REGISTRY_TABLE.Flags */
  4.3056 -#define RTL_QUERY_REGISTRY_SUBKEY         0x00000001
  4.3057 -#define RTL_QUERY_REGISTRY_TOPKEY         0x00000002
  4.3058 -#define RTL_QUERY_REGISTRY_REQUIRED       0x00000004
  4.3059 -#define RTL_QUERY_REGISTRY_NOVALUE        0x00000008
  4.3060 -#define RTL_QUERY_REGISTRY_NOEXPAND       0x00000010
  4.3061 -#define RTL_QUERY_REGISTRY_DIRECT         0x00000020
  4.3062 -#define RTL_QUERY_REGISTRY_DELETE         0x00000040
  4.3063 -
  4.3064 -typedef struct _RTL_QUERY_REGISTRY_TABLE {
  4.3065 -  PRTL_QUERY_REGISTRY_ROUTINE  QueryRoutine;
  4.3066 -  ULONG  Flags;
  4.3067 -  PWSTR  Name;
  4.3068 -  PVOID  EntryContext;
  4.3069 -  ULONG  DefaultType;
  4.3070 -  PVOID  DefaultData;
  4.3071 -  ULONG  DefaultLength;
  4.3072 -} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
  4.3073 -
  4.3074 -typedef struct _TIME_FIELDS {
  4.3075 -  CSHORT  Year;
  4.3076 -  CSHORT  Month;
  4.3077 -  CSHORT  Day;
  4.3078 -  CSHORT  Hour;
  4.3079 -  CSHORT  Minute;
  4.3080 -  CSHORT  Second;
  4.3081 -  CSHORT  Milliseconds;
  4.3082 -  CSHORT  Weekday;
  4.3083 -} TIME_FIELDS, *PTIME_FIELDS;
  4.3084 -
  4.3085 -typedef PVOID DDKAPI
  4.3086 -(*PALLOCATE_FUNCTION)(
  4.3087 -  /*IN*/ POOL_TYPE  PoolType,
  4.3088 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.3089 -  /*IN*/ ULONG  Tag);
  4.3090 -
  4.3091 -typedef VOID DDKAPI
  4.3092 -(*PFREE_FUNCTION)(
  4.3093 -  /*IN*/ PVOID  Buffer);
  4.3094 -
  4.3095 -#define GENERAL_LOOKASIDE_S \
  4.3096 -  SLIST_HEADER  ListHead; \
  4.3097 -  USHORT  Depth; \
  4.3098 -  USHORT  MaximumDepth; \
  4.3099 -  ULONG  TotalAllocates; \
  4.3100 -  _ANONYMOUS_UNION union { \
  4.3101 -    ULONG  AllocateMisses; \
  4.3102 -    ULONG  AllocateHits; \
  4.3103 -  } DUMMYUNIONNAME; \
  4.3104 -  ULONG  TotalFrees; \
  4.3105 -  _ANONYMOUS_UNION union { \
  4.3106 -    ULONG  FreeMisses; \
  4.3107 -    ULONG  FreeHits; \
  4.3108 -  } DUMMYUNIONNAME2; \
  4.3109 -  POOL_TYPE  Type; \
  4.3110 -  ULONG  Tag; \
  4.3111 -  ULONG  Size; \
  4.3112 -  PALLOCATE_FUNCTION  Allocate; \
  4.3113 -  PFREE_FUNCTION  Free; \
  4.3114 -  LIST_ENTRY  ListEntry; \
  4.3115 -  ULONG  LastTotalAllocates; \
  4.3116 -  _ANONYMOUS_UNION union { \
  4.3117 -    ULONG  LastAllocateMisses; \
  4.3118 -    ULONG  LastAllocateHits; \
  4.3119 -  } DUMMYUNIONNAME3; \
  4.3120 -  ULONG Future[2];
  4.3121 -
  4.3122 -typedef struct _GENERAL_LOOKASIDE {
  4.3123 -  GENERAL_LOOKASIDE_S
  4.3124 -} GENERAL_LOOKASIDE, *PGENERAL_LOOKASIDE;
  4.3125 -
  4.3126 -typedef struct _NPAGED_LOOKASIDE_LIST {
  4.3127 -  GENERAL_LOOKASIDE_S
  4.3128 -  KSPIN_LOCK  Obsoleted;
  4.3129 -} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
  4.3130 -
  4.3131 -typedef struct _PAGED_LOOKASIDE_LIST {
  4.3132 -  GENERAL_LOOKASIDE_S
  4.3133 -  FAST_MUTEX  Obsoleted;
  4.3134 -} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
  4.3135 -
  4.3136 -typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
  4.3137 -
  4.3138 -typedef VOID DDKAPI (*PCALLBACK_FUNCTION)(
  4.3139 -  /*IN*/ PVOID  CallbackContext,
  4.3140 -  /*IN*/ PVOID  Argument1,
  4.3141 -  /*IN*/ PVOID  Argument2);
  4.3142 -
  4.3143 -typedef enum _EVENT_TYPE {
  4.3144 -  NotificationEvent,
  4.3145 -  SynchronizationEvent
  4.3146 -} EVENT_TYPE;
  4.3147 -
  4.3148 -typedef enum _KWAIT_REASON {
  4.3149 -  Executive,
  4.3150 -  FreePage,
  4.3151 -  PageIn,
  4.3152 -  PoolAllocation,
  4.3153 -  DelayExecution,
  4.3154 -  Suspended,
  4.3155 -  UserRequest,
  4.3156 -  WrExecutive,
  4.3157 -  WrFreePage,
  4.3158 -  WrPageIn,
  4.3159 -  WrPoolAllocation,
  4.3160 -  WrDelayExecution,
  4.3161 -  WrSuspended,
  4.3162 -  WrUserRequest,
  4.3163 -  WrEventPair,
  4.3164 -  WrQueue,
  4.3165 -  WrLpcReceive,
  4.3166 -  WrLpcReply,
  4.3167 -  WrVirtualMemory,
  4.3168 -  WrPageOut,
  4.3169 -  WrRendezvous,
  4.3170 -  Spare2,
  4.3171 -  Spare3,
  4.3172 -  Spare4,
  4.3173 -  Spare5,
  4.3174 -  Spare6,
  4.3175 -  WrKernel,
  4.3176 -  MaximumWaitReason
  4.3177 -} KWAIT_REASON;
  4.3178 -
  4.3179 -typedef struct _KWAIT_BLOCK {
  4.3180 -  LIST_ENTRY  WaitListEntry;
  4.3181 -  struct _KTHREAD * RESTRICTED_POINTER  Thread;
  4.3182 -  PVOID  Object;
  4.3183 -  struct _KWAIT_BLOCK * RESTRICTED_POINTER  NextWaitBlock;
  4.3184 -  USHORT  WaitKey;
  4.3185 -  USHORT  WaitType;
  4.3186 -} KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
  4.3187 -
  4.3188 -typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
  4.3189 -
  4.3190 -typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
  4.3191 -  BOOLEAN  Removed;
  4.3192 -  BOOLEAN  Reserved[3];
  4.3193 -  LONG  IoCount;
  4.3194 -  KEVENT  RemoveEvent;
  4.3195 -} IO_REMOVE_LOCK_COMMON_BLOCK;
  4.3196 -
  4.3197 -typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
  4.3198 -  LONG  Signature;
  4.3199 -  LONG  HighWatermark;
  4.3200 -  LONGLONG  MaxLockedTicks;
  4.3201 -  LONG  AllocateTag;
  4.3202 -  LIST_ENTRY  LockList;
  4.3203 -  KSPIN_LOCK  Spin;
  4.3204 -  LONG  LowMemoryCount;
  4.3205 -  ULONG  Reserved1[4];
  4.3206 -  PVOID  Reserved2;
  4.3207 -  PIO_REMOVE_LOCK_TRACKING_BLOCK  Blocks;
  4.3208 -} IO_REMOVE_LOCK_DBG_BLOCK;
  4.3209 -
  4.3210 -typedef struct _IO_REMOVE_LOCK {
  4.3211 -  IO_REMOVE_LOCK_COMMON_BLOCK  Common;
  4.3212 -#ifdef DBG
  4.3213 -  IO_REMOVE_LOCK_DBG_BLOCK  Dbg;
  4.3214 -#endif
  4.3215 -} IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
  4.3216 -
  4.3217 -typedef struct _IO_WORKITEM *PIO_WORKITEM;
  4.3218 -
  4.3219 -typedef VOID DDKAPI
  4.3220 -(*PIO_WORKITEM_ROUTINE)(
  4.3221 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.3222 -  /*IN*/ PVOID  Context);
  4.3223 -
  4.3224 -typedef struct _SHARE_ACCESS {
  4.3225 -  ULONG  OpenCount;
  4.3226 -  ULONG  Readers;
  4.3227 -  ULONG  Writers;
  4.3228 -  ULONG  Deleters;
  4.3229 -  ULONG  SharedRead;
  4.3230 -  ULONG  SharedWrite;
  4.3231 -  ULONG  SharedDelete;
  4.3232 -} SHARE_ACCESS, *PSHARE_ACCESS;
  4.3233 -
  4.3234 -typedef enum _KINTERRUPT_MODE {
  4.3235 -  LevelSensitive,
  4.3236 -  Latched
  4.3237 -} KINTERRUPT_MODE;
  4.3238 -
  4.3239 -typedef VOID DDKAPI
  4.3240 -(*PKINTERRUPT_ROUTINE)(
  4.3241 -  VOID);
  4.3242 -
  4.3243 -typedef enum _KPROFILE_SOURCE {
  4.3244 -  ProfileTime,
  4.3245 -  ProfileAlignmentFixup,
  4.3246 -  ProfileTotalIssues,
  4.3247 -  ProfilePipelineDry,
  4.3248 -  ProfileLoadInstructions,
  4.3249 -  ProfilePipelineFrozen,
  4.3250 -  ProfileBranchInstructions,
  4.3251 -  ProfileTotalNonissues,
  4.3252 -  ProfileDcacheMisses,
  4.3253 -  ProfileIcacheMisses,
  4.3254 -  ProfileCacheMisses,
  4.3255 -  ProfileBranchMispredictions,
  4.3256 -  ProfileStoreInstructions,
  4.3257 -  ProfileFpInstructions,
  4.3258 -  ProfileIntegerInstructions,
  4.3259 -  Profile2Issue,
  4.3260 -  Profile3Issue,
  4.3261 -  Profile4Issue,
  4.3262 -  ProfileSpecialInstructions,
  4.3263 -  ProfileTotalCycles,
  4.3264 -  ProfileIcacheIssues,
  4.3265 -  ProfileDcacheAccesses,
  4.3266 -  ProfileMemoryBarrierCycles,
  4.3267 -  ProfileLoadLinkedIssues,
  4.3268 -  ProfileMaximum
  4.3269 -} KPROFILE_SOURCE;
  4.3270 -
  4.3271 -typedef enum _CREATE_FILE_TYPE {
  4.3272 -  CreateFileTypeNone,
  4.3273 -  CreateFileTypeNamedPipe,
  4.3274 -  CreateFileTypeMailslot
  4.3275 -} CREATE_FILE_TYPE;
  4.3276 -
  4.3277 -typedef struct _CONFIGURATION_INFORMATION {
  4.3278 -  ULONG  DiskCount;
  4.3279 -  ULONG  FloppyCount;
  4.3280 -  ULONG  CdRomCount;
  4.3281 -  ULONG  TapeCount;
  4.3282 -  ULONG  ScsiPortCount;
  4.3283 -  ULONG  SerialCount;
  4.3284 -  ULONG  ParallelCount;
  4.3285 -  BOOLEAN  AtDiskPrimaryAddressClaimed;
  4.3286 -  BOOLEAN  AtDiskSecondaryAddressClaimed;
  4.3287 -  ULONG  Version;
  4.3288 -  ULONG  MediumChangerCount;
  4.3289 -} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
  4.3290 -
  4.3291 -typedef enum _CONFIGURATION_TYPE {
  4.3292 -  ArcSystem,
  4.3293 -  CentralProcessor,
  4.3294 -  FloatingPointProcessor,
  4.3295 -  PrimaryIcache,
  4.3296 -  PrimaryDcache,
  4.3297 -  SecondaryIcache,
  4.3298 -  SecondaryDcache,
  4.3299 -  SecondaryCache,
  4.3300 -  EisaAdapter,
  4.3301 -  TcAdapter,
  4.3302 -  ScsiAdapter,
  4.3303 -  DtiAdapter,
  4.3304 -  MultiFunctionAdapter,
  4.3305 -  DiskController,
  4.3306 -  TapeController,
  4.3307 -  CdromController,
  4.3308 -  WormController,
  4.3309 -  SerialController,
  4.3310 -  NetworkController,
  4.3311 -  DisplayController,
  4.3312 -  ParallelController,
  4.3313 -  PointerController,
  4.3314 -  KeyboardController,
  4.3315 -  AudioController,
  4.3316 -  OtherController,
  4.3317 -  DiskPeripheral,
  4.3318 -  FloppyDiskPeripheral,
  4.3319 -  TapePeripheral,
  4.3320 -  ModemPeripheral,
  4.3321 -  MonitorPeripheral,
  4.3322 -  PrinterPeripheral,
  4.3323 -  PointerPeripheral,
  4.3324 -  KeyboardPeripheral,
  4.3325 -  TerminalPeripheral,
  4.3326 -  OtherPeripheral,
  4.3327 -  LinePeripheral,
  4.3328 -  NetworkPeripheral,
  4.3329 -  SystemMemory,
  4.3330 -  DockingInformation,
  4.3331 -  RealModeIrqRoutingTable,
  4.3332 -  MaximumType
  4.3333 -} CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
  4.3334 -
  4.3335 -typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(
  4.3336 -  /*IN*/ PVOID  Context,
  4.3337 -  /*IN*/ PUNICODE_STRING  PathName,
  4.3338 -  /*IN*/ INTERFACE_TYPE  BusType,
  4.3339 -  /*IN*/ ULONG  BusNumber,
  4.3340 -  /*IN*/ PKEY_VALUE_FULL_INFORMATION  *BusInformation,
  4.3341 -  /*IN*/ CONFIGURATION_TYPE  ControllerType,
  4.3342 -  /*IN*/ ULONG  ControllerNumber,
  4.3343 -  /*IN*/ PKEY_VALUE_FULL_INFORMATION  *ControllerInformation,
  4.3344 -  /*IN*/ CONFIGURATION_TYPE  PeripheralType,
  4.3345 -  /*IN*/ ULONG  PeripheralNumber,
  4.3346 -  /*IN*/ PKEY_VALUE_FULL_INFORMATION  *PeripheralInformation);
  4.3347 -
  4.3348 -typedef enum _WORK_QUEUE_TYPE {
  4.3349 -  CriticalWorkQueue,
  4.3350 -  DelayedWorkQueue,
  4.3351 -  HyperCriticalWorkQueue,
  4.3352 -  MaximumWorkQueue
  4.3353 -} WORK_QUEUE_TYPE;
  4.3354 -
  4.3355 -typedef VOID DDKAPI
  4.3356 -(*PWORKER_THREAD_ROUTINE)(
  4.3357 -  /*IN*/ PVOID Parameter);
  4.3358 -
  4.3359 -typedef struct _WORK_QUEUE_ITEM {
  4.3360 -  LIST_ENTRY  List;
  4.3361 -  PWORKER_THREAD_ROUTINE  WorkerRoutine;
  4.3362 -  PVOID  Parameter;
  4.3363 -} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
  4.3364 -
  4.3365 -typedef enum _KBUGCHECK_BUFFER_DUMP_STATE {
  4.3366 -    BufferEmpty,
  4.3367 -    BufferInserted,
  4.3368 -    BufferStarted,
  4.3369 -    BufferFinished,
  4.3370 -    BufferIncomplete
  4.3371 -} KBUGCHECK_BUFFER_DUMP_STATE;
  4.3372 -
  4.3373 -typedef VOID DDKAPI
  4.3374 -(*PKBUGCHECK_CALLBACK_ROUTINE)(
  4.3375 -  /*IN*/ PVOID  Buffer,
  4.3376 -  /*IN*/ ULONG  Length);
  4.3377 -
  4.3378 -typedef struct _KBUGCHECK_CALLBACK_RECORD {
  4.3379 -  LIST_ENTRY  Entry;
  4.3380 -  PKBUGCHECK_CALLBACK_ROUTINE  CallbackRoutine;
  4.3381 -  PVOID  Buffer;
  4.3382 -  ULONG  Length;
  4.3383 -  PUCHAR  Component;
  4.3384 -  ULONG_PTR  Checksum;
  4.3385 -  UCHAR  State;
  4.3386 -} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
  4.3387 -
  4.3388 -/*
  4.3389 - * VOID
  4.3390 - * KeInitializeCallbackRecord(
  4.3391 - * IN PKBUGCHECK_CALLBACK_RECORD  CallbackRecord)
  4.3392 - */
  4.3393 -#define KeInitializeCallbackRecord(CallbackRecord) \
  4.3394 -  CallbackRecord->State = BufferEmpty;
  4.3395 -
  4.3396 -typedef enum _KDPC_IMPORTANCE {
  4.3397 -  LowImportance,
  4.3398 -  MediumImportance,
  4.3399 -  HighImportance
  4.3400 -} KDPC_IMPORTANCE;
  4.3401 -
  4.3402 -typedef enum _MEMORY_CACHING_TYPE_ORIG {
  4.3403 -  MmFrameBufferCached = 2
  4.3404 -} MEMORY_CACHING_TYPE_ORIG;
  4.3405 -
  4.3406 -typedef enum _MEMORY_CACHING_TYPE {
  4.3407 -  MmNonCached = FALSE,
  4.3408 -  MmCached = TRUE,
  4.3409 -  MmWriteCombined = MmFrameBufferCached,
  4.3410 -  MmHardwareCoherentCached,
  4.3411 -  MmNonCachedUnordered,
  4.3412 -  MmUSWCCached,
  4.3413 -  MmMaximumCacheType
  4.3414 -} MEMORY_CACHING_TYPE;
  4.3415 -
  4.3416 -typedef enum _MM_PAGE_PRIORITY {
  4.3417 -  LowPagePriority,
  4.3418 -  NormalPagePriority = 16,
  4.3419 -  HighPagePriority = 32
  4.3420 -} MM_PAGE_PRIORITY;
  4.3421 -
  4.3422 -typedef enum _LOCK_OPERATION {
  4.3423 -  IoReadAccess,
  4.3424 -  IoWriteAccess,
  4.3425 -  IoModifyAccess
  4.3426 -} LOCK_OPERATION;
  4.3427 -
  4.3428 -typedef enum _MM_SYSTEM_SIZE {
  4.3429 -  MmSmallSystem,
  4.3430 -  MmMediumSystem,
  4.3431 -  MmLargeSystem
  4.3432 -} MM_SYSTEM_SIZE;
  4.3433 -
  4.3434 -typedef struct _OBJECT_HANDLE_INFORMATION {
  4.3435 -  ULONG HandleAttributes;
  4.3436 -  ACCESS_MASK GrantedAccess;
  4.3437 -} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
  4.3438 -
  4.3439 -typedef struct _CLIENT_ID {
  4.3440 -  HANDLE  UniqueProcess;
  4.3441 -  HANDLE  UniqueThread;
  4.3442 -} CLIENT_ID, *PCLIENT_ID;
  4.3443 -
  4.3444 -typedef VOID DDKAPI
  4.3445 -(*PKSTART_ROUTINE)(
  4.3446 -  /*IN*/ PVOID  StartContext);
  4.3447 -
  4.3448 -typedef VOID DDKAPI
  4.3449 -(*PCREATE_PROCESS_NOTIFY_ROUTINE)(
  4.3450 -  /*IN*/ HANDLE  ParentId,
  4.3451 -  /*IN*/ HANDLE  ProcessId,
  4.3452 -  /*IN*/ BOOLEAN  Create);
  4.3453 -
  4.3454 -typedef VOID DDKAPI
  4.3455 -(*PCREATE_THREAD_NOTIFY_ROUTINE)(
  4.3456 -  /*IN*/ HANDLE  ProcessId,
  4.3457 -  /*IN*/ HANDLE  ThreadId,
  4.3458 -  /*IN*/ BOOLEAN  Create);
  4.3459 -
  4.3460 -typedef struct _IMAGE_INFO {
  4.3461 -  _ANONYMOUS_UNION union {
  4.3462 -    ULONG  Properties;
  4.3463 -    _ANONYMOUS_STRUCT struct {
  4.3464 -      ULONG  ImageAddressingMode  : 8;
  4.3465 -      ULONG  SystemModeImage      : 1;
  4.3466 -      ULONG  ImageMappedToAllPids : 1;
  4.3467 -      ULONG  Reserved             : 22;
  4.3468 -    } DUMMYSTRUCTNAME;
  4.3469 -  } DUMMYUNIONNAME;
  4.3470 -  PVOID  ImageBase;
  4.3471 -  ULONG  ImageSelector;
  4.3472 -  SIZE_T  ImageSize;
  4.3473 -  ULONG  ImageSectionNumber;
  4.3474 -} IMAGE_INFO, *PIMAGE_INFO;
  4.3475 -
  4.3476 -#define IMAGE_ADDRESSING_MODE_32BIT       3
  4.3477 -
  4.3478 -typedef VOID DDKAPI
  4.3479 -(*PLOAD_IMAGE_NOTIFY_ROUTINE)(
  4.3480 -  /*IN*/ PUNICODE_STRING  FullImageName,
  4.3481 -  /*IN*/ HANDLE  ProcessId,
  4.3482 -  /*IN*/ PIMAGE_INFO  ImageInfo);
  4.3483 -
  4.3484 -typedef enum _PROCESSINFOCLASS {
  4.3485 -  ProcessBasicInformation,
  4.3486 -  ProcessQuotaLimits,
  4.3487 -  ProcessIoCounters,
  4.3488 -  ProcessVmCounters,
  4.3489 -  ProcessTimes,
  4.3490 -  ProcessBasePriority,
  4.3491 -  ProcessRaisePriority,
  4.3492 -  ProcessDebugPort,
  4.3493 -  ProcessExceptionPort,
  4.3494 -  ProcessAccessToken,
  4.3495 -  ProcessLdtInformation,
  4.3496 -  ProcessLdtSize,
  4.3497 -  ProcessDefaultHardErrorMode,
  4.3498 -  ProcessIoPortHandlers,
  4.3499 -  ProcessPooledUsageAndLimits,
  4.3500 -  ProcessWorkingSetWatch,
  4.3501 -  ProcessUserModeIOPL,
  4.3502 -  ProcessEnableAlignmentFaultFixup,
  4.3503 -  ProcessPriorityClass,
  4.3504 -  ProcessWx86Information,
  4.3505 -  ProcessHandleCount,
  4.3506 -  ProcessAffinityMask,
  4.3507 -  ProcessPriorityBoost,
  4.3508 -  ProcessDeviceMap,
  4.3509 -  ProcessSessionInformation,
  4.3510 -  ProcessForegroundInformation,
  4.3511 -  ProcessWow64Information,
  4.3512 -  ProcessImageFileName,
  4.3513 -  ProcessLUIDDeviceMapsEnabled,
  4.3514 -  ProcessBreakOnTermination,
  4.3515 -  ProcessDebugObjectHandle,
  4.3516 -  ProcessDebugFlags,
  4.3517 -  ProcessHandleTracing,
  4.3518 -  MaxProcessInfoClass
  4.3519 -} PROCESSINFOCLASS;
  4.3520 -
  4.3521 -typedef enum _THREADINFOCLASS {
  4.3522 -  ThreadBasicInformation,
  4.3523 -  ThreadTimes,
  4.3524 -  ThreadPriority,
  4.3525 -  ThreadBasePriority,
  4.3526 -  ThreadAffinityMask,
  4.3527 -  ThreadImpersonationToken,
  4.3528 -  ThreadDescriptorTableEntry,
  4.3529 -  ThreadEnableAlignmentFaultFixup,
  4.3530 -  ThreadEventPair_Reusable,
  4.3531 -  ThreadQuerySetWin32StartAddress,
  4.3532 -  ThreadZeroTlsCell,
  4.3533 -  ThreadPerformanceCount,
  4.3534 -  ThreadAmILastThread,
  4.3535 -  ThreadIdealProcessor,
  4.3536 -  ThreadPriorityBoost,
  4.3537 -  ThreadSetTlsArrayAddress,
  4.3538 -  ThreadIsIoPending,
  4.3539 -  ThreadHideFromDebugger,
  4.3540 -  ThreadBreakOnTermination,
  4.3541 -  MaxThreadInfoClass
  4.3542 -} THREADINFOCLASS;
  4.3543 -
  4.3544 -#define ES_SYSTEM_REQUIRED                0x00000001
  4.3545 -#define ES_DISPLAY_REQUIRED               0x00000002
  4.3546 -#define ES_USER_PRESENT                   0x00000004
  4.3547 -#define ES_CONTINUOUS                     0x80000000
  4.3548 -
  4.3549 -typedef ULONG EXECUTION_STATE;
  4.3550 -
  4.3551 -typedef VOID DDKAPI
  4.3552 -(*PREQUEST_POWER_COMPLETE)(
  4.3553 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.3554 -  /*IN*/ UCHAR  MinorFunction,
  4.3555 -  /*IN*/ POWER_STATE  PowerState,
  4.3556 -  /*IN*/ PVOID  Context,
  4.3557 -  /*IN*/ PIO_STATUS_BLOCK  IoStatus);
  4.3558 -
  4.3559 -typedef enum _TRACE_INFORMATION_CLASS {
  4.3560 -  TraceIdClass,
  4.3561 -  TraceHandleClass,
  4.3562 -  TraceEnableFlagsClass,
  4.3563 -  TraceEnableLevelClass,
  4.3564 -  GlobalLoggerHandleClass,
  4.3565 -  EventLoggerHandleClass,
  4.3566 -  AllLoggerHandlesClass,
  4.3567 -  TraceHandleByNameClass
  4.3568 -} TRACE_INFORMATION_CLASS;
  4.3569 -
  4.3570 -typedef NTSTATUS DDKAPI
  4.3571 -(*PEX_CALLBACK_FUNCTION)(
  4.3572 -  /*IN*/ PVOID  CallbackContext,
  4.3573 -  /*IN*/ PVOID  Argument1,
  4.3574 -  /*IN*/ PVOID  Argument2);
  4.3575 -
  4.3576 -
  4.3577 -
  4.3578 -/*
  4.3579 -** Storage structures
  4.3580 -*/
  4.3581 -typedef enum _PARTITION_STYLE {
  4.3582 -  PARTITION_STYLE_MBR,
  4.3583 -  PARTITION_STYLE_GPT
  4.3584 -} PARTITION_STYLE;
  4.3585 -
  4.3586 -typedef struct _CREATE_DISK_MBR {
  4.3587 -  ULONG  Signature;
  4.3588 -} CREATE_DISK_MBR, *PCREATE_DISK_MBR;
  4.3589 -
  4.3590 -typedef struct _CREATE_DISK_GPT {
  4.3591 -  GUID  DiskId;
  4.3592 -  ULONG  MaxPartitionCount;
  4.3593 -} CREATE_DISK_GPT, *PCREATE_DISK_GPT;
  4.3594 -
  4.3595 -typedef struct _CREATE_DISK {
  4.3596 -  PARTITION_STYLE  PartitionStyle;
  4.3597 -  _ANONYMOUS_UNION union {
  4.3598 -    CREATE_DISK_MBR  Mbr;
  4.3599 -    CREATE_DISK_GPT  Gpt;
  4.3600 -  } DUMMYUNIONNAME;
  4.3601 -} CREATE_DISK, *PCREATE_DISK;
  4.3602 -
  4.3603 -typedef struct _DISK_SIGNATURE {
  4.3604 -  ULONG  PartitionStyle;
  4.3605 -  _ANONYMOUS_UNION union {
  4.3606 -    struct {
  4.3607 -      ULONG  Signature;
  4.3608 -      ULONG  CheckSum;
  4.3609 -    } Mbr;
  4.3610 -    struct {
  4.3611 -      GUID  DiskId;
  4.3612 -    } Gpt;
  4.3613 -  } DUMMYUNIONNAME;
  4.3614 -} DISK_SIGNATURE, *PDISK_SIGNATURE;
  4.3615 -
  4.3616 -typedef VOID DDKFASTAPI
  4.3617 -(*PTIME_UPDATE_NOTIFY_ROUTINE)(
  4.3618 -  /*IN*/ HANDLE  ThreadId,
  4.3619 -  /*IN*/ KPROCESSOR_MODE  Mode);
  4.3620 -
  4.3621 -#define DBG_STATUS_CONTROL_C              1
  4.3622 -#define DBG_STATUS_SYSRQ                  2
  4.3623 -#define DBG_STATUS_BUGCHECK_FIRST         3
  4.3624 -#define DBG_STATUS_BUGCHECK_SECOND        4
  4.3625 -#define DBG_STATUS_FATAL                  5
  4.3626 -#define DBG_STATUS_DEBUG_CONTROL          6
  4.3627 -#define DBG_STATUS_WORKER                 7
  4.3628 -
  4.3629 -typedef struct _PHYSICAL_MEMORY_RANGE {
  4.3630 -  PHYSICAL_ADDRESS  BaseAddress;
  4.3631 -  LARGE_INTEGER  NumberOfBytes;
  4.3632 -} PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
  4.3633 -
  4.3634 -typedef ULONG_PTR
  4.3635 -(*PDRIVER_VERIFIER_THUNK_ROUTINE)(
  4.3636 -  /*IN*/ PVOID  Context);
  4.3637 -
  4.3638 -typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
  4.3639 -  PDRIVER_VERIFIER_THUNK_ROUTINE  PristineRoutine;
  4.3640 -  PDRIVER_VERIFIER_THUNK_ROUTINE  NewRoutine;
  4.3641 -} DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS;
  4.3642 -
  4.3643 -#define DRIVER_VERIFIER_SPECIAL_POOLING             0x0001
  4.3644 -#define DRIVER_VERIFIER_FORCE_IRQL_CHECKING         0x0002
  4.3645 -#define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES  0x0004
  4.3646 -#define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS      0x0008
  4.3647 -#define DRIVER_VERIFIER_IO_CHECKING                 0x0010
  4.3648 -
  4.3649 -#define RTL_RANGE_LIST_ADD_IF_CONFLICT    0x00000001
  4.3650 -#define RTL_RANGE_LIST_ADD_SHARED         0x00000002
  4.3651 -
  4.3652 -#define RTL_RANGE_LIST_SHARED_OK          0x00000001
  4.3653 -#define RTL_RANGE_LIST_NULL_CONFLICT_OK   0x00000002
  4.3654 -
  4.3655 -#define RTL_RANGE_LIST_SHARED_OK          0x00000001
  4.3656 -#define RTL_RANGE_LIST_NULL_CONFLICT_OK   0x00000002
  4.3657 -
  4.3658 -#define RTL_RANGE_LIST_MERGE_IF_CONFLICT  RTL_RANGE_LIST_ADD_IF_CONFLICT
  4.3659 -
  4.3660 -typedef struct _RTL_RANGE {
  4.3661 -  ULONGLONG  Start;
  4.3662 -  ULONGLONG  End;
  4.3663 -  PVOID  UserData;
  4.3664 -  PVOID  Owner;
  4.3665 -  UCHAR  Attributes;
  4.3666 -  UCHAR  Flags;
  4.3667 -} RTL_RANGE, *PRTL_RANGE;
  4.3668 -
  4.3669 -#define RTL_RANGE_SHARED                  0x01
  4.3670 -#define RTL_RANGE_CONFLICT                0x02
  4.3671 -
  4.3672 -typedef struct _RTL_RANGE_LIST {
  4.3673 -  LIST_ENTRY  ListHead;
  4.3674 -  ULONG  Flags;
  4.3675 -  ULONG  Count;
  4.3676 -  ULONG  Stamp;
  4.3677 -} RTL_RANGE_LIST, *PRTL_RANGE_LIST;
  4.3678 -
  4.3679 -typedef struct _RANGE_LIST_ITERATOR {
  4.3680 -  PLIST_ENTRY  RangeListHead;
  4.3681 -  PLIST_ENTRY  MergedHead;
  4.3682 -  PVOID  Current;
  4.3683 -  ULONG  Stamp;
  4.3684 -} RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
  4.3685 -
  4.3686 -typedef BOOLEAN
  4.3687 -(*PRTL_CONFLICT_RANGE_CALLBACK)(
  4.3688 -  /*IN*/ PVOID  Context,
  4.3689 -  /*IN*/ PRTL_RANGE  Range);
  4.3690 -
  4.3691 -#define HASH_STRING_ALGORITHM_DEFAULT     0
  4.3692 -#define HASH_STRING_ALGORITHM_X65599      1
  4.3693 -#define HASH_STRING_ALGORITHM_INVALID     0xffffffff
  4.3694 -
  4.3695 -typedef enum _SUITE_TYPE {
  4.3696 -  SmallBusiness,
  4.3697 -  Enterprise,
  4.3698 -  BackOffice,
  4.3699 -  CommunicationServer,
  4.3700 -  TerminalServer,
  4.3701 -  SmallBusinessRestricted,
  4.3702 -  EmbeddedNT,
  4.3703 -  DataCenter,
  4.3704 -  SingleUserTS,
  4.3705 -  Personal,
  4.3706 -  Blade,
  4.3707 -  MaxSuiteType
  4.3708 -} SUITE_TYPE;
  4.3709 -
  4.3710 -typedef VOID DDKAPI
  4.3711 -(*PTIMER_APC_ROUTINE)(
  4.3712 -  /*IN*/ PVOID  TimerContext,
  4.3713 -  /*IN*/ ULONG  TimerLowValue,
  4.3714 -  /*IN*/ LONG  TimerHighValue);
  4.3715 -
  4.3716 -
  4.3717 -
  4.3718 -/*
  4.3719 -** WMI structures
  4.3720 -*/
  4.3721 -
  4.3722 -typedef VOID DDKAPI
  4.3723 -(*WMI_NOTIFICATION_CALLBACK)(
  4.3724 -  PVOID  Wnode,
  4.3725 -  PVOID  Context);
  4.3726 -
  4.3727 -
  4.3728 -/*
  4.3729 -** Architecture specific structures
  4.3730 -*/
  4.3731 -
  4.3732 -#ifdef _X86_
  4.3733 -
  4.3734 -typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
  4.3735 -
  4.3736 -#define PASSIVE_LEVEL                      0
  4.3737 -#define LOW_LEVEL                          0
  4.3738 -#define APC_LEVEL                          1
  4.3739 -#define DISPATCH_LEVEL                     2
  4.3740 -#define SYNCH_LEVEL                       27
  4.3741 -#define PROFILE_LEVEL                     27
  4.3742 -#define CLOCK1_LEVEL                      28
  4.3743 -#define CLOCK2_LEVEL                      28
  4.3744 -#define IPI_LEVEL                         29
  4.3745 -#define POWER_LEVEL                       30
  4.3746 -#define HIGH_LEVEL                        31
  4.3747 -
  4.3748 -typedef struct _KPCR_TIB {
  4.3749 -  PVOID  ExceptionList;         /* 00 */
  4.3750 -  PVOID  StackBase;             /* 04 */
  4.3751 -  PVOID  StackLimit;            /* 08 */
  4.3752 -  PVOID  SubSystemTib;          /* 0C */
  4.3753 -  _ANONYMOUS_UNION union {
  4.3754 -    PVOID  FiberData;           /* 10 */
  4.3755 -    DWORD  Version;             /* 10 */
  4.3756 -  } DUMMYUNIONNAME;
  4.3757 -  PVOID  ArbitraryUserPointer;  /* 14 */
  4.3758 -  struct _NT_TIB *Self;         /* 18 */
  4.3759 -} KPCR_TIB, *PKPCR_TIB;         /* 1C */
  4.3760 -
  4.3761 -#define PCR_MINOR_VERSION 1
  4.3762 -#define PCR_MAJOR_VERSION 1
  4.3763 -
  4.3764 -typedef struct _KPCR {
  4.3765 -  KPCR_TIB  Tib;                /* 00 */
  4.3766 -  struct _KPCR  *Self;          /* 1C */
  4.3767 -  struct _KPRCB  *PCRCB;        /* 20 */
  4.3768 -  KIRQL  Irql;                  /* 24 */
  4.3769 -  ULONG  IRR;                   /* 28 */
  4.3770 -  ULONG  IrrActive;             /* 2C */
  4.3771 -  ULONG  IDR;                   /* 30 */
  4.3772 -  PVOID  KdVersionBlock;        /* 34 */
  4.3773 -  PUSHORT  IDT;                 /* 38 */
  4.3774 -  PUSHORT  GDT;                 /* 3C */
  4.3775 -  struct _KTSS  *TSS;           /* 40 */
  4.3776 -  USHORT  MajorVersion;         /* 44 */
  4.3777 -  USHORT  MinorVersion;         /* 46 */
  4.3778 -  KAFFINITY  SetMember;         /* 48 */
  4.3779 -  ULONG  StallScaleFactor;      /* 4C */
  4.3780 -  UCHAR  SpareUnused;           /* 50 */
  4.3781 -  UCHAR  Number;                /* 51 */
  4.3782 -} KPCR, *PKPCR;                 /* 54 */
  4.3783 -
  4.3784 -typedef struct _KFLOATING_SAVE {
  4.3785 -  ULONG  ControlWord;
  4.3786 -  ULONG  StatusWord;
  4.3787 -  ULONG  ErrorOffset;
  4.3788 -  ULONG  ErrorSelector;
  4.3789 -  ULONG  DataOffset;
  4.3790 -  ULONG  DataSelector;
  4.3791 -  ULONG  Cr0NpxState;
  4.3792 -  ULONG  Spare1;
  4.3793 -} KFLOATING_SAVE, *PKFLOATING_SAVE;
  4.3794 -
  4.3795 -#define PAGE_SIZE                         0x1000
  4.3796 -#define PAGE_SHIFT                        12L
  4.3797 -
  4.3798 -extern NTOSAPI PVOID *MmHighestUserAddress;
  4.3799 -extern NTOSAPI PVOID *MmSystemRangeStart;
  4.3800 -extern NTOSAPI ULONG *MmUserProbeAddress;
  4.3801 -
  4.3802 -#define MM_HIGHEST_USER_ADDRESS           *MmHighestUserAddress
  4.3803 -#define MM_SYSTEM_RANGE_START             *MmSystemRangeStart
  4.3804 -#define MM_USER_PROBE_ADDRESS             *MmUserProbeAddress
  4.3805 -#define MM_LOWEST_USER_ADDRESS            (PVOID)0x10000
  4.3806 -#define MM_LOWEST_SYSTEM_ADDRESS          (PVOID)0xC0C00000
  4.3807 -
  4.3808 -#define KI_USER_SHARED_DATA               0xffdf0000
  4.3809 -#define SharedUserData                    ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
  4.3810 -
  4.3811 -#define EFLAG_SIGN                        0x8000
  4.3812 -#define EFLAG_ZERO                        0x4000
  4.3813 -#define EFLAG_SELECT                      (EFLAG_SIGN | EFLAG_ZERO)
  4.3814 -
  4.3815 -#define RESULT_NEGATIVE                   ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
  4.3816 -#define RESULT_ZERO                       ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
  4.3817 -#define RESULT_POSITIVE                   ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
  4.3818 -
  4.3819 -typedef enum _INTERLOCKED_RESULT {
  4.3820 -  ResultNegative = RESULT_NEGATIVE,
  4.3821 -  ResultZero = RESULT_ZERO,
  4.3822 -  ResultPositive = RESULT_POSITIVE
  4.3823 -} INTERLOCKED_RESULT;
  4.3824 -
  4.3825 -NTOSAPI
  4.3826 -KIRQL
  4.3827 -DDKAPI
  4.3828 -KeGetCurrentIrql(
  4.3829 -  VOID);
  4.3830 -
  4.3831 -/*
  4.3832 - * ULONG
  4.3833 - * KeGetCurrentProcessorNumber(
  4.3834 - *   VOID)
  4.3835 - */
  4.3836 -#define KeGetCurrentProcessorNumber() \
  4.3837 -  ((ULONG)KeGetCurrentKPCR()->ProcessorNumber)
  4.3838 -
  4.3839 -
  4.3840 -#if  __USE_NTOSKRNL__
  4.3841 -/* CAREFUL: These are exported from ntoskrnl.exe as __fastcall functions,
  4.3842 -   but are also exported from kernel32.dll and declared in winbase.h as
  4.3843 -   __stdcall */
  4.3844 -#if !defined(__INTERLOCKED_DECLARED)
  4.3845 -#define __INTERLOCKED_DECLARED
  4.3846 -
  4.3847 -NTOSAPI
  4.3848 -LONG
  4.3849 -DDKFASTAPI
  4.3850 -InterlockedIncrement(
  4.3851 -  /*IN*/ long VOLATILE *Addend);
  4.3852 -
  4.3853 -NTOSAPI
  4.3854 -LONG
  4.3855 -DDKFASTAPI
  4.3856 -InterlockedDecrement(
  4.3857 -  /*IN*/ long VOLATILE *Addend);
  4.3858 -
  4.3859 -NTOSAPI
  4.3860 -LONG
  4.3861 -DDKFASTAPI
  4.3862 -InterlockedCompareExchange(
  4.3863 -  /*IN OUT*/ PLONG  VOLATILE  Destination,
  4.3864 -  /*IN*/ LONG  Exchange,
  4.3865 -  /*IN*/ LONG  Comparand);
  4.3866 -
  4.3867 -NTOSAPI
  4.3868 -LONG
  4.3869 -DDKFASTAPI
  4.3870 -InterlockedExchange(
  4.3871 -  /*IN OUT*/ PLONG  VOLATILE  Target,
  4.3872 -  /*IN*/ LONG Value);
  4.3873 -
  4.3874 -NTOSAPI
  4.3875 -LONG
  4.3876 -DDKFASTAPI
  4.3877 -InterlockedExchangeAdd(
  4.3878 -  /*IN OUT*/ PLONG VOLATILE  Addend,
  4.3879 -  /*IN*/ LONG  Value);
  4.3880 -
  4.3881 -/*
  4.3882 - * PVOID
  4.3883 - * InterlockedExchangePointer(
  4.3884 - * IN OUT PVOID VOLATILE  *Target,
  4.3885 - * IN PVOID  Value)
  4.3886 - */
  4.3887 -#define InterlockedExchangePointer(Target, Value) \
  4.3888 -  ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
  4.3889 -
  4.3890 -/*
  4.3891 - * PVOID
  4.3892 - * InterlockedCompareExchangePointer(
  4.3893 - * IN OUT PVOID  *Destination,
  4.3894 - * IN PVOID  Exchange,
  4.3895 - * IN PVOID  Comparand)
  4.3896 - */
  4.3897 -#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
  4.3898 -  ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
  4.3899 -
  4.3900 -#if  (_WIN32_WINNT >= 0x0501)
  4.3901 -PSLIST_ENTRY
  4.3902 -DDKFASTAPI
  4.3903 -InterlockedPopEntrySList(
  4.3904 -  /*IN*/ PSLIST_HEADER  ListHead);
  4.3905 -
  4.3906 -NTOSAPI
  4.3907 -PSLIST_ENTRY
  4.3908 -DDKFASTAPI
  4.3909 -InterlockedPushEntrySList(
  4.3910 -  /*IN*/ PSLIST_HEADER  ListHead,
  4.3911 -  /*IN*/ PSLIST_ENTRY  ListEntry);
  4.3912 -#endif /* _WIN32_WINNT >= 0x0501 */
  4.3913 -
  4.3914 -#endif /* !__INTERLOCKED_DECLARED */
  4.3915 -#endif /*  __USE_NTOSKRNL__ */
  4.3916 -
  4.3917 -NTOSAPI
  4.3918 -VOID
  4.3919 -DDKFASTAPI
  4.3920 -KefAcquireSpinLockAtDpcLevel(
  4.3921 -  /*IN*/ PKSPIN_LOCK  SpinLock);
  4.3922 -
  4.3923 -NTOSAPI
  4.3924 -VOID
  4.3925 -DDKFASTAPI
  4.3926 -KefReleaseSpinLockFromDpcLevel(
  4.3927 -  /*IN*/ PKSPIN_LOCK  SpinLock);
  4.3928 -
  4.3929 -#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
  4.3930 -#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
  4.3931 -
  4.3932 -#define RtlCopyMemoryNonTemporal RtlCopyMemory
  4.3933 -
  4.3934 -#define KeGetDcacheFillSize() 1L
  4.3935 -
  4.3936 -#endif /* _X86_ */
  4.3937 -
  4.3938 -
  4.3939 -
  4.3940 -/*
  4.3941 -** Utillity functions
  4.3942 -*/
  4.3943 -
  4.3944 -#define ARGUMENT_PRESENT(ArgumentPointer) \
  4.3945 -  ((BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL))
  4.3946 -
  4.3947 -/*
  4.3948 - * ULONG
  4.3949 - * BYTE_OFFSET(
  4.3950 - * IN PVOID  Va)
  4.3951 - */
  4.3952 -#define BYTE_OFFSET(Va) \
  4.3953 -  ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
  4.3954 -
  4.3955 -/*
  4.3956 - * ULONG
  4.3957 - * BYTES_TO_PAGES(
  4.3958 - * IN ULONG  Size)
  4.3959 - */
  4.3960 -#define BYTES_TO_PAGES(Size) \
  4.3961 -  ((ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0))
  4.3962 -
  4.3963 -/*
  4.3964 - * PCHAR
  4.3965 - * CONTAINING_RECORD(
  4.3966 - * IN PCHAR  Address,
  4.3967 - * IN TYPE  Type,
  4.3968 - * IN PCHAR  Field);
  4.3969 - */
  4.3970 -#ifndef CONTAINING_RECORD
  4.3971 -#define CONTAINING_RECORD(Address, Type, Field) \
  4.3972 -  ((Type *) (((ULONG_PTR) Address) - FIELD_OFFSET(Type, Field)))
  4.3973 -#endif
  4.3974 -
  4.3975 -/* LONG
  4.3976 - * FIELD_OFFSET(
  4.3977 - * IN TYPE  Type,
  4.3978 - * IN PCHAR  Field);
  4.3979 - */
  4.3980 -#ifndef FIELD_OFFSET
  4.3981 -#define FIELD_OFFSET(Type, Field) \
  4.3982 -  ((LONG) (&(((Type *) 0)->Field)))
  4.3983 -#endif
  4.3984 -
  4.3985 -/*
  4.3986 - * PVOID
  4.3987 - * PAGE_ALIGN(
  4.3988 - * IN PVOID  Va)
  4.3989 - */
  4.3990 -#define PAGE_ALIGN(Va) \
  4.3991 -  ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
  4.3992 -
  4.3993 -/*
  4.3994 - * ULONG_PTR
  4.3995 - * ROUND_TO_PAGES(
  4.3996 - * IN ULONG_PTR  Size)
  4.3997 - */
  4.3998 -#define ROUND_TO_PAGES(Size) \
  4.3999 -  ((ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))
  4.4000 -
  4.4001 -NTOSAPI
  4.4002 -VOID
  4.4003 -DDKAPI
  4.4004 -RtlAssert(
  4.4005 -  /*IN*/ PVOID  FailedAssertion,
  4.4006 -  /*IN*/ PVOID  FileName,
  4.4007 -  /*IN*/ ULONG  LineNumber,
  4.4008 -  /*IN*/ PCHAR  Message);
  4.4009 -
  4.4010 -#ifdef DBG
  4.4011 -
  4.4012 -#define ASSERT(exp) \
  4.4013 -  ((!(exp)) ? \
  4.4014 -    (RtlAssert( #exp, __FILE__, __LINE__, NULL ), FALSE) : TRUE)
  4.4015 -
  4.4016 -#define ASSERTMSG(msg, exp) \
  4.4017 -  ((!(exp)) ? \
  4.4018 -    (RtlAssert( #exp, __FILE__, __LINE__, msg ), FALSE) : TRUE)
  4.4019 -
  4.4020 -#define RTL_SOFT_ASSERT(exp) \
  4.4021 -  ((!(_exp)) ? \
  4.4022 -    (DbgPrint("%s(%d): Soft assertion failed\n   Expression: %s\n", __FILE__, __LINE__, #exp), FALSE) : TRUE)
  4.4023 -
  4.4024 -#define RTL_SOFT_ASSERTMSG(msg, exp) \
  4.4025 -  ((!(exp)) ? \
  4.4026 -    (DbgPrint("%s(%d): Soft assertion failed\n   Expression: %s\n   Message: %s\n", __FILE__, __LINE__, #exp, (msg)), FALSE) : TRUE)
  4.4027 -
  4.4028 -#define RTL_VERIFY(exp) ASSERT(exp)
  4.4029 -#define RTL_VERIFYMSG(msg, exp) ASSERT(msg, exp)
  4.4030 -
  4.4031 -#define RTL_SOFT_VERIFY(exp) RTL_SOFT_ASSERT(exp)
  4.4032 -#define RTL_SOFT_VERIFYMSG(msg, exp) RTL_SOFT_ASSERTMSG(msg, exp)
  4.4033 -
  4.4034 -#else /* !DBG */
  4.4035 -
  4.4036 -#define ASSERT(exp) ((VOID) 0)
  4.4037 -#define ASSERTMSG(msg, exp) ((VOID) 0)
  4.4038 -
  4.4039 -#define RTL_SOFT_ASSERT(exp) ((VOID) 0)
  4.4040 -#define RTL_SOFT_ASSERTMSG(msg, exp) ((VOID) 0)
  4.4041 -
  4.4042 -#define RTL_VERIFY(exp) ((exp) ? TRUE : FALSE)
  4.4043 -#define RTL_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
  4.4044 -
  4.4045 -#define RTL_SOFT_VERIFY(exp) ((exp) ? TRUE : FALSE)
  4.4046 -#define RTL_SOFT_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
  4.4047 -
  4.4048 -#endif /* DBG */
  4.4049 -
  4.4050 -
  4.4051 -/*
  4.4052 -** Driver support routines
  4.4053 -*/
  4.4054 -
  4.4055 -/** Runtime library routines **/
  4.4056 -
  4.4057 -/*
  4.4058 - * VOID
  4.4059 - * InitializeListHead(
  4.4060 - * IN PLIST_ENTRY  ListHead)
  4.4061 - */
  4.4062 -#define InitializeListHead(_ListHead) \
  4.4063 -{ \
  4.4064 -  (_ListHead)->Flink = (_ListHead); \
  4.4065 -  (_ListHead)->Blink = (_ListHead); \
  4.4066 -}
  4.4067 -
  4.4068 -/*
  4.4069 - * VOID
  4.4070 - * InsertHeadList(
  4.4071 - * IN PLIST_ENTRY  ListHead,
  4.4072 - * IN PLIST_ENTRY  Entry)
  4.4073 - */
  4.4074 -#define InsertHeadList(_ListHead, \
  4.4075 -                       _Entry) \
  4.4076 -{ \
  4.4077 -  PLIST_ENTRY _OldFlink; \
  4.4078 -  _OldFlink = (_ListHead)->Flink; \
  4.4079 -  (_Entry)->Flink = _OldFlink; \
  4.4080 -  (_Entry)->Blink = (_ListHead); \
  4.4081 -  _OldFlink->Blink = (_Entry); \
  4.4082 -  (_ListHead)->Flink = (_Entry); \
  4.4083 -}
  4.4084 -
  4.4085 -/*
  4.4086 - * VOID
  4.4087 - * InsertTailList(
  4.4088 - * IN PLIST_ENTRY  ListHead,
  4.4089 - * IN PLIST_ENTRY  Entry)
  4.4090 - */
  4.4091 -#define InsertTailList(_ListHead, \
  4.4092 -                       _Entry) \
  4.4093 -{ \
  4.4094 -	PLIST_ENTRY _OldBlink; \
  4.4095 -	_OldBlink = (_ListHead)->Blink; \
  4.4096 -	(_Entry)->Flink = (_ListHead); \
  4.4097 -	(_Entry)->Blink = _OldBlink; \
  4.4098 -	_OldBlink->Flink = (_Entry); \
  4.4099 -	(_ListHead)->Blink = (_Entry); \
  4.4100 -}
  4.4101 -
  4.4102 -/*
  4.4103 - * BOOLEAN
  4.4104 - * IsListEmpty(
  4.4105 - * IN PLIST_ENTRY  ListHead)
  4.4106 - */
  4.4107 -#define IsListEmpty(_ListHead) \
  4.4108 -  ((_ListHead)->Flink == (_ListHead))
  4.4109 -
  4.4110 -static __inline PSINGLE_LIST_ENTRY 
  4.4111 -PopEntryList(
  4.4112 -  /*IN*/ PSINGLE_LIST_ENTRY  ListHead)
  4.4113 -{
  4.4114 -	PSINGLE_LIST_ENTRY Entry;
  4.4115 -
  4.4116 -	Entry = ListHead->Next;
  4.4117 -	if (Entry != NULL)
  4.4118 -	{
  4.4119 -		ListHead->Next = Entry->Next;
  4.4120 -	}
  4.4121 -  return Entry;
  4.4122 -}
  4.4123 -
  4.4124 -/*
  4.4125 - * VOID
  4.4126 - * PushEntryList(
  4.4127 - * IN PSINGLE_LIST_ENTRY  ListHead,
  4.4128 - * IN PSINGLE_LIST_ENTRY  Entry)
  4.4129 - */
  4.4130 -#define PushEntryList(_ListHead, \
  4.4131 -                      _Entry) \
  4.4132 -{ \
  4.4133 -	(_Entry)->Next = (_ListHead)->Next; \
  4.4134 -	(_ListHead)->Next = (_Entry); \
  4.4135 -}
  4.4136 -
  4.4137 -/*
  4.4138 - * VOID
  4.4139 - * RemoveEntryList(
  4.4140 - * IN PLIST_ENTRY  Entry)
  4.4141 - */
  4.4142 -#define RemoveEntryList(_Entry) \
  4.4143 -{ \
  4.4144 -	PLIST_ENTRY _OldFlink; \
  4.4145 -	PLIST_ENTRY _OldBlink; \
  4.4146 -	_OldFlink = (_Entry)->Flink; \
  4.4147 -	_OldBlink = (_Entry)->Blink; \
  4.4148 -	_OldFlink->Blink = _OldBlink; \
  4.4149 -	_OldBlink->Flink = _OldFlink; \
  4.4150 -  (_Entry)->Flink = NULL; \
  4.4151 -  (_Entry)->Blink = NULL; \
  4.4152 -}
  4.4153 -
  4.4154 -static __inline PLIST_ENTRY 
  4.4155 -RemoveHeadList(
  4.4156 -  /*IN*/ PLIST_ENTRY  ListHead)
  4.4157 -{
  4.4158 -	PLIST_ENTRY OldFlink;
  4.4159 -	PLIST_ENTRY OldBlink;
  4.4160 -	PLIST_ENTRY Entry;
  4.4161 -
  4.4162 -	Entry = ListHead->Flink;
  4.4163 -	OldFlink = ListHead->Flink->Flink;
  4.4164 -	OldBlink = ListHead->Flink->Blink;
  4.4165 -	OldFlink->Blink = OldBlink;
  4.4166 -	OldBlink->Flink = OldFlink;
  4.4167 -
  4.4168 -  if (Entry != ListHead)
  4.4169 -  {
  4.4170 -    Entry->Flink = NULL;
  4.4171 -    Entry->Blink = NULL;
  4.4172 -  }
  4.4173 -
  4.4174 -	return Entry;
  4.4175 -}
  4.4176 -
  4.4177 -static __inline PLIST_ENTRY
  4.4178 -RemoveTailList(
  4.4179 -  /*IN*/ PLIST_ENTRY  ListHead)
  4.4180 -{
  4.4181 -	PLIST_ENTRY OldFlink;
  4.4182 -	PLIST_ENTRY OldBlink;
  4.4183 -	PLIST_ENTRY Entry;
  4.4184 -
  4.4185 -	Entry = ListHead->Blink;
  4.4186 -	OldFlink = ListHead->Blink->Flink;
  4.4187 -	OldBlink = ListHead->Blink->Blink;
  4.4188 -	OldFlink->Blink = OldBlink;
  4.4189 -	OldBlink->Flink = OldFlink;
  4.4190 -
  4.4191 -  if (Entry != ListHead)
  4.4192 -  {
  4.4193 -    Entry->Flink = NULL;
  4.4194 -    Entry->Blink = NULL;
  4.4195 -  }
  4.4196 -   
  4.4197 -  return Entry;
  4.4198 -}
  4.4199 -
  4.4200 -/*
  4.4201 - * USHORT
  4.4202 - * QueryDepthSList(
  4.4203 - * IN PSLIST_HEADER  SListHead)
  4.4204 - */
  4.4205 -#define QueryDepthSList(_SListHead) \
  4.4206 -  ((USHORT) ((_SListHead)->Alignment & 0xffff))
  4.4207 -
  4.4208 -#define InterlockedFlushSList(ListHead) ExInterlockedFlushSList(ListHead)
  4.4209 -
  4.4210 -NTOSAPI
  4.4211 -ULONG
  4.4212 -DDKAPI
  4.4213 -RtlAnsiStringToUnicodeSize(
  4.4214 -  /*IN*/ PANSI_STRING  AnsiString);
  4.4215 -
  4.4216 -NTOSAPI
  4.4217 -NTSTATUS
  4.4218 -DDKAPI
  4.4219 -RtlAddRange(
  4.4220 -  /*IN OUT*/ PRTL_RANGE_LIST  RangeList,
  4.4221 -  /*IN*/ ULONGLONG  Start,
  4.4222 -  /*IN*/ ULONGLONG  End,
  4.4223 -  /*IN*/ UCHAR  Attributes,
  4.4224 -  /*IN*/ ULONG  Flags,
  4.4225 -  /*IN*/ PVOID  UserData  /*OPTIONAL*/,
  4.4226 -  /*IN*/ PVOID  Owner  /*OPTIONAL*/);
  4.4227 -
  4.4228 -NTOSAPI
  4.4229 -NTSTATUS
  4.4230 -DDKAPI
  4.4231 -RtlAnsiStringToUnicodeString(
  4.4232 -  /*IN OUT*/ PUNICODE_STRING  DestinationString,
  4.4233 -  /*IN*/ PANSI_STRING  SourceString,
  4.4234 -  /*IN*/ BOOLEAN  AllocateDestinationString);
  4.4235 -
  4.4236 -NTOSAPI
  4.4237 -NTSTATUS
  4.4238 -DDKAPI
  4.4239 -RtlAppendUnicodeStringToString(
  4.4240 -  /*IN OUT*/ PUNICODE_STRING  Destination,
  4.4241 -  /*IN*/ PUNICODE_STRING  Source);
  4.4242 -
  4.4243 -NTOSAPI
  4.4244 -NTSTATUS
  4.4245 -DDKAPI
  4.4246 -RtlAppendUnicodeToString(
  4.4247 -  /*IN OUT*/ PUNICODE_STRING  Destination,
  4.4248 -  /*IN*/ PCWSTR  Source);
  4.4249 -
  4.4250 -NTOSAPI
  4.4251 -BOOLEAN
  4.4252 -DDKAPI
  4.4253 -RtlAreBitsClear(
  4.4254 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4255 -  /*IN*/ ULONG  StartingIndex,
  4.4256 -  /*IN*/ ULONG  Length); 
  4.4257 -
  4.4258 -NTOSAPI
  4.4259 -BOOLEAN
  4.4260 -DDKAPI
  4.4261 -RtlAreBitsSet(
  4.4262 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4263 -  /*IN*/ ULONG  StartingIndex,
  4.4264 -  /*IN*/ ULONG  Length); 
  4.4265 -
  4.4266 -NTOSAPI
  4.4267 -NTSTATUS
  4.4268 -DDKAPI
  4.4269 -RtlCharToInteger(
  4.4270 -  /*IN*/ PCSZ  String,
  4.4271 -  /*IN*/ ULONG  Base  /*OPTIONAL*/,
  4.4272 -  /*IN OUT*/ PULONG  Value);
  4.4273 -
  4.4274 -NTOSAPI
  4.4275 -ULONG
  4.4276 -DDKAPI
  4.4277 -RtlCheckBit(
  4.4278 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4279 -  /*IN*/ ULONG  BitPosition); 
  4.4280 -
  4.4281 -NTOSAPI
  4.4282 -NTSTATUS
  4.4283 -DDKAPI
  4.4284 -RtlCheckRegistryKey(
  4.4285 -  /*IN*/ ULONG  RelativeTo,
  4.4286 -  /*IN*/ PWSTR  Path);
  4.4287 -
  4.4288 -NTOSAPI
  4.4289 -VOID
  4.4290 -DDKAPI
  4.4291 -RtlClearAllBits(
  4.4292 -  /*IN*/ PRTL_BITMAP  BitMapHeader); 
  4.4293 -
  4.4294 -NTOSAPI
  4.4295 -VOID
  4.4296 -DDKAPI
  4.4297 -RtlClearBit(
  4.4298 -  PRTL_BITMAP  BitMapHeader,
  4.4299 -  ULONG  BitNumber);
  4.4300 -
  4.4301 -NTOSAPI
  4.4302 -VOID
  4.4303 -DDKAPI
  4.4304 -RtlClearBits(
  4.4305 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4306 -  /*IN*/ ULONG  StartingIndex,
  4.4307 -  /*IN*/ ULONG  NumberToClear); 
  4.4308 -
  4.4309 -NTOSAPI
  4.4310 -SIZE_T
  4.4311 -DDKAPI
  4.4312 -RtlCompareMemory(
  4.4313 -  /*IN*/ CONST VOID  *Source1,
  4.4314 -  /*IN*/ CONST VOID  *Source2,
  4.4315 -  /*IN*/ SIZE_T  Length);
  4.4316 -
  4.4317 -NTOSAPI
  4.4318 -LONG
  4.4319 -DDKAPI
  4.4320 -RtlCompareString(
  4.4321 -  /*IN*/ PSTRING  String1,
  4.4322 -  /*IN*/ PSTRING  String2,
  4.4323 -  BOOLEAN  CaseInSensitive);
  4.4324 -
  4.4325 -NTOSAPI
  4.4326 -LONG
  4.4327 -DDKAPI
  4.4328 -RtlCompareUnicodeString(
  4.4329 -  /*IN*/ PUNICODE_STRING  String1,
  4.4330 -  /*IN*/ PUNICODE_STRING  String2,
  4.4331 -  /*IN*/ BOOLEAN  CaseInSensitive);
  4.4332 -
  4.4333 -NTOSAPI
  4.4334 -LARGE_INTEGER
  4.4335 -DDKAPI
  4.4336 -RtlConvertLongToLargeInteger(
  4.4337 -  /*IN*/ LONG  SignedInteger);
  4.4338 -
  4.4339 -NTOSAPI
  4.4340 -LUID
  4.4341 -DDKAPI
  4.4342 -RtlConvertLongToLuid(
  4.4343 -  /*IN*/ LONG  Long);
  4.4344 -
  4.4345 -NTOSAPI
  4.4346 -LARGE_INTEGER
  4.4347 -DDKAPI
  4.4348 -RtlConvertUlongToLargeInteger(
  4.4349 -  /*IN*/ ULONG  UnsignedInteger);
  4.4350 -
  4.4351 -NTOSAPI
  4.4352 -LUID
  4.4353 -DDKAPI
  4.4354 -RtlConvertUlongToLuid(
  4.4355 -  ULONG  Ulong);
  4.4356 -
  4.4357 -/*
  4.4358 - * VOID
  4.4359 - * RtlCopyMemory(
  4.4360 - * IN VOID UNALIGNED  *Destination,
  4.4361 - * IN CONST VOID UNALIGNED  *Source,
  4.4362 - * IN SIZE_T  Length)
  4.4363 - */
  4.4364 -#ifndef RtlCopyMemory
  4.4365 -#define RtlCopyMemory(Destination, Source, Length) \
  4.4366 -  memcpy(Destination, Source, Length);
  4.4367 -#endif
  4.4368 -
  4.4369 -#ifndef RtlCopyBytes
  4.4370 -#define RtlCopyBytes RtlCopyMemory
  4.4371 -#endif
  4.4372 -
  4.4373 -NTOSAPI
  4.4374 -VOID
  4.4375 -DDKAPI
  4.4376 -RtlCopyMemory32(
  4.4377 -  /*IN*/ VOID UNALIGNED  *Destination,
  4.4378 -  /*IN*/ CONST VOID UNALIGNED  *Source,
  4.4379 -  /*IN*/ ULONG  Length);
  4.4380 -
  4.4381 -NTOSAPI
  4.4382 -NTSTATUS
  4.4383 -DDKAPI
  4.4384 -RtlCopyRangeList(
  4.4385 -  /*OUT*/ PRTL_RANGE_LIST  CopyRangeList,
  4.4386 -  /*IN*/ PRTL_RANGE_LIST  RangeList);
  4.4387 -
  4.4388 -NTOSAPI
  4.4389 -VOID
  4.4390 -DDKAPI
  4.4391 -RtlCopyString(
  4.4392 -  /*IN OUT*/ PSTRING  DestinationString,
  4.4393 -  /*IN*/ PSTRING  SourceString  /*OPTIONAL*/);
  4.4394 -
  4.4395 -NTOSAPI
  4.4396 -VOID
  4.4397 -DDKAPI
  4.4398 -RtlCopyUnicodeString(
  4.4399 -  /*IN OUT*/ PUNICODE_STRING  DestinationString,
  4.4400 -  /*IN*/ PUNICODE_STRING  SourceString);
  4.4401 -
  4.4402 -NTOSAPI
  4.4403 -NTSTATUS
  4.4404 -DDKAPI
  4.4405 -RtlCreateRegistryKey(
  4.4406 -  /*IN*/ ULONG  RelativeTo,
  4.4407 -  /*IN*/ PWSTR  Path);
  4.4408 -
  4.4409 -NTOSAPI
  4.4410 -NTSTATUS
  4.4411 -DDKAPI
  4.4412 -RtlCreateSecurityDescriptor(
  4.4413 -  /*IN OUT*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  4.4414 -  /*IN*/ ULONG  Revision);
  4.4415 -
  4.4416 -NTOSAPI
  4.4417 -NTSTATUS
  4.4418 -DDKAPI
  4.4419 -RtlDeleteOwnersRanges(
  4.4420 -  /*IN OUT*/ PRTL_RANGE_LIST  RangeList,
  4.4421 -  /*IN*/ PVOID  Owner);
  4.4422 -
  4.4423 -NTOSAPI
  4.4424 -NTSTATUS
  4.4425 -DDKAPI
  4.4426 -RtlDeleteRange(
  4.4427 -  /*IN OUT*/ PRTL_RANGE_LIST  RangeList,
  4.4428 -  /*IN*/ ULONGLONG  Start,
  4.4429 -  /*IN*/ ULONGLONG  End,
  4.4430 -  /*IN*/ PVOID  Owner);
  4.4431 -
  4.4432 -NTOSAPI
  4.4433 -NTSTATUS
  4.4434 -DDKAPI
  4.4435 -RtlDeleteRegistryValue(
  4.4436 -  /*IN*/ ULONG  RelativeTo,
  4.4437 -  /*IN*/ PCWSTR  Path,
  4.4438 -  /*IN*/ PCWSTR  ValueName);
  4.4439 -
  4.4440 -NTOSAPI
  4.4441 -BOOL
  4.4442 -DDKAPI
  4.4443 -RtlDosPathNameToNtPathName_U(
  4.4444 -  /*IN*/ PCWSTR  DosPathName,
  4.4445 -  /*OUT*/ PUNICODE_STRING  NtPathName,
  4.4446 -  /*OUT*/ PCWSTR  *NtFileNamePart,
  4.4447 -  /*OUT*/ VOID  *DirectoryInfo);
  4.4448 -
  4.4449 -/*
  4.4450 - * BOOLEAN
  4.4451 - * RtlEqualLuid( 
  4.4452 - * IN LUID  Luid1,
  4.4453 - * IN LUID  Luid2)
  4.4454 - */
  4.4455 -#define RtlEqualLuid(_Luid1, \
  4.4456 -                     _Luid2) \
  4.4457 -  ((Luid1.LowPart == Luid2.LowPart) && (Luid1.HighPart == Luid2.HighPart))
  4.4458 -
  4.4459 -/*
  4.4460 - * ULONG
  4.4461 - * RtlEqualMemory(
  4.4462 - * IN VOID UNALIGNED  *Destination,
  4.4463 - * IN CONST VOID UNALIGNED  *Source,
  4.4464 - * IN SIZE_T  Length)
  4.4465 - */
  4.4466 -#define RtlEqualMemory(Destination, Source, Length) (!memcmp(Destination, Source, Length))
  4.4467 -
  4.4468 -NTOSAPI
  4.4469 -BOOLEAN
  4.4470 -DDKAPI
  4.4471 -RtlEqualString(
  4.4472 -  /*IN*/ PSTRING  String1,
  4.4473 -  /*IN*/ PSTRING  String2,
  4.4474 -  /*IN*/ BOOLEAN  CaseInSensitive);
  4.4475 -
  4.4476 -NTOSAPI
  4.4477 -BOOLEAN
  4.4478 -DDKAPI
  4.4479 -RtlEqualUnicodeString(
  4.4480 -  /*IN*/ CONST UNICODE_STRING  *String1,
  4.4481 -  /*IN*/ CONST UNICODE_STRING  *String2,
  4.4482 -  /*IN*/ BOOLEAN  CaseInSensitive);
  4.4483 -
  4.4484 -/*
  4.4485 - * VOID
  4.4486 - * RtlFillMemory(
  4.4487 - * IN VOID UNALIGNED  *Destination,
  4.4488 - * IN SIZE_T  Length,
  4.4489 - * IN UCHAR  Fill)
  4.4490 - */
  4.4491 -#ifndef RtlFillMemory
  4.4492 -#define RtlFillMemory(Destination, Length, Fill) \
  4.4493 -  memset(Destination, Fill, Length)
  4.4494 -#endif
  4.4495 -
  4.4496 -#ifndef RtlFillBytes
  4.4497 -#define RtlFillBytes RtlFillMemory
  4.4498 -#endif
  4.4499 -
  4.4500 -NTOSAPI
  4.4501 -ULONG
  4.4502 -DDKAPI
  4.4503 -RtlFindClearBits(
  4.4504 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4505 -  /*IN*/ ULONG  NumberToFind,
  4.4506 -  /*IN*/ ULONG  HintIndex); 
  4.4507 -
  4.4508 -NTOSAPI
  4.4509 -ULONG
  4.4510 -DDKAPI
  4.4511 -RtlFindClearBitsAndSet(
  4.4512 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4513 -  /*IN*/ ULONG  NumberToFind,
  4.4514 -  /*IN*/ ULONG  HintIndex); 
  4.4515 -
  4.4516 -NTOSAPI
  4.4517 -ULONG
  4.4518 -DDKAPI
  4.4519 -RtlFindClearRuns( 
  4.4520 -  /*IN*/ PRTL_BITMAP  BitMapHeader, 
  4.4521 -  /*OUT*/ PRTL_BITMAP_RUN  RunArray, 
  4.4522 -  /*IN*/ ULONG  SizeOfRunArray, 
  4.4523 -  /*IN*/ BOOLEAN  LocateLongestRuns);
  4.4524 -
  4.4525 -NTOSAPI
  4.4526 -ULONG
  4.4527 -DDKAPI
  4.4528 -RtlFindFirstRunClear(
  4.4529 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4530 -  /*OUT*/ PULONG  StartingIndex);
  4.4531 -
  4.4532 -NTOSAPI
  4.4533 -ULONG
  4.4534 -DDKAPI
  4.4535 -RtlFindLastBackwardRunClear(
  4.4536 -  /*IN*/ PRTL_BITMAP  BitMapHeader, 
  4.4537 -  /*IN*/ ULONG  FromIndex, 
  4.4538 -  /*OUT*/ PULONG  StartingRunIndex); 
  4.4539 -
  4.4540 -NTOSAPI
  4.4541 -CCHAR
  4.4542 -DDKAPI
  4.4543 -RtlFindLeastSignificantBit(
  4.4544 -  /*IN*/ ULONGLONG  Set);
  4.4545 -
  4.4546 -NTOSAPI
  4.4547 -ULONG
  4.4548 -DDKAPI
  4.4549 -RtlFindLongestRunClear(
  4.4550 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4551 -  /*OUT*/ PULONG  StartingIndex); 
  4.4552 -
  4.4553 -NTOSAPI
  4.4554 -CCHAR
  4.4555 -DDKAPI
  4.4556 -RtlFindMostSignificantBit(
  4.4557 -  /*IN*/ ULONGLONG  Set);
  4.4558 -
  4.4559 -NTOSAPI
  4.4560 -ULONG
  4.4561 -DDKAPI
  4.4562 -RtlFindNextForwardRunClear(
  4.4563 -  /*IN*/ PRTL_BITMAP  BitMapHeader, 
  4.4564 -  /*IN*/ ULONG  FromIndex, 
  4.4565 -  /*OUT*/ PULONG  StartingRunIndex);
  4.4566 -
  4.4567 -NTOSAPI
  4.4568 -NTSTATUS
  4.4569 -DDKAPI
  4.4570 -RtlFindRange(
  4.4571 -  /*IN*/ PRTL_RANGE_LIST  RangeList,
  4.4572 -  /*IN*/ ULONGLONG  Minimum,
  4.4573 -  /*IN*/ ULONGLONG  Maximum,
  4.4574 -  /*IN*/ ULONG  Length,
  4.4575 -  /*IN*/ ULONG  Alignment,
  4.4576 -  /*IN*/ ULONG  Flags,
  4.4577 -  /*IN*/ UCHAR  AttributeAvailableMask,
  4.4578 -  /*IN*/ PVOID  Context  /*OPTIONAL*/,
  4.4579 -  /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK  Callback  /*OPTIONAL*/,
  4.4580 -  /*OUT*/ PULONGLONG  Start);
  4.4581 -
  4.4582 -NTOSAPI
  4.4583 -ULONG
  4.4584 -DDKAPI
  4.4585 -RtlFindSetBits(
  4.4586 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4587 -  /*IN*/ ULONG  NumberToFind,
  4.4588 -  /*IN*/ ULONG  HintIndex); 
  4.4589 -
  4.4590 -NTOSAPI
  4.4591 -ULONG
  4.4592 -DDKAPI
  4.4593 -RtlFindSetBitsAndClear(
  4.4594 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4595 -  /*IN*/ ULONG  NumberToFind,
  4.4596 -  /*IN*/ ULONG  HintIndex); 
  4.4597 -
  4.4598 -NTOSAPI
  4.4599 -VOID
  4.4600 -DDKAPI
  4.4601 -RtlFreeAnsiString(
  4.4602 -  /*IN*/ PANSI_STRING  AnsiString);
  4.4603 -
  4.4604 -NTOSAPI
  4.4605 -VOID
  4.4606 -DDKAPI
  4.4607 -RtlFreeRangeList(
  4.4608 -  /*IN*/ PRTL_RANGE_LIST  RangeList);
  4.4609 -
  4.4610 -NTOSAPI
  4.4611 -VOID
  4.4612 -DDKAPI
  4.4613 -RtlFreeUnicodeString(
  4.4614 -  /*IN*/ PUNICODE_STRING  UnicodeString);
  4.4615 -
  4.4616 -NTOSAPI
  4.4617 -VOID
  4.4618 -DDKAPI
  4.4619 -RtlGetCallersAddress(
  4.4620 -  /*OUT*/ PVOID  *CallersAddress,
  4.4621 -  /*OUT*/ PVOID  *CallersCaller);
  4.4622 -
  4.4623 -NTOSAPI
  4.4624 -NTSTATUS
  4.4625 -DDKAPI
  4.4626 -RtlGetVersion(
  4.4627 -  /*IN OUT*/ PRTL_OSVERSIONINFOW  lpVersionInformation);
  4.4628 -
  4.4629 -NTOSAPI
  4.4630 -NTSTATUS
  4.4631 -DDKAPI
  4.4632 -RtlGetFirstRange(
  4.4633 -  /*IN*/ PRTL_RANGE_LIST  RangeList,
  4.4634 -  /*OUT*/ PRTL_RANGE_LIST_ITERATOR  Iterator,
  4.4635 -  /*OUT*/ PRTL_RANGE  *Range);
  4.4636 -
  4.4637 -NTOSAPI
  4.4638 -NTSTATUS
  4.4639 -DDKAPI
  4.4640 -RtlGetNextRange(
  4.4641 -  /*IN OUT*/  PRTL_RANGE_LIST_ITERATOR  Iterator,
  4.4642 -  /*OUT*/ PRTL_RANGE  *Range,
  4.4643 -  /*IN*/ BOOLEAN  MoveForwards);
  4.4644 -
  4.4645 -#define FOR_ALL_RANGES(RangeList, Iterator, Current)          \
  4.4646 -  for (RtlGetFirstRange((RangeList), (Iterator), &(Current)); \
  4.4647 -    (Current) != NULL;                                        \
  4.4648 -    RtlGetNextRange((Iterator), &(Current), TRUE))
  4.4649 -
  4.4650 -#define FOR_ALL_RANGES_BACKWARDS(RangeList, Iterator, Current) \
  4.4651 -  for (RtlGetLastRange((RangeList), (Iterator), &(Current));   \
  4.4652 -    (Current) != NULL;                                         \
  4.4653 -    RtlGetNextRange((Iterator), &(Current), FALSE))
  4.4654 -
  4.4655 -NTOSAPI
  4.4656 -NTSTATUS
  4.4657 -DDKAPI
  4.4658 -RtlGUIDFromString( 
  4.4659 -  /*IN*/ PUNICODE_STRING  GuidString, 
  4.4660 -  /*OUT*/ GUID  *Guid);
  4.4661 -
  4.4662 -NTOSAPI
  4.4663 -NTSTATUS
  4.4664 -DDKAPI
  4.4665 -RtlHashUnicodeString(
  4.4666 -  /*IN*/ CONST UNICODE_STRING  *String,
  4.4667 -  /*IN*/ BOOLEAN  CaseInSensitive,
  4.4668 -  /*IN*/ ULONG  HashAlgorithm,
  4.4669 -  /*OUT*/ PULONG  HashValue);
  4.4670 -
  4.4671 -NTOSAPI
  4.4672 -VOID
  4.4673 -DDKAPI
  4.4674 -RtlInitAnsiString(
  4.4675 -  /*IN OUT*/ PANSI_STRING  DestinationString,
  4.4676 -  /*IN*/ PCSZ  SourceString);
  4.4677 -
  4.4678 -NTOSAPI
  4.4679 -VOID
  4.4680 -DDKAPI
  4.4681 -RtlInitializeBitMap(
  4.4682 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4683 -  /*IN*/ PULONG  BitMapBuffer,
  4.4684 -  /*IN*/ ULONG  SizeOfBitMap); 
  4.4685 -
  4.4686 -NTOSAPI
  4.4687 -VOID
  4.4688 -DDKAPI
  4.4689 -RtlInitializeRangeList(
  4.4690 -  /*IN OUT*/ PRTL_RANGE_LIST  RangeList);
  4.4691 -
  4.4692 -NTOSAPI
  4.4693 -VOID
  4.4694 -DDKAPI
  4.4695 -RtlInitString(
  4.4696 -  /*IN OUT*/ PSTRING  DestinationString,
  4.4697 -  /*IN*/ PCSZ  SourceString);
  4.4698 -
  4.4699 -NTOSAPI
  4.4700 -VOID
  4.4701 -DDKAPI
  4.4702 -RtlInitUnicodeString(
  4.4703 -  /*IN OUT*/ PUNICODE_STRING  DestinationString,
  4.4704 -  /*IN*/ PCWSTR  SourceString);
  4.4705 -
  4.4706 -NTOSAPI
  4.4707 -NTSTATUS
  4.4708 -DDKAPI
  4.4709 -RtlInt64ToUnicodeString(
  4.4710 -  /*IN*/ ULONGLONG  Value,
  4.4711 -  /*IN*/ ULONG  Base /*OPTIONAL*/,
  4.4712 -  /*IN OUT*/ PUNICODE_STRING  String);
  4.4713 -
  4.4714 -NTOSAPI
  4.4715 -NTSTATUS
  4.4716 -DDKAPI
  4.4717 -RtlIntegerToUnicodeString(
  4.4718 -  /*IN*/ ULONG  Value,
  4.4719 -  /*IN*/ ULONG  Base  /*OPTIONAL*/,
  4.4720 -  /*IN OUT*/ PUNICODE_STRING  String);
  4.4721 -
  4.4722 -NTOSAPI
  4.4723 -NTSTATUS
  4.4724 -DDKAPI
  4.4725 -RtlIntPtrToUnicodeString(
  4.4726 -  PLONG  Value,
  4.4727 -  ULONG  Base  /*OPTIONAL*/,
  4.4728 -  PUNICODE_STRING  String);
  4.4729 -
  4.4730 -NTOSAPI
  4.4731 -NTSTATUS
  4.4732 -DDKAPI
  4.4733 -RtlInvertRangeList(
  4.4734 -  /*OUT*/ PRTL_RANGE_LIST  InvertedRangeList,
  4.4735 -  /*IN*/ PRTL_RANGE_LIST  RangeList);
  4.4736 -
  4.4737 -NTOSAPI
  4.4738 -NTSTATUS
  4.4739 -DDKAPI
  4.4740 -RtlIsRangeAvailable(
  4.4741 -  /*IN*/ PRTL_RANGE_LIST  RangeList,
  4.4742 -  /*IN*/ ULONGLONG  Start,
  4.4743 -  /*IN*/ ULONGLONG  End,
  4.4744 -  /*IN*/ ULONG  Flags,
  4.4745 -  /*IN*/ UCHAR  AttributeAvailableMask,
  4.4746 -  /*IN*/ PVOID  Context  /*OPTIONAL*/,
  4.4747 -  /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK  Callback  /*OPTIONAL*/,
  4.4748 -  /*OUT*/ PBOOLEAN  Available);
  4.4749 -
  4.4750 -/*
  4.4751 - * BOOLEAN
  4.4752 - * RtlIsZeroLuid(
  4.4753 - * IN PLUID  L1)
  4.4754 - */
  4.4755 -#define RtlIsZeroLuid(_L1) \
  4.4756 -  ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
  4.4757 -
  4.4758 -NTOSAPI
  4.4759 -ULONG
  4.4760 -DDKAPI
  4.4761 -RtlLengthSecurityDescriptor(
  4.4762 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor);
  4.4763 -
  4.4764 -NTOSAPI
  4.4765 -VOID
  4.4766 -DDKAPI
  4.4767 -RtlMapGenericMask(
  4.4768 -  /*IN OUT*/ PACCESS_MASK  AccessMask,
  4.4769 -  /*IN*/ PGENERIC_MAPPING  GenericMapping);
  4.4770 -
  4.4771 -NTOSAPI
  4.4772 -NTSTATUS
  4.4773 -DDKAPI
  4.4774 -RtlMergeRangeLists(
  4.4775 -  /*OUT*/ PRTL_RANGE_LIST  MergedRangeList,
  4.4776 -  /*IN*/ PRTL_RANGE_LIST  RangeList1,
  4.4777 -  /*IN*/ PRTL_RANGE_LIST  RangeList2,
  4.4778 -  /*IN*/ ULONG  Flags);
  4.4779 -
  4.4780 -/*
  4.4781 - * VOID
  4.4782 - * RtlMoveMemory(
  4.4783 - * IN VOID UNALIGNED  *Destination,
  4.4784 - * IN CONST VOID UNALIGNED  *Source,
  4.4785 - * IN SIZE_T  Length)
  4.4786 - */
  4.4787 -#define RtlMoveMemory memmove
  4.4788 -
  4.4789 -NTOSAPI
  4.4790 -ULONG
  4.4791 -DDKAPI
  4.4792 -RtlNumberOfClearBits(
  4.4793 -  /*IN*/ PRTL_BITMAP  BitMapHeader);
  4.4794 -
  4.4795 -NTOSAPI
  4.4796 -ULONG
  4.4797 -DDKAPI
  4.4798 -RtlNumberOfSetBits(
  4.4799 -  /*IN*/ PRTL_BITMAP  BitMapHeader); 
  4.4800 -
  4.4801 -NTOSAPI
  4.4802 -VOID
  4.4803 -DDKFASTAPI
  4.4804 -RtlPrefetchMemoryNonTemporal(
  4.4805 -  /*IN*/ PVOID  Source,
  4.4806 -  /*IN*/ SIZE_T  Length);
  4.4807 -
  4.4808 -NTOSAPI
  4.4809 -BOOLEAN
  4.4810 -DDKAPI
  4.4811 -RtlPrefixUnicodeString( 
  4.4812 -  /*IN*/ PUNICODE_STRING  String1, 
  4.4813 -  /*IN*/ PUNICODE_STRING  String2, 
  4.4814 -  /*IN*/ BOOLEAN  CaseInSensitive);
  4.4815 -
  4.4816 -NTOSAPI
  4.4817 -NTSTATUS
  4.4818 -DDKAPI
  4.4819 -RtlQueryRegistryValues(
  4.4820 -  /*IN*/ ULONG  RelativeTo,
  4.4821 -  /*IN*/ PCWSTR  Path,
  4.4822 -  /*IN*/ PRTL_QUERY_REGISTRY_TABLE  QueryTable,
  4.4823 -  /*IN*/ PVOID  Context,
  4.4824 -  /*IN*/ PVOID  Environment  /*OPTIONAL*/);
  4.4825 -
  4.4826 -NTOSAPI
  4.4827 -VOID
  4.4828 -DDKAPI
  4.4829 -RtlRetrieveUlong(
  4.4830 -  /*IN OUT*/ PULONG  DestinationAddress,
  4.4831 -  /*IN*/ PULONG  SourceAddress);
  4.4832 -
  4.4833 -NTOSAPI
  4.4834 -VOID
  4.4835 -DDKAPI
  4.4836 -RtlRetrieveUshort(
  4.4837 -  /*IN OUT*/ PUSHORT  DestinationAddress,
  4.4838 -  /*IN*/ PUSHORT  SourceAddress);
  4.4839 -
  4.4840 -NTOSAPI
  4.4841 -VOID
  4.4842 -DDKAPI
  4.4843 -RtlSetAllBits(
  4.4844 -  /*IN*/ PRTL_BITMAP  BitMapHeader); 
  4.4845 -
  4.4846 -NTOSAPI
  4.4847 -VOID
  4.4848 -DDKAPI
  4.4849 -RtlSetBit(
  4.4850 -  PRTL_BITMAP  BitMapHeader,
  4.4851 -  ULONG  BitNumber);
  4.4852 -
  4.4853 -NTOSAPI
  4.4854 -VOID
  4.4855 -DDKAPI
  4.4856 -RtlSetBits(
  4.4857 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4858 -  /*IN*/ ULONG  StartingIndex,
  4.4859 -  /*IN*/ ULONG  NumberToSet); 
  4.4860 -
  4.4861 -NTOSAPI
  4.4862 -NTSTATUS
  4.4863 -DDKAPI
  4.4864 -RtlSetDaclSecurityDescriptor(
  4.4865 -  /*IN OUT*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  4.4866 -  /*IN*/ BOOLEAN  DaclPresent,
  4.4867 -  /*IN*/ PACL  Dacl  /*OPTIONAL*/,
  4.4868 -  /*IN*/ BOOLEAN  DaclDefaulted  /*OPTIONAL*/);
  4.4869 -
  4.4870 -NTOSAPI
  4.4871 -VOID
  4.4872 -DDKAPI
  4.4873 -RtlStoreUlong(
  4.4874 -  /*IN*/ PULONG  Address,
  4.4875 -  /*IN*/ ULONG  Value);
  4.4876 -
  4.4877 -NTOSAPI
  4.4878 -VOID
  4.4879 -DDKAPI
  4.4880 -RtlStoreUlonglong(
  4.4881 -  /*IN OUT*/ PULONGLONG  Address,
  4.4882 -  ULONGLONG  Value);
  4.4883 -
  4.4884 -NTOSAPI
  4.4885 -VOID
  4.4886 -DDKAPI
  4.4887 -RtlStoreUlongPtr(
  4.4888 -  /*IN OUT*/ PULONG_PTR  Address,
  4.4889 -  /*IN*/ ULONG_PTR  Value);
  4.4890 -
  4.4891 -NTOSAPI
  4.4892 -VOID
  4.4893 -DDKAPI
  4.4894 -RtlStoreUshort(
  4.4895 -  /*IN*/ PUSHORT  Address,
  4.4896 -  /*IN*/ USHORT  Value);
  4.4897 -
  4.4898 -NTOSAPI
  4.4899 -NTSTATUS
  4.4900 -DDKAPI
  4.4901 -RtlStringFromGUID( 
  4.4902 -  /*IN*/ REFGUID  Guid, 
  4.4903 -  /*OUT*/ PUNICODE_STRING  GuidString);
  4.4904 -
  4.4905 -NTOSAPI
  4.4906 -BOOLEAN
  4.4907 -DDKAPI
  4.4908 -RtlTestBit(
  4.4909 -  /*IN*/ PRTL_BITMAP  BitMapHeader,
  4.4910 -  /*IN*/ ULONG  BitNumber);
  4.4911 -
  4.4912 -NTOSAPI
  4.4913 -BOOLEAN
  4.4914 -DDKAPI
  4.4915 -RtlTimeFieldsToTime(
  4.4916 -  /*IN*/ PTIME_FIELDS  TimeFields,
  4.4917 -  /*IN*/ PLARGE_INTEGER  Time);
  4.4918 -
  4.4919 -NTOSAPI
  4.4920 -VOID
  4.4921 -DDKAPI
  4.4922 -RtlTimeToTimeFields(
  4.4923 -  /*IN*/ PLARGE_INTEGER  Time,
  4.4924 -  /*IN*/ PTIME_FIELDS  TimeFields);
  4.4925 -
  4.4926 -NTOSAPI
  4.4927 -ULONG
  4.4928 -DDKFASTAPI
  4.4929 -RtlUlongByteSwap(
  4.4930 -  /*IN*/ ULONG  Source);
  4.4931 -
  4.4932 -NTOSAPI
  4.4933 -ULONGLONG
  4.4934 -DDKFASTAPI
  4.4935 -RtlUlonglongByteSwap(
  4.4936 -  /*IN*/ ULONGLONG  Source);
  4.4937 -
  4.4938 -NTOSAPI
  4.4939 -ULONG
  4.4940 -DDKAPI
  4.4941 -RtlUnicodeStringToAnsiSize(
  4.4942 -  /*IN*/ PUNICODE_STRING  UnicodeString);
  4.4943 -
  4.4944 -NTOSAPI
  4.4945 -NTSTATUS
  4.4946 -DDKAPI
  4.4947 -RtlUnicodeStringToAnsiString(
  4.4948 -  /*IN OUT*/ PANSI_STRING  DestinationString,
  4.4949 -  /*IN*/ PUNICODE_STRING  SourceString,
  4.4950 -  /*IN*/ BOOLEAN  AllocateDestinationString);
  4.4951 -
  4.4952 -NTOSAPI
  4.4953 -NTSTATUS
  4.4954 -DDKAPI
  4.4955 -RtlUnicodeStringToInteger(
  4.4956 -  /*IN*/ PUNICODE_STRING  String,
  4.4957 -  /*IN*/ ULONG  Base  /*OPTIONAL*/,
  4.4958 -  /*OUT*/ PULONG  Value);
  4.4959 -
  4.4960 -NTOSAPI
  4.4961 -WCHAR
  4.4962 -DDKAPI
  4.4963 -RtlUpcaseUnicodeChar( 
  4.4964 -  /*IN*/ WCHAR  SourceCharacter);
  4.4965 -
  4.4966 -NTOSAPI
  4.4967 -NTSTATUS
  4.4968 -DDKAPI
  4.4969 -RtlUpcaseUnicodeString(
  4.4970 -  /*IN OUT*/ PUNICODE_STRING  DestinationString  /*OPTIONAL*/,
  4.4971 -  /*IN*/ PCUNICODE_STRING  SourceString,
  4.4972 -  /*IN*/ BOOLEAN  AllocateDestinationString);
  4.4973 -
  4.4974 -NTOSAPI
  4.4975 -CHAR
  4.4976 -DDKAPI
  4.4977 -RtlUpperChar( 
  4.4978 -  /*IN*/ CHAR Character);
  4.4979 -
  4.4980 -NTOSAPI
  4.4981 -VOID
  4.4982 -DDKAPI
  4.4983 -RtlUpperString(
  4.4984 -  /*IN OUT*/ PSTRING  DestinationString,
  4.4985 -  /*IN*/ PSTRING  SourceString);
  4.4986 -
  4.4987 -NTOSAPI
  4.4988 -USHORT
  4.4989 -DDKFASTAPI
  4.4990 -RtlUshortByteSwap(
  4.4991 -  /*IN*/ USHORT  Source);
  4.4992 -
  4.4993 -NTOSAPI
  4.4994 -BOOLEAN
  4.4995 -DDKAPI
  4.4996 -RtlValidRelativeSecurityDescriptor(
  4.4997 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptorInput,
  4.4998 -  /*IN*/ ULONG  SecurityDescriptorLength,
  4.4999 -  /*IN*/ SECURITY_INFORMATION  RequiredInformation);
  4.5000 -
  4.5001 -NTOSAPI
  4.5002 -BOOLEAN
  4.5003 -DDKAPI
  4.5004 -RtlValidSecurityDescriptor(
  4.5005 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor);
  4.5006 -
  4.5007 -NTOSAPI
  4.5008 -NTSTATUS
  4.5009 -DDKAPI
  4.5010 -RtlVerifyVersionInfo(
  4.5011 -  /*IN*/ PRTL_OSVERSIONINFOEXW  VersionInfo,
  4.5012 -  /*IN*/ ULONG  TypeMask,
  4.5013 -  /*IN*/ ULONGLONG  ConditionMask);
  4.5014 -
  4.5015 -NTOSAPI
  4.5016 -NTSTATUS
  4.5017 -DDKAPI
  4.5018 -RtlVolumeDeviceToDosName(
  4.5019 -  /*IN*/ PVOID  VolumeDeviceObject,
  4.5020 -  /*OUT*/ PUNICODE_STRING  DosName);
  4.5021 -
  4.5022 -NTOSAPI
  4.5023 -ULONG
  4.5024 -DDKAPI
  4.5025 -RtlWalkFrameChain(
  4.5026 -  /*OUT*/ PVOID  *Callers,
  4.5027 -  /*IN*/ ULONG  Count,
  4.5028 -  /*IN*/ ULONG  Flags);
  4.5029 -
  4.5030 -NTOSAPI
  4.5031 -NTSTATUS
  4.5032 -DDKAPI
  4.5033 -RtlWriteRegistryValue(
  4.5034 -  /*IN*/ ULONG  RelativeTo,
  4.5035 -  /*IN*/ PCWSTR  Path,
  4.5036 -  /*IN*/ PCWSTR  ValueName,
  4.5037 -  /*IN*/ ULONG  ValueType,
  4.5038 -  /*IN*/ PVOID  ValueData,
  4.5039 -  /*IN*/ ULONG  ValueLength);
  4.5040 -
  4.5041 -NTOSAPI
  4.5042 -ULONG
  4.5043 -DDKAPI
  4.5044 -RtlxUnicodeStringToAnsiSize(
  4.5045 -  /*IN*/ PUNICODE_STRING  UnicodeString);
  4.5046 -
  4.5047 -/*
  4.5048 - * VOID
  4.5049 - * RtlZeroMemory(
  4.5050 - * IN VOID UNALIGNED  *Destination,
  4.5051 - * IN SIZE_T  Length)
  4.5052 - */
  4.5053 -#ifndef RtlZeroMemory
  4.5054 -#define RtlZeroMemory(Destination, Length) \
  4.5055 -  memset(Destination, 0, Length)
  4.5056 -#endif
  4.5057 -
  4.5058 -#ifndef RtlZeroBytes
  4.5059 -#define RtlZeroBytes RtlZeroMemory
  4.5060 -#endif
  4.5061 -
  4.5062 -
  4.5063 -/** Executive support routines **/
  4.5064 -
  4.5065 -NTOSAPI
  4.5066 -VOID
  4.5067 -DDKFASTAPI
  4.5068 -ExAcquireFastMutex(
  4.5069 -  /*IN*/ PFAST_MUTEX  FastMutex);
  4.5070 -
  4.5071 -NTOSAPI
  4.5072 -VOID
  4.5073 -DDKFASTAPI
  4.5074 -ExAcquireFastMutexUnsafe(
  4.5075 -  /*IN*/ PFAST_MUTEX  FastMutex);
  4.5076 -
  4.5077 -NTOSAPI
  4.5078 -BOOLEAN
  4.5079 -DDKAPI
  4.5080 -ExAcquireResourceExclusiveLite(
  4.5081 -  /*IN*/ PERESOURCE  Resource,
  4.5082 -  /*IN*/ BOOLEAN  Wait);
  4.5083 -
  4.5084 -NTOSAPI
  4.5085 -BOOLEAN
  4.5086 -DDKAPI
  4.5087 -ExAcquireResourceSharedLite(
  4.5088 -  /*IN*/ PERESOURCE  Resource,
  4.5089 -  /*IN*/ BOOLEAN  Wait);
  4.5090 -
  4.5091 -NTOSAPI
  4.5092 -BOOLEAN
  4.5093 -DDKAPI
  4.5094 -ExAcquireSharedStarveExclusive(
  4.5095 -  /*IN*/ PERESOURCE  Resource,
  4.5096 -  /*IN*/ BOOLEAN  Wait);
  4.5097 -
  4.5098 -NTOSAPI
  4.5099 -BOOLEAN
  4.5100 -DDKAPI
  4.5101 -ExAcquireSharedWaitForExclusive(
  4.5102 -  /*IN*/ PERESOURCE  Resource,
  4.5103 -  /*IN*/ BOOLEAN  Wait);
  4.5104 -
  4.5105 -
  4.5106 -NTOSAPI
  4.5107 -PSINGLE_LIST_ENTRY
  4.5108 -DDKFASTAPI
  4.5109 -ExInterlockedPopEntrySList(
  4.5110 -  /*IN*/ PSLIST_HEADER  ListHead,
  4.5111 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5112 -
  4.5113 -
  4.5114 -NTOSAPI
  4.5115 -PSINGLE_LIST_ENTRY
  4.5116 -DDKFASTAPI
  4.5117 -ExInterlockedPushEntrySList(
  4.5118 -  /*IN*/ PSLIST_HEADER  ListHead,
  4.5119 -  /*IN*/ PSINGLE_LIST_ENTRY  ListEntry,
  4.5120 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5121 -
  4.5122 -
  4.5123 -#if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
  4.5124 -#define ExInterlockedPopEntrySList(_ListHead, \
  4.5125 -                                   _Lock) \
  4.5126 -  InterlockedPopEntrySList(_ListHead)
  4.5127 -
  4.5128 -#define ExInterlockedPushEntrySList(_ListHead, \
  4.5129 -                                    _ListEntry, \
  4.5130 -                                    _Lock) \
  4.5131 -  InterlockedPushEntrySList(_ListHead, _ListEntry)
  4.5132 -#endif /*  __USE_NTOSKRNL__ */
  4.5133 -
  4.5134 -#define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
  4.5135 -
  4.5136 -static __inline PVOID
  4.5137 -ExAllocateFromNPagedLookasideList(
  4.5138 -  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside)
  4.5139 -{
  4.5140 -  PVOID Entry;
  4.5141 -
  4.5142 -  Lookaside->TotalAllocates++;
  4.5143 -  Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
  4.5144 -				     &Lookaside->Obsoleted);
  4.5145 -  if (Entry == NULL) {
  4.5146 -    Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
  4.5147 -    Entry = (Lookaside->Allocate)(Lookaside->Type,
  4.5148 -				  Lookaside->Size,
  4.5149 -				  Lookaside->Tag);
  4.5150 -  }
  4.5151 -  return Entry;
  4.5152 -}
  4.5153 -
  4.5154 -static __inline VOID
  4.5155 -ExFreeToNPagedLookasideList(
  4.5156 -  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside,
  4.5157 -  /*IN*/ PVOID  Entry)
  4.5158 -{
  4.5159 -  Lookaside->TotalFrees++;
  4.5160 -  if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
  4.5161 -    Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
  4.5162 -    (Lookaside->Free)(Entry);
  4.5163 -  } else {
  4.5164 -    ExInterlockedPushEntrySList(&Lookaside->ListHead,
  4.5165 -				(PSLIST_ENTRY)Entry,
  4.5166 -				&Lookaside->Obsoleted);
  4.5167 -  }
  4.5168 -}
  4.5169 -
  4.5170 -#if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
  4.5171 -
  4.5172 -static __inline PVOID
  4.5173 -ExAllocateFromPagedLookasideList(
  4.5174 -  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside)
  4.5175 -{
  4.5176 -  PVOID Entry;
  4.5177 -
  4.5178 -  Lookaside->TotalAllocates++;
  4.5179 -  Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
  4.5180 -  if (Entry == NULL) {
  4.5181 -    Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
  4.5182 -    Entry = (Lookaside->Allocate)(Lookaside->Type,
  4.5183 -				  Lookaside->Size,
  4.5184 -				  Lookaside->Tag);
  4.5185 -  }
  4.5186 -  return Entry;
  4.5187 -}
  4.5188 -
  4.5189 -static __inline VOID
  4.5190 -ExFreeToPagedLookasideList(
  4.5191 -  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside,
  4.5192 -  /*IN*/ PVOID  Entry)
  4.5193 -{
  4.5194 -  Lookaside->TotalFrees++;
  4.5195 -  if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
  4.5196 -    Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
  4.5197 -    (Lookaside->Free)(Entry);
  4.5198 -  } else {
  4.5199 -    InterlockedPushEntrySList(&Lookaside->ListHead,
  4.5200 -			      (PSLIST_ENTRY)Entry);
  4.5201 -  }
  4.5202 -}
  4.5203 -
  4.5204 -#else /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
  4.5205 -
  4.5206 -NTOSAPI
  4.5207 -PVOID
  4.5208 -DDKAPI
  4.5209 -ExAllocateFromPagedLookasideList(
  4.5210 -  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside);
  4.5211 -
  4.5212 -NTOSAPI
  4.5213 -VOID
  4.5214 -DDKAPI
  4.5215 -ExFreeToPagedLookasideList(
  4.5216 -  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside,
  4.5217 -  /*IN*/ PVOID  Entry);
  4.5218 -
  4.5219 -#endif /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
  4.5220 -
  4.5221 -NTOSAPI
  4.5222 -PVOID
  4.5223 -DDKAPI
  4.5224 -ExAllocatePoolWithQuotaTag(
  4.5225 -  /*IN*/ POOL_TYPE  PoolType,
  4.5226 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.5227 -  /*IN*/ ULONG  Tag);
  4.5228 -
  4.5229 -NTOSAPI
  4.5230 -PVOID
  4.5231 -DDKAPI
  4.5232 -ExAllocatePoolWithTag(
  4.5233 -  /*IN*/ POOL_TYPE  PoolType,
  4.5234 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.5235 -  /*IN*/ ULONG  Tag);
  4.5236 -
  4.5237 -#ifdef POOL_TAGGING
  4.5238 -
  4.5239 -#define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
  4.5240 -#define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
  4.5241 -
  4.5242 -#else /* !POOL_TAGGING */
  4.5243 -
  4.5244 -NTOSAPI
  4.5245 -PVOID
  4.5246 -DDKAPI
  4.5247 -ExAllocatePool(
  4.5248 -  /*IN*/ POOL_TYPE  PoolType,
  4.5249 -  /*IN*/ SIZE_T  NumberOfBytes);
  4.5250 -
  4.5251 -NTOSAPI
  4.5252 -PVOID
  4.5253 -DDKAPI
  4.5254 -ExAllocatePoolWithQuota(
  4.5255 -  /*IN*/ POOL_TYPE  PoolType,
  4.5256 -  /*IN*/ SIZE_T  NumberOfBytes);
  4.5257 -
  4.5258 -#endif /* POOL_TAGGING */
  4.5259 -
  4.5260 -NTOSAPI
  4.5261 -PVOID
  4.5262 -DDKAPI
  4.5263 -ExAllocatePoolWithTagPriority(
  4.5264 -  /*IN*/ POOL_TYPE  PoolType,
  4.5265 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.5266 -  /*IN*/ ULONG  Tag,
  4.5267 -  /*IN*/ EX_POOL_PRIORITY  Priority);
  4.5268 -
  4.5269 -NTOSAPI
  4.5270 -VOID
  4.5271 -DDKAPI
  4.5272 -ExConvertExclusiveToSharedLite(
  4.5273 -  /*IN*/ PERESOURCE  Resource);
  4.5274 -
  4.5275 -NTOSAPI
  4.5276 -NTSTATUS
  4.5277 -DDKAPI
  4.5278 -ExCreateCallback(
  4.5279 -  /*OUT*/ PCALLBACK_OBJECT  *CallbackObject,
  4.5280 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.5281 -  /*IN*/ BOOLEAN  Create,
  4.5282 -  /*IN*/ BOOLEAN  AllowMultipleCallbacks);
  4.5283 -
  4.5284 -NTOSAPI
  4.5285 -VOID
  4.5286 -DDKAPI
  4.5287 -ExDeleteNPagedLookasideList(
  4.5288 -  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside);
  4.5289 -
  4.5290 -NTOSAPI
  4.5291 -VOID
  4.5292 -DDKAPI
  4.5293 -ExDeletePagedLookasideList(
  4.5294 -  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside);
  4.5295 -
  4.5296 -NTOSAPI
  4.5297 -NTSTATUS
  4.5298 -DDKAPI
  4.5299 -ExDeleteResourceLite(
  4.5300 -  /*IN*/ PERESOURCE  Resource);
  4.5301 -
  4.5302 -NTOSAPI
  4.5303 -VOID
  4.5304 -DDKAPI
  4.5305 -ExFreePool(
  4.5306 -  /*IN*/ PVOID  P);
  4.5307 -
  4.5308 -#define PROTECTED_POOL                    0x80000000
  4.5309 -
  4.5310 -#ifdef POOL_TAGGING
  4.5311 -#define ExFreePool(P) ExFreePoolWithTag(P, 0)
  4.5312 -#endif
  4.5313 -
  4.5314 -NTOSAPI
  4.5315 -VOID
  4.5316 -DDKAPI
  4.5317 -ExFreePoolWithTag(
  4.5318 -  /*IN*/ PVOID  P,
  4.5319 -  /*IN*/ ULONG  Tag);
  4.5320 -
  4.5321 -/*
  4.5322 - * ERESOURCE_THREAD
  4.5323 - * ExGetCurrentResourceThread(
  4.5324 - *   VOID);
  4.5325 - */
  4.5326 -#define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
  4.5327 -
  4.5328 -NTOSAPI
  4.5329 -ULONG
  4.5330 -DDKAPI
  4.5331 -ExGetExclusiveWaiterCount(
  4.5332 -  /*IN*/ PERESOURCE  Resource);
  4.5333 -
  4.5334 -NTOSAPI
  4.5335 -KPROCESSOR_MODE
  4.5336 -DDKAPI
  4.5337 -ExGetPreviousMode( 
  4.5338 -  VOID);
  4.5339 -
  4.5340 -NTOSAPI
  4.5341 -ULONG
  4.5342 -DDKAPI
  4.5343 -ExGetSharedWaiterCount(
  4.5344 -  /*IN*/ PERESOURCE  Resource);
  4.5345 -
  4.5346 -NTOSAPI
  4.5347 -VOID
  4.5348 -DDKAPI
  4.5349 -KeInitializeEvent(
  4.5350 -  /*IN*/ PRKEVENT  Event,
  4.5351 -  /*IN*/ EVENT_TYPE  Type,
  4.5352 -  /*IN*/ BOOLEAN  State);
  4.5353 -
  4.5354 -/*
  4.5355 - * VOID DDKAPI
  4.5356 - * ExInitializeFastMutex(
  4.5357 - * IN PFAST_MUTEX  FastMutex)
  4.5358 - */
  4.5359 -#define ExInitializeFastMutex(_FastMutex) \
  4.5360 -{ \
  4.5361 -  (_FastMutex)->Count = 1; \
  4.5362 -  (_FastMutex)->Owner = NULL; \
  4.5363 -  (_FastMutex)->Contention = 0; \
  4.5364 -  KeInitializeEvent(&(_FastMutex)->Event, SynchronizationEvent, FALSE); \
  4.5365 -}
  4.5366 -
  4.5367 -NTOSAPI
  4.5368 -VOID
  4.5369 -DDKAPI
  4.5370 -ExInitializeNPagedLookasideList(
  4.5371 -  /*IN*/ PNPAGED_LOOKASIDE_LIST  Lookaside,
  4.5372 -  /*IN*/ PALLOCATE_FUNCTION  Allocate  /*OPTIONAL*/,
  4.5373 -  /*IN*/ PFREE_FUNCTION  Free  /*OPTIONAL*/,
  4.5374 -  /*IN*/ ULONG  Flags,
  4.5375 -  /*IN*/ SIZE_T  Size,
  4.5376 -  /*IN*/ ULONG  Tag,
  4.5377 -  /*IN*/ USHORT  Depth);
  4.5378 -
  4.5379 -NTOSAPI
  4.5380 -VOID
  4.5381 -DDKAPI
  4.5382 -ExInitializePagedLookasideList(
  4.5383 -  /*IN*/ PPAGED_LOOKASIDE_LIST  Lookaside,
  4.5384 -  /*IN*/ PALLOCATE_FUNCTION  Allocate  /*OPTIONAL*/,
  4.5385 -  /*IN*/ PFREE_FUNCTION  Free  /*OPTIONAL*/,
  4.5386 -  /*IN*/ ULONG  Flags,
  4.5387 -  /*IN*/ SIZE_T  Size,
  4.5388 -  /*IN*/ ULONG  Tag,
  4.5389 -  /*IN*/ USHORT  Depth);
  4.5390 -
  4.5391 -NTOSAPI
  4.5392 -NTSTATUS
  4.5393 -DDKAPI
  4.5394 -ExInitializeResourceLite(
  4.5395 -  /*IN*/ PERESOURCE  Resource);
  4.5396 -
  4.5397 -/*
  4.5398 - * VOID
  4.5399 - * InitializeSListHead(
  4.5400 - * IN PSLIST_HEADER  SListHead)
  4.5401 - */
  4.5402 -#define InitializeSListHead(_SListHead) \
  4.5403 -	(_SListHead)->Alignment = 0
  4.5404 -
  4.5405 -#define ExInitializeSListHead InitializeSListHead
  4.5406 -
  4.5407 -NTOSAPI
  4.5408 -LARGE_INTEGER
  4.5409 -DDKAPI
  4.5410 -ExInterlockedAddLargeInteger(
  4.5411 -  /*IN*/ PLARGE_INTEGER  Addend,
  4.5412 -  /*IN*/ LARGE_INTEGER  Increment,
  4.5413 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5414 -
  4.5415 -NTOSAPI
  4.5416 -VOID
  4.5417 -DDKFASTAPI
  4.5418 -ExInterlockedAddLargeStatistic(
  4.5419 -  /*IN*/ PLARGE_INTEGER  Addend,
  4.5420 -  /*IN*/ ULONG  Increment);
  4.5421 -
  4.5422 -NTOSAPI
  4.5423 -ULONG
  4.5424 -DDKAPI
  4.5425 -ExInterlockedAddUlong(
  4.5426 -  /*IN*/ PULONG  Addend,
  4.5427 -  /*IN*/ ULONG  Increment,
  4.5428 -  PKSPIN_LOCK  Lock);
  4.5429 -
  4.5430 -NTOSAPI
  4.5431 -ULONG
  4.5432 -DDKFASTAPI
  4.5433 -ExfInterlockedAddUlong(
  4.5434 -  /*IN*/ PULONG  Addend,
  4.5435 -  /*IN*/ ULONG  Increment,
  4.5436 -  PKSPIN_LOCK  Lock);
  4.5437 -
  4.5438 -
  4.5439 -NTOSAPI
  4.5440 -LONGLONG
  4.5441 -DDKFASTAPI
  4.5442 -ExInterlockedCompareExchange64(
  4.5443 -  /*IN OUT*/ PLONGLONG  Destination,
  4.5444 -  /*IN*/ PLONGLONG  Exchange,
  4.5445 -  /*IN*/ PLONGLONG  Comparand,
  4.5446 -  /*IN*/ PKSPIN_LOCK  Lock); 
  4.5447 -
  4.5448 -NTOSAPI
  4.5449 -PSINGLE_LIST_ENTRY
  4.5450 -DDKFASTAPI
  4.5451 -ExInterlockedFlushSList(
  4.5452 -  /*IN*/ PSLIST_HEADER  ListHead);
  4.5453 -
  4.5454 -NTOSAPI
  4.5455 -PLIST_ENTRY
  4.5456 -DDKAPI
  4.5457 -ExInterlockedInsertHeadList(
  4.5458 -  /*IN*/ PLIST_ENTRY  ListHead,
  4.5459 -  /*IN*/ PLIST_ENTRY  ListEntry,
  4.5460 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5461 -
  4.5462 -NTOSAPI
  4.5463 -PLIST_ENTRY
  4.5464 -DDKFASTAPI
  4.5465 -ExfInterlockedInsertHeadList(
  4.5466 -  /*IN*/ PLIST_ENTRY  ListHead,
  4.5467 -  /*IN*/ PLIST_ENTRY  ListEntry,
  4.5468 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5469 -
  4.5470 -NTOSAPI
  4.5471 -PLIST_ENTRY
  4.5472 -DDKAPI
  4.5473 -ExInterlockedInsertTailList(
  4.5474 -  /*IN*/ PLIST_ENTRY  ListHead,
  4.5475 -  /*IN*/ PLIST_ENTRY  ListEntry,
  4.5476 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5477 -
  4.5478 -NTOSAPI
  4.5479 -PLIST_ENTRY
  4.5480 -DDKFASTAPI
  4.5481 -ExfInterlockedInsertTailList(
  4.5482 -  /*IN*/ PLIST_ENTRY  ListHead,
  4.5483 -  /*IN*/ PLIST_ENTRY  ListEntry,
  4.5484 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5485 -
  4.5486 -NTOSAPI
  4.5487 -PSINGLE_LIST_ENTRY
  4.5488 -DDKAPI
  4.5489 -ExInterlockedPopEntryList(
  4.5490 -  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  4.5491 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5492 -
  4.5493 -NTOSAPI
  4.5494 -PSINGLE_LIST_ENTRY
  4.5495 -DDKFASTAPI
  4.5496 -ExfInterlockedPopEntryList(
  4.5497 -  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  4.5498 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5499 -
  4.5500 -
  4.5501 -NTOSAPI
  4.5502 -PSINGLE_LIST_ENTRY
  4.5503 -DDKAPI
  4.5504 -ExInterlockedPushEntryList(
  4.5505 -  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  4.5506 -  /*IN*/ PSINGLE_LIST_ENTRY  ListEntry,
  4.5507 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5508 -
  4.5509 -NTOSAPI
  4.5510 -PSINGLE_LIST_ENTRY
  4.5511 -DDKFASTAPI
  4.5512 -ExfInterlockedPushEntryList(
  4.5513 -  /*IN*/ PSINGLE_LIST_ENTRY  ListHead,
  4.5514 -  /*IN*/ PSINGLE_LIST_ENTRY  ListEntry,
  4.5515 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5516 -
  4.5517 -
  4.5518 -NTOSAPI
  4.5519 -PLIST_ENTRY
  4.5520 -DDKAPI
  4.5521 -ExInterlockedRemoveHeadList(
  4.5522 -  /*IN*/ PLIST_ENTRY  ListHead,
  4.5523 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5524 -
  4.5525 -NTOSAPI
  4.5526 -PLIST_ENTRY
  4.5527 -DDKFASTAPI
  4.5528 -ExfInterlockedRemoveHeadList(
  4.5529 -  /*IN*/ PLIST_ENTRY  ListHead,
  4.5530 -  /*IN*/ PKSPIN_LOCK  Lock);
  4.5531 -
  4.5532 -
  4.5533 -NTOSAPI
  4.5534 -BOOLEAN
  4.5535 -DDKAPI
  4.5536 -ExIsProcessorFeaturePresent(
  4.5537 -  /*IN*/ ULONG  ProcessorFeature);
  4.5538 -
  4.5539 -NTOSAPI
  4.5540 -BOOLEAN
  4.5541 -DDKAPI
  4.5542 -ExIsResourceAcquiredExclusiveLite(
  4.5543 -  /*IN*/ PERESOURCE  Resource);
  4.5544 -
  4.5545 -NTOSAPI
  4.5546 -USHORT
  4.5547 -DDKAPI
  4.5548 -ExIsResourceAcquiredLite(
  4.5549 -  /*IN*/ PERESOURCE  Resource);
  4.5550 -
  4.5551 -NTOSAPI
  4.5552 -USHORT
  4.5553 -DDKAPI
  4.5554 -ExIsResourceAcquiredSharedLite(
  4.5555 -  /*IN*/ PERESOURCE  Resource);
  4.5556 -
  4.5557 -NTOSAPI
  4.5558 -VOID
  4.5559 -DDKAPI
  4.5560 -ExLocalTimeToSystemTime(
  4.5561 -  /*IN*/ PLARGE_INTEGER  LocalTime,
  4.5562 -  /*OUT*/ PLARGE_INTEGER  SystemTime);
  4.5563 -
  4.5564 -NTOSAPI
  4.5565 -VOID
  4.5566 -DDKAPI
  4.5567 -ExNotifyCallback(
  4.5568 -  /*IN*/ PCALLBACK_OBJECT  CallbackObject,
  4.5569 -  /*IN*/ PVOID  Argument1,
  4.5570 -  /*IN*/ PVOID  Argument2);
  4.5571 -
  4.5572 -NTOSAPI
  4.5573 -VOID
  4.5574 -DDKAPI
  4.5575 -ExRaiseAccessViolation(
  4.5576 -  VOID);
  4.5577 -
  4.5578 -NTOSAPI
  4.5579 -VOID
  4.5580 -DDKAPI
  4.5581 -ExRaiseDatatypeMisalignment(
  4.5582 -  VOID);
  4.5583 -
  4.5584 -NTOSAPI
  4.5585 -VOID
  4.5586 -DDKAPI
  4.5587 -ExRaiseStatus(
  4.5588 -  /*IN*/ NTSTATUS  Status);
  4.5589 -
  4.5590 -NTOSAPI
  4.5591 -PVOID
  4.5592 -DDKAPI
  4.5593 -ExRegisterCallback(
  4.5594 -  /*IN*/ PCALLBACK_OBJECT  CallbackObject,
  4.5595 -  /*IN*/ PCALLBACK_FUNCTION  CallbackFunction,
  4.5596 -  /*IN*/ PVOID  CallbackContext);
  4.5597 -
  4.5598 -NTOSAPI
  4.5599 -VOID
  4.5600 -DDKAPI
  4.5601 -ExReinitializeResourceLite(
  4.5602 -  /*IN*/ PERESOURCE  Resource);
  4.5603 -
  4.5604 -NTOSAPI
  4.5605 -VOID
  4.5606 -DDKFASTAPI
  4.5607 -ExReleaseFastMutex(
  4.5608 -  /*IN*/ PFAST_MUTEX  FastMutex);
  4.5609 -
  4.5610 -NTOSAPI
  4.5611 -VOID
  4.5612 -DDKFASTAPI
  4.5613 -ExReleaseFastMutexUnsafe(
  4.5614 -  /*IN*/ PFAST_MUTEX  FastMutex);
  4.5615 -
  4.5616 -NTOSAPI
  4.5617 -VOID
  4.5618 -DDKAPI
  4.5619 -ExReleaseResourceForThreadLite(
  4.5620 -  /*IN*/ PERESOURCE  Resource,
  4.5621 -  /*IN*/ ERESOURCE_THREAD  ResourceThreadId);
  4.5622 -
  4.5623 -NTOSAPI
  4.5624 -VOID
  4.5625 -DDKFASTAPI
  4.5626 -ExReleaseResourceLite(
  4.5627 -  /*IN*/ PERESOURCE  Resource);
  4.5628 -
  4.5629 -NTOSAPI
  4.5630 -VOID
  4.5631 -DDKAPI
  4.5632 -ExSetResourceOwnerPointer( 
  4.5633 -  /*IN*/ PERESOURCE  Resource,
  4.5634 -  /*IN*/ PVOID  OwnerPointer);
  4.5635 -
  4.5636 -NTOSAPI
  4.5637 -ULONG
  4.5638 -DDKAPI
  4.5639 -ExSetTimerResolution(
  4.5640 -  /*IN*/ ULONG  DesiredTime,
  4.5641 -  /*IN*/ BOOLEAN  SetResolution);
  4.5642 -
  4.5643 -NTOSAPI
  4.5644 -VOID
  4.5645 -DDKAPI
  4.5646 -ExSystemTimeToLocalTime(
  4.5647 -  /*IN*/ PLARGE_INTEGER  SystemTime,
  4.5648 -  /*OUT*/ PLARGE_INTEGER  LocalTime);
  4.5649 -
  4.5650 -NTOSAPI
  4.5651 -BOOLEAN
  4.5652 -DDKFASTAPI
  4.5653 -ExTryToAcquireFastMutex(
  4.5654 -  /*IN*/ PFAST_MUTEX  FastMutex);
  4.5655 -
  4.5656 -NTOSAPI
  4.5657 -BOOLEAN
  4.5658 -DDKAPI
  4.5659 -ExTryToAcquireResourceExclusiveLite(
  4.5660 -  /*IN*/ PERESOURCE  Resource);
  4.5661 -
  4.5662 -NTOSAPI
  4.5663 -VOID
  4.5664 -DDKAPI
  4.5665 -ExUnregisterCallback(
  4.5666 -  /*IN*/ PVOID  CbRegistration);
  4.5667 -
  4.5668 -NTOSAPI
  4.5669 -NTSTATUS
  4.5670 -DDKAPI
  4.5671 -ExUuidCreate(
  4.5672 -  /*OUT*/ UUID  *Uuid);
  4.5673 -
  4.5674 -NTOSAPI
  4.5675 -BOOLEAN
  4.5676 -DDKAPI
  4.5677 -ExVerifySuite(
  4.5678 -  /*IN*/ SUITE_TYPE  SuiteType);
  4.5679 -
  4.5680 -#ifdef DBG
  4.5681 -
  4.5682 -#define PAGED_CODE() { \
  4.5683 -  if (KeGetCurrentIrql() > APC_LEVEL) { \
  4.5684 -    KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
  4.5685 -    ASSERT(FALSE); \
  4.5686 -  } \
  4.5687 -}
  4.5688 -
  4.5689 -#else
  4.5690 -
  4.5691 -#define PAGED_CODE()
  4.5692 -
  4.5693 -#endif
  4.5694 -
  4.5695 -NTOSAPI
  4.5696 -VOID
  4.5697 -DDKAPI
  4.5698 -ProbeForRead(
  4.5699 -  /*IN*/ CONST VOID  *Address,
  4.5700 -  /*IN*/ ULONG  Length,
  4.5701 -  /*IN*/ ULONG  Alignment);
  4.5702 -
  4.5703 -NTOSAPI
  4.5704 -VOID
  4.5705 -DDKAPI
  4.5706 -ProbeForWrite(
  4.5707 -  /*IN*/ CONST VOID  *Address,
  4.5708 -  /*IN*/ ULONG  Length,
  4.5709 -  /*IN*/ ULONG  Alignment);
  4.5710 -
  4.5711 -
  4.5712 -
  4.5713 -/** Configuration manager routines **/
  4.5714 -
  4.5715 -NTOSAPI
  4.5716 -NTSTATUS
  4.5717 -DDKAPI
  4.5718 -CmRegisterCallback(
  4.5719 -  /*IN*/ PEX_CALLBACK_FUNCTION  Function,
  4.5720 -  /*IN*/ PVOID  Context,
  4.5721 -  /*IN OUT*/ PLARGE_INTEGER  Cookie);
  4.5722 -
  4.5723 -NTOSAPI
  4.5724 -NTSTATUS
  4.5725 -DDKAPI
  4.5726 -CmUnRegisterCallback(
  4.5727 -  /*IN*/ LARGE_INTEGER  Cookie);
  4.5728 -
  4.5729 -
  4.5730 -
  4.5731 -/** Filesystem runtime library routines **/
  4.5732 -
  4.5733 -NTOSAPI
  4.5734 -BOOLEAN
  4.5735 -DDKAPI
  4.5736 -FsRtlIsTotalDeviceFailure(
  4.5737 -  /*IN*/ NTSTATUS  Status);
  4.5738 -
  4.5739 -
  4.5740 -
  4.5741 -/** Hardware abstraction layer routines **/
  4.5742 -
  4.5743 -NTOSAPI
  4.5744 -VOID
  4.5745 -DDKFASTAPI
  4.5746 -HalExamineMBR(
  4.5747 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.5748 -  /*IN*/ ULONG  SectorSize,
  4.5749 -  /*IN*/ ULONG  MBRTypeIdentifier,
  4.5750 -  /*OUT*/ PVOID  Buffer);
  4.5751 -
  4.5752 -NTOSAPI
  4.5753 -VOID
  4.5754 -DDKAPI
  4.5755 -READ_PORT_BUFFER_UCHAR(
  4.5756 -  /*IN*/ PUCHAR  Port,
  4.5757 -  /*IN*/ PUCHAR  Buffer,
  4.5758 -  /*IN*/ ULONG  Count);
  4.5759 -
  4.5760 -NTOSAPI
  4.5761 -VOID
  4.5762 -DDKAPI
  4.5763 -READ_PORT_BUFFER_ULONG(
  4.5764 -  /*IN*/ PULONG  Port,
  4.5765 -  /*IN*/ PULONG  Buffer,
  4.5766 -  /*IN*/ ULONG  Count);
  4.5767 -
  4.5768 -NTOSAPI
  4.5769 -VOID
  4.5770 -DDKAPI
  4.5771 -READ_PORT_BUFFER_USHORT(
  4.5772 -  /*IN*/ PUSHORT  Port,
  4.5773 -  /*IN*/ PUSHORT  Buffer,
  4.5774 -  /*IN*/ ULONG  Count);
  4.5775 -
  4.5776 -NTOSAPI
  4.5777 -UCHAR
  4.5778 -DDKAPI
  4.5779 -READ_PORT_UCHAR(
  4.5780 -  /*IN*/ PUCHAR  Port);
  4.5781 -
  4.5782 -NTOSAPI
  4.5783 -ULONG
  4.5784 -DDKAPI
  4.5785 -READ_PORT_ULONG(
  4.5786 -  /*IN*/ PULONG  Port);
  4.5787 -
  4.5788 -NTOSAPI
  4.5789 -USHORT
  4.5790 -DDKAPI
  4.5791 -READ_PORT_USHORT(
  4.5792 -  /*IN*/ PUSHORT  Port);
  4.5793 -
  4.5794 -NTOSAPI
  4.5795 -VOID
  4.5796 -DDKAPI
  4.5797 -READ_REGISTER_BUFFER_UCHAR(
  4.5798 -  /*IN*/ PUCHAR  Register,
  4.5799 -  /*IN*/ PUCHAR  Buffer,
  4.5800 -  /*IN*/ ULONG  Count);
  4.5801 -
  4.5802 -NTOSAPI
  4.5803 -VOID
  4.5804 -DDKAPI
  4.5805 -READ_REGISTER_BUFFER_ULONG(
  4.5806 -  /*IN*/ PULONG  Register,
  4.5807 -  /*IN*/ PULONG  Buffer,
  4.5808 -  /*IN*/ ULONG  Count);
  4.5809 -
  4.5810 -NTOSAPI
  4.5811 -VOID
  4.5812 -DDKAPI
  4.5813 -READ_REGISTER_BUFFER_USHORT(
  4.5814 -  /*IN*/ PUSHORT  Register,
  4.5815 -  /*IN*/ PUSHORT  Buffer,
  4.5816 -  /*IN*/ ULONG  Count);
  4.5817 -
  4.5818 -NTOSAPI
  4.5819 -UCHAR
  4.5820 -DDKAPI
  4.5821 -READ_REGISTER_UCHAR(
  4.5822 -  /*IN*/ PUCHAR  Register);
  4.5823 -
  4.5824 -NTOSAPI
  4.5825 -ULONG
  4.5826 -DDKAPI
  4.5827 -READ_REGISTER_ULONG(
  4.5828 -  /*IN*/ PULONG  Register);
  4.5829 -
  4.5830 -NTOSAPI
  4.5831 -USHORT
  4.5832 -DDKAPI
  4.5833 -READ_REGISTER_USHORT(
  4.5834 -  /*IN*/ PUSHORT  Register);
  4.5835 -
  4.5836 -NTOSAPI
  4.5837 -VOID
  4.5838 -DDKAPI
  4.5839 -WRITE_PORT_BUFFER_UCHAR(
  4.5840 -  /*IN*/ PUCHAR  Port,
  4.5841 -  /*IN*/ PUCHAR  Buffer,
  4.5842 -  /*IN*/ ULONG  Count);
  4.5843 -
  4.5844 -NTOSAPI
  4.5845 -VOID
  4.5846 -DDKAPI
  4.5847 -WRITE_PORT_BUFFER_ULONG(
  4.5848 -  /*IN*/ PULONG  Port,
  4.5849 -  /*IN*/ PULONG  Buffer,
  4.5850 -  /*IN*/ ULONG  Count);
  4.5851 -
  4.5852 -NTOSAPI
  4.5853 -VOID
  4.5854 -DDKAPI
  4.5855 -WRITE_PORT_BUFFER_USHORT(
  4.5856 -  /*IN*/ PUSHORT  Port,
  4.5857 -  /*IN*/ PUSHORT  Buffer,
  4.5858 -  /*IN*/ ULONG  Count);
  4.5859 -
  4.5860 -NTOSAPI
  4.5861 -VOID
  4.5862 -DDKAPI
  4.5863 -WRITE_PORT_UCHAR(
  4.5864 -  /*IN*/ PUCHAR  Port,
  4.5865 -  /*IN*/ UCHAR  Value);
  4.5866 -
  4.5867 -NTOSAPI
  4.5868 -VOID
  4.5869 -DDKAPI
  4.5870 -WRITE_PORT_ULONG(
  4.5871 -  /*IN*/ PULONG  Port,
  4.5872 -  /*IN*/ ULONG  Value);
  4.5873 -
  4.5874 -NTOSAPI
  4.5875 -VOID
  4.5876 -DDKAPI
  4.5877 -WRITE_PORT_USHORT(
  4.5878 -  /*IN*/ PUSHORT  Port,
  4.5879 -  /*IN*/ USHORT  Value);
  4.5880 -
  4.5881 -NTOSAPI
  4.5882 -VOID
  4.5883 -DDKAPI
  4.5884 -WRITE_REGISTER_BUFFER_UCHAR(
  4.5885 -  /*IN*/ PUCHAR  Register,
  4.5886 -  /*IN*/ PUCHAR  Buffer,
  4.5887 -  /*IN*/ ULONG  Count);
  4.5888 -
  4.5889 -NTOSAPI
  4.5890 -VOID
  4.5891 -DDKAPI
  4.5892 -WRITE_REGISTER_BUFFER_ULONG(
  4.5893 -  /*IN*/ PULONG  Register,
  4.5894 -  /*IN*/ PULONG  Buffer,
  4.5895 -  /*IN*/ ULONG  Count);
  4.5896 -
  4.5897 -NTOSAPI
  4.5898 -VOID
  4.5899 -DDKAPI
  4.5900 -WRITE_REGISTER_BUFFER_USHORT(
  4.5901 -  /*IN*/ PUSHORT  Register,
  4.5902 -  /*IN*/ PUSHORT  Buffer,
  4.5903 -  /*IN*/ ULONG  Count);
  4.5904 -
  4.5905 -NTOSAPI
  4.5906 -VOID
  4.5907 -DDKAPI
  4.5908 -WRITE_REGISTER_UCHAR(
  4.5909 -  /*IN*/ PUCHAR  Register,
  4.5910 -  /*IN*/ UCHAR  Value);
  4.5911 -
  4.5912 -NTOSAPI
  4.5913 -VOID
  4.5914 -DDKAPI
  4.5915 -WRITE_REGISTER_ULONG(
  4.5916 -  /*IN*/ PULONG  Register,
  4.5917 -  /*IN*/ ULONG  Value);
  4.5918 -
  4.5919 -NTOSAPI
  4.5920 -VOID
  4.5921 -DDKAPI
  4.5922 -WRITE_REGISTER_USHORT(
  4.5923 -  /*IN*/ PUSHORT  Register,
  4.5924 -  /*IN*/ USHORT  Value);
  4.5925 -
  4.5926 -/** I/O manager routines **/
  4.5927 -
  4.5928 -NTOSAPI
  4.5929 -VOID
  4.5930 -DDKAPI
  4.5931 -IoAcquireCancelSpinLock(
  4.5932 -  /*OUT*/ PKIRQL  Irql);
  4.5933 -
  4.5934 -NTOSAPI
  4.5935 -NTSTATUS
  4.5936 -DDKAPI
  4.5937 -IoAcquireRemoveLockEx(
  4.5938 -  /*IN*/ PIO_REMOVE_LOCK  RemoveLock,
  4.5939 -  /*IN*/ PVOID  Tag  /*OPTIONAL*/,
  4.5940 -  /*IN*/ PCSTR  File,
  4.5941 -  /*IN*/ ULONG  Line,
  4.5942 -  /*IN*/ ULONG  RemlockSize);
  4.5943 -
  4.5944 -/*
  4.5945 - * NTSTATUS
  4.5946 - * IoAcquireRemoveLock(
  4.5947 - * IN PIO_REMOVE_LOCK  RemoveLock,
  4.5948 - * IN PVOID  Tag OPTIONAL)
  4.5949 - */
  4.5950 -#define IoAcquireRemoveLock(_RemoveLock, \
  4.5951 -                            _Tag) \
  4.5952 -  IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK))
  4.5953 -
  4.5954 -/*
  4.5955 - * VOID
  4.5956 - * IoAdjustPagingPathCount(
  4.5957 - * IN PLONG  Count,
  4.5958 - * IN BOOLEAN  Increment)
  4.5959 - */
  4.5960 -#define IoAdjustPagingPathCount(_Count, \
  4.5961 -                                _Increment) \
  4.5962 -{ \
  4.5963 -  if (_Increment) \
  4.5964 -    { \
  4.5965 -      InterlockedIncrement(_Count); \
  4.5966 -    } \
  4.5967 -  else \
  4.5968 -    { \
  4.5969 -      InterlockedDecrement(_Count); \
  4.5970 -    } \
  4.5971 -}
  4.5972 -
  4.5973 -NTOSAPI
  4.5974 -VOID
  4.5975 -DDKAPI
  4.5976 -IoAllocateController(
  4.5977 -  /*IN*/ PCONTROLLER_OBJECT  ControllerObject,
  4.5978 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.5979 -  /*IN*/ PDRIVER_CONTROL  ExecutionRoutine,
  4.5980 -  /*IN*/ PVOID  Context);
  4.5981 -
  4.5982 -NTOSAPI
  4.5983 -NTSTATUS
  4.5984 -DDKAPI
  4.5985 -IoAllocateDriverObjectExtension(
  4.5986 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.5987 -  /*IN*/ PVOID  ClientIdentificationAddress,
  4.5988 -  /*IN*/ ULONG  DriverObjectExtensionSize,
  4.5989 -  /*OUT*/ PVOID  *DriverObjectExtension);
  4.5990 -
  4.5991 -typedef struct _IO_ERROR_LOG_PACKET { 
  4.5992 -	UCHAR  MajorFunctionCode; 
  4.5993 -	UCHAR  RetryCount; 
  4.5994 -	USHORT  DumpDataSize; 
  4.5995 -	USHORT  NumberOfStrings; 
  4.5996 -	USHORT  StringOffset; 
  4.5997 -	USHORT  EventCategory; 
  4.5998 -	NTSTATUS  ErrorCode; 
  4.5999 -	ULONG  UniqueErrorValue; 
  4.6000 -	NTSTATUS  FinalStatus; 
  4.6001 -	ULONG  SequenceNumber; 
  4.6002 -	ULONG  IoControlCode; 
  4.6003 -	LARGE_INTEGER  DeviceOffset; 
  4.6004 -	ULONG  DumpData[1]; 
  4.6005 -} IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET; 
  4.6006 -
  4.6007 -NTOSAPI
  4.6008 -PVOID
  4.6009 -DDKAPI
  4.6010 -IoAllocateErrorLogEntry(
  4.6011 -  /*IN*/ PVOID  IoObject,
  4.6012 -  /*IN*/ UCHAR  EntrySize);
  4.6013 -
  4.6014 -NTOSAPI
  4.6015 -PIRP
  4.6016 -DDKAPI
  4.6017 -IoAllocateIrp(
  4.6018 -  /*IN*/ CCHAR  StackSize,
  4.6019 -  /*IN*/ BOOLEAN  ChargeQuota);
  4.6020 -
  4.6021 -NTOSAPI
  4.6022 -PMDL
  4.6023 -DDKAPI
  4.6024 -IoAllocateMdl(
  4.6025 -  /*IN*/ PVOID  VirtualAddress,
  4.6026 -  /*IN*/ ULONG  Length,
  4.6027 -  /*IN*/ BOOLEAN  SecondaryBuffer,
  4.6028 -  /*IN*/ BOOLEAN  ChargeQuota,
  4.6029 -  /*IN OUT*/ PIRP  Irp  /*OPTIONAL*/);
  4.6030 -
  4.6031 -NTOSAPI
  4.6032 -PIO_WORKITEM
  4.6033 -DDKAPI
  4.6034 -IoAllocateWorkItem(
  4.6035 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.6036 -
  4.6037 -/*
  4.6038 - * VOID IoAssignArcName(
  4.6039 - * IN PUNICODE_STRING  ArcName,
  4.6040 - * IN PUNICODE_STRING  DeviceName);
  4.6041 - */
  4.6042 -#define IoAssignArcName(_ArcName, _DeviceName) ( \
  4.6043 -  IoCreateSymbolicLink((_ArcName), (_DeviceName)))
  4.6044 -
  4.6045 -NTOSAPI
  4.6046 -NTSTATUS
  4.6047 -DDKAPI
  4.6048 -IoAttachDevice(
  4.6049 -  /*IN*/ PDEVICE_OBJECT  SourceDevice,
  4.6050 -  /*IN*/ PUNICODE_STRING  TargetDevice,
  4.6051 -  /*OUT*/ PDEVICE_OBJECT  *AttachedDevice);
  4.6052 -
  4.6053 -NTOSAPI
  4.6054 -PDEVICE_OBJECT
  4.6055 -DDKAPI
  4.6056 -IoAttachDeviceToDeviceStack(
  4.6057 -  /*IN*/ PDEVICE_OBJECT  SourceDevice,
  4.6058 -  /*IN*/ PDEVICE_OBJECT  TargetDevice);
  4.6059 -
  4.6060 -NTOSAPI
  4.6061 -PIRP
  4.6062 -DDKAPI
  4.6063 -IoBuildAsynchronousFsdRequest(
  4.6064 -  /*IN*/ ULONG  MajorFunction,
  4.6065 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6066 -  /*IN OUT*/ PVOID  Buffer  /*OPTIONAL*/,
  4.6067 -  /*IN*/ ULONG  Length  /*OPTIONAL*/,
  4.6068 -  /*IN*/ PLARGE_INTEGER  StartingOffset  /*OPTIONAL*/,
  4.6069 -  /*IN*/ PIO_STATUS_BLOCK  IoStatusBlock  /*OPTIONAL*/);
  4.6070 -
  4.6071 -NTOSAPI
  4.6072 -PIRP
  4.6073 -DDKAPI
  4.6074 -IoBuildDeviceIoControlRequest(
  4.6075 -  /*IN*/ ULONG  IoControlCode,
  4.6076 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6077 -  /*IN*/ PVOID  InputBuffer  /*OPTIONAL*/,
  4.6078 -  /*IN*/ ULONG  InputBufferLength,
  4.6079 -  /*OUT*/ PVOID  OutputBuffer  /*OPTIONAL*/,
  4.6080 -  /*IN*/ ULONG  OutputBufferLength,
  4.6081 -  /*IN*/ BOOLEAN  InternalDeviceIoControl,
  4.6082 -  /*IN*/ PKEVENT  Event,
  4.6083 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock);
  4.6084 -
  4.6085 -NTOSAPI
  4.6086 -VOID
  4.6087 -DDKAPI
  4.6088 -IoBuildPartialMdl(
  4.6089 -  /*IN*/ PMDL  SourceMdl,
  4.6090 -  /*IN OUT*/ PMDL  TargetMdl,
  4.6091 -  /*IN*/ PVOID  VirtualAddress,
  4.6092 -  /*IN*/ ULONG  Length);
  4.6093 -
  4.6094 -NTOSAPI
  4.6095 -PIRP
  4.6096 -DDKAPI
  4.6097 -IoBuildSynchronousFsdRequest(
  4.6098 -  /*IN*/ ULONG  MajorFunction,
  4.6099 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6100 -  /*IN OUT*/ PVOID  Buffer  /*OPTIONAL*/,
  4.6101 -  /*IN*/ ULONG  Length  /*OPTIONAL*/,
  4.6102 -  /*IN*/ PLARGE_INTEGER  StartingOffset  /*OPTIONAL*/,
  4.6103 -  /*IN*/ PKEVENT  Event,
  4.6104 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock);
  4.6105 -
  4.6106 -NTOSAPI
  4.6107 -NTSTATUS
  4.6108 -DDKFASTAPI
  4.6109 -IofCallDriver(
  4.6110 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6111 -  /*IN OUT*/ PIRP  Irp);
  4.6112 -
  4.6113 -/*
  4.6114 - * NTSTATUS
  4.6115 - * IoCallDriver(
  4.6116 - * IN PDEVICE_OBJECT  DeviceObject,
  4.6117 - * IN OUT PIRP  Irp)
  4.6118 - */
  4.6119 -#define IoCallDriver IofCallDriver
  4.6120 -
  4.6121 -NTOSAPI
  4.6122 -VOID
  4.6123 -DDKAPI
  4.6124 -IoCancelFileOpen(
  4.6125 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6126 -  /*IN*/ PFILE_OBJECT  FileObject);
  4.6127 -
  4.6128 -NTOSAPI
  4.6129 -BOOLEAN
  4.6130 -DDKAPI
  4.6131 -IoCancelIrp(
  4.6132 -  /*IN*/ PIRP  Irp);
  4.6133 -
  4.6134 -NTOSAPI
  4.6135 -NTSTATUS
  4.6136 -DDKAPI
  4.6137 -IoCheckShareAccess(
  4.6138 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.6139 -  /*IN*/ ULONG  DesiredShareAccess,
  4.6140 -  /*IN OUT*/ PFILE_OBJECT  FileObject,
  4.6141 -  /*IN OUT*/ PSHARE_ACCESS  ShareAccess,
  4.6142 -  /*IN*/ BOOLEAN  Update);
  4.6143 -
  4.6144 -NTOSAPI
  4.6145 -VOID
  4.6146 -DDKFASTAPI
  4.6147 -IofCompleteRequest(
  4.6148 -  /*IN*/ PIRP  Irp,
  4.6149 -  /*IN*/ CCHAR  PriorityBoost);
  4.6150 -
  4.6151 -/*
  4.6152 - * VOID
  4.6153 - * IoCompleteRequest(
  4.6154 - * IN PIRP  Irp,
  4.6155 - * IN CCHAR  PriorityBoost)
  4.6156 - */
  4.6157 -#define IoCompleteRequest IofCompleteRequest
  4.6158 -
  4.6159 -NTOSAPI
  4.6160 -NTSTATUS
  4.6161 -DDKAPI
  4.6162 -IoConnectInterrupt(
  4.6163 -  /*OUT*/ PKINTERRUPT  *InterruptObject,
  4.6164 -  /*IN*/ PKSERVICE_ROUTINE  ServiceRoutine,
  4.6165 -  /*IN*/ PVOID  ServiceContext,
  4.6166 -  /*IN*/ PKSPIN_LOCK  SpinLock  /*OPTIONAL*/,
  4.6167 -  /*IN*/ ULONG  Vector,
  4.6168 -  /*IN*/ KIRQL  Irql,
  4.6169 -  /*IN*/ KIRQL  SynchronizeIrql,
  4.6170 -  /*IN*/ KINTERRUPT_MODE    InterruptMode,
  4.6171 -  /*IN*/ BOOLEAN  ShareVector,
  4.6172 -  /*IN*/ KAFFINITY  ProcessorEnableMask,
  4.6173 -  /*IN*/ BOOLEAN  FloatingSave);
  4.6174 -
  4.6175 -/*
  4.6176 - * PIO_STACK_LOCATION
  4.6177 - * IoGetCurrentIrpStackLocation(
  4.6178 - * IN PIRP  Irp)
  4.6179 - */
  4.6180 -#define IoGetCurrentIrpStackLocation(_Irp) \
  4.6181 -  ((_Irp)->Tail.Overlay.CurrentStackLocation)
  4.6182 -
  4.6183 -/*
  4.6184 - * PIO_STACK_LOCATION
  4.6185 - * IoGetNextIrpStackLocation(
  4.6186 - * IN PIRP  Irp)
  4.6187 - */
  4.6188 -#define IoGetNextIrpStackLocation(_Irp) \
  4.6189 -  ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
  4.6190 -
  4.6191 -/*
  4.6192 - * VOID
  4.6193 - * IoCopyCurrentIrpStackLocationToNext(
  4.6194 - * IN PIRP  Irp)
  4.6195 - */
  4.6196 -#define IoCopyCurrentIrpStackLocationToNext(_Irp) \
  4.6197 -{ \
  4.6198 -  PIO_STACK_LOCATION _IrpSp; \
  4.6199 -  PIO_STACK_LOCATION _NextIrpSp; \
  4.6200 -  _IrpSp = IoGetCurrentIrpStackLocation(_Irp); \
  4.6201 -  _NextIrpSp = IoGetNextIrpStackLocation(_Irp); \
  4.6202 -  RtlCopyMemory(_NextIrpSp, _IrpSp, \
  4.6203 -    FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
  4.6204 -  _NextIrpSp->Control = 0; \
  4.6205 -}
  4.6206 -
  4.6207 -NTOSAPI
  4.6208 -PCONTROLLER_OBJECT
  4.6209 -DDKAPI
  4.6210 -IoCreateController(
  4.6211 -  /*IN*/ ULONG  Size);
  4.6212 -
  4.6213 -NTOSAPI
  4.6214 -NTSTATUS
  4.6215 -DDKAPI
  4.6216 -IoCreateDevice(
  4.6217 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6218 -  /*IN*/ ULONG  DeviceExtensionSize,
  4.6219 -  /*IN*/ PUNICODE_STRING  DeviceName  /*OPTIONAL*/,
  4.6220 -  /*IN*/ DEVICE_TYPE  DeviceType,
  4.6221 -  /*IN*/ ULONG  DeviceCharacteristics,
  4.6222 -  /*IN*/ BOOLEAN  Exclusive,
  4.6223 -  /*OUT*/ PDEVICE_OBJECT  *DeviceObject);
  4.6224 -
  4.6225 -NTOSAPI
  4.6226 -NTSTATUS
  4.6227 -DDKAPI
  4.6228 -IoCreateDisk(
  4.6229 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6230 -  /*IN*/ PCREATE_DISK  Disk);
  4.6231 -
  4.6232 -NTOSAPI
  4.6233 -NTSTATUS
  4.6234 -DDKAPI
  4.6235 -IoCreateFile(
  4.6236 -  /*OUT*/ PHANDLE FileHandle,
  4.6237 -  /*IN*/ ACCESS_MASK DesiredAccess,
  4.6238 -  /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
  4.6239 -  /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
  4.6240 -  /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
  4.6241 -  /*IN*/ ULONG FileAttributes,
  4.6242 -  /*IN*/ ULONG ShareAccess,
  4.6243 -  /*IN*/ ULONG Disposition,
  4.6244 -  /*IN*/ ULONG CreateOptions,
  4.6245 -  /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
  4.6246 -  /*IN*/ ULONG EaLength,
  4.6247 -  /*IN*/ CREATE_FILE_TYPE CreateFileType,
  4.6248 -  /*IN*/ PVOID ExtraCreateParameters /*OPTIONAL*/,
  4.6249 -  /*IN*/ ULONG Options);
  4.6250 -
  4.6251 -NTOSAPI
  4.6252 -PKEVENT
  4.6253 -DDKAPI
  4.6254 -IoCreateNotificationEvent(
  4.6255 -  /*IN*/ PUNICODE_STRING  EventName,
  4.6256 -  /*OUT*/ PHANDLE  EventHandle);
  4.6257 -
  4.6258 -NTOSAPI
  4.6259 -NTSTATUS
  4.6260 -DDKAPI
  4.6261 -IoCreateSymbolicLink(
  4.6262 -  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  4.6263 -  /*IN*/ PUNICODE_STRING  DeviceName);
  4.6264 -
  4.6265 -NTOSAPI
  4.6266 -PKEVENT
  4.6267 -DDKAPI
  4.6268 -IoCreateSynchronizationEvent(
  4.6269 -  /*IN*/ PUNICODE_STRING  EventName,
  4.6270 -  /*OUT*/ PHANDLE  EventHandle);
  4.6271 -
  4.6272 -NTOSAPI
  4.6273 -NTSTATUS
  4.6274 -DDKAPI
  4.6275 -IoCreateUnprotectedSymbolicLink(
  4.6276 -  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  4.6277 -  /*IN*/ PUNICODE_STRING  DeviceName);
  4.6278 -
  4.6279 -NTOSAPI
  4.6280 -VOID
  4.6281 -DDKAPI
  4.6282 -IoCsqInitialize(
  4.6283 -  PIO_CSQ  Csq,
  4.6284 -  /*IN*/ PIO_CSQ_INSERT_IRP  CsqInsertIrp,
  4.6285 -  /*IN*/ PIO_CSQ_REMOVE_IRP  CsqRemoveIrp,
  4.6286 -  /*IN*/ PIO_CSQ_PEEK_NEXT_IRP  CsqPeekNextIrp,
  4.6287 -  /*IN*/ PIO_CSQ_ACQUIRE_LOCK  CsqAcquireLock,
  4.6288 -  /*IN*/ PIO_CSQ_RELEASE_LOCK  CsqReleaseLock,
  4.6289 -  /*IN*/ PIO_CSQ_COMPLETE_CANCELED_IRP  CsqCompleteCanceledIrp);
  4.6290 -
  4.6291 -NTOSAPI
  4.6292 -VOID
  4.6293 -DDKAPI
  4.6294 -IoCsqInsertIrp(
  4.6295 -  /*IN*/ PIO_CSQ  Csq,
  4.6296 -  /*IN*/ PIRP  Irp,
  4.6297 -  /*IN*/ PIO_CSQ_IRP_CONTEXT  Context);
  4.6298 -
  4.6299 -NTOSAPI
  4.6300 -PIRP
  4.6301 -DDKAPI
  4.6302 -IoCsqRemoveIrp(
  4.6303 -  /*IN*/ PIO_CSQ  Csq,
  4.6304 -  /*IN*/ PIO_CSQ_IRP_CONTEXT  Context);
  4.6305 -
  4.6306 -NTOSAPI
  4.6307 -PIRP
  4.6308 -DDKAPI
  4.6309 -IoCsqRemoveNextIrp(
  4.6310 -  /*IN*/ PIO_CSQ  Csq,
  4.6311 -  /*IN*/ PVOID  PeekContext);
  4.6312 -
  4.6313 -NTOSAPI
  4.6314 -VOID
  4.6315 -DDKAPI
  4.6316 -IoDeleteController(
  4.6317 -  /*IN*/ PCONTROLLER_OBJECT  ControllerObject);
  4.6318 -
  4.6319 -NTOSAPI
  4.6320 -VOID
  4.6321 -DDKAPI
  4.6322 -IoDeleteDevice(
  4.6323 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.6324 -
  4.6325 -NTOSAPI
  4.6326 -NTSTATUS
  4.6327 -DDKAPI
  4.6328 -IoDeleteSymbolicLink(
  4.6329 -  /*IN*/ PUNICODE_STRING  SymbolicLinkName);
  4.6330 -
  4.6331 -/*
  4.6332 - * VOID
  4.6333 - * IoDeassignArcName(
  4.6334 - * IN PUNICODE_STRING  ArcName)
  4.6335 - */
  4.6336 -#define IoDeassignArcName IoDeleteSymbolicLink
  4.6337 -
  4.6338 -NTOSAPI
  4.6339 -VOID
  4.6340 -DDKAPI
  4.6341 -IoDetachDevice(
  4.6342 -  /*IN OUT*/ PDEVICE_OBJECT  TargetDevice);
  4.6343 -
  4.6344 -NTOSAPI
  4.6345 -VOID
  4.6346 -DDKAPI
  4.6347 -IoDisconnectInterrupt(
  4.6348 -  /*IN*/ PKINTERRUPT  InterruptObject);
  4.6349 -
  4.6350 -NTOSAPI
  4.6351 -BOOLEAN
  4.6352 -DDKAPI
  4.6353 -IoForwardIrpSynchronously(
  4.6354 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6355 -  /*IN*/ PIRP  Irp);
  4.6356 -
  4.6357 -#define IoForwardAndCatchIrp IoForwardIrpSynchronously
  4.6358 -
  4.6359 -NTOSAPI
  4.6360 -VOID
  4.6361 -DDKAPI
  4.6362 -IoFreeController(
  4.6363 -  /*IN*/ PCONTROLLER_OBJECT  ControllerObject);
  4.6364 -
  4.6365 -NTOSAPI
  4.6366 -VOID
  4.6367 -DDKAPI
  4.6368 -IoFreeErrorLogEntry(
  4.6369 -  PVOID  ElEntry);
  4.6370 -
  4.6371 -NTOSAPI
  4.6372 -VOID
  4.6373 -DDKAPI
  4.6374 -IoFreeIrp(
  4.6375 -  /*IN*/ PIRP  Irp);
  4.6376 -
  4.6377 -NTOSAPI
  4.6378 -VOID
  4.6379 -DDKAPI
  4.6380 -IoFreeMdl(
  4.6381 -  /*IN*/ PMDL  Mdl);
  4.6382 -
  4.6383 -NTOSAPI
  4.6384 -VOID
  4.6385 -DDKAPI
  4.6386 -IoFreeWorkItem(
  4.6387 -  /*IN*/ PIO_WORKITEM  pIOWorkItem);
  4.6388 -
  4.6389 -NTOSAPI
  4.6390 -PDEVICE_OBJECT
  4.6391 -DDKAPI
  4.6392 -IoGetAttachedDevice(
  4.6393 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.6394 -
  4.6395 -NTOSAPI
  4.6396 -PDEVICE_OBJECT
  4.6397 -DDKAPI
  4.6398 -IoGetAttachedDeviceReference(
  4.6399 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.6400 -
  4.6401 -NTOSAPI
  4.6402 -NTSTATUS
  4.6403 -DDKAPI
  4.6404 -IoGetBootDiskInformation(
  4.6405 -  /*IN OUT*/ PBOOTDISK_INFORMATION  BootDiskInformation,
  4.6406 -  /*IN*/ ULONG  Size);
  4.6407 -
  4.6408 -NTOSAPI
  4.6409 -PCONFIGURATION_INFORMATION
  4.6410 -DDKAPI
  4.6411 -IoGetConfigurationInformation( 
  4.6412 -  VOID);
  4.6413 -
  4.6414 -NTOSAPI
  4.6415 -PEPROCESS
  4.6416 -DDKAPI
  4.6417 -IoGetCurrentProcess(
  4.6418 -  VOID);
  4.6419 -
  4.6420 -NTOSAPI
  4.6421 -NTSTATUS
  4.6422 -DDKAPI
  4.6423 -IoGetDeviceInterfaceAlias(
  4.6424 -  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  4.6425 -  /*IN*/ CONST GUID  *AliasInterfaceClassGuid,
  4.6426 -  /*OUT*/ PUNICODE_STRING  AliasSymbolicLinkName);
  4.6427 -
  4.6428 -NTOSAPI
  4.6429 -NTSTATUS
  4.6430 -DDKAPI
  4.6431 -IoGetDeviceInterfaces(
  4.6432 -  /*IN*/ CONST GUID  *InterfaceClassGuid,
  4.6433 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject  /*OPTIONAL*/,
  4.6434 -  /*IN*/ ULONG  Flags,
  4.6435 -  /*OUT*/ PWSTR  *SymbolicLinkList);
  4.6436 -
  4.6437 -NTOSAPI
  4.6438 -NTSTATUS
  4.6439 -DDKAPI
  4.6440 -IoGetDeviceObjectPointer(
  4.6441 -  /*IN*/ PUNICODE_STRING  ObjectName,
  4.6442 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.6443 -  /*OUT*/ PFILE_OBJECT  *FileObject,
  4.6444 -  /*OUT*/ PDEVICE_OBJECT  *DeviceObject);
  4.6445 -
  4.6446 -NTOSAPI
  4.6447 -NTSTATUS
  4.6448 -DDKAPI
  4.6449 -IoGetDeviceProperty(
  4.6450 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6451 -  /*IN*/ DEVICE_REGISTRY_PROPERTY  DeviceProperty,
  4.6452 -  /*IN*/ ULONG  BufferLength,
  4.6453 -  /*OUT*/ PVOID  PropertyBuffer,
  4.6454 -  /*OUT*/ PULONG  ResultLength);
  4.6455 -
  4.6456 -NTOSAPI
  4.6457 -PDEVICE_OBJECT
  4.6458 -DDKAPI
  4.6459 -IoGetDeviceToVerify(
  4.6460 -  /*IN*/ PETHREAD  Thread);
  4.6461 -
  4.6462 -NTOSAPI
  4.6463 -PDMA_ADAPTER
  4.6464 -DDKAPI
  4.6465 -IoGetDmaAdapter(
  4.6466 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  4.6467 -  /*IN*/ PDEVICE_DESCRIPTION  DeviceDescription,
  4.6468 -  /*IN OUT*/ PULONG  NumberOfMapRegisters);
  4.6469 -
  4.6470 -NTOSAPI
  4.6471 -PVOID
  4.6472 -DDKAPI
  4.6473 -IoGetDriverObjectExtension(
  4.6474 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6475 -  /*IN*/ PVOID  ClientIdentificationAddress);
  4.6476 -
  4.6477 -NTOSAPI
  4.6478 -PGENERIC_MAPPING
  4.6479 -DDKAPI
  4.6480 -IoGetFileObjectGenericMapping(
  4.6481 -  VOID);
  4.6482 -
  4.6483 -/*
  4.6484 - * ULONG
  4.6485 - * IoGetFunctionCodeFromCtlCode(
  4.6486 - * IN ULONG  ControlCode)
  4.6487 - */
  4.6488 -#define IoGetFunctionCodeFromCtlCode(_ControlCode) \
  4.6489 -  (((_ControlCode) >> 2) & 0x00000FFF)
  4.6490 -
  4.6491 -NTOSAPI
  4.6492 -PVOID
  4.6493 -DDKAPI
  4.6494 -IoGetInitialStack(
  4.6495 -  VOID);
  4.6496 -
  4.6497 -NTOSAPI
  4.6498 -PDEVICE_OBJECT
  4.6499 -DDKAPI
  4.6500 -IoGetRelatedDeviceObject(
  4.6501 -  /*IN*/ PFILE_OBJECT  FileObject);
  4.6502 -
  4.6503 -NTOSAPI
  4.6504 -ULONG
  4.6505 -DDKAPI
  4.6506 -IoGetRemainingStackSize(
  4.6507 -  VOID);
  4.6508 -
  4.6509 -NTOSAPI
  4.6510 -VOID
  4.6511 -DDKAPI
  4.6512 -IoGetStackLimits(
  4.6513 -  /*OUT*/ PULONG_PTR  LowLimit,
  4.6514 -  /*OUT*/ PULONG_PTR  HighLimit);
  4.6515 -
  4.6516 -NTOSAPI
  4.6517 -VOID
  4.6518 -DDKAPI
  4.6519 -KeInitializeDpc(
  4.6520 -  /*IN*/ PRKDPC  Dpc,
  4.6521 -  /*IN*/ PKDEFERRED_ROUTINE  DeferredRoutine,
  4.6522 -  /*IN*/ PVOID  DeferredContext);
  4.6523 -
  4.6524 -/*
  4.6525 - * VOID
  4.6526 - * IoInitializeDpcRequest(
  4.6527 - * IN PDEVICE_OBJECT DeviceObject,
  4.6528 - * IN PIO_DPC_ROUTINE DpcRoutine)
  4.6529 - */
  4.6530 -#define IoInitializeDpcRequest(_DeviceObject, \
  4.6531 -                               _DpcRoutine) \
  4.6532 -  KeInitializeDpc(&(_DeviceObject)->Dpc, \
  4.6533 -    (PKDEFERRED_ROUTINE) (_DpcRoutine), \
  4.6534 -    _DeviceObject)
  4.6535 -
  4.6536 -NTOSAPI
  4.6537 -VOID
  4.6538 -DDKAPI
  4.6539 -IoInitializeIrp(
  4.6540 -  /*IN OUT*/ PIRP  Irp,
  4.6541 -  /*IN*/ USHORT  PacketSize,
  4.6542 -  /*IN*/ CCHAR  StackSize);
  4.6543 -
  4.6544 -NTOSAPI
  4.6545 -VOID
  4.6546 -DDKAPI
  4.6547 -IoInitializeRemoveLockEx(
  4.6548 -  /*IN*/ PIO_REMOVE_LOCK Lock,
  4.6549 -  /*IN*/ ULONG   AllocateTag,
  4.6550 -  /*IN*/ ULONG   MaxLockedMinutes,
  4.6551 -  /*IN*/ ULONG   HighWatermark,
  4.6552 -  /*IN*/ ULONG   RemlockSize);
  4.6553 -
  4.6554 -/* VOID
  4.6555 - * IoInitializeRemoveLock(
  4.6556 - * IN PIO_REMOVE_LOCK  Lock,
  4.6557 - * IN ULONG  AllocateTag,
  4.6558 - * IN ULONG  MaxLockedMinutes,
  4.6559 - * IN ULONG  HighWatermark)
  4.6560 - */
  4.6561 -#define IoInitializeRemoveLock( \
  4.6562 -  Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
  4.6563 -  IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
  4.6564 -    HighWatermark, sizeof(IO_REMOVE_LOCK))
  4.6565 -
  4.6566 -NTOSAPI
  4.6567 -NTSTATUS
  4.6568 -DDKAPI
  4.6569 -IoInitializeTimer(
  4.6570 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6571 -  /*IN*/ PIO_TIMER_ROUTINE  TimerRoutine,
  4.6572 -  /*IN*/ PVOID  Context);
  4.6573 -
  4.6574 -NTOSAPI
  4.6575 -VOID
  4.6576 -DDKAPI
  4.6577 -IoInvalidateDeviceRelations(
  4.6578 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6579 -  /*IN*/ DEVICE_RELATION_TYPE  Type);
  4.6580 -
  4.6581 -NTOSAPI
  4.6582 -VOID
  4.6583 -DDKAPI
  4.6584 -IoInvalidateDeviceState(
  4.6585 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject);
  4.6586 -
  4.6587 -NTOSAPI
  4.6588 -BOOLEAN
  4.6589 -DDKAPI
  4.6590 -IoIs32bitProcess(
  4.6591 -  /*IN*/ PIRP  Irp  /*OPTIONAL*/);
  4.6592 -
  4.6593 -/*
  4.6594 - * BOOLEAN
  4.6595 - * IoIsErrorUserInduced(
  4.6596 - * IN NTSTATUS  Status);
  4.6597 - */
  4.6598 -#define IoIsErrorUserInduced(Status) \
  4.6599 -	((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
  4.6600 -   ((Status) == STATUS_IO_TIMEOUT) || \
  4.6601 -   ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
  4.6602 -   ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
  4.6603 -   ((Status) == STATUS_VERIFY_REQUIRED) || \
  4.6604 -   ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
  4.6605 -   ((Status) == STATUS_WRONG_VOLUME)))
  4.6606 -
  4.6607 -NTOSAPI
  4.6608 -BOOLEAN
  4.6609 -DDKAPI
  4.6610 -IoIsWdmVersionAvailable(
  4.6611 -  /*IN*/ UCHAR  MajorVersion,
  4.6612 -  /*IN*/ UCHAR  MinorVersion);
  4.6613 -
  4.6614 -NTOSAPI
  4.6615 -PIRP
  4.6616 -DDKAPI
  4.6617 -IoMakeAssociatedIrp(
  4.6618 -  /*IN*/ PIRP  Irp,
  4.6619 -  /*IN*/ CCHAR  StackSize);
  4.6620 -
  4.6621 -/*
  4.6622 - * VOID
  4.6623 - * IoMarkIrpPending(
  4.6624 - * IN OUT PIRP  Irp)
  4.6625 - */
  4.6626 -#define IoMarkIrpPending(_Irp) \
  4.6627 -  (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
  4.6628 -
  4.6629 -NTOSAPI
  4.6630 -NTSTATUS
  4.6631 -DDKAPI
  4.6632 -IoOpenDeviceInterfaceRegistryKey(
  4.6633 -  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  4.6634 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.6635 -  /*OUT*/ PHANDLE  DeviceInterfaceKey);
  4.6636 -
  4.6637 -NTOSAPI
  4.6638 -NTSTATUS
  4.6639 -DDKAPI
  4.6640 -IoOpenDeviceRegistryKey(
  4.6641 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6642 -  /*IN*/ ULONG  DevInstKeyType,
  4.6643 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.6644 -  /*OUT*/ PHANDLE  DevInstRegKey);
  4.6645 -
  4.6646 -NTOSAPI
  4.6647 -NTSTATUS
  4.6648 -DDKAPI
  4.6649 -IoQueryDeviceDescription(
  4.6650 -  /*IN*/ PINTERFACE_TYPE  BusType  /*OPTIONAL*/,
  4.6651 -  /*IN*/ PULONG  BusNumber  /*OPTIONAL*/,
  4.6652 -  /*IN*/ PCONFIGURATION_TYPE  ControllerType  /*OPTIONAL*/,
  4.6653 -  /*IN*/ PULONG  ControllerNumber  /*OPTIONAL*/,
  4.6654 -  /*IN*/ PCONFIGURATION_TYPE  PeripheralType  /*OPTIONAL*/,
  4.6655 -  /*IN*/ PULONG  PeripheralNumber  /*OPTIONAL*/,
  4.6656 -  /*IN*/ PIO_QUERY_DEVICE_ROUTINE  CalloutRoutine,
  4.6657 -  /*IN*/ PVOID  Context);
  4.6658 -
  4.6659 -NTOSAPI
  4.6660 -VOID
  4.6661 -DDKAPI
  4.6662 -IoQueueWorkItem(
  4.6663 -  /*IN*/ PIO_WORKITEM  pIOWorkItem,
  4.6664 -  /*IN*/ PIO_WORKITEM_ROUTINE  Routine,
  4.6665 -  /*IN*/ WORK_QUEUE_TYPE  QueueType,
  4.6666 -  /*IN*/ PVOID  Context);
  4.6667 -
  4.6668 -NTOSAPI
  4.6669 -VOID
  4.6670 -DDKAPI
  4.6671 -IoRaiseHardError(
  4.6672 -  /*IN*/ PIRP  Irp,
  4.6673 -  /*IN*/ PVPB  Vpb  /*OPTIONAL*/,
  4.6674 -  /*IN*/ PDEVICE_OBJECT  RealDeviceObject);
  4.6675 -
  4.6676 -NTOSAPI
  4.6677 -BOOLEAN
  4.6678 -DDKAPI
  4.6679 -IoRaiseInformationalHardError(
  4.6680 -  /*IN*/ NTSTATUS  ErrorStatus,
  4.6681 -  /*IN*/ PUNICODE_STRING  String  /*OPTIONAL*/,
  4.6682 -  /*IN*/ PKTHREAD  Thread  /*OPTIONAL*/);
  4.6683 -
  4.6684 -NTOSAPI
  4.6685 -NTSTATUS
  4.6686 -DDKAPI
  4.6687 -IoReadDiskSignature(
  4.6688 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6689 -  /*IN*/ ULONG  BytesPerSector,
  4.6690 -  /*OUT*/ PDISK_SIGNATURE  Signature);
  4.6691 -
  4.6692 -NTOSAPI
  4.6693 -NTSTATUS
  4.6694 -DDKAPI
  4.6695 -IoReadPartitionTableEx(
  4.6696 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6697 -  /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX  **PartitionBuffer);
  4.6698 -
  4.6699 -NTOSAPI
  4.6700 -VOID
  4.6701 -DDKAPI
  4.6702 -IoRegisterBootDriverReinitialization(
  4.6703 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6704 -  /*IN*/ PDRIVER_REINITIALIZE  DriverReinitializationRoutine,
  4.6705 -  /*IN*/ PVOID  Context);
  4.6706 -
  4.6707 -NTOSAPI
  4.6708 -VOID
  4.6709 -DDKAPI
  4.6710 -IoRegisterBootDriverReinitialization(
  4.6711 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6712 -  /*IN*/ PDRIVER_REINITIALIZE  DriverReinitializationRoutine,
  4.6713 -  /*IN*/ PVOID  Context);
  4.6714 -
  4.6715 -NTOSAPI
  4.6716 -NTSTATUS
  4.6717 -DDKAPI
  4.6718 -IoRegisterDeviceInterface(
  4.6719 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  4.6720 -  /*IN*/ CONST GUID  *InterfaceClassGuid,
  4.6721 -  /*IN*/ PUNICODE_STRING  ReferenceString  /*OPTIONAL*/,
  4.6722 -  /*OUT*/ PUNICODE_STRING  SymbolicLinkName);
  4.6723 -
  4.6724 -NTOSAPI
  4.6725 -VOID
  4.6726 -DDKAPI
  4.6727 -IoRegisterDriverReinitialization(
  4.6728 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6729 -  /*IN*/ PDRIVER_REINITIALIZE  DriverReinitializationRoutine,
  4.6730 -  /*IN*/ PVOID  Context);
  4.6731 -
  4.6732 -NTOSAPI
  4.6733 -NTSTATUS
  4.6734 -DDKAPI
  4.6735 -IoRegisterPlugPlayNotification(
  4.6736 -  /*IN*/ IO_NOTIFICATION_EVENT_CATEGORY  EventCategory,
  4.6737 -  /*IN*/ ULONG  EventCategoryFlags,
  4.6738 -  /*IN*/ PVOID  EventCategoryData  /*OPTIONAL*/,
  4.6739 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6740 -  /*IN*/ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE  CallbackRoutine,
  4.6741 -  /*IN*/ PVOID  Context,
  4.6742 -  /*OUT*/ PVOID  *NotificationEntry);
  4.6743 -
  4.6744 -NTOSAPI
  4.6745 -NTSTATUS
  4.6746 -DDKAPI
  4.6747 -IoRegisterShutdownNotification(
  4.6748 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.6749 -
  4.6750 -NTOSAPI
  4.6751 -VOID
  4.6752 -DDKAPI
  4.6753 -IoReleaseCancelSpinLock(
  4.6754 -  /*IN*/ KIRQL  Irql);
  4.6755 -
  4.6756 -NTOSAPI
  4.6757 -VOID
  4.6758 -DDKAPI
  4.6759 -IoReleaseRemoveLockAndWaitEx(
  4.6760 -  /*IN*/ PIO_REMOVE_LOCK  RemoveLock,
  4.6761 -  /*IN*/ PVOID  Tag,
  4.6762 -  /*IN*/ ULONG  RemlockSize);
  4.6763 -
  4.6764 -/*
  4.6765 - * VOID
  4.6766 - * IoReleaseRemoveLockAndWait(
  4.6767 - * IN PIO_REMOVE_LOCK  RemoveLock,
  4.6768 - * IN PVOID  Tag)
  4.6769 - */
  4.6770 -#define IoReleaseRemoveLockAndWait(_RemoveLock, \
  4.6771 -                                   _Tag) \
  4.6772 -  IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
  4.6773 -
  4.6774 -NTOSAPI
  4.6775 -VOID
  4.6776 -DDKAPI
  4.6777 -IoReleaseRemoveLockEx(
  4.6778 -  /*IN*/ PIO_REMOVE_LOCK  RemoveLock,
  4.6779 -  /*IN*/ PVOID  Tag,
  4.6780 -  /*IN*/ ULONG  RemlockSize);
  4.6781 -
  4.6782 -/*
  4.6783 - * VOID
  4.6784 - * IoReleaseRemoveLock(
  4.6785 - * IN PIO_REMOVE_LOCK  RemoveLock,
  4.6786 - * IN PVOID  Tag)
  4.6787 - */
  4.6788 -#define IoReleaseRemoveLock(_RemoveLock, \
  4.6789 -                                   _Tag) \
  4.6790 -  IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
  4.6791 -
  4.6792 -NTOSAPI
  4.6793 -VOID
  4.6794 -DDKAPI
  4.6795 -IoRemoveShareAccess(
  4.6796 -  /*IN*/ PFILE_OBJECT  FileObject,
  4.6797 -  /*IN OUT*/ PSHARE_ACCESS  ShareAccess);
  4.6798 -
  4.6799 -NTOSAPI
  4.6800 -NTSTATUS
  4.6801 -DDKAPI
  4.6802 -IoReportDetectedDevice(
  4.6803 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6804 -  /*IN*/ INTERFACE_TYPE  LegacyBusType,
  4.6805 -  /*IN*/ ULONG  BusNumber,
  4.6806 -  /*IN*/ ULONG  SlotNumber,
  4.6807 -  /*IN*/ PCM_RESOURCE_LIST  ResourceList,
  4.6808 -  /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST  ResourceRequirements  /*OPTIONAL*/,
  4.6809 -  /*IN*/ BOOLEAN  ResourceAssigned,
  4.6810 -  /*IN OUT*/ PDEVICE_OBJECT  *DeviceObject);
  4.6811 -
  4.6812 -NTOSAPI
  4.6813 -NTSTATUS
  4.6814 -DDKAPI
  4.6815 -IoReportResourceForDetection(
  4.6816 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6817 -  /*IN*/ PCM_RESOURCE_LIST  DriverList  /*OPTIONAL*/,
  4.6818 -  /*IN*/ ULONG  DriverListSize  /*OPTIONAL*/,
  4.6819 -  /*IN*/ PDEVICE_OBJECT  DeviceObject  /*OPTIONAL*/,
  4.6820 -  /*IN*/ PCM_RESOURCE_LIST  DeviceList  /*OPTIONAL*/,
  4.6821 -  /*IN*/ ULONG  DeviceListSize  /*OPTIONAL*/,
  4.6822 -  /*OUT*/ PBOOLEAN  ConflictDetected);
  4.6823 -
  4.6824 -NTOSAPI
  4.6825 -NTSTATUS
  4.6826 -DDKAPI
  4.6827 -IoReportResourceUsage(
  4.6828 -  /*IN*/ PUNICODE_STRING  DriverClassName  /*OPTIONAL*/,
  4.6829 -  /*IN*/ PDRIVER_OBJECT  DriverObject,
  4.6830 -  /*IN*/ PCM_RESOURCE_LIST  DriverList  /*OPTIONAL*/,
  4.6831 -  /*IN*/ ULONG  DriverListSize  /*OPTIONAL*/,
  4.6832 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6833 -  /*IN*/ PCM_RESOURCE_LIST  DeviceList  /*OPTIONAL*/,
  4.6834 -  /*IN*/ ULONG  DeviceListSize  /*OPTIONAL*/,
  4.6835 -  /*IN*/ BOOLEAN  OverrideConflict,
  4.6836 -  /*OUT*/ PBOOLEAN  ConflictDetected);
  4.6837 -
  4.6838 -NTOSAPI
  4.6839 -NTSTATUS
  4.6840 -DDKAPI
  4.6841 -IoReportTargetDeviceChange(
  4.6842 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  4.6843 -  /*IN*/ PVOID  NotificationStructure);
  4.6844 -
  4.6845 -NTOSAPI
  4.6846 -NTSTATUS
  4.6847 -DDKAPI
  4.6848 -IoReportTargetDeviceChangeAsynchronous(
  4.6849 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject,
  4.6850 -  /*IN*/ PVOID  NotificationStructure,
  4.6851 -  /*IN*/ PDEVICE_CHANGE_COMPLETE_CALLBACK  Callback  /*OPTIONAL*/,
  4.6852 -  /*IN*/ PVOID  Context  /*OPTIONAL*/);
  4.6853 -
  4.6854 -NTOSAPI
  4.6855 -VOID
  4.6856 -DDKAPI
  4.6857 -IoRequestDeviceEject(
  4.6858 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject);
  4.6859 -
  4.6860 -/*
  4.6861 - * VOID
  4.6862 - * IoRequestDpc(
  4.6863 - * IN PDEVICE_OBJECT  DeviceObject,
  4.6864 - * IN PIRP  Irp,
  4.6865 - * IN PVOID  Context);
  4.6866 - */
  4.6867 -#define IoRequestDpc(DeviceObject, Irp, Context)( \
  4.6868 -  KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
  4.6869 -
  4.6870 -NTOSAPI
  4.6871 -VOID
  4.6872 -DDKAPI
  4.6873 -IoReuseIrp(
  4.6874 -  /*IN OUT*/ PIRP  Irp,
  4.6875 -  /*IN*/ NTSTATUS  Status);
  4.6876 -
  4.6877 -/*
  4.6878 - * PDRIVER_CANCEL
  4.6879 - * IoSetCancelRoutine(
  4.6880 - * IN PIRP  Irp,
  4.6881 - * IN PDRIVER_CANCEL  CancelRoutine)
  4.6882 - */
  4.6883 -#define IoSetCancelRoutine(_Irp, \
  4.6884 -                           _CancelRoutine) \
  4.6885 -  ((PDRIVER_CANCEL) InterlockedExchangePointer( \
  4.6886 -    (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)))
  4.6887 -
  4.6888 -/*
  4.6889 - * VOID
  4.6890 - * IoSetCompletionRoutine(
  4.6891 - * IN PIRP  Irp,
  4.6892 - * IN PIO_COMPLETION_ROUTINE  CompletionRoutine,
  4.6893 - * IN PVOID  Context,
  4.6894 - * IN BOOLEAN  InvokeOnSuccess,
  4.6895 - * IN BOOLEAN  InvokeOnError,
  4.6896 - * IN BOOLEAN  InvokeOnCancel)
  4.6897 - */
  4.6898 -#define IoSetCompletionRoutine(_Irp, \
  4.6899 -                               _CompletionRoutine, \
  4.6900 -                               _Context, \
  4.6901 -                               _InvokeOnSuccess, \
  4.6902 -                               _InvokeOnError, \
  4.6903 -                               _InvokeOnCancel) \
  4.6904 -{ \
  4.6905 -  PIO_STACK_LOCATION _IrpSp; \
  4.6906 -  ASSERT(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
  4.6907 -    _CompletionRoutine != NULL : TRUE); \
  4.6908 -  _IrpSp = IoGetNextIrpStackLocation(_Irp); \
  4.6909 -  _IrpSp->CompletionRoutine = (PIO_COMPLETION_ROUTINE)(_CompletionRoutine); \
  4.6910 -	_IrpSp->Context = (_Context); \
  4.6911 -  _IrpSp->Control = 0; \
  4.6912 -  if (_InvokeOnSuccess) _IrpSp->Control = SL_INVOKE_ON_SUCCESS; \
  4.6913 -  if (_InvokeOnError) _IrpSp->Control |= SL_INVOKE_ON_ERROR; \
  4.6914 -  if (_InvokeOnCancel) _IrpSp->Control |= SL_INVOKE_ON_CANCEL; \
  4.6915 -}
  4.6916 -
  4.6917 -NTOSAPI
  4.6918 -VOID
  4.6919 -DDKAPI
  4.6920 -IoSetCompletionRoutineEx(
  4.6921 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6922 -  /*IN*/ PIRP  Irp,
  4.6923 -  /*IN*/ PIO_COMPLETION_ROUTINE  CompletionRoutine,
  4.6924 -  /*IN*/ PVOID  Context,
  4.6925 -  /*IN*/ BOOLEAN    InvokeOnSuccess,
  4.6926 -  /*IN*/ BOOLEAN  InvokeOnError,
  4.6927 -  /*IN*/ BOOLEAN  InvokeOnCancel);
  4.6928 -
  4.6929 -NTOSAPI
  4.6930 -NTSTATUS
  4.6931 -DDKAPI
  4.6932 -IoSetDeviceInterfaceState(
  4.6933 -  /*IN*/ PUNICODE_STRING  SymbolicLinkName,
  4.6934 -  /*IN*/ BOOLEAN  Enable);
  4.6935 -
  4.6936 -NTOSAPI
  4.6937 -VOID
  4.6938 -DDKAPI
  4.6939 -IoSetHardErrorOrVerifyDevice(
  4.6940 -  /*IN*/ PIRP  Irp,
  4.6941 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.6942 -
  4.6943 -/*
  4.6944 - * VOID
  4.6945 - * IoSetNextIrpStackLocation(
  4.6946 - * IN OUT PIRP  Irp)
  4.6947 - */
  4.6948 -#define IoSetNextIrpStackLocation(_Irp) \
  4.6949 -{ \
  4.6950 -  (_Irp)->CurrentLocation--; \
  4.6951 -  (_Irp)->Tail.Overlay.CurrentStackLocation--; \
  4.6952 -}
  4.6953 -
  4.6954 -NTOSAPI
  4.6955 -NTSTATUS
  4.6956 -DDKAPI
  4.6957 -IoSetPartitionInformationEx(
  4.6958 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.6959 -  /*IN*/ ULONG  PartitionNumber,
  4.6960 -  /*IN*/ struct _SET_PARTITION_INFORMATION_EX  *PartitionInfo);
  4.6961 -
  4.6962 -NTOSAPI
  4.6963 -VOID
  4.6964 -DDKAPI
  4.6965 -IoSetShareAccess(
  4.6966 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.6967 -  /*IN*/ ULONG  DesiredShareAccess,
  4.6968 -  /*IN OUT*/ PFILE_OBJECT  FileObject,
  4.6969 -  /*OUT*/ PSHARE_ACCESS  ShareAccess);
  4.6970 -
  4.6971 -NTOSAPI
  4.6972 -VOID
  4.6973 -DDKAPI
  4.6974 -IoSetStartIoAttributes(
  4.6975 -  /*IN*/ PDEVICE_OBJECT  DeviceObject, 
  4.6976 -  /*IN*/ BOOLEAN  DeferredStartIo, 
  4.6977 -  /*IN*/ BOOLEAN  NonCancelable); 
  4.6978 -
  4.6979 -NTOSAPI
  4.6980 -NTSTATUS
  4.6981 -DDKAPI
  4.6982 -IoSetSystemPartition(
  4.6983 -  /*IN*/ PUNICODE_STRING  VolumeNameString);
  4.6984 -
  4.6985 -NTOSAPI
  4.6986 -BOOLEAN
  4.6987 -DDKAPI
  4.6988 -IoSetThreadHardErrorMode(
  4.6989 -  /*IN*/ BOOLEAN  EnableHardErrors);
  4.6990 -
  4.6991 -/*
  4.6992 - * USHORT
  4.6993 - * IoSizeOfIrp(
  4.6994 - * IN CCHAR  StackSize)
  4.6995 - */
  4.6996 -#define IoSizeOfIrp(_StackSize) \
  4.6997 -  ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
  4.6998 -
  4.6999 -/*
  4.7000 - * VOID
  4.7001 - * IoSkipCurrentIrpStackLocation(
  4.7002 - * IN PIRP  Irp)
  4.7003 - */
  4.7004 -#define IoSkipCurrentIrpStackLocation(_Irp) \
  4.7005 -{ \
  4.7006 -  (_Irp)->CurrentLocation++; \
  4.7007 -  (_Irp)->Tail.Overlay.CurrentStackLocation++; \
  4.7008 -}
  4.7009 -
  4.7010 -NTOSAPI
  4.7011 -VOID
  4.7012 -DDKAPI
  4.7013 -IoStartNextPacket(
  4.7014 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.7015 -  /*IN*/ BOOLEAN  Cancelable);
  4.7016 -
  4.7017 -NTOSAPI
  4.7018 -VOID
  4.7019 -DDKAPI
  4.7020 -IoStartNextPacketByKey(
  4.7021 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.7022 -  /*IN*/ BOOLEAN  Cancelable,
  4.7023 -  /*IN*/ ULONG  Key);
  4.7024 -
  4.7025 -NTOSAPI
  4.7026 -VOID
  4.7027 -DDKAPI
  4.7028 -IoStartPacket(
  4.7029 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.7030 -  /*IN*/ PIRP  Irp,
  4.7031 -  /*IN*/ PULONG  Key  /*OPTIONAL*/,
  4.7032 -  /*IN*/ PDRIVER_CANCEL  CancelFunction  /*OPTIONAL*/);
  4.7033 -
  4.7034 -NTOSAPI
  4.7035 -VOID
  4.7036 -DDKAPI
  4.7037 -IoStartTimer(
  4.7038 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.7039 -
  4.7040 -NTOSAPI
  4.7041 -VOID
  4.7042 -DDKAPI
  4.7043 -IoStopTimer(
  4.7044 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.7045 -
  4.7046 -NTOSAPI
  4.7047 -NTSTATUS
  4.7048 -DDKAPI
  4.7049 -IoUnregisterPlugPlayNotification(
  4.7050 -  /*IN*/ PVOID  NotificationEntry);
  4.7051 -
  4.7052 -NTOSAPI
  4.7053 -VOID
  4.7054 -DDKAPI
  4.7055 -IoUnregisterShutdownNotification(
  4.7056 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.7057 -
  4.7058 -NTOSAPI
  4.7059 -VOID
  4.7060 -DDKAPI
  4.7061 -IoUpdateShareAccess(
  4.7062 -  /*IN*/ PFILE_OBJECT  FileObject,
  4.7063 -  /*IN OUT*/ PSHARE_ACCESS  ShareAccess);
  4.7064 -
  4.7065 -NTOSAPI
  4.7066 -NTSTATUS
  4.7067 -DDKAPI
  4.7068 -IoVerifyPartitionTable(
  4.7069 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.7070 -  /*IN*/ BOOLEAN  FixErrors);
  4.7071 -
  4.7072 -NTOSAPI
  4.7073 -NTSTATUS
  4.7074 -DDKAPI
  4.7075 -IoVolumeDeviceToDosName(
  4.7076 -  /*IN*/ PVOID  VolumeDeviceObject,
  4.7077 -  /*OUT*/ PUNICODE_STRING  DosName);
  4.7078 -
  4.7079 -NTOSAPI
  4.7080 -NTSTATUS
  4.7081 -DDKAPI
  4.7082 -IoWMIAllocateInstanceIds(
  4.7083 -  /*IN*/ GUID  *Guid,
  4.7084 -  /*IN*/ ULONG  InstanceCount,
  4.7085 -  /*OUT*/ ULONG  *FirstInstanceId);
  4.7086 -
  4.7087 -NTOSAPI
  4.7088 -ULONG
  4.7089 -DDKAPI
  4.7090 -IoWMIDeviceObjectToProviderId(
  4.7091 -  /*IN*/ PDEVICE_OBJECT  DeviceObject);
  4.7092 -
  4.7093 -NTOSAPI
  4.7094 -NTSTATUS
  4.7095 -DDKAPI
  4.7096 -IoWMIDeviceObjectToInstanceName(
  4.7097 -  /*IN*/ PVOID  DataBlockObject,
  4.7098 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.7099 -  /*OUT*/ PUNICODE_STRING  InstanceName);
  4.7100 -
  4.7101 -NTOSAPI
  4.7102 -NTSTATUS
  4.7103 -DDKAPI
  4.7104 -IoWMIExecuteMethod(
  4.7105 -  /*IN*/ PVOID  DataBlockObject,
  4.7106 -  /*IN*/ PUNICODE_STRING  InstanceName,
  4.7107 -  /*IN*/ ULONG  MethodId,
  4.7108 -  /*IN*/ ULONG  InBufferSize,
  4.7109 -  /*IN OUT*/ PULONG  OutBufferSize,
  4.7110 -  /*IN OUT*/  PUCHAR  InOutBuffer);
  4.7111 -
  4.7112 -NTOSAPI
  4.7113 -NTSTATUS
  4.7114 -DDKAPI
  4.7115 -IoWMIHandleToInstanceName(
  4.7116 -  /*IN*/ PVOID  DataBlockObject,
  4.7117 -  /*IN*/ HANDLE  FileHandle,
  4.7118 -  /*OUT*/ PUNICODE_STRING  InstanceName);
  4.7119 -
  4.7120 -NTOSAPI
  4.7121 -NTSTATUS
  4.7122 -DDKAPI
  4.7123 -IoWMIOpenBlock(
  4.7124 -  /*IN*/ GUID  *DataBlockGuid,
  4.7125 -  /*IN*/ ULONG  DesiredAccess,
  4.7126 -  /*OUT*/ PVOID  *DataBlockObject);
  4.7127 -
  4.7128 -NTOSAPI
  4.7129 -NTSTATUS
  4.7130 -DDKAPI
  4.7131 -IoWMIQueryAllData(
  4.7132 -  /*IN*/ PVOID  DataBlockObject,
  4.7133 -  /*IN OUT*/ ULONG  *InOutBufferSize,
  4.7134 -  /*OUT*/ PVOID  OutBuffer);
  4.7135 -
  4.7136 -NTOSAPI
  4.7137 -NTSTATUS
  4.7138 -DDKAPI
  4.7139 -IoWMIQueryAllDataMultiple(
  4.7140 -  /*IN*/ PVOID  *DataBlockObjectList,
  4.7141 -  /*IN*/ ULONG  ObjectCount,
  4.7142 -  /*IN OUT*/ ULONG  *InOutBufferSize,
  4.7143 -  /*OUT*/ PVOID  OutBuffer);
  4.7144 -
  4.7145 -NTOSAPI
  4.7146 -NTSTATUS
  4.7147 -DDKAPI
  4.7148 -IoWMIQuerySingleInstance(
  4.7149 -  /*IN*/ PVOID  DataBlockObject,
  4.7150 -  /*IN*/ PUNICODE_STRING  InstanceName,
  4.7151 -  /*IN OUT*/ ULONG  *InOutBufferSize,
  4.7152 -  /*OUT*/ PVOID OutBuffer);
  4.7153 -
  4.7154 -NTOSAPI
  4.7155 -NTSTATUS
  4.7156 -DDKAPI
  4.7157 -IoWMIQuerySingleInstanceMultiple(
  4.7158 -  /*IN*/ PVOID  *DataBlockObjectList,
  4.7159 -  /*IN*/ PUNICODE_STRING  InstanceNames,
  4.7160 -  /*IN*/ ULONG  ObjectCount,
  4.7161 -  /*IN OUT*/ ULONG  *InOutBufferSize,
  4.7162 -  /*OUT*/ PVOID  OutBuffer);
  4.7163 -
  4.7164 -NTOSAPI
  4.7165 -NTSTATUS
  4.7166 -DDKAPI
  4.7167 -IoWMIRegistrationControl(
  4.7168 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.7169 -  /*IN*/ ULONG  Action);
  4.7170 -
  4.7171 -NTOSAPI
  4.7172 -NTSTATUS
  4.7173 -DDKAPI
  4.7174 -IoWMISetNotificationCallback(
  4.7175 -  /*IN*/ PVOID  Object,
  4.7176 -  /*IN*/ WMI_NOTIFICATION_CALLBACK  Callback,
  4.7177 -  /*IN*/ PVOID  Context);
  4.7178 -
  4.7179 -NTOSAPI
  4.7180 -NTSTATUS
  4.7181 -DDKAPI
  4.7182 -IoWMISetSingleInstance(
  4.7183 -  /*IN*/ PVOID  DataBlockObject,
  4.7184 -  /*IN*/ PUNICODE_STRING  InstanceName,
  4.7185 -  /*IN*/ ULONG  Version,
  4.7186 -  /*IN*/ ULONG  ValueBufferSize,
  4.7187 -  /*IN*/ PVOID  ValueBuffer);
  4.7188 -
  4.7189 -NTOSAPI
  4.7190 -NTSTATUS
  4.7191 -DDKAPI
  4.7192 -IoWMISetSingleItem(
  4.7193 -  /*IN*/ PVOID  DataBlockObject,
  4.7194 -  /*IN*/ PUNICODE_STRING  InstanceName,
  4.7195 -  /*IN*/ ULONG  DataItemId,
  4.7196 -  /*IN*/ ULONG  Version,
  4.7197 -  /*IN*/ ULONG  ValueBufferSize,
  4.7198 -  /*IN*/ PVOID  ValueBuffer);
  4.7199 -
  4.7200 -NTOSAPI
  4.7201 -NTSTATUS
  4.7202 -DDKAPI
  4.7203 -IoWMISuggestInstanceName(
  4.7204 -  /*IN*/ PDEVICE_OBJECT  PhysicalDeviceObject /*OPTIONAL*/,
  4.7205 -  /*IN*/ PUNICODE_STRING  SymbolicLinkName /*OPTIONAL*/,
  4.7206 -  /*IN*/ BOOLEAN  CombineNames,
  4.7207 -  /*OUT*/ PUNICODE_STRING  SuggestedInstanceName);
  4.7208 -
  4.7209 -NTOSAPI
  4.7210 -NTSTATUS
  4.7211 -DDKAPI
  4.7212 -IoWMIWriteEvent(
  4.7213 -  /*IN*/ PVOID  WnodeEventItem);
  4.7214 -
  4.7215 -NTOSAPI
  4.7216 -VOID
  4.7217 -DDKAPI
  4.7218 -IoWriteErrorLogEntry(
  4.7219 -  /*IN*/ PVOID  ElEntry);
  4.7220 -
  4.7221 -NTOSAPI
  4.7222 -NTSTATUS
  4.7223 -DDKAPI
  4.7224 -IoWritePartitionTableEx(
  4.7225 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.7226 -  /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX  *PartitionBuffer);
  4.7227 -
  4.7228 -
  4.7229 -
  4.7230 -/** Kernel routines **/
  4.7231 -
  4.7232 -NTOSAPI
  4.7233 -VOID
  4.7234 -DDKFASTAPI
  4.7235 -KeAcquireInStackQueuedSpinLock(
  4.7236 -  /*IN*/ PKSPIN_LOCK  SpinLock,
  4.7237 -  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  4.7238 -
  4.7239 -NTOSAPI
  4.7240 -VOID
  4.7241 -DDKFASTAPI
  4.7242 -KeAcquireInStackQueuedSpinLockAtDpcLevel(
  4.7243 -  /*IN*/ PKSPIN_LOCK  SpinLock,
  4.7244 -  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  4.7245 -
  4.7246 -NTOSAPI
  4.7247 -KIRQL
  4.7248 -DDKAPI
  4.7249 -KeAcquireInterruptSpinLock(
  4.7250 -  /*IN*/ PKINTERRUPT  Interrupt);
  4.7251 -
  4.7252 -NTOSAPI
  4.7253 -VOID
  4.7254 -DDKAPI
  4.7255 -KeAcquireSpinLock(
  4.7256 -  /*IN*/ PKSPIN_LOCK  SpinLock,
  4.7257 -  /*OUT*/ PKIRQL  OldIrql);
  4.7258 -
  4.7259 -/* System Service Dispatch Table */
  4.7260 -typedef PVOID (NTAPI * SSDT)(VOID);
  4.7261 -typedef SSDT * PSSDT;
  4.7262 -
  4.7263 -/* System Service Parameters Table */
  4.7264 -typedef UCHAR SSPT, * PSSPT;
  4.7265 -
  4.7266 -typedef struct _SSDT_ENTRY {
  4.7267 -	PSSDT  SSDT;
  4.7268 -	PULONG  ServiceCounterTable;
  4.7269 -	ULONG  NumberOfServices;
  4.7270 -	PSSPT  SSPT;
  4.7271 -} SSDT_ENTRY, *PSSDT_ENTRY;
  4.7272 -
  4.7273 -NTOSAPI
  4.7274 -BOOLEAN
  4.7275 -DDKAPI
  4.7276 -KeAddSystemServiceTable(
  4.7277 -  /*IN*/ PSSDT  SSDT,
  4.7278 -  /*IN*/ PULONG  ServiceCounterTable,
  4.7279 -  /*IN*/ ULONG  NumberOfServices,
  4.7280 -  /*IN*/ PSSPT  SSPT,
  4.7281 -  /*IN*/ ULONG  TableIndex);
  4.7282 -
  4.7283 -NTOSAPI
  4.7284 -BOOLEAN
  4.7285 -DDKAPI
  4.7286 -KeAreApcsDisabled(
  4.7287 -  VOID);
  4.7288 -
  4.7289 -NTOSAPI
  4.7290 -VOID
  4.7291 -DDKAPI
  4.7292 -KeAttachProcess(
  4.7293 -  /*IN*/ PEPROCESS  Process);
  4.7294 -
  4.7295 -NTOSAPI
  4.7296 -VOID
  4.7297 -DDKAPI
  4.7298 -KeBugCheck(
  4.7299 -  /*IN*/ ULONG  BugCheckCode);
  4.7300 -
  4.7301 -NTOSAPI
  4.7302 -VOID
  4.7303 -DDKAPI
  4.7304 -KeBugCheckEx(
  4.7305 -  /*IN*/ ULONG  BugCheckCode,
  4.7306 -  /*IN*/ ULONG_PTR  BugCheckParameter1,
  4.7307 -  /*IN*/ ULONG_PTR  BugCheckParameter2,
  4.7308 -  /*IN*/ ULONG_PTR  BugCheckParameter3,
  4.7309 -  /*IN*/ ULONG_PTR  BugCheckParameter4);
  4.7310 -
  4.7311 -NTOSAPI
  4.7312 -BOOLEAN
  4.7313 -DDKAPI
  4.7314 -KeCancelTimer(
  4.7315 -  /*IN*/ PKTIMER  Timer);
  4.7316 -
  4.7317 -NTOSAPI
  4.7318 -VOID
  4.7319 -DDKAPI
  4.7320 -KeClearEvent(
  4.7321 -  /*IN*/ PRKEVENT  Event);
  4.7322 -
  4.7323 -NTOSAPI
  4.7324 -NTSTATUS
  4.7325 -DDKAPI
  4.7326 -KeDelayExecutionThread(
  4.7327 -  /*IN*/ KPROCESSOR_MODE  WaitMode,
  4.7328 -  /*IN*/ BOOLEAN  Alertable,
  4.7329 -  /*IN*/ PLARGE_INTEGER  Interval);
  4.7330 -
  4.7331 -NTOSAPI
  4.7332 -BOOLEAN
  4.7333 -DDKAPI
  4.7334 -KeDeregisterBugCheckCallback(
  4.7335 -  /*IN*/ PKBUGCHECK_CALLBACK_RECORD  CallbackRecord);
  4.7336 -
  4.7337 -NTOSAPI
  4.7338 -VOID
  4.7339 -DDKAPI
  4.7340 -KeDetachProcess(
  4.7341 -  VOID);
  4.7342 -
  4.7343 -NTOSAPI
  4.7344 -VOID
  4.7345 -DDKAPI
  4.7346 -KeEnterCriticalRegion(
  4.7347 -  VOID);
  4.7348 -
  4.7349 -/*
  4.7350 - * VOID
  4.7351 - * KeFlushIoBuffers(
  4.7352 - * IN PMDL  Mdl,
  4.7353 - * IN BOOLEAN  ReadOperation,
  4.7354 - * IN BOOLEAN  DmaOperation)
  4.7355 - */
  4.7356 -#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
  4.7357 -
  4.7358 -NTOSAPI
  4.7359 -PRKTHREAD
  4.7360 -DDKAPI
  4.7361 -KeGetCurrentThread(
  4.7362 -  VOID);
  4.7363 -
  4.7364 -NTOSAPI
  4.7365 -KPROCESSOR_MODE
  4.7366 -DDKAPI
  4.7367 -KeGetPreviousMode(
  4.7368 -  VOID);
  4.7369 -
  4.7370 -NTOSAPI
  4.7371 -ULONG
  4.7372 -DDKAPI
  4.7373 -KeGetRecommendedSharedDataAlignment(
  4.7374 -  VOID);
  4.7375 -
  4.7376 -NTOSAPI
  4.7377 -VOID
  4.7378 -DDKAPI
  4.7379 -KeInitializeApc(
  4.7380 -  /*IN*/ PKAPC  Apc,
  4.7381 -  /*IN*/ PKTHREAD  Thread,
  4.7382 -  /*IN*/ UCHAR  StateIndex,
  4.7383 -  /*IN*/ PKKERNEL_ROUTINE  KernelRoutine,
  4.7384 -  /*IN*/ PKRUNDOWN_ROUTINE  RundownRoutine,
  4.7385 -  /*IN*/ PKNORMAL_ROUTINE  NormalRoutine,
  4.7386 -  /*IN*/ UCHAR  Mode,
  4.7387 -  /*IN*/ PVOID  Context);
  4.7388 -
  4.7389 -NTOSAPI
  4.7390 -VOID
  4.7391 -DDKAPI
  4.7392 -KeInitializeDeviceQueue(
  4.7393 -  /*IN*/ PKDEVICE_QUEUE  DeviceQueue);
  4.7394 -
  4.7395 -NTOSAPI
  4.7396 -VOID
  4.7397 -DDKAPI
  4.7398 -KeInitializeMutex(
  4.7399 -  /*IN*/ PRKMUTEX  Mutex,
  4.7400 -  /*IN*/ ULONG  Level);
  4.7401 -
  4.7402 -NTOSAPI
  4.7403 -VOID
  4.7404 -DDKAPI
  4.7405 -KeInitializeSemaphore(
  4.7406 -  /*IN*/ PRKSEMAPHORE  Semaphore,
  4.7407 -  /*IN*/ LONG  Count,
  4.7408 -  /*IN*/ LONG  Limit);
  4.7409 -
  4.7410 -NTOSAPI
  4.7411 -VOID
  4.7412 -DDKAPI
  4.7413 -KeInitializeSpinLock(
  4.7414 -  /*IN*/ PKSPIN_LOCK  SpinLock);
  4.7415 -
  4.7416 -NTOSAPI
  4.7417 -VOID
  4.7418 -DDKAPI
  4.7419 -KeInitializeTimer(
  4.7420 -  /*IN*/ PKTIMER  Timer);
  4.7421 -
  4.7422 -NTOSAPI
  4.7423 -VOID
  4.7424 -DDKAPI
  4.7425 -KeInitializeTimerEx(
  4.7426 -  /*IN*/ PKTIMER  Timer,
  4.7427 -  /*IN*/ TIMER_TYPE  Type);
  4.7428 -
  4.7429 -NTOSAPI
  4.7430 -BOOLEAN
  4.7431 -DDKAPI
  4.7432 -KeInsertByKeyDeviceQueue(
  4.7433 -  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  4.7434 -  /*IN*/ PKDEVICE_QUEUE_ENTRY  DeviceQueueEntry,
  4.7435 -  /*IN*/ ULONG  SortKey);
  4.7436 -
  4.7437 -NTOSAPI
  4.7438 -BOOLEAN
  4.7439 -DDKAPI
  4.7440 -KeInsertDeviceQueue(
  4.7441 -  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  4.7442 -  /*IN*/ PKDEVICE_QUEUE_ENTRY  DeviceQueueEntry);
  4.7443 -
  4.7444 -NTOSAPI
  4.7445 -BOOLEAN
  4.7446 -DDKAPI
  4.7447 -KeInsertQueueDpc(
  4.7448 -  /*IN*/ PRKDPC  Dpc,
  4.7449 -  /*IN*/ PVOID  SystemArgument1,
  4.7450 -  /*IN*/ PVOID  SystemArgument2);
  4.7451 -
  4.7452 -NTOSAPI
  4.7453 -VOID
  4.7454 -DDKAPI
  4.7455 -KeLeaveCriticalRegion(
  4.7456 -  VOID);
  4.7457 -
  4.7458 -NTOSAPI
  4.7459 -NTSTATUS
  4.7460 -DDKAPI
  4.7461 -KePulseEvent(
  4.7462 -  /*IN*/ PRKEVENT  Event,
  4.7463 -  /*IN*/ KPRIORITY  Increment,
  4.7464 -  /*IN*/ BOOLEAN  Wait);
  4.7465 -
  4.7466 -NTOSAPI
  4.7467 -ULONGLONG
  4.7468 -DDKAPI
  4.7469 -KeQueryInterruptTime(
  4.7470 -  VOID);
  4.7471 -
  4.7472 -NTOSAPI
  4.7473 -LARGE_INTEGER
  4.7474 -DDKAPI
  4.7475 -KeQueryPerformanceCounter(
  4.7476 -  /*OUT*/ PLARGE_INTEGER  PerformanceFrequency  /*OPTIONAL*/);
  4.7477 -
  4.7478 -NTOSAPI
  4.7479 -KPRIORITY
  4.7480 -DDKAPI
  4.7481 -KeQueryPriorityThread(
  4.7482 -  /*IN*/ PRKTHREAD  Thread);
  4.7483 -
  4.7484 -NTOSAPI
  4.7485 -VOID
  4.7486 -DDKAPI
  4.7487 -KeQuerySystemTime(
  4.7488 -  /*OUT*/ PLARGE_INTEGER  CurrentTime);
  4.7489 -
  4.7490 -NTOSAPI
  4.7491 -VOID
  4.7492 -DDKAPI
  4.7493 -KeQueryTickCount(
  4.7494 -  /*OUT*/ PLARGE_INTEGER  TickCount);
  4.7495 -
  4.7496 -NTOSAPI
  4.7497 -ULONG
  4.7498 -DDKAPI
  4.7499 -KeQueryTimeIncrement(
  4.7500 -  VOID);
  4.7501 -
  4.7502 -NTOSAPI
  4.7503 -LONG
  4.7504 -DDKAPI
  4.7505 -KeReadStateEvent(
  4.7506 -  /*IN*/ PRKEVENT  Event);
  4.7507 -
  4.7508 -NTOSAPI
  4.7509 -LONG
  4.7510 -DDKAPI
  4.7511 -KeReadStateMutex(
  4.7512 -  /*IN*/ PRKMUTEX  Mutex);
  4.7513 -
  4.7514 -NTOSAPI
  4.7515 -LONG
  4.7516 -DDKAPI
  4.7517 -KeReadStateSemaphore(
  4.7518 -  /*IN*/ PRKSEMAPHORE  Semaphore);
  4.7519 -
  4.7520 -NTOSAPI
  4.7521 -BOOLEAN
  4.7522 -DDKAPI
  4.7523 -KeReadStateTimer(
  4.7524 -  /*IN*/ PKTIMER  Timer);
  4.7525 -
  4.7526 -NTOSAPI
  4.7527 -BOOLEAN
  4.7528 -DDKAPI
  4.7529 -KeRegisterBugCheckCallback(
  4.7530 -  /*IN*/ PKBUGCHECK_CALLBACK_RECORD  CallbackRecord,
  4.7531 -  /*IN*/ PKBUGCHECK_CALLBACK_ROUTINE  CallbackRoutine,
  4.7532 -  /*IN*/ PVOID  Buffer,
  4.7533 -  /*IN*/ ULONG  Length,
  4.7534 -  /*IN*/ PUCHAR  Component);
  4.7535 -
  4.7536 -NTOSAPI
  4.7537 -VOID
  4.7538 -DDKFASTAPI
  4.7539 -KeReleaseInStackQueuedSpinLock(
  4.7540 -  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  4.7541 -
  4.7542 -NTOSAPI
  4.7543 -VOID
  4.7544 -DDKFASTAPI
  4.7545 -KeReleaseInStackQueuedSpinLockFromDpcLevel(
  4.7546 -  /*IN*/ PKLOCK_QUEUE_HANDLE  LockHandle);
  4.7547 -
  4.7548 -NTOSAPI
  4.7549 -VOID
  4.7550 -DDKAPI
  4.7551 -KeReleaseInterruptSpinLock(
  4.7552 -  /*IN*/ PKINTERRUPT  Interrupt,
  4.7553 -  /*IN*/ KIRQL  OldIrql);
  4.7554 -
  4.7555 -NTOSAPI
  4.7556 -LONG
  4.7557 -DDKAPI
  4.7558 -KeReleaseMutex(
  4.7559 -  /*IN*/ PRKMUTEX  Mutex,
  4.7560 -  /*IN*/ BOOLEAN  Wait);
  4.7561 -
  4.7562 -NTOSAPI
  4.7563 -LONG
  4.7564 -DDKAPI
  4.7565 -KeReleaseSemaphore(
  4.7566 -  /*IN*/ PRKSEMAPHORE  Semaphore,
  4.7567 -  /*IN*/ KPRIORITY  Increment,
  4.7568 -  /*IN*/ LONG  Adjustment,
  4.7569 -  /*IN*/ BOOLEAN  Wait);
  4.7570 -
  4.7571 -NTOSAPI
  4.7572 -VOID
  4.7573 -DDKAPI
  4.7574 -KeReleaseSpinLock(
  4.7575 -  /*IN*/ PKSPIN_LOCK  SpinLock,
  4.7576 -  /*IN*/ KIRQL  NewIrql);
  4.7577 -
  4.7578 -NTOSAPI
  4.7579 -PKDEVICE_QUEUE_ENTRY
  4.7580 -DDKAPI 
  4.7581 -KeRemoveByKeyDeviceQueue(
  4.7582 -  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  4.7583 -  /*IN*/ ULONG  SortKey);
  4.7584 -
  4.7585 -NTOSAPI
  4.7586 -PKDEVICE_QUEUE_ENTRY
  4.7587 -DDKAPI
  4.7588 -KeRemoveDeviceQueue(
  4.7589 -  /*IN*/ PKDEVICE_QUEUE  DeviceQueue);
  4.7590 -
  4.7591 -NTOSAPI
  4.7592 -BOOLEAN
  4.7593 -DDKAPI
  4.7594 -KeRemoveEntryDeviceQueue(
  4.7595 -  /*IN*/ PKDEVICE_QUEUE  DeviceQueue,
  4.7596 -  /*IN*/ PKDEVICE_QUEUE_ENTRY  DeviceQueueEntry);
  4.7597 -
  4.7598 -NTOSAPI
  4.7599 -BOOLEAN
  4.7600 -DDKAPI
  4.7601 -KeRemoveQueueDpc(
  4.7602 -  /*IN*/ PRKDPC  Dpc);
  4.7603 -
  4.7604 -NTOSAPI
  4.7605 -LONG
  4.7606 -DDKAPI
  4.7607 -KeResetEvent(
  4.7608 -  /*IN*/ PRKEVENT  Event);
  4.7609 -
  4.7610 -NTOSAPI
  4.7611 -NTSTATUS
  4.7612 -DDKAPI
  4.7613 -KeRestoreFloatingPointState(
  4.7614 -  /*IN*/ PKFLOATING_SAVE  FloatSave);
  4.7615 -
  4.7616 -NTOSAPI
  4.7617 -NTSTATUS
  4.7618 -DDKAPI
  4.7619 -KeSaveFloatingPointState(
  4.7620 -  /*OUT*/ PKFLOATING_SAVE  FloatSave);
  4.7621 -
  4.7622 -NTOSAPI
  4.7623 -LONG
  4.7624 -DDKAPI
  4.7625 -KeSetBasePriorityThread(
  4.7626 -  /*IN*/ PRKTHREAD  Thread,
  4.7627 -  /*IN*/ LONG  Increment);
  4.7628 -
  4.7629 -NTOSAPI
  4.7630 -LONG
  4.7631 -DDKAPI
  4.7632 -KeSetEvent(
  4.7633 -  /*IN*/ PRKEVENT  Event,
  4.7634 -  /*IN*/ KPRIORITY  Increment,
  4.7635 -  /*IN*/ BOOLEAN  Wait);
  4.7636 -
  4.7637 -NTOSAPI
  4.7638 -VOID
  4.7639 -DDKAPI
  4.7640 -KeSetImportanceDpc(
  4.7641 -  /*IN*/ PRKDPC  Dpc,
  4.7642 -  /*IN*/ KDPC_IMPORTANCE  Importance);
  4.7643 -
  4.7644 -NTOSAPI
  4.7645 -KPRIORITY
  4.7646 -DDKAPI
  4.7647 -KeSetPriorityThread(
  4.7648 -  /*IN*/ PKTHREAD  Thread,
  4.7649 -  /*IN*/ KPRIORITY  Priority);
  4.7650 -
  4.7651 -NTOSAPI
  4.7652 -VOID
  4.7653 -DDKAPI
  4.7654 -KeSetTargetProcessorDpc(
  4.7655 -  /*IN*/ PRKDPC  Dpc,
  4.7656 -  /*IN*/ CCHAR  Number);
  4.7657 -
  4.7658 -NTOSAPI
  4.7659 -BOOLEAN
  4.7660 -DDKAPI
  4.7661 -KeSetTimer(
  4.7662 -  /*IN*/ PKTIMER  Timer,
  4.7663 -  /*IN*/ LARGE_INTEGER  DueTime,
  4.7664 -  /*IN*/ PKDPC  Dpc  /*OPTIONAL*/);
  4.7665 -
  4.7666 -NTOSAPI
  4.7667 -BOOLEAN
  4.7668 -DDKAPI
  4.7669 -KeSetTimerEx(
  4.7670 -  /*IN*/ PKTIMER  Timer,
  4.7671 -  /*IN*/ LARGE_INTEGER  DueTime,
  4.7672 -  /*IN*/ LONG  Period  /*OPTIONAL*/,
  4.7673 -  /*IN*/ PKDPC  Dpc  /*OPTIONAL*/);
  4.7674 -
  4.7675 -NTOSAPI
  4.7676 -VOID
  4.7677 -DDKFASTAPI
  4.7678 -KeSetTimeUpdateNotifyRoutine(
  4.7679 -  /*IN*/ PTIME_UPDATE_NOTIFY_ROUTINE  NotifyRoutine);
  4.7680 -
  4.7681 -NTOSAPI
  4.7682 -VOID
  4.7683 -DDKAPI
  4.7684 -KeStallExecutionProcessor(
  4.7685 -  /*IN*/ ULONG  MicroSeconds);
  4.7686 -
  4.7687 -NTOSAPI
  4.7688 -BOOLEAN
  4.7689 -DDKAPI
  4.7690 -KeSynchronizeExecution(
  4.7691 -  /*IN*/ PKINTERRUPT    Interrupt,
  4.7692 -  /*IN*/ PKSYNCHRONIZE_ROUTINE  SynchronizeRoutine,
  4.7693 -  /*IN*/ PVOID  SynchronizeContext);
  4.7694 -
  4.7695 -NTOSAPI
  4.7696 -NTSTATUS
  4.7697 -DDKAPI
  4.7698 -KeWaitForMultipleObjects(
  4.7699 -  /*IN*/ ULONG  Count,
  4.7700 -  /*IN*/ PVOID  Object[],
  4.7701 -  /*IN*/ WAIT_TYPE  WaitType,
  4.7702 -  /*IN*/ KWAIT_REASON  WaitReason,
  4.7703 -  /*IN*/ KPROCESSOR_MODE  WaitMode,
  4.7704 -  /*IN*/ BOOLEAN  Alertable,
  4.7705 -  /*IN*/ PLARGE_INTEGER  Timeout  /*OPTIONAL */,
  4.7706 -  /*IN*/ PKWAIT_BLOCK  WaitBlockArray  /*OPTIONAL*/);
  4.7707 -
  4.7708 -NTOSAPI
  4.7709 -NTSTATUS
  4.7710 -DDKAPI
  4.7711 -KeWaitForMutexObject(
  4.7712 -  /*IN*/ PRKMUTEX  Mutex,
  4.7713 -  /*IN*/ KWAIT_REASON  WaitReason,
  4.7714 -  /*IN*/ KPROCESSOR_MODE  WaitMode,
  4.7715 -  /*IN*/ BOOLEAN  Alertable,
  4.7716 -  /*IN*/ PLARGE_INTEGER  Timeout  /*OPTIONAL*/);
  4.7717 -
  4.7718 -NTOSAPI
  4.7719 -NTSTATUS
  4.7720 -DDKAPI
  4.7721 -KeWaitForSingleObject(
  4.7722 -  /*IN*/ PVOID  Object,
  4.7723 -  /*IN*/ KWAIT_REASON  WaitReason,
  4.7724 -  /*IN*/ KPROCESSOR_MODE  WaitMode,
  4.7725 -  /*IN*/ BOOLEAN  Alertable,
  4.7726 -  /*IN*/ PLARGE_INTEGER  Timeout  /*OPTIONAL*/);
  4.7727 -
  4.7728 -#if defined(_X86_)
  4.7729 -
  4.7730 -NTOSAPI
  4.7731 -VOID
  4.7732 -FASTCALL
  4.7733 -KfLowerIrql(
  4.7734 -  /*IN*/ KIRQL  NewIrql);
  4.7735 -
  4.7736 -NTOSAPI
  4.7737 -KIRQL
  4.7738 -FASTCALL
  4.7739 -KfRaiseIrql(
  4.7740 -  /*IN*/ KIRQL  NewIrql);
  4.7741 -
  4.7742 -#define KeLowerIrql(a) KfLowerIrql(a)
  4.7743 -#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
  4.7744 -
  4.7745 -#else
  4.7746 -
  4.7747 -NTOSAPI
  4.7748 -VOID
  4.7749 -DDKAPI
  4.7750 -KeLowerIrql(
  4.7751 -  /*IN*/ KIRQL  NewIrql);
  4.7752 -
  4.7753 -NTOSAPI
  4.7754 -KIRQL
  4.7755 -DDKAPI
  4.7756 -KeRaiseIrql(
  4.7757 -  /*IN*/ KIRQL  NewIrql);
  4.7758 -
  4.7759 -#endif
  4.7760 -
  4.7761 -NTOSAPI
  4.7762 -KIRQL
  4.7763 -DDKAPI
  4.7764 -KeRaiseIrqlToDpcLevel(
  4.7765 -  VOID);
  4.7766 -
  4.7767 -/** Memory manager routines **/
  4.7768 -
  4.7769 -NTOSAPI
  4.7770 -NTSTATUS
  4.7771 -DDKAPI
  4.7772 -MmAdvanceMdl(
  4.7773 -  /*IN*/ PMDL  Mdl,
  4.7774 -  /*IN*/ ULONG  NumberOfBytes);
  4.7775 -
  4.7776 -NTOSAPI
  4.7777 -PVOID
  4.7778 -DDKAPI
  4.7779 -MmAllocateContiguousMemory(
  4.7780 -  /*IN*/ ULONG  NumberOfBytes,
  4.7781 -  /*IN*/ PHYSICAL_ADDRESS  HighestAcceptableAddress);
  4.7782 -
  4.7783 -NTOSAPI
  4.7784 -PVOID
  4.7785 -DDKAPI
  4.7786 -MmAllocateContiguousMemorySpecifyCache(
  4.7787 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.7788 -  /*IN*/ PHYSICAL_ADDRESS  LowestAcceptableAddress,
  4.7789 -  /*IN*/ PHYSICAL_ADDRESS  HighestAcceptableAddress,
  4.7790 -  /*IN*/ PHYSICAL_ADDRESS  BoundaryAddressMultiple  /*OPTIONAL*/,
  4.7791 -  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  4.7792 -
  4.7793 -NTOSAPI
  4.7794 -PVOID
  4.7795 -DDKAPI
  4.7796 -MmAllocateMappingAddress(
  4.7797 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.7798 -  /*IN*/ ULONG  PoolTag);
  4.7799 -
  4.7800 -NTOSAPI
  4.7801 -PVOID
  4.7802 -DDKAPI
  4.7803 -MmAllocateNonCachedMemory(
  4.7804 -  /*IN*/ ULONG  NumberOfBytes);
  4.7805 -
  4.7806 -NTOSAPI
  4.7807 -PMDL
  4.7808 -DDKAPI
  4.7809 -MmAllocatePagesForMdl(
  4.7810 -  /*IN*/ PHYSICAL_ADDRESS  LowAddress,
  4.7811 -  /*IN*/ PHYSICAL_ADDRESS  HighAddress,
  4.7812 -  /*IN*/ PHYSICAL_ADDRESS  SkipBytes,
  4.7813 -  /*IN*/ SIZE_T  TotalBytes);
  4.7814 -
  4.7815 -NTOSAPI
  4.7816 -VOID
  4.7817 -DDKAPI
  4.7818 -MmBuildMdlForNonPagedPool(
  4.7819 -  /*IN OUT*/ PMDL  MemoryDescriptorList);
  4.7820 -
  4.7821 -NTOSAPI
  4.7822 -NTSTATUS
  4.7823 -DDKAPI
  4.7824 -MmCreateSection(
  4.7825 -  /*OUT*/ PSECTION_OBJECT  *SectionObject,
  4.7826 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.7827 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes  /*OPTIONAL*/,
  4.7828 -  /*IN*/ PLARGE_INTEGER  MaximumSize,
  4.7829 -  /*IN*/ ULONG  SectionPageProtection,
  4.7830 -  /*IN*/ ULONG  AllocationAttributes,
  4.7831 -  /*IN*/ HANDLE  FileHandle  /*OPTIONAL*/,
  4.7832 -  /*IN*/ PFILE_OBJECT  File  /*OPTIONAL*/);
  4.7833 -
  4.7834 -typedef enum _MMFLUSH_TYPE {
  4.7835 -  MmFlushForDelete,
  4.7836 -  MmFlushForWrite
  4.7837 -} MMFLUSH_TYPE;
  4.7838 -
  4.7839 -NTOSAPI
  4.7840 -BOOLEAN
  4.7841 -DDKAPI
  4.7842 -MmFlushImageSection(
  4.7843 -  /*IN*/ PSECTION_OBJECT_POINTERS  SectionObjectPointer,
  4.7844 -  /*IN*/ MMFLUSH_TYPE  FlushType);
  4.7845 -
  4.7846 -NTOSAPI
  4.7847 -VOID
  4.7848 -DDKAPI
  4.7849 -MmFreeContiguousMemory(
  4.7850 -  /*IN*/ PVOID  BaseAddress);
  4.7851 -
  4.7852 -NTOSAPI
  4.7853 -VOID
  4.7854 -DDKAPI
  4.7855 -MmFreeContiguousMemorySpecifyCache(
  4.7856 -  /*IN*/ PVOID  BaseAddress,
  4.7857 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.7858 -  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  4.7859 -
  4.7860 -NTOSAPI
  4.7861 -VOID
  4.7862 -DDKAPI
  4.7863 -MmFreeMappingAddress(
  4.7864 -  /*IN*/ PVOID  BaseAddress,
  4.7865 -  /*IN*/ ULONG  PoolTag);
  4.7866 -
  4.7867 -NTOSAPI
  4.7868 -VOID
  4.7869 -DDKAPI
  4.7870 -MmFreeNonCachedMemory(
  4.7871 -  /*IN*/ PVOID  BaseAddress,
  4.7872 -  /*IN*/ SIZE_T  NumberOfBytes);
  4.7873 -
  4.7874 -NTOSAPI
  4.7875 -VOID
  4.7876 -DDKAPI
  4.7877 -MmFreePagesFromMdl(
  4.7878 -  /*IN*/ PMDL  MemoryDescriptorList);
  4.7879 -
  4.7880 -/*
  4.7881 - * ULONG
  4.7882 - * MmGetMdlByteCount(
  4.7883 - * IN PMDL  Mdl)
  4.7884 - */
  4.7885 -#define MmGetMdlByteCount(_Mdl) \
  4.7886 -  ((_Mdl)->ByteCount)
  4.7887 -
  4.7888 -/*
  4.7889 - * ULONG
  4.7890 - * MmGetMdlByteOffset(
  4.7891 - * IN PMDL  Mdl)
  4.7892 - */
  4.7893 -#define MmGetMdlByteOffset(_Mdl) \
  4.7894 -  ((_Mdl)->ByteOffset)
  4.7895 -
  4.7896 -/*
  4.7897 - * PPFN_NUMBER
  4.7898 - * MmGetMdlPfnArray(
  4.7899 - * IN PMDL  Mdl)
  4.7900 - */
  4.7901 -#define MmGetMdlPfnArray(_Mdl) \
  4.7902 -  ((PPFN_NUMBER) ((_Mdl) + 1))
  4.7903 -
  4.7904 -/*
  4.7905 - * PVOID
  4.7906 - * MmGetMdlVirtualAddress(
  4.7907 - * IN PMDL  Mdl)
  4.7908 - */
  4.7909 -#define MmGetMdlVirtualAddress(_Mdl) \
  4.7910 -  ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
  4.7911 -
  4.7912 -NTOSAPI
  4.7913 -PHYSICAL_ADDRESS
  4.7914 -DDKAPI
  4.7915 -MmGetPhysicalAddress(
  4.7916 -  /*IN*/ PVOID  BaseAddress);
  4.7917 -
  4.7918 -NTOSAPI
  4.7919 -PPHYSICAL_MEMORY_RANGE
  4.7920 -DDKAPI
  4.7921 -MmGetPhysicalMemoryRanges(
  4.7922 -  VOID);
  4.7923 -
  4.7924 -NTOSAPI
  4.7925 -PVOID
  4.7926 -DDKAPI
  4.7927 -MmGetVirtualForPhysical(
  4.7928 -  /*IN*/ PHYSICAL_ADDRESS  PhysicalAddress);
  4.7929 -
  4.7930 -NTOSAPI
  4.7931 -PVOID
  4.7932 -DDKAPI
  4.7933 -MmMapLockedPagesSpecifyCache(
  4.7934 -  /*IN*/ PMDL  MemoryDescriptorList,
  4.7935 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.7936 -  /*IN*/ MEMORY_CACHING_TYPE  CacheType,
  4.7937 -  /*IN*/ PVOID  BaseAddress,
  4.7938 -  /*IN*/ ULONG  BugCheckOnFailure,
  4.7939 -  /*IN*/ MM_PAGE_PRIORITY  Priority);
  4.7940 -
  4.7941 -NTOSAPI
  4.7942 -PVOID
  4.7943 -DDKAPI
  4.7944 -MmMapLockedPagesWithReservedMapping(
  4.7945 -  /*IN*/ PVOID  MappingAddress,
  4.7946 -  /*IN*/ ULONG  PoolTag,
  4.7947 -  /*IN*/ PMDL  MemoryDescriptorList,
  4.7948 -  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  4.7949 -
  4.7950 -NTOSAPI
  4.7951 -NTSTATUS
  4.7952 -DDKAPI
  4.7953 -MmMapUserAddressesToPage(
  4.7954 -  /*IN*/ PVOID  BaseAddress,
  4.7955 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.7956 -  /*IN*/ PVOID  PageAddress);
  4.7957 -
  4.7958 -NTOSAPI
  4.7959 -PVOID
  4.7960 -DDKAPI
  4.7961 -MmMapVideoDisplay(
  4.7962 -  /*IN*/ PHYSICAL_ADDRESS  PhysicalAddress,
  4.7963 -  /*IN*/ SIZE_T  NumberOfBytes,
  4.7964 -  /*IN*/ MEMORY_CACHING_TYPE  CacheType);
  4.7965 -
  4.7966 -NTOSAPI
  4.7967 -NTSTATUS
  4.7968 -DDKAPI
  4.7969 -MmMapViewInSessionSpace(
  4.7970 -  /*IN*/ PVOID  Section,
  4.7971 -  /*OUT*/ PVOID  *MappedBase,
  4.7972 -  /*IN OUT*/ PSIZE_T  ViewSize);
  4.7973 -
  4.7974 -NTOSAPI
  4.7975 -NTSTATUS
  4.7976 -DDKAPI
  4.7977 -MmMapViewInSystemSpace(
  4.7978 -  /*IN*/ PVOID  Section,
  4.7979 -  /*OUT*/ PVOID  *MappedBase,
  4.7980 -  /*IN*/ PSIZE_T  ViewSize);
  4.7981 -
  4.7982 -NTOSAPI
  4.7983 -NTSTATUS
  4.7984 -DDKAPI
  4.7985 -MmMarkPhysicalMemoryAsBad(
  4.7986 -  /*IN*/ PPHYSICAL_ADDRESS  StartAddress,
  4.7987 -  /*IN OUT*/ PLARGE_INTEGER  NumberOfBytes);
  4.7988 -
  4.7989 -NTOSAPI
  4.7990 -NTSTATUS
  4.7991 -DDKAPI
  4.7992 -MmMarkPhysicalMemoryAsGood(
  4.7993 -  /*IN*/ PPHYSICAL_ADDRESS  StartAddress,
  4.7994 -  /*IN OUT*/ PLARGE_INTEGER  NumberOfBytes);
  4.7995 -
  4.7996 -/*
  4.7997 - * PVOID
  4.7998 - * MmGetSystemAddressForMdlSafe(
  4.7999 - * IN PMDL  Mdl,
  4.8000 - * IN MM_PAGE_PRIORITY  Priority)
  4.8001 - */
  4.8002 -#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
  4.8003 -  ((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
  4.8004 -    | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
  4.8005 -    (_Mdl)->MappedSystemVa : \
  4.8006 -    (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
  4.8007 -      KernelMode, MmCached, NULL, FALSE, _Priority)
  4.8008 -
  4.8009 -NTOSAPI
  4.8010 -PVOID
  4.8011 -DDKAPI
  4.8012 -MmGetSystemRoutineAddress(
  4.8013 -  /*IN*/ PUNICODE_STRING  SystemRoutineName);
  4.8014 -
  4.8015 -/*
  4.8016 - * ULONG
  4.8017 - * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
  4.8018 - * IN PVOID  Va,
  4.8019 - * IN ULONG  Size)
  4.8020 - */
  4.8021 -#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, \
  4.8022 -                                       _Size) \
  4.8023 -  ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
  4.8024 -    + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
  4.8025 -
  4.8026 -/*
  4.8027 - * VOID
  4.8028 - * MmInitializeMdl(
  4.8029 - * IN PMDL  MemoryDescriptorList,
  4.8030 - * IN PVOID  BaseVa,
  4.8031 - * IN SIZE_T  Length)
  4.8032 - */
  4.8033 -#define MmInitializeMdl(_MemoryDescriptorList, \
  4.8034 -                        _BaseVa, \
  4.8035 -                        _Length) \
  4.8036 -{ \
  4.8037 -  (_MemoryDescriptorList)->Next = (PMDL) NULL; \
  4.8038 -  (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
  4.8039 -    (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
  4.8040 -  (_MemoryDescriptorList)->MdlFlags = 0; \
  4.8041 -  (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
  4.8042 -  (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
  4.8043 -  (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
  4.8044 -}
  4.8045 -
  4.8046 -NTOSAPI
  4.8047 -BOOLEAN
  4.8048 -DDKAPI
  4.8049 -MmIsAddressValid(
  4.8050 -  /*IN*/ PVOID  VirtualAddress);
  4.8051 -
  4.8052 -NTOSAPI
  4.8053 -LOGICAL
  4.8054 -DDKAPI
  4.8055 -MmIsDriverVerifying(
  4.8056 -  /*IN*/ PDRIVER_OBJECT  DriverObject);
  4.8057 -
  4.8058 -NTOSAPI
  4.8059 -BOOLEAN
  4.8060 -DDKAPI
  4.8061 -MmIsThisAnNtAsSystem(
  4.8062 -  VOID);
  4.8063 -
  4.8064 -NTOSAPI
  4.8065 -NTSTATUS
  4.8066 -DDKAPI
  4.8067 -MmIsVerifierEnabled(
  4.8068 -  /*OUT*/ PULONG  VerifierFlags);
  4.8069 -
  4.8070 -NTOSAPI
  4.8071 -PVOID
  4.8072 -DDKAPI
  4.8073 -MmLockPagableDataSection(
  4.8074 -  /*IN*/ PVOID  AddressWithinSection);
  4.8075 -
  4.8076 -NTOSAPI
  4.8077 -PVOID
  4.8078 -DDKAPI
  4.8079 -MmLockPagableImageSection(
  4.8080 -  /*IN*/ PVOID  AddressWithinSection);
  4.8081 -
  4.8082 -/*
  4.8083 - * PVOID
  4.8084 - * MmLockPagableCodeSection(
  4.8085 - * IN PVOID  AddressWithinSection)
  4.8086 - */
  4.8087 -#define MmLockPagableCodeSection MmLockPagableDataSection
  4.8088 -
  4.8089 -NTOSAPI
  4.8090 -VOID
  4.8091 -DDKAPI
  4.8092 -MmLockPagableSectionByHandle(
  4.8093 -  /*IN*/ PVOID  ImageSectionHandle);
  4.8094 -
  4.8095 -NTOSAPI
  4.8096 -PVOID
  4.8097 -DDKAPI
  4.8098 -MmMapIoSpace(
  4.8099 -  /*IN*/ PHYSICAL_ADDRESS  PhysicalAddress,
  4.8100 -  /*IN*/ ULONG  NumberOfBytes,
  4.8101 -  /*IN*/ MEMORY_CACHING_TYPE  CacheEnable);
  4.8102 -
  4.8103 -NTOSAPI
  4.8104 -PVOID
  4.8105 -DDKAPI
  4.8106 -MmMapLockedPages(
  4.8107 -  /*IN*/ PMDL  MemoryDescriptorList,
  4.8108 -  /*IN*/ KPROCESSOR_MODE  AccessMode);
  4.8109 -
  4.8110 -NTOSAPI
  4.8111 -VOID
  4.8112 -DDKAPI
  4.8113 -MmPageEntireDriver(
  4.8114 -  /*IN*/ PVOID  AddressWithinSection);
  4.8115 -
  4.8116 -NTOSAPI
  4.8117 -VOID
  4.8118 -DDKAPI
  4.8119 -MmProbeAndLockProcessPages(
  4.8120 -  /*IN OUT*/ PMDL  MemoryDescriptorList,
  4.8121 -  /*IN*/ PEPROCESS  Process,
  4.8122 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.8123 -  /*IN*/ LOCK_OPERATION  Operation);
  4.8124 -
  4.8125 -NTOSAPI
  4.8126 -NTSTATUS
  4.8127 -DDKAPI
  4.8128 -MmProtectMdlSystemAddress(
  4.8129 -  /*IN*/ PMDL  MemoryDescriptorList,
  4.8130 -  /*IN*/ ULONG  NewProtect);
  4.8131 -
  4.8132 -NTOSAPI
  4.8133 -VOID
  4.8134 -DDKAPI
  4.8135 -MmUnmapLockedPages(
  4.8136 -  /*IN*/ PVOID  BaseAddress,
  4.8137 -  /*IN*/ PMDL  MemoryDescriptorList);
  4.8138 -
  4.8139 -NTOSAPI
  4.8140 -NTSTATUS
  4.8141 -DDKAPI
  4.8142 -MmUnmapViewInSessionSpace(
  4.8143 -  /*IN*/ PVOID  MappedBase);
  4.8144 -
  4.8145 -NTOSAPI
  4.8146 -NTSTATUS
  4.8147 -DDKAPI
  4.8148 -MmUnmapViewInSystemSpace(
  4.8149 -  /*IN*/ PVOID MappedBase);
  4.8150 -
  4.8151 -NTOSAPI
  4.8152 -VOID
  4.8153 -DDKAPI
  4.8154 -MmUnsecureVirtualMemory(
  4.8155 -  /*IN*/ HANDLE  SecureHandle);
  4.8156 -
  4.8157 -/*
  4.8158 - * VOID
  4.8159 - * MmPrepareMdlForReuse(
  4.8160 - * IN PMDL  Mdl)
  4.8161 - */
  4.8162 -#define MmPrepareMdlForReuse(_Mdl) \
  4.8163 -{ \
  4.8164 -  if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
  4.8165 -    ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
  4.8166 -    MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
  4.8167 -  } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
  4.8168 -    ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
  4.8169 -  } \
  4.8170 -}
  4.8171 -
  4.8172 -NTOSAPI
  4.8173 -VOID
  4.8174 -DDKAPI
  4.8175 -MmProbeAndLockPages(
  4.8176 -  /*IN OUT*/ PMDL  MemoryDescriptorList,
  4.8177 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.8178 -  /*IN*/ LOCK_OPERATION  Operation);
  4.8179 -
  4.8180 -NTOSAPI
  4.8181 -MM_SYSTEM_SIZE
  4.8182 -DDKAPI
  4.8183 -MmQuerySystemSize(
  4.8184 -  VOID);
  4.8185 -
  4.8186 -NTOSAPI
  4.8187 -NTSTATUS
  4.8188 -DDKAPI
  4.8189 -MmRemovePhysicalMemory(
  4.8190 -  /*IN*/ PPHYSICAL_ADDRESS  StartAddress,
  4.8191 -  /*IN OUT*/ PLARGE_INTEGER  NumberOfBytes);
  4.8192 -
  4.8193 -NTOSAPI
  4.8194 -VOID
  4.8195 -DDKAPI
  4.8196 -MmResetDriverPaging(
  4.8197 -  /*IN*/ PVOID  AddressWithinSection);
  4.8198 -
  4.8199 -NTOSAPI
  4.8200 -HANDLE
  4.8201 -DDKAPI
  4.8202 -MmSecureVirtualMemory(
  4.8203 -  /*IN*/ PVOID  Address,
  4.8204 -  /*IN*/ SIZE_T  Size,
  4.8205 -  /*IN*/ ULONG  ProbeMode);
  4.8206 -
  4.8207 -NTOSAPI
  4.8208 -ULONG
  4.8209 -DDKAPI
  4.8210 -MmSizeOfMdl(
  4.8211 -  /*IN*/ PVOID  Base,
  4.8212 -  /*IN*/ SIZE_T  Length);
  4.8213 -
  4.8214 -NTOSAPI
  4.8215 -VOID
  4.8216 -DDKAPI
  4.8217 -MmUnlockPagableImageSection(
  4.8218 -  /*IN*/ PVOID  ImageSectionHandle);
  4.8219 -
  4.8220 -NTOSAPI
  4.8221 -VOID
  4.8222 -DDKAPI
  4.8223 -MmUnlockPages(
  4.8224 -  /*IN*/ PMDL  MemoryDescriptorList);
  4.8225 -
  4.8226 -NTOSAPI
  4.8227 -VOID
  4.8228 -DDKAPI
  4.8229 -MmUnmapIoSpace(
  4.8230 -  /*IN*/ PVOID  BaseAddress,
  4.8231 -  /*IN*/ SIZE_T  NumberOfBytes);
  4.8232 -
  4.8233 -NTOSAPI
  4.8234 -VOID
  4.8235 -DDKAPI
  4.8236 -MmUnmapReservedMapping(
  4.8237 -  /*IN*/ PVOID  BaseAddress,
  4.8238 -  /*IN*/ ULONG  PoolTag,
  4.8239 -  /*IN*/ PMDL  MemoryDescriptorList);
  4.8240 -
  4.8241 -NTOSAPI
  4.8242 -VOID
  4.8243 -DDKAPI
  4.8244 -MmUnmapVideoDisplay(
  4.8245 -  /*IN*/ PVOID  BaseAddress,
  4.8246 -  /*IN*/ SIZE_T  NumberOfBytes);
  4.8247 -
  4.8248 -
  4.8249 -
  4.8250 -/** Object manager routines **/
  4.8251 -
  4.8252 -NTOSAPI
  4.8253 -NTSTATUS
  4.8254 -DDKAPI
  4.8255 -ObAssignSecurity(
  4.8256 -  /*IN*/ PACCESS_STATE  AccessState,
  4.8257 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  4.8258 -  /*IN*/ PVOID  Object,
  4.8259 -  /*IN*/ POBJECT_TYPE  Type);
  4.8260 -
  4.8261 -NTOSAPI
  4.8262 -VOID
  4.8263 -DDKAPI
  4.8264 -ObDereferenceSecurityDescriptor(
  4.8265 -  PSECURITY_DESCRIPTOR  SecurityDescriptor,
  4.8266 -  ULONG  Count);
  4.8267 -
  4.8268 -NTOSAPI
  4.8269 -VOID
  4.8270 -DDKFASTAPI
  4.8271 -ObfDereferenceObject(
  4.8272 -  /*IN*/ PVOID  Object);
  4.8273 -
  4.8274 -/*
  4.8275 - * VOID
  4.8276 - * ObDereferenceObject(
  4.8277 - * IN PVOID  Object)
  4.8278 - */
  4.8279 -#define ObDereferenceObject ObfDereferenceObject
  4.8280 -
  4.8281 -NTOSAPI
  4.8282 -NTSTATUS
  4.8283 -DDKAPI
  4.8284 -ObGetObjectSecurity(
  4.8285 -  /*IN*/ PVOID  Object,
  4.8286 -  /*OUT*/ PSECURITY_DESCRIPTOR  *SecurityDescriptor,
  4.8287 -  /*OUT*/ PBOOLEAN  MemoryAllocated); 
  4.8288 -
  4.8289 -NTOSAPI
  4.8290 -NTSTATUS
  4.8291 -DDKAPI
  4.8292 -ObInsertObject(
  4.8293 -  /*IN*/ PVOID  Object,
  4.8294 -  /*IN*/ PACCESS_STATE  PassedAccessState  /*OPTIONAL*/,
  4.8295 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8296 -  /*IN*/ ULONG  AdditionalReferences,
  4.8297 -  /*OUT*/ PVOID*  ReferencedObject  /*OPTIONAL*/,
  4.8298 -  /*OUT*/ PHANDLE  Handle);
  4.8299 -
  4.8300 -NTOSAPI
  4.8301 -VOID
  4.8302 -DDKFASTAPI
  4.8303 -ObfReferenceObject(
  4.8304 -  /*IN*/ PVOID  Object);
  4.8305 -
  4.8306 -NTOSAPI
  4.8307 -NTSTATUS
  4.8308 -DDKAPI
  4.8309 -ObLogSecurityDescriptor(
  4.8310 -  /*IN*/ PSECURITY_DESCRIPTOR  InputSecurityDescriptor,
  4.8311 -  /*OUT*/ PSECURITY_DESCRIPTOR  *OutputSecurityDescriptor,
  4.8312 -  /*IN*/ ULONG RefBias);
  4.8313 -/*
  4.8314 - * VOID
  4.8315 - * ObReferenceObject(
  4.8316 - * IN PVOID  Object)
  4.8317 - */
  4.8318 -#define ObReferenceObject ObfReferenceObject
  4.8319 -
  4.8320 -NTOSAPI
  4.8321 -VOID
  4.8322 -DDKAPI
  4.8323 -ObMakeTemporaryObject(
  4.8324 -  /*IN*/ PVOID  Object);
  4.8325 -
  4.8326 -NTOSAPI
  4.8327 -NTSTATUS
  4.8328 -DDKAPI
  4.8329 -ObOpenObjectByName(
  4.8330 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8331 -  /*IN*/ POBJECT_TYPE  ObjectType,
  4.8332 -  /*IN OUT*/ PVOID  ParseContext  /*OPTIONAL*/,
  4.8333 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.8334 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8335 -  /*IN*/ PACCESS_STATE  PassedAccessState,
  4.8336 -  /*OUT*/ PHANDLE  Handle);
  4.8337 -
  4.8338 -NTOSAPI
  4.8339 -NTSTATUS
  4.8340 -DDKAPI
  4.8341 -ObOpenObjectByPointer(
  4.8342 -  /*IN*/ PVOID  Object,
  4.8343 -  /*IN*/ ULONG  HandleAttributes,
  4.8344 -  /*IN*/ PACCESS_STATE  PassedAccessState  /*OPTIONAL*/,
  4.8345 -  /*IN*/ ACCESS_MASK  DesiredAccess  /*OPTIONAL*/,
  4.8346 -  /*IN*/ POBJECT_TYPE  ObjectType  /*OPTIONAL*/,
  4.8347 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.8348 -  /*OUT*/ PHANDLE  Handle);
  4.8349 -
  4.8350 -NTOSAPI
  4.8351 -NTSTATUS
  4.8352 -DDKAPI
  4.8353 -ObQueryObjectAuditingByHandle(
  4.8354 -  /*IN*/ HANDLE  Handle,
  4.8355 -  /*OUT*/ PBOOLEAN  GenerateOnClose);
  4.8356 -
  4.8357 -NTOSAPI
  4.8358 -NTSTATUS
  4.8359 -DDKAPI
  4.8360 -ObReferenceObjectByHandle(
  4.8361 -  /*IN*/ HANDLE  Handle,
  4.8362 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8363 -  /*IN*/ POBJECT_TYPE  ObjectType  /*OPTIONAL*/,
  4.8364 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.8365 -  /*OUT*/ PVOID  *Object,
  4.8366 -  /*OUT*/ POBJECT_HANDLE_INFORMATION  HandleInformation  /*OPTIONAL*/);
  4.8367 -
  4.8368 -NTOSAPI
  4.8369 -NTSTATUS
  4.8370 -DDKAPI
  4.8371 -ObReferenceObjectByName(
  4.8372 -  /*IN*/ PUNICODE_STRING  ObjectPath,
  4.8373 -  /*IN*/ ULONG  Attributes,
  4.8374 -  /*IN*/ PACCESS_STATE  PassedAccessState  /*OPTIONAL*/,
  4.8375 -  /*IN*/ ACCESS_MASK  DesiredAccess  /*OPTIONAL*/,
  4.8376 -  /*IN*/ POBJECT_TYPE  ObjectType,
  4.8377 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.8378 -  /*IN OUT*/ PVOID  ParseContext  /*OPTIONAL*/,
  4.8379 -  /*OUT*/ PVOID  *Object);
  4.8380 -
  4.8381 -NTOSAPI
  4.8382 -NTSTATUS
  4.8383 -DDKAPI
  4.8384 -ObReferenceObjectByPointer(
  4.8385 -  /*IN*/ PVOID  Object,
  4.8386 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8387 -  /*IN*/ POBJECT_TYPE  ObjectType,
  4.8388 -  /*IN*/ KPROCESSOR_MODE  AccessMode);
  4.8389 -
  4.8390 -NTOSAPI
  4.8391 -VOID
  4.8392 -DDKAPI
  4.8393 -ObReferenceSecurityDescriptor(
  4.8394 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  4.8395 -  /*IN*/ ULONG  Count);
  4.8396 -
  4.8397 -NTOSAPI
  4.8398 -VOID
  4.8399 -DDKAPI
  4.8400 -ObReleaseObjectSecurity(
  4.8401 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  4.8402 -  /*IN*/ BOOLEAN  MemoryAllocated);
  4.8403 -
  4.8404 -
  4.8405 -
  4.8406 -/** Process manager routines **/
  4.8407 -
  4.8408 -NTOSAPI
  4.8409 -NTSTATUS
  4.8410 -DDKAPI
  4.8411 -PsCreateSystemProcess(
  4.8412 -  /*IN*/ PHANDLE  ProcessHandle,
  4.8413 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8414 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  4.8415 -
  4.8416 -NTOSAPI
  4.8417 -NTSTATUS
  4.8418 -DDKAPI
  4.8419 -PsCreateSystemThread(
  4.8420 -  /*OUT*/ PHANDLE  ThreadHandle,
  4.8421 -  /*IN*/ ULONG  DesiredAccess,
  4.8422 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes  /*OPTIONAL*/,
  4.8423 -  /*IN*/ HANDLE  ProcessHandle  /*OPTIONAL*/,
  4.8424 -  /*OUT*/ PCLIENT_ID  ClientId  /*OPTIONAL*/,
  4.8425 -  /*IN*/ PKSTART_ROUTINE  StartRoutine,
  4.8426 -  /*IN*/ PVOID  StartContext);
  4.8427 -
  4.8428 -/*
  4.8429 - * PEPROCESS
  4.8430 - * PsGetCurrentProcess(VOID)
  4.8431 - */
  4.8432 -#define PsGetCurrentProcess IoGetCurrentProcess
  4.8433 -
  4.8434 -NTOSAPI
  4.8435 -HANDLE
  4.8436 -DDKAPI
  4.8437 -PsGetCurrentProcessId(
  4.8438 -  VOID);
  4.8439 -
  4.8440 -/*
  4.8441 - * PETHREAD
  4.8442 - * PsGetCurrentThread(VOID)
  4.8443 - */
  4.8444 -#define PsGetCurrentThread() \
  4.8445 -  ((PETHREAD) KeGetCurrentThread())
  4.8446 -
  4.8447 -NTOSAPI
  4.8448 -HANDLE
  4.8449 -DDKAPI
  4.8450 -PsGetCurrentThreadId(
  4.8451 -  VOID);
  4.8452 -
  4.8453 -NTOSAPI
  4.8454 -BOOLEAN
  4.8455 -DDKAPI
  4.8456 -PsGetVersion(
  4.8457 -  PULONG  MajorVersion  /*OPTIONAL*/,
  4.8458 -  PULONG  MinorVersion  /*OPTIONAL*/,
  4.8459 -  PULONG  BuildNumber  /*OPTIONAL*/,
  4.8460 -  PUNICODE_STRING  CSDVersion  /*OPTIONAL*/);
  4.8461 -
  4.8462 -NTOSAPI
  4.8463 -NTSTATUS
  4.8464 -DDKAPI
  4.8465 -PsRemoveCreateThreadNotifyRoutine(
  4.8466 -  /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE  NotifyRoutine);
  4.8467 -
  4.8468 -NTOSAPI
  4.8469 -NTSTATUS
  4.8470 -DDKAPI
  4.8471 -PsRemoveLoadImageNotifyRoutine(
  4.8472 -  /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE  NotifyRoutine);
  4.8473 -
  4.8474 -NTOSAPI
  4.8475 -NTSTATUS
  4.8476 -DDKAPI
  4.8477 -PsSetCreateProcessNotifyRoutine(
  4.8478 -  /*IN*/ PCREATE_PROCESS_NOTIFY_ROUTINE  NotifyRoutine,
  4.8479 -  /*IN*/ BOOLEAN  Remove);
  4.8480 -
  4.8481 -NTOSAPI
  4.8482 -NTSTATUS
  4.8483 -DDKAPI
  4.8484 -PsSetCreateThreadNotifyRoutine(
  4.8485 -  /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE  NotifyRoutine);
  4.8486 -
  4.8487 -NTOSAPI
  4.8488 -NTSTATUS
  4.8489 -DDKAPI
  4.8490 -PsSetLoadImageNotifyRoutine(
  4.8491 -  /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE  NotifyRoutine);
  4.8492 -
  4.8493 -NTOSAPI
  4.8494 -NTSTATUS
  4.8495 -DDKAPI
  4.8496 -PsTerminateSystemThread(
  4.8497 -  /*IN*/ NTSTATUS  ExitStatus);
  4.8498 -
  4.8499 -
  4.8500 -
  4.8501 -/** Security reference monitor routines **/
  4.8502 -
  4.8503 -NTOSAPI
  4.8504 -BOOLEAN
  4.8505 -DDKAPI
  4.8506 -SeAccessCheck(
  4.8507 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor,
  4.8508 -  /*IN*/ PSECURITY_SUBJECT_CONTEXT  SubjectSecurityContext,
  4.8509 -  /*IN*/ BOOLEAN  SubjectContextLocked,
  4.8510 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8511 -  /*IN*/ ACCESS_MASK  PreviouslyGrantedAccess,
  4.8512 -  /*OUT*/ PPRIVILEGE_SET  *Privileges  /*OPTIONAL*/,
  4.8513 -  /*IN*/ PGENERIC_MAPPING  GenericMapping,
  4.8514 -  /*IN*/ KPROCESSOR_MODE  AccessMode,
  4.8515 -  /*OUT*/ PACCESS_MASK  GrantedAccess,
  4.8516 -  /*OUT*/ PNTSTATUS  AccessStatus);
  4.8517 -
  4.8518 -NTOSAPI
  4.8519 -NTSTATUS
  4.8520 -DDKAPI
  4.8521 -SeAssignSecurity(
  4.8522 -  /*IN*/ PSECURITY_DESCRIPTOR  ParentDescriptor  /*OPTIONAL*/,
  4.8523 -  /*IN*/ PSECURITY_DESCRIPTOR  ExplicitDescriptor  /*OPTIONAL*/,
  4.8524 -  /*OUT*/ PSECURITY_DESCRIPTOR  *NewDescriptor,
  4.8525 -  /*IN*/ BOOLEAN  IsDirectoryObject,
  4.8526 -  /*IN*/ PSECURITY_SUBJECT_CONTEXT  SubjectContext,
  4.8527 -  /*IN*/ PGENERIC_MAPPING  GenericMapping,
  4.8528 -  /*IN*/ POOL_TYPE  PoolType);
  4.8529 -
  4.8530 -NTOSAPI
  4.8531 -NTSTATUS
  4.8532 -DDKAPI
  4.8533 -SeAssignSecurityEx(
  4.8534 -  /*IN*/ PSECURITY_DESCRIPTOR  ParentDescriptor  /*OPTIONAL*/,
  4.8535 -  /*IN*/ PSECURITY_DESCRIPTOR  ExplicitDescriptor  /*OPTIONAL*/,
  4.8536 -  /*OUT*/ PSECURITY_DESCRIPTOR  *NewDescriptor,
  4.8537 -  /*IN*/ GUID  *ObjectType  /*OPTIONAL*/,
  4.8538 -  /*IN*/ BOOLEAN  IsDirectoryObject,
  4.8539 -  /*IN*/ ULONG  AutoInheritFlags,
  4.8540 -  /*IN*/ PSECURITY_SUBJECT_CONTEXT  SubjectContext,
  4.8541 -  /*IN*/ PGENERIC_MAPPING  GenericMapping,
  4.8542 -  /*IN*/ POOL_TYPE  PoolType);
  4.8543 -
  4.8544 -NTOSAPI
  4.8545 -NTSTATUS
  4.8546 -DDKAPI
  4.8547 -SeDeassignSecurity(
  4.8548 -  /*IN OUT*/ PSECURITY_DESCRIPTOR  *SecurityDescriptor);
  4.8549 -
  4.8550 -NTOSAPI
  4.8551 -BOOLEAN
  4.8552 -DDKAPI
  4.8553 -SeSinglePrivilegeCheck(
  4.8554 -  LUID  PrivilegeValue,
  4.8555 -  KPROCESSOR_MODE  PreviousMode);
  4.8556 -
  4.8557 -NTOSAPI
  4.8558 -BOOLEAN
  4.8559 -DDKAPI
  4.8560 -SeValidSecurityDescriptor(
  4.8561 -  /*IN*/ ULONG  Length,
  4.8562 -  /*IN*/ PSECURITY_DESCRIPTOR  SecurityDescriptor);
  4.8563 -
  4.8564 -
  4.8565 -
  4.8566 -/** NtXxx routines **/
  4.8567 -
  4.8568 -NTOSAPI
  4.8569 -NTSTATUS
  4.8570 -DDKAPI
  4.8571 -NtOpenProcess(
  4.8572 -  /*OUT*/ PHANDLE  ProcessHandle,
  4.8573 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8574 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8575 -  /*IN*/ PCLIENT_ID  ClientId  /*OPTIONAL*/);
  4.8576 -
  4.8577 -NTOSAPI
  4.8578 -NTSTATUS
  4.8579 -DDKAPI
  4.8580 -NtQueryInformationProcess(
  4.8581 -  /*IN*/ HANDLE  ProcessHandle,
  4.8582 -  /*IN*/ PROCESSINFOCLASS  ProcessInformationClass,
  4.8583 -  /*OUT*/ PVOID  ProcessInformation,
  4.8584 -  /*IN*/ ULONG  ProcessInformationLength,
  4.8585 -  /*OUT*/ PULONG  ReturnLength /*OPTIONAL*/);
  4.8586 -
  4.8587 -
  4.8588 -
  4.8589 -/** NtXxx and ZwXxx routines **/
  4.8590 -
  4.8591 -NTOSAPI
  4.8592 -NTSTATUS
  4.8593 -DDKAPI
  4.8594 -ZwCancelTimer(
  4.8595 -  /*IN*/ HANDLE  TimerHandle,
  4.8596 -  /*OUT*/ PBOOLEAN  CurrentState  /*OPTIONAL*/);
  4.8597 -
  4.8598 -NTOSAPI
  4.8599 -NTSTATUS
  4.8600 -DDKAPI
  4.8601 -NtClose(
  4.8602 -  /*IN*/ HANDLE  Handle);
  4.8603 -
  4.8604 -NTOSAPI
  4.8605 -NTSTATUS
  4.8606 -DDKAPI
  4.8607 -ZwClose(
  4.8608 -  /*IN*/ HANDLE  Handle);
  4.8609 -
  4.8610 -NTOSAPI
  4.8611 -NTSTATUS
  4.8612 -DDKAPI
  4.8613 -ZwCreateDirectoryObject(
  4.8614 -  /*OUT*/ PHANDLE  DirectoryHandle,
  4.8615 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8616 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  4.8617 -
  4.8618 -NTOSAPI
  4.8619 -NTSTATUS
  4.8620 -DDKAPI
  4.8621 -NtCreateEvent(
  4.8622 -  /*OUT*/ PHANDLE  EventHandle,
  4.8623 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8624 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8625 -  /*IN*/ BOOLEAN  ManualReset,
  4.8626 -  /*IN*/ BOOLEAN  InitialState);
  4.8627 -
  4.8628 -NTOSAPI
  4.8629 -NTSTATUS
  4.8630 -DDKAPI
  4.8631 -ZwCreateEvent(
  4.8632 -  /*OUT*/ PHANDLE  EventHandle,
  4.8633 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8634 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8635 -  /*IN*/ BOOLEAN  ManualReset,
  4.8636 -  /*IN*/ BOOLEAN  InitialState);
  4.8637 -
  4.8638 -NTOSAPI
  4.8639 -NTSTATUS
  4.8640 -DDKAPI
  4.8641 -ZwCreateFile(
  4.8642 -  /*OUT*/ PHANDLE  FileHandle,
  4.8643 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8644 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8645 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.8646 -  /*IN*/ PLARGE_INTEGER  AllocationSize  /*OPTIONAL*/,
  4.8647 -  /*IN*/ ULONG  FileAttributes,
  4.8648 -  /*IN*/ ULONG  ShareAccess,
  4.8649 -  /*IN*/ ULONG  CreateDisposition,
  4.8650 -  /*IN*/ ULONG  CreateOptions,
  4.8651 -  /*IN*/ PVOID  EaBuffer  /*OPTIONAL*/,
  4.8652 -  /*IN*/ ULONG  EaLength);
  4.8653 -
  4.8654 -NTOSAPI
  4.8655 -NTSTATUS
  4.8656 -DDKAPI
  4.8657 -ZwCreateKey(
  4.8658 -  /*OUT*/ PHANDLE  KeyHandle,
  4.8659 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8660 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8661 -  /*IN*/ ULONG  TitleIndex,
  4.8662 -  /*IN*/ PUNICODE_STRING  Class  /*OPTIONAL*/,
  4.8663 -  /*IN*/ ULONG  CreateOptions,
  4.8664 -  /*OUT*/ PULONG  Disposition  /*OPTIONAL*/);
  4.8665 -
  4.8666 -NTOSAPI
  4.8667 -NTSTATUS
  4.8668 -DDKAPI
  4.8669 -ZwCreateTimer(
  4.8670 -  /*OUT*/ PHANDLE  TimerHandle,
  4.8671 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8672 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes  /*OPTIONAL*/,
  4.8673 -  /*IN*/ TIMER_TYPE  TimerType);
  4.8674 -
  4.8675 -NTOSAPI
  4.8676 -NTSTATUS
  4.8677 -DDKAPI
  4.8678 -ZwDeleteKey(
  4.8679 -  /*IN*/ HANDLE  KeyHandle);
  4.8680 -
  4.8681 -NTOSAPI
  4.8682 -NTSTATUS
  4.8683 -DDKAPI
  4.8684 -ZwDeleteValueKey(
  4.8685 -  /*IN*/ HANDLE  KeyHandle,
  4.8686 -  /*IN*/ PUNICODE_STRING  ValueName);
  4.8687 -
  4.8688 -NTOSAPI
  4.8689 -NTSTATUS
  4.8690 -DDKAPI
  4.8691 -NtDeviceIoControlFile(
  4.8692 -  /*IN*/ HANDLE  DeviceHandle,
  4.8693 -  /*IN*/ HANDLE  Event  /*OPTIONAL*/, 
  4.8694 -  /*IN*/ PIO_APC_ROUTINE  UserApcRoutine  /*OPTIONAL*/, 
  4.8695 -  /*IN*/ PVOID  UserApcContext  /*OPTIONAL*/, 
  4.8696 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock, 
  4.8697 -  /*IN*/ ULONG  IoControlCode,
  4.8698 -  /*IN*/ PVOID  InputBuffer, 
  4.8699 -  /*IN*/ ULONG  InputBufferSize,
  4.8700 -  /*OUT*/ PVOID  OutputBuffer,
  4.8701 -  /*IN*/ ULONG  OutputBufferSize);
  4.8702 -
  4.8703 -NTOSAPI
  4.8704 -NTSTATUS
  4.8705 -DDKAPI
  4.8706 -ZwDeviceIoControlFile(
  4.8707 -  /*IN*/ HANDLE  DeviceHandle,
  4.8708 -  /*IN*/ HANDLE  Event  /*OPTIONAL*/, 
  4.8709 -  /*IN*/ PIO_APC_ROUTINE  UserApcRoutine  /*OPTIONAL*/, 
  4.8710 -  /*IN*/ PVOID  UserApcContext  /*OPTIONAL*/, 
  4.8711 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock, 
  4.8712 -  /*IN*/ ULONG  IoControlCode,
  4.8713 -  /*IN*/ PVOID  InputBuffer, 
  4.8714 -  /*IN*/ ULONG  InputBufferSize,
  4.8715 -  /*OUT*/ PVOID  OutputBuffer,
  4.8716 -  /*IN*/ ULONG  OutputBufferSize);
  4.8717 -
  4.8718 -NTOSAPI
  4.8719 -NTSTATUS
  4.8720 -DDKAPI
  4.8721 -ZwEnumerateKey(
  4.8722 -  /*IN*/ HANDLE  KeyHandle,
  4.8723 -  /*IN*/ ULONG  Index,
  4.8724 -  /*IN*/ KEY_INFORMATION_CLASS  KeyInformationClass,
  4.8725 -  /*OUT*/ PVOID  KeyInformation,
  4.8726 -  /*IN*/ ULONG  Length,
  4.8727 -  /*OUT*/ PULONG  ResultLength);
  4.8728 -
  4.8729 -NTOSAPI
  4.8730 -NTSTATUS
  4.8731 -DDKAPI
  4.8732 -ZwEnumerateValueKey(
  4.8733 -  /*IN*/ HANDLE  KeyHandle,
  4.8734 -  /*IN*/ ULONG  Index,
  4.8735 -  /*IN*/ KEY_VALUE_INFORMATION_CLASS  KeyValueInformationClass,
  4.8736 -  /*OUT*/ PVOID  KeyValueInformation,
  4.8737 -  /*IN*/ ULONG  Length,
  4.8738 -  /*OUT*/ PULONG  ResultLength);
  4.8739 -
  4.8740 -NTOSAPI
  4.8741 -NTSTATUS
  4.8742 -DDKAPI
  4.8743 -ZwFlushKey(
  4.8744 -  /*IN*/ HANDLE  KeyHandle);
  4.8745 -
  4.8746 -NTOSAPI
  4.8747 -NTSTATUS
  4.8748 -DDKAPI
  4.8749 -ZwMakeTemporaryObject(
  4.8750 -  /*IN*/ HANDLE  Handle);
  4.8751 -
  4.8752 -NTOSAPI
  4.8753 -NTSTATUS
  4.8754 -DDKAPI
  4.8755 -NtMapViewOfSection(
  4.8756 -  /*IN*/ HANDLE  SectionHandle,
  4.8757 -  /*IN*/ HANDLE  ProcessHandle,
  4.8758 -  /*IN OUT*/ PVOID  *BaseAddress,
  4.8759 -  /*IN*/ ULONG  ZeroBits,
  4.8760 -  /*IN*/ ULONG  CommitSize,
  4.8761 -  /*IN OUT*/ PLARGE_INTEGER  SectionOffset  /*OPTIONAL*/,
  4.8762 -  /*IN OUT*/ PSIZE_T  ViewSize,
  4.8763 -  /*IN*/ SECTION_INHERIT  InheritDisposition,
  4.8764 -  /*IN*/ ULONG  AllocationType,
  4.8765 -  /*IN*/ ULONG  Protect);
  4.8766 -
  4.8767 -NTOSAPI
  4.8768 -NTSTATUS
  4.8769 -DDKAPI
  4.8770 -ZwMapViewOfSection(
  4.8771 -  /*IN*/ HANDLE  SectionHandle,
  4.8772 -  /*IN*/ HANDLE  ProcessHandle,
  4.8773 -  /*IN OUT*/ PVOID  *BaseAddress,
  4.8774 -  /*IN*/ ULONG  ZeroBits,
  4.8775 -  /*IN*/ ULONG  CommitSize,
  4.8776 -  /*IN OUT*/ PLARGE_INTEGER  SectionOffset  /*OPTIONAL*/,
  4.8777 -  /*IN OUT*/ PSIZE_T  ViewSize,
  4.8778 -  /*IN*/ SECTION_INHERIT  InheritDisposition,
  4.8779 -  /*IN*/ ULONG  AllocationType,
  4.8780 -  /*IN*/ ULONG  Protect);
  4.8781 -
  4.8782 -NTOSAPI
  4.8783 -NTSTATUS
  4.8784 -DDKAPI
  4.8785 -NtOpenFile(
  4.8786 -  /*OUT*/ PHANDLE  FileHandle,
  4.8787 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8788 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8789 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.8790 -  /*IN*/ ULONG  ShareAccess,
  4.8791 -  /*IN*/ ULONG  OpenOptions);
  4.8792 -
  4.8793 -NTOSAPI
  4.8794 -NTSTATUS
  4.8795 -DDKAPI
  4.8796 -ZwOpenFile(
  4.8797 -  /*OUT*/ PHANDLE  FileHandle,
  4.8798 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8799 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes,
  4.8800 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.8801 -  /*IN*/ ULONG  ShareAccess,
  4.8802 -  /*IN*/ ULONG  OpenOptions);
  4.8803 -
  4.8804 -NTOSAPI
  4.8805 -NTSTATUS
  4.8806 -DDKAPI
  4.8807 -ZwOpenKey(
  4.8808 -  /*OUT*/ PHANDLE  KeyHandle,
  4.8809 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8810 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  4.8811 -
  4.8812 -NTOSAPI
  4.8813 -NTSTATUS
  4.8814 -DDKAPI
  4.8815 -ZwOpenSection(
  4.8816 -  /*OUT*/ PHANDLE  SectionHandle,
  4.8817 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8818 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  4.8819 -
  4.8820 -NTOSAPI
  4.8821 -NTSTATUS
  4.8822 -DDKAPI
  4.8823 -ZwOpenSymbolicLinkObject(
  4.8824 -  /*OUT*/ PHANDLE  LinkHandle,
  4.8825 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8826 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  4.8827 -
  4.8828 -NTOSAPI
  4.8829 -NTSTATUS
  4.8830 -DDKAPI
  4.8831 -ZwOpenTimer(
  4.8832 -  /*OUT*/ PHANDLE  TimerHandle,
  4.8833 -  /*IN*/ ACCESS_MASK  DesiredAccess,
  4.8834 -  /*IN*/ POBJECT_ATTRIBUTES  ObjectAttributes);
  4.8835 -
  4.8836 -NTOSAPI
  4.8837 -NTSTATUS
  4.8838 -DDKAPI
  4.8839 -ZwQueryInformationFile(
  4.8840 -  /*IN*/ HANDLE  FileHandle,
  4.8841 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.8842 -  /*OUT*/ PVOID  FileInformation,
  4.8843 -  /*IN*/ ULONG  Length,
  4.8844 -  /*IN*/ FILE_INFORMATION_CLASS  FileInformationClass);
  4.8845 -
  4.8846 -NTOSAPI
  4.8847 -NTSTATUS
  4.8848 -DDKAPI
  4.8849 -ZwQueryKey(
  4.8850 -  /*IN*/ HANDLE  KeyHandle,
  4.8851 -  /*IN*/ KEY_INFORMATION_CLASS  KeyInformationClass,
  4.8852 -  /*OUT*/ PVOID  KeyInformation,
  4.8853 -  /*IN*/ ULONG  Length,
  4.8854 -  /*OUT*/ PULONG  ResultLength);
  4.8855 -
  4.8856 -NTOSAPI
  4.8857 -NTSTATUS
  4.8858 -DDKAPI
  4.8859 -ZwQuerySymbolicLinkObject(
  4.8860 -  /*IN*/ HANDLE  LinkHandle,
  4.8861 -  /*IN OUT*/ PUNICODE_STRING  LinkTarget,
  4.8862 -  /*OUT*/ PULONG  ReturnedLength  /*OPTIONAL*/);
  4.8863 -
  4.8864 -NTOSAPI
  4.8865 -NTSTATUS
  4.8866 -DDKAPI
  4.8867 -ZwQueryValueKey(
  4.8868 -  /*IN*/ HANDLE  KeyHandle,
  4.8869 -  /*IN*/ PUNICODE_STRING  ValueName,
  4.8870 -  /*IN*/ KEY_VALUE_INFORMATION_CLASS  KeyValueInformationClass,
  4.8871 -  /*OUT*/ PVOID  KeyValueInformation,
  4.8872 -  /*IN*/ ULONG  Length,
  4.8873 -  /*OUT*/ PULONG  ResultLength);
  4.8874 -
  4.8875 -NTOSAPI
  4.8876 -NTSTATUS
  4.8877 -DDKAPI
  4.8878 -NtReadFile(
  4.8879 -  /*IN*/ HANDLE  FileHandle,
  4.8880 -  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  4.8881 -  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  4.8882 -  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  4.8883 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.8884 -  /*OUT*/ PVOID  Buffer,
  4.8885 -  /*IN*/ ULONG  Length,
  4.8886 -  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  4.8887 -  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  4.8888 -
  4.8889 -NTOSAPI
  4.8890 -NTSTATUS
  4.8891 -DDKAPI
  4.8892 -ZwReadFile(
  4.8893 -  /*IN*/ HANDLE  FileHandle,
  4.8894 -  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  4.8895 -  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  4.8896 -  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  4.8897 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.8898 -  /*OUT*/ PVOID  Buffer,
  4.8899 -  /*IN*/ ULONG  Length,
  4.8900 -  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  4.8901 -  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  4.8902 -
  4.8903 -NTOSAPI
  4.8904 -NTSTATUS
  4.8905 -DDKAPI
  4.8906 -NtSetEvent(
  4.8907 -  /*IN*/ HANDLE  EventHandle,
  4.8908 -  /*IN*/ PULONG  NumberOfThreadsReleased);
  4.8909 -
  4.8910 -NTOSAPI
  4.8911 -NTSTATUS
  4.8912 -DDKAPI
  4.8913 -ZwSetEvent(
  4.8914 -  /*IN*/ HANDLE  EventHandle,
  4.8915 -  /*IN*/ PULONG  NumberOfThreadsReleased);
  4.8916 -
  4.8917 -NTOSAPI
  4.8918 -NTSTATUS
  4.8919 -DDKAPI
  4.8920 -ZwSetInformationFile(
  4.8921 -  /*IN*/ HANDLE  FileHandle,
  4.8922 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.8923 -  /*IN*/ PVOID  FileInformation,
  4.8924 -  /*IN*/ ULONG  Length,
  4.8925 -  /*IN*/ FILE_INFORMATION_CLASS  FileInformationClass);
  4.8926 -
  4.8927 -NTOSAPI
  4.8928 -NTSTATUS
  4.8929 -DDKAPI
  4.8930 -ZwSetInformationThread(
  4.8931 -  /*IN*/ HANDLE  ThreadHandle,
  4.8932 -  /*IN*/ THREADINFOCLASS  ThreadInformationClass,
  4.8933 -  /*IN*/ PVOID  ThreadInformation,
  4.8934 -  /*IN*/ ULONG  ThreadInformationLength);
  4.8935 -
  4.8936 -NTOSAPI
  4.8937 -NTSTATUS
  4.8938 -DDKAPI
  4.8939 -ZwSetTimer(
  4.8940 -  /*IN*/ HANDLE  TimerHandle,
  4.8941 -  /*IN*/ PLARGE_INTEGER  DueTime,
  4.8942 -  /*IN*/ PTIMER_APC_ROUTINE  TimerApcRoutine  /*OPTIONAL*/,
  4.8943 -  /*IN*/ PVOID  TimerContext  /*OPTIONAL*/,
  4.8944 -  /*IN*/ BOOLEAN  WakeTimer,
  4.8945 -  /*IN*/ LONG  Period  /*OPTIONAL*/,
  4.8946 -  /*OUT*/ PBOOLEAN  PreviousState  /*OPTIONAL*/);
  4.8947 -
  4.8948 -NTOSAPI
  4.8949 -NTSTATUS
  4.8950 -DDKAPI
  4.8951 -ZwSetValueKey(
  4.8952 -  /*IN*/ HANDLE  KeyHandle,
  4.8953 -  /*IN*/ PUNICODE_STRING  ValueName,
  4.8954 -  /*IN*/ ULONG  TitleIndex  /*OPTIONAL*/,
  4.8955 -  /*IN*/ ULONG  Type,
  4.8956 -  /*IN*/ PVOID  Data,
  4.8957 -  /*IN*/ ULONG  DataSize);
  4.8958 -
  4.8959 -/* [Nt|Zw]MapViewOfSection.InheritDisposition constants */
  4.8960 -#define AT_EXTENDABLE_FILE                0x00002000
  4.8961 -#define SEC_NO_CHANGE                     0x00400000
  4.8962 -#define AT_RESERVED                       0x20000000
  4.8963 -#define AT_ROUND_TO_PAGE                  0x40000000
  4.8964 -
  4.8965 -NTOSAPI
  4.8966 -NTSTATUS
  4.8967 -DDKAPI
  4.8968 -NtUnmapViewOfSection(
  4.8969 -  /*IN*/ HANDLE  ProcessHandle,
  4.8970 -  /*IN*/ PVOID  BaseAddress);
  4.8971 -
  4.8972 -NTOSAPI
  4.8973 -NTSTATUS
  4.8974 -DDKAPI
  4.8975 -ZwUnmapViewOfSection(
  4.8976 -  /*IN*/ HANDLE  ProcessHandle,
  4.8977 -  /*IN*/ PVOID  BaseAddress);
  4.8978 -
  4.8979 -NTOSAPI
  4.8980 -NTSTATUS
  4.8981 -DDKAPI
  4.8982 -NtWaitForSingleObject(
  4.8983 -  /*IN*/ HANDLE  Object,
  4.8984 -  /*IN*/ BOOLEAN  Alertable,
  4.8985 -  /*IN*/ PLARGE_INTEGER  Time);
  4.8986 -
  4.8987 -NTOSAPI
  4.8988 -NTSTATUS
  4.8989 -DDKAPI
  4.8990 -ZwWaitForSingleObject(
  4.8991 -  /*IN*/ HANDLE  Object,
  4.8992 -  /*IN*/ BOOLEAN  Alertable,
  4.8993 -  /*IN*/ PLARGE_INTEGER  Time);
  4.8994 -
  4.8995 -NTOSAPI
  4.8996 -NTSTATUS
  4.8997 -DDKAPI
  4.8998 -NtWriteFile(
  4.8999 -  /*IN*/ HANDLE  FileHandle,
  4.9000 -  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  4.9001 -  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  4.9002 -  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  4.9003 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.9004 -  /*IN*/ PVOID  Buffer,
  4.9005 -  /*IN*/ ULONG  Length,
  4.9006 -  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  4.9007 -  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  4.9008 -
  4.9009 -NTOSAPI
  4.9010 -NTSTATUS
  4.9011 -DDKAPI
  4.9012 -ZwWriteFile(
  4.9013 -  /*IN*/ HANDLE  FileHandle,
  4.9014 -  /*IN*/ HANDLE  Event  /*OPTIONAL*/,
  4.9015 -  /*IN*/ PIO_APC_ROUTINE  ApcRoutine  /*OPTIONAL*/,
  4.9016 -  /*IN*/ PVOID  ApcContext  /*OPTIONAL*/,
  4.9017 -  /*OUT*/ PIO_STATUS_BLOCK  IoStatusBlock,
  4.9018 -  /*IN*/ PVOID  Buffer,
  4.9019 -  /*IN*/ ULONG  Length,
  4.9020 -  /*IN*/ PLARGE_INTEGER  ByteOffset  /*OPTIONAL*/,
  4.9021 -  /*IN*/ PULONG  Key  /*OPTIONAL*/);
  4.9022 -
  4.9023 -
  4.9024 -
  4.9025 -/** Power management support routines **/
  4.9026 -
  4.9027 -NTOSAPI
  4.9028 -NTSTATUS
  4.9029 -DDKAPI
  4.9030 -PoCallDriver(
  4.9031 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.9032 -  /*IN OUT*/ PIRP  Irp);
  4.9033 -
  4.9034 -NTOSAPI
  4.9035 -PULONG
  4.9036 -DDKAPI
  4.9037 -PoRegisterDeviceForIdleDetection(
  4.9038 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.9039 -  /*IN*/ ULONG  ConservationIdleTime,
  4.9040 -  /*IN*/ ULONG  PerformanceIdleTime,
  4.9041 -  /*IN*/ DEVICE_POWER_STATE  State);
  4.9042 -
  4.9043 -NTOSAPI
  4.9044 -PVOID
  4.9045 -DDKAPI
  4.9046 -PoRegisterSystemState(
  4.9047 -  /*IN*/ PVOID  StateHandle,
  4.9048 -  /*IN*/ EXECUTION_STATE  Flags);
  4.9049 -
  4.9050 -NTOSAPI
  4.9051 -NTSTATUS
  4.9052 -DDKAPI
  4.9053 -PoRequestPowerIrp(
  4.9054 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.9055 -  /*IN*/ UCHAR  MinorFunction,  
  4.9056 -  /*IN*/ POWER_STATE  PowerState,
  4.9057 -  /*IN*/ PREQUEST_POWER_COMPLETE  CompletionFunction,
  4.9058 -  /*IN*/ PVOID  Context,
  4.9059 -  /*OUT*/ PIRP  *Irp /*OPTIONAL*/);
  4.9060 -
  4.9061 -NTOSAPI
  4.9062 -NTSTATUS
  4.9063 -DDKAPI
  4.9064 -PoRequestShutdownEvent(
  4.9065 -  /*OUT*/ PVOID  *Event);
  4.9066 -
  4.9067 -NTOSAPI
  4.9068 -VOID
  4.9069 -DDKAPI
  4.9070 -PoSetDeviceBusy(
  4.9071 -  PULONG  IdlePointer); 
  4.9072 -
  4.9073 -NTOSAPI
  4.9074 -POWER_STATE
  4.9075 -DDKAPI
  4.9076 -PoSetPowerState(
  4.9077 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.9078 -  /*IN*/ POWER_STATE_TYPE  Type,
  4.9079 -  /*IN*/ POWER_STATE  State);
  4.9080 -
  4.9081 -NTOSAPI
  4.9082 -VOID
  4.9083 -DDKAPI
  4.9084 -PoSetSystemState(
  4.9085 -  /*IN*/ EXECUTION_STATE  Flags);
  4.9086 -
  4.9087 -NTOSAPI
  4.9088 -VOID
  4.9089 -DDKAPI
  4.9090 -PoStartNextPowerIrp(
  4.9091 -  /*IN*/ PIRP  Irp);
  4.9092 -
  4.9093 -NTOSAPI
  4.9094 -VOID
  4.9095 -DDKAPI
  4.9096 -PoUnregisterSystemState(
  4.9097 -  /*IN*/ PVOID  StateHandle);
  4.9098 -
  4.9099 -
  4.9100 -
  4.9101 -/** WMI library support routines **/
  4.9102 -
  4.9103 -NTOSAPI
  4.9104 -NTSTATUS
  4.9105 -DDKAPI
  4.9106 -WmiCompleteRequest(
  4.9107 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.9108 -  /*IN*/ PIRP  Irp,
  4.9109 -  /*IN*/ NTSTATUS  Status,
  4.9110 -  /*IN*/ ULONG  BufferUsed,
  4.9111 -  /*IN*/ CCHAR  PriorityBoost);
  4.9112 -
  4.9113 -NTOSAPI
  4.9114 -NTSTATUS
  4.9115 -DDKAPI
  4.9116 -WmiFireEvent(
  4.9117 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.9118 -  /*IN*/ LPGUID  Guid, 
  4.9119 -  /*IN*/ ULONG  InstanceIndex,
  4.9120 -  /*IN*/ ULONG  EventDataSize,
  4.9121 -  /*IN*/ PVOID  EventData); 
  4.9122 -
  4.9123 -NTOSAPI
  4.9124 -NTSTATUS
  4.9125 -DDKAPI
  4.9126 -WmiQueryTraceInformation(
  4.9127 -  /*IN*/ TRACE_INFORMATION_CLASS  TraceInformationClass,
  4.9128 -  /*OUT*/ PVOID  TraceInformation,
  4.9129 -  /*IN*/ ULONG  TraceInformationLength,
  4.9130 -  /*OUT*/ PULONG  RequiredLength /*OPTIONAL*/,
  4.9131 -  /*IN*/ PVOID  Buffer /*OPTIONAL*/);
  4.9132 -
  4.9133 -NTOSAPI
  4.9134 -NTSTATUS
  4.9135 -DDKAPI
  4.9136 -WmiSystemControl(
  4.9137 -  /*IN*/ PWMILIB_CONTEXT  WmiLibInfo,
  4.9138 -  /*IN*/ PDEVICE_OBJECT  DeviceObject,
  4.9139 -  /*IN*/ PIRP  Irp,
  4.9140 -  /*OUT*/ PSYSCTL_IRP_DISPOSITION  IrpDisposition);
  4.9141 -
  4.9142 -NTOSAPI
  4.9143 -NTSTATUS
  4.9144 -DDKCDECLAPI
  4.9145 -WmiTraceMessage(
  4.9146 -  /*IN*/ TRACEHANDLE  LoggerHandle,
  4.9147 -  /*IN*/ ULONG  MessageFlags,
  4.9148 -  /*IN*/ LPGUID  MessageGuid,
  4.9149 -  /*IN*/ USHORT  MessageNumber,
  4.9150 -  /*IN*/ ...);
  4.9151 -
  4.9152 -#if 0
  4.9153 -/* FIXME: Get va_list from where? */
  4.9154 -NTOSAPI
  4.9155 -NTSTATUS
  4.9156 -DDKCDECLAPI
  4.9157 -WmiTraceMessageVa(
  4.9158 -  /*IN*/ TRACEHANDLE  LoggerHandle,
  4.9159 -  /*IN*/ ULONG  MessageFlags,
  4.9160 -  /*IN*/ LPGUID  MessageGuid,
  4.9161 -  /*IN*/ USHORT  MessageNumber,
  4.9162 -  /*IN*/ va_list  MessageArgList);
  4.9163 -#endif
  4.9164 -
  4.9165 -
  4.9166 -/** Kernel debugger routines **/
  4.9167 -
  4.9168 -NTOSAPI
  4.9169 -VOID
  4.9170 -DDKAPI
  4.9171 -KdDisableDebugger(
  4.9172 -  VOID);
  4.9173 -
  4.9174 -NTOSAPI
  4.9175 -VOID
  4.9176 -DDKAPI
  4.9177 -KdEnableDebugger(
  4.9178 -  VOID);
  4.9179 -
  4.9180 -NTOSAPI
  4.9181 -VOID
  4.9182 -DDKAPI
  4.9183 -DbgBreakPoint(
  4.9184 -  VOID);
  4.9185 -
  4.9186 -NTOSAPI
  4.9187 -VOID
  4.9188 -DDKAPI
  4.9189 -DbgBreakPointWithStatus(
  4.9190 -  /*IN*/ ULONG  Status);
  4.9191 -
  4.9192 -NTOSAPI
  4.9193 -ULONG
  4.9194 -DDKCDECLAPI
  4.9195 -DbgPrint(
  4.9196 -  /*IN*/ PCH  Format,
  4.9197 -  /*IN*/ ...);
  4.9198 -
  4.9199 -NTOSAPI
  4.9200 -ULONG
  4.9201 -DDKCDECLAPI
  4.9202 -DbgPrintEx(
  4.9203 -  /*IN*/ ULONG  ComponentId,
  4.9204 -  /*IN*/ ULONG  Level,
  4.9205 -  /*IN*/ PCH  Format,
  4.9206 -  /*IN*/ ...);
  4.9207 -
  4.9208 -NTOSAPI
  4.9209 -ULONG
  4.9210 -DDKCDECLAPI
  4.9211 -DbgPrintReturnControlC(
  4.9212 -  /*IN*/ PCH  Format,
  4.9213 -  /*IN*/ ...);
  4.9214 -
  4.9215 -NTOSAPI
  4.9216 -NTSTATUS
  4.9217 -DDKAPI
  4.9218 -DbgQueryDebugFilterState(
  4.9219 -  /*IN*/ ULONG  ComponentId,
  4.9220 -  /*IN*/ ULONG  Level);
  4.9221 -
  4.9222 -NTOSAPI
  4.9223 -NTSTATUS
  4.9224 -DDKAPI
  4.9225 -DbgSetDebugFilterState(
  4.9226 -  /*IN*/ ULONG  ComponentId,
  4.9227 -  /*IN*/ ULONG  Level,
  4.9228 -  /*IN*/ BOOLEAN  State);
  4.9229 -
  4.9230 -#ifdef DBG
  4.9231 -
  4.9232 -#define KdPrint(_x_) DbgPrint _x_
  4.9233 -#define KdPrintEx(_x_) DbgPrintEx _x_
  4.9234 -#define KdBreakPoint() DbgBreakPoint()
  4.9235 -#define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
  4.9236 -
  4.9237 -#else /* !DBG */
  4.9238 -
  4.9239 -#define KdPrint(_x_)
  4.9240 -#define KdPrintEx(_x_)
  4.9241 -#define KdBreakPoint()
  4.9242 -#define KdBreakPointWithStatus(s)
  4.9243 -
  4.9244 -#endif /* !DBG */
  4.9245 -
  4.9246 -extern NTOSAPI PBOOLEAN KdDebuggerNotPresent;
  4.9247 -extern NTOSAPI PBOOLEAN KdDebuggerEnabled;
  4.9248 -#define KD_DEBUGGER_ENABLED     *KdDebuggerEnabled
  4.9249 -#define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
  4.9250 -
  4.9251 -#ifdef __cplusplus
  4.9252 -}
  4.9253 -#endif
  4.9254 -
  4.9255 -#endif /* __WINDDK_H */
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/mingw/mingw_extras.c	Wed Jul 09 20:17:22 2008 +1000
     5.3 @@ -0,0 +1,597 @@
     5.4 +/*
     5.5 + * Provide missing std functions needed by the driver but not provided by
     5.6 + * MinGW. Code mostly taken from Linux or as noted.
     5.7 + *
     5.8 + * Remaining code is
     5.9 + * Copyright Andy Grover <andy.grover@oracle.com> 
    5.10 + * and licensed under the GPLv2.
    5.11 + */
    5.12 +
    5.13 +#include <ntddk.h>
    5.14 +#include "mingw_extras.h"
    5.15 +
    5.16 +NTSTATUS
    5.17 +RtlStringCbPrintfW(
    5.18 +  win_wchar_t *dest_str,
    5.19 +  size_t dest_size,
    5.20 +  win_wchar_t *format,
    5.21 +  ...)
    5.22 +{
    5.23 +  va_list args;
    5.24 +  int len;
    5.25 +  int i;
    5.26 +  char tmp_buf[512];
    5.27 +  NTSTATUS status = STATUS_SUCCESS;
    5.28 +
    5.29 +  if (dest_size > sizeof(tmp_buf))
    5.30 +    dest_size = sizeof(tmp_buf);
    5.31 +
    5.32 +  /* we don't have a 2-byte version of vsnprintf, so write it to a single-byte
    5.33 +     array using vsnprintf() and then copy result to the wchar buffer.
    5.34 +     This should be seldom executed, so this inefficiency should be ok. */
    5.35 +  va_start(args, format);
    5.36 +  len = vsnprintf(tmp_buf, sizeof(tmp_buf), (char *)format, args);
    5.37 +  va_end(args);
    5.38 +
    5.39 +  if (len >= (dest_size * sizeof(win_wchar_t))) {
    5.40 +    /* output buffer truncated */
    5.41 +    status = STATUS_BUFFER_OVERFLOW;
    5.42 +    len = sizeof(tmp_buf) - 1;
    5.43 +    tmp_buf[len] = '\0';
    5.44 +  }
    5.45 +
    5.46 +  /* copy byte-string to short_string, incl NULL */
    5.47 +  for (i = 0; i < (len + 1); i++)
    5.48 +  {
    5.49 +    dest_str[i] = tmp_buf[i];
    5.50 +  }
    5.51 +
    5.52 +  return status;
    5.53 +}
    5.54 +
    5.55 +/* ----- BEGIN Other people's code --------- */
    5.56 +
    5.57 +/* from arch/x86/boot/string.c, used under GPLv2 */
    5.58 +/* Copyright (C) 1991, 1992 Linus Torvalds
    5.59 + * Copyright 2007 rPath, Inc. - All Rights Reserved
    5.60 + */
    5.61 +size_t strnlen(const char *s, size_t maxlen)
    5.62 +{
    5.63 +  const char *es = s;
    5.64 +  while (*es && maxlen) {
    5.65 +    es++;
    5.66 +    maxlen--;
    5.67 +  }
    5.68 +
    5.69 +  return (es - s);
    5.70 +}
    5.71 +
    5.72 +/* from arch/x86/boot/boot.h, used under GPLv2 */
    5.73 +/* Copyright (C) 1991, 1992 Linus Torvalds
    5.74 + * Copyright 2007 rPath, Inc. - All Rights Reserved
    5.75 + */
    5.76 +static int isdigit(int ch)
    5.77 +{
    5.78 +        return (ch >= '0') && (ch <= '9');
    5.79 +}
    5.80 +
    5.81 +/* from K&Rv2 p. 43 */
    5.82 +int atoi(const char s[])
    5.83 +{
    5.84 +  int i, n;
    5.85 +
    5.86 +  n = 0;
    5.87 +  for(i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
    5.88 +    n = 10 * n + (s[i] - '0');
    5.89 +  return n;
    5.90 +}
    5.91 +
    5.92 +/* from linux/lib/vsprintf.c, used under GPLv2 */
    5.93 +/* Copyright (C) 1991, 1992  Linus Torvalds
    5.94 + * Wirzenius wrote this portably, Torvalds fucked it up :-)
    5.95 + */
    5.96 +static int skip_atoi(const char **s)
    5.97 +{
    5.98 +	int i=0;
    5.99 +
   5.100 +	while (isdigit(**s))
   5.101 +		i = i*10 + *((*s)++) - '0';
   5.102 +	return i;
   5.103 +}
   5.104 +
   5.105 +int snprintf(char * buf, size_t size, const char *fmt, ...)
   5.106 +{
   5.107 +  va_list args;
   5.108 +  int i;
   5.109 +
   5.110 +  va_start(args, fmt);
   5.111 +  i = vsnprintf(buf,size,fmt,args);
   5.112 +  va_end(args);
   5.113 +  return i;
   5.114 +}
   5.115 +
   5.116 +#define do_div(n,base) ({ \
   5.117 +int __res; \
   5.118 +__res = ((unsigned long) n) % (unsigned) base; \
   5.119 +n = ((unsigned long) n) / (unsigned) base; \
   5.120 +__res; })
   5.121 +
   5.122 +
   5.123 +/* Decimal conversion is by far the most typical, and is used
   5.124 + * for /proc and /sys data. This directly impacts e.g. top performance
   5.125 + * with many processes running. We optimize it for speed
   5.126 + * using code from
   5.127 + * http://www.cs.uiowa.edu/~jones/bcd/decimal.html
   5.128 + * (with permission from the author, Douglas W. Jones). */
   5.129 +
   5.130 +/* Formats correctly any integer in [0,99999].
   5.131 + * Outputs from one to five digits depending on input.
   5.132 + * On i386 gcc 4.1.2 -O2: ~250 bytes of code. */
   5.133 +static char* put_dec_trunc(char *buf, unsigned q)
   5.134 +{
   5.135 +	unsigned d3, d2, d1, d0;
   5.136 +	d1 = (q>>4) & 0xf;
   5.137 +	d2 = (q>>8) & 0xf;
   5.138 +	d3 = (q>>12);
   5.139 +
   5.140 +	d0 = 6*(d3 + d2 + d1) + (q & 0xf);
   5.141 +	q = (d0 * 0xcd) >> 11;
   5.142 +	d0 = d0 - 10*q;
   5.143 +	*buf++ = d0 + '0'; /* least significant digit */
   5.144 +	d1 = q + 9*d3 + 5*d2 + d1;
   5.145 +	if (d1 != 0) {
   5.146 +		q = (d1 * 0xcd) >> 11;
   5.147 +		d1 = d1 - 10*q;
   5.148 +		*buf++ = d1 + '0'; /* next digit */
   5.149 +
   5.150 +		d2 = q + 2*d2;
   5.151 +		if ((d2 != 0) || (d3 != 0)) {
   5.152 +			q = (d2 * 0xd) >> 7;
   5.153 +			d2 = d2 - 10*q;
   5.154 +			*buf++ = d2 + '0'; /* next digit */
   5.155 +
   5.156 +			d3 = q + 4*d3;
   5.157 +			if (d3 != 0) {
   5.158 +				q = (d3 * 0xcd) >> 11;
   5.159 +				d3 = d3 - 10*q;
   5.160 +				*buf++ = d3 + '0';  /* next digit */
   5.161 +				if (q != 0)
   5.162 +					*buf++ = q + '0';  /* most sign. digit */
   5.163 +			}
   5.164 +		}
   5.165 +	}
   5.166 +	return buf;
   5.167 +}
   5.168 +/* Same with if's removed. Always emits five digits */
   5.169 +static char* put_dec_full(char *buf, unsigned q)
   5.170 +{
   5.171 +	/* BTW, if q is in [0,9999], 8-bit ints will be enough, */
   5.172 +	/* but anyway, gcc produces better code with full-sized ints */
   5.173 +	unsigned d3, d2, d1, d0;
   5.174 +	d1 = (q>>4) & 0xf;
   5.175 +	d2 = (q>>8) & 0xf;
   5.176 +	d3 = (q>>12);
   5.177 +
   5.178 +	/* Possible ways to approx. divide by 10 */
   5.179 +	/* gcc -O2 replaces multiply with shifts and adds */
   5.180 +	// (x * 0xcd) >> 11: 11001101 - shorter code than * 0x67 (on i386)
   5.181 +	// (x * 0x67) >> 10:  1100111
   5.182 +	// (x * 0x34) >> 9:    110100 - same
   5.183 +	// (x * 0x1a) >> 8:     11010 - same
   5.184 +	// (x * 0x0d) >> 7:      1101 - same, shortest code (on i386)
   5.185 +
   5.186 +	d0 = 6*(d3 + d2 + d1) + (q & 0xf);
   5.187 +	q = (d0 * 0xcd) >> 11;
   5.188 +	d0 = d0 - 10*q;
   5.189 +	*buf++ = d0 + '0';
   5.190 +	d1 = q + 9*d3 + 5*d2 + d1;
   5.191 +		q = (d1 * 0xcd) >> 11;
   5.192 +		d1 = d1 - 10*q;
   5.193 +		*buf++ = d1 + '0';
   5.194 +
   5.195 +		d2 = q + 2*d2;
   5.196 +			q = (d2 * 0xd) >> 7;
   5.197 +			d2 = d2 - 10*q;
   5.198 +			*buf++ = d2 + '0';
   5.199 +
   5.200 +			d3 = q + 4*d3;
   5.201 +				q = (d3 * 0xcd) >> 11; /* - shorter code */
   5.202 +				/* q = (d3 * 0x67) >> 10; - would also work */
   5.203 +				d3 = d3 - 10*q;
   5.204 +				*buf++ = d3 + '0';
   5.205 +					*buf++ = q + '0';
   5.206 +	return buf;
   5.207 +}
   5.208 +
   5.209 +static char* put_dec(char *buf, unsigned long long num)
   5.210 +{
   5.211 +	while (1) {
   5.212 +		unsigned rem;
   5.213 +		if (num < 100000)
   5.214 +			return put_dec_trunc(buf, num);
   5.215 +		rem = do_div(num, 100000);
   5.216 +		buf = put_dec_full(buf, rem);
   5.217 +	}
   5.218 +}
   5.219 +
   5.220 +
   5.221 +#define ZEROPAD	1		/* pad with zero */
   5.222 +#define SIGN	2		/* unsigned/signed long */
   5.223 +#define PLUS	4		/* show plus */
   5.224 +#define SPACE	8		/* space if plus */
   5.225 +#define LEFT	16		/* left justified */
   5.226 +#define SMALL	32		/* Must be 32 == 0x20 */
   5.227 +#define SPECIAL	64		/* 0x */
   5.228 +
   5.229 +static char *number(char *buf, char *end, unsigned long long num, int base, int size, int precision, int type)
   5.230 +{
   5.231 +	/* we are called with base 8, 10 or 16, only, thus don't need "G..."  */
   5.232 +	static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
   5.233 +
   5.234 +	char tmp[66];
   5.235 +	char sign;
   5.236 +	char locase;
   5.237 +	int need_pfx = ((type & SPECIAL) && base != 10);
   5.238 +	int i;
   5.239 +
   5.240 +	/* locase = 0 or 0x20. ORing digits or letters with 'locase'
   5.241 +	 * produces same digits or (maybe lowercased) letters */
   5.242 +	locase = (type & SMALL);
   5.243 +	if (type & LEFT)
   5.244 +		type &= ~ZEROPAD;
   5.245 +	sign = 0;
   5.246 +	if (type & SIGN) {
   5.247 +		if ((signed long long) num < 0) {
   5.248 +			sign = '-';
   5.249 +			num = - (signed long long) num;
   5.250 +			size--;
   5.251 +		} else if (type & PLUS) {
   5.252 +			sign = '+';
   5.253 +			size--;
   5.254 +		} else if (type & SPACE) {
   5.255 +			sign = ' ';
   5.256 +			size--;
   5.257 +		}
   5.258 +	}
   5.259 +	if (need_pfx) {
   5.260 +		size--;
   5.261 +		if (base == 16)
   5.262 +			size--;
   5.263 +	}
   5.264 +
   5.265 +	/* generate full string in tmp[], in reverse order */
   5.266 +	i = 0;
   5.267 +	if (num == 0)
   5.268 +		tmp[i++] = '0';
   5.269 +	/* Generic code, for any base:
   5.270 +	else do {
   5.271 +		tmp[i++] = (digits[do_div(num,base)] | locase);
   5.272 +	} while (num != 0);
   5.273 +	*/
   5.274 +	else if (base != 10) { /* 8 or 16 */
   5.275 +		int mask = base - 1;
   5.276 +		int shift = 3;
   5.277 +		if (base == 16) shift = 4;
   5.278 +		do {
   5.279 +			tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
   5.280 +			num >>= shift;
   5.281 +		} while (num);
   5.282 +	} else { /* base 10 */
   5.283 +		i = put_dec(tmp, num) - tmp;
   5.284 +	}
   5.285 +
   5.286 +	/* printing 100 using %2d gives "100", not "00" */
   5.287 +	if (i > precision)
   5.288 +		precision = i;
   5.289 +	/* leading space padding */
   5.290 +	size -= precision;
   5.291 +	if (!(type & (ZEROPAD+LEFT))) {
   5.292 +		while(--size >= 0) {
   5.293 +			if (buf < end)
   5.294 +				*buf = ' ';
   5.295 +			++buf;
   5.296 +		}
   5.297 +	}
   5.298 +	/* sign */
   5.299 +	if (sign) {
   5.300 +		if (buf < end)
   5.301 +			*buf = sign;
   5.302 +		++buf;
   5.303 +	}
   5.304 +	/* "0x" / "0" prefix */
   5.305 +	if (need_pfx) {
   5.306 +		if (buf < end)
   5.307 +			*buf = '0';
   5.308 +		++buf;
   5.309 +		if (base == 16) {
   5.310 +			if (buf < end)
   5.311 +				*buf = ('X' | locase);
   5.312 +			++buf;
   5.313 +		}
   5.314 +	}
   5.315 +	/* zero or space padding */
   5.316 +	if (!(type & LEFT)) {
   5.317 +		char c = (type & ZEROPAD) ? '0' : ' ';
   5.318 +		while (--size >= 0) {
   5.319 +			if (buf < end)
   5.320 +				*buf = c;
   5.321 +			++buf;
   5.322 +		}
   5.323 +	}
   5.324 +	/* hmm even more zero padding? */
   5.325 +	while (i <= --precision) {
   5.326 +		if (buf < end)
   5.327 +			*buf = '0';
   5.328 +		++buf;
   5.329 +	}
   5.330 +	/* actual digits of result */
   5.331 +	while (--i >= 0) {
   5.332 +		if (buf < end)
   5.333 +			*buf = tmp[i];
   5.334 +		++buf;
   5.335 +	}
   5.336 +	/* trailing space padding */
   5.337 +	while (--size >= 0) {
   5.338 +		if (buf < end)
   5.339 +			*buf = ' ';
   5.340 +		++buf;
   5.341 +	}
   5.342 +	return buf;
   5.343 +}
   5.344 +
   5.345 +/**
   5.346 + * vsnprintf - Format a string and place it in a buffer
   5.347 + * @buf: The buffer to place the result into
   5.348 + * @size: The size of the buffer, including the trailing null space
   5.349 + * @fmt: The format string to use
   5.350 + * @args: Arguments for the format string
   5.351 + *
   5.352 + * The return value is the number of characters which would
   5.353 + * be generated for the given input, excluding the trailing
   5.354 + * '\0', as per ISO C99. If you want to have the exact
   5.355 + * number of characters written into @buf as return value
   5.356 + * (not including the trailing '\0'), use vscnprintf(). If the
   5.357 + * return is greater than or equal to @size, the resulting
   5.358 + * string is truncated.
   5.359 + *
   5.360 + * Call this function if you are already dealing with a va_list.
   5.361 + * You probably want snprintf() instead.
   5.362 + */
   5.363 +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
   5.364 +{
   5.365 +	int len;
   5.366 +	unsigned long long num;
   5.367 +	int i, base;
   5.368 +	char *str, *end, c;
   5.369 +	const char *s;
   5.370 +
   5.371 +	int flags;		/* flags to number() */
   5.372 +
   5.373 +	int field_width;	/* width of output field */
   5.374 +	int precision;		/* min. # of digits for integers; max
   5.375 +				   number of chars for from string */
   5.376 +	int qualifier;		/* 'h', 'l', or 'L' for integer fields */
   5.377 +				/* 'z' support added 23/7/1999 S.H.    */
   5.378 +				/* 'z' changed to 'Z' --davidm 1/25/99 */
   5.379 +				/* 't' added for ptrdiff_t */
   5.380 +
   5.381 +	/* Reject out-of-range values early.  Large positive sizes are
   5.382 +	   used for unknown buffer sizes. */
   5.383 +	if ((int) size < 0)
   5.384 +		return 0;
   5.385 +
   5.386 +	str = buf;
   5.387 +	end = buf + size;
   5.388 +
   5.389 +	/* Make sure end is always >= buf */
   5.390 +	if (end < buf) {
   5.391 +		end = ((void *)-1);
   5.392 +		size = end - buf;
   5.393 +	}
   5.394 +
   5.395 +	for (; *fmt ; ++fmt) {
   5.396 +		if (*fmt != '%') {
   5.397 +			if (str < end)
   5.398 +				*str = *fmt;
   5.399 +			++str;
   5.400 +			continue;
   5.401 +		}
   5.402 +
   5.403 +		/* process flags */
   5.404 +		flags = 0;
   5.405 +		repeat:
   5.406 +			++fmt;		/* this also skips first '%' */
   5.407 +			switch (*fmt) {
   5.408 +				case '-': flags |= LEFT; goto repeat;
   5.409 +				case '+': flags |= PLUS; goto repeat;
   5.410 +				case ' ': flags |= SPACE; goto repeat;
   5.411 +				case '#': flags |= SPECIAL; goto repeat;
   5.412 +				case '0': flags |= ZEROPAD; goto repeat;
   5.413 +			}
   5.414 +
   5.415 +		/* get field width */
   5.416 +		field_width = -1;
   5.417 +		if (isdigit(*fmt))
   5.418 +			field_width = skip_atoi(&fmt);
   5.419 +		else if (*fmt == '*') {
   5.420 +			++fmt;
   5.421 +			/* it's the next argument */
   5.422 +			field_width = va_arg(args, int);
   5.423 +			if (field_width < 0) {
   5.424 +				field_width = -field_width;
   5.425 +				flags |= LEFT;
   5.426 +			}
   5.427 +		}
   5.428 +
   5.429 +		/* get the precision */
   5.430 +		precision = -1;
   5.431 +		if (*fmt == '.') {
   5.432 +			++fmt;	
   5.433 +			if (isdigit(*fmt))
   5.434 +				precision = skip_atoi(&fmt);
   5.435 +			else if (*fmt == '*') {
   5.436 +				++fmt;
   5.437 +				/* it's the next argument */
   5.438 +				precision = va_arg(args, int);
   5.439 +			}
   5.440 +			if (precision < 0)
   5.441 +				precision = 0;
   5.442 +		}
   5.443 +
   5.444 +		/* get the conversion qualifier */
   5.445 +		qualifier = -1;
   5.446 +		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
   5.447 +		    *fmt =='Z' || *fmt == 'z' || *fmt == 't') {
   5.448 +			qualifier = *fmt;
   5.449 +			++fmt;
   5.450 +			if (qualifier == 'l' && *fmt == 'l') {
   5.451 +				qualifier = 'L';
   5.452 +				++fmt;
   5.453 +			}
   5.454 +		}
   5.455 +
   5.456 +		/* default base */
   5.457 +		base = 10;
   5.458 +
   5.459 +		switch (*fmt) {
   5.460 +			case 'c':
   5.461 +				if (!(flags & LEFT)) {
   5.462 +					while (--field_width > 0) {
   5.463 +						if (str < end)
   5.464 +							*str = ' ';
   5.465 +						++str;
   5.466 +					}
   5.467 +				}
   5.468 +				c = (unsigned char) va_arg(args, int);
   5.469 +				if (str < end)
   5.470 +					*str = c;
   5.471 +				++str;
   5.472 +				while (--field_width > 0) {
   5.473 +					if (str < end)
   5.474 +						*str = ' ';
   5.475 +					++str;
   5.476 +				}
   5.477 +				continue;
   5.478 +
   5.479 +			case 's':
   5.480 +				s = va_arg(args, char *);
   5.481 +				if ((unsigned long)s < PAGE_SIZE)
   5.482 +					s = "<NULL>";
   5.483 +
   5.484 +				len = strnlen(s, precision);
   5.485 +
   5.486 +				if (!(flags & LEFT)) {
   5.487 +					while (len < field_width--) {
   5.488 +						if (str < end)
   5.489 +							*str = ' ';
   5.490 +						++str;
   5.491 +					}
   5.492 +				}
   5.493 +				for (i = 0; i < len; ++i) {
   5.494 +					if (str < end)
   5.495 +						*str = *s;
   5.496 +					++str; ++s;
   5.497 +				}
   5.498 +				while (len < field_width--) {
   5.499 +					if (str < end)
   5.500 +						*str = ' ';
   5.501 +					++str;
   5.502 +				}
   5.503 +				continue;
   5.504 +
   5.505 +			case 'p':
   5.506 +				flags |= SMALL;
   5.507 +				if (field_width == -1) {
   5.508 +					field_width = 2*sizeof(void *);
   5.509 +					flags |= ZEROPAD;
   5.510 +				}
   5.511 +				str = number(str, end,
   5.512 +						(unsigned long) va_arg(args, void *),
   5.513 +						16, field_width, precision, flags);
   5.514 +				continue;
   5.515 +
   5.516 +
   5.517 +			case 'n':
   5.518 +				/* FIXME:
   5.519 +				* What does C99 say about the overflow case here? */
   5.520 +				if (qualifier == 'l') {
   5.521 +					long * ip = va_arg(args, long *);
   5.522 +					*ip = (str - buf);
   5.523 +				} else if (qualifier == 'Z' || qualifier == 'z') {
   5.524 +					size_t * ip = va_arg(args, size_t *);
   5.525 +					*ip = (str - buf);
   5.526 +				} else {
   5.527 +					int * ip = va_arg(args, int *);
   5.528 +					*ip = (str - buf);
   5.529 +				}
   5.530 +				continue;
   5.531 +
   5.532 +			case '%':
   5.533 +				if (str < end)
   5.534 +					*str = '%';
   5.535 +				++str;
   5.536 +				continue;
   5.537 +
   5.538 +				/* integer number formats - set up the flags and "break" */
   5.539 +			case 'o':
   5.540 +				base = 8;
   5.541 +				break;
   5.542 +
   5.543 +			case 'x':
   5.544 +				flags |= SMALL;
   5.545 +			case 'X':
   5.546 +				base = 16;
   5.547 +				break;
   5.548 +
   5.549 +			case 'd':
   5.550 +			case 'i':
   5.551 +				flags |= SIGN;
   5.552 +			case 'u':
   5.553 +				break;
   5.554 +
   5.555 +			default:
   5.556 +				if (str < end)
   5.557 +					*str = '%';
   5.558 +				++str;
   5.559 +				if (*fmt) {
   5.560 +					if (str < end)
   5.561 +						*str = *fmt;
   5.562 +					++str;
   5.563 +				} else {
   5.564 +					--fmt;
   5.565 +				}
   5.566 +				continue;
   5.567 +		}
   5.568 +		if (qualifier == 'L')
   5.569 +			num = va_arg(args, long long);
   5.570 +		else if (qualifier == 'l') {
   5.571 +			num = va_arg(args, unsigned long);
   5.572 +			if (flags & SIGN)
   5.573 +				num = (signed long) num;
   5.574 +		} else if (qualifier == 'Z' || qualifier == 'z') {
   5.575 +			num = va_arg(args, size_t);
   5.576 +		} else if (qualifier == 't') {
   5.577 +			num = va_arg(args, ptrdiff_t);
   5.578 +		} else if (qualifier == 'h') {
   5.579 +			num = (unsigned short) va_arg(args, int);
   5.580 +			if (flags & SIGN)
   5.581 +				num = (signed short) num;
   5.582 +		} else {
   5.583 +			num = va_arg(args, unsigned int);
   5.584 +			if (flags & SIGN)
   5.585 +				num = (signed int) num;
   5.586 +		}
   5.587 +		str = number(str, end, num, base,
   5.588 +				field_width, precision, flags);
   5.589 +	}
   5.590 +	if (size > 0) {
   5.591 +		if (str < end)
   5.592 +			*str = '\0';
   5.593 +		else
   5.594 +			end[-1] = '\0';
   5.595 +	}
   5.596 +	/* the trailing null byte doesn't count towards the total */
   5.597 +	return str-buf;
   5.598 +}
   5.599 +/* ----- END Other people's code --------- */
   5.600 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/mingw/mingw_extras.h	Wed Jul 09 20:17:22 2008 +1000
     6.3 @@ -0,0 +1,17 @@
     6.4 +#include <stdio.h>
     6.5 +
     6.6 +/* windows wchar 2 bytes, Linux's is 4! */
     6.7 +typedef unsigned short win_wchar_t;
     6.8 +
     6.9 +NTSTATUS
    6.10 +RtlStringCbPrintfW(
    6.11 +  win_wchar_t *dest_str,
    6.12 +  size_t dest_size,
    6.13 +  win_wchar_t *format,
    6.14 +  ...);
    6.15 +
    6.16 +/* stuff needed for xennet */
    6.17 +#include <ndis.h>
    6.18 +
    6.19 +//#define GCCNOANON u.s2.
    6.20 +
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/mingw/w32api.diff	Wed Jul 09 20:17:22 2008 +1000
     7.3 @@ -0,0 +1,373 @@
     7.4 +diff -r 79e257d5a1f7 include/ddk/ndis.h
     7.5 +--- a/include/ddk/ndis.h	Tue Jul 08 22:16:37 2008 -0700
     7.6 ++++ b/include/ddk/ndis.h	Wed Jul 09 00:34:21 2008 -0700
     7.7 +@@ -52,12 +52,16 @@ extern "C" {
     7.8 + #if defined(NDIS50_MINIPORT)
     7.9 + #ifndef NDIS50
    7.10 + #define NDIS50
    7.11 ++#define NDIS_MINIPORT_MAJOR_VERSION 5
    7.12 ++#define NDIS_MINIPORT_MINOR_VERSION 0
    7.13 + #endif
    7.14 + #endif /* NDIS50_MINIPORT */
    7.15 + 
    7.16 + #if defined(NDIS51_MINIPORT)
    7.17 + #ifndef NDIS51
    7.18 + #define NDIS51
    7.19 ++#define NDIS_MINIPORT_MAJOR_VERSION 5
    7.20 ++#define NDIS_MINIPORT_MINOR_VERSION 1
    7.21 + #endif
    7.22 + #endif /* NDIS51_MINIPORT */
    7.23 + 
    7.24 +@@ -399,19 +403,19 @@ typedef struct _NDIS_PACKET_PRIVATE {
    7.25 + 
    7.26 + typedef struct _NDIS_PACKET {
    7.27 +   NDIS_PACKET_PRIVATE  Private;
    7.28 +-  union {
    7.29 +-    struct {
    7.30 ++  _ANONYMOUS_UNION union {
    7.31 ++    _ANONYMOUS_STRUCT struct {
    7.32 +       UCHAR  MiniportReserved[2 * sizeof(PVOID)];
    7.33 +       UCHAR  WrapperReserved[2 * sizeof(PVOID)];
    7.34 +-    } s1;
    7.35 +-    struct {
    7.36 ++    } DUMMYSTRUCTNAME;
    7.37 ++    _ANONYMOUS_STRUCT struct {
    7.38 +       UCHAR  MiniportReservedEx[3 * sizeof(PVOID)];
    7.39 +       UCHAR  WrapperReservedEx[sizeof(PVOID)];
    7.40 +-    } s2;
    7.41 +-    struct {
    7.42 ++    } DUMMYSTRUCTNAME;
    7.43 ++    _ANONYMOUS_STRUCT struct {
    7.44 +       UCHAR  MacReserved[4 * sizeof(PVOID)];
    7.45 +-    } s3;
    7.46 +-  } u;
    7.47 ++    } DUMMYSTRUCTNAME;
    7.48 ++  } DUMMYUNIONNAME;
    7.49 +   ULONG_PTR  Reserved[2];
    7.50 +   UCHAR  ProtocolReserved[1];
    7.51 + } NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
    7.52 +@@ -642,6 +646,13 @@ typedef enum _NDIS_PNP_DEVICE_STATE {
    7.53 + #define NDIS_DEVICE_DISABLE_WAKE_ON_MAGIC_PACKET  0x00000080
    7.54 + #define NDIS_DEVICE_DISABLE_WAKE_ON_PATTERN_MATCH 0x00000100
    7.55 + 
    7.56 ++typedef enum _NDIS_DEVICE_PNP_EVENT
    7.57 ++{
    7.58 ++  /* couldn't find public docs on other values */
    7.59 ++  NdisDevicePnpEventSurpriseRemoved=2,
    7.60 ++  NdisDevicePnpEventPowerProfileChanged=5
    7.61 ++} NDIS_DEVICE_PNP_EVENT;
    7.62 ++
    7.63 + 
    7.64 + /* OID_GEN_NETWORK_LAYER_ADDRESSES */
    7.65 + typedef struct _NETWORK_ADDRESS {
    7.66 +@@ -915,6 +926,33 @@ typedef struct _NDIS_TASK_IPSEC {
    7.67 +   } V4ESP;
    7.68 + } NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
    7.69 + 
    7.70 ++typedef enum _NDIS_ENCAPSULATION {
    7.71 ++  UNSPECIFIED_Encapsulation,
    7.72 ++  NULL_Encapsulation,
    7.73 ++  IEEE_802_3_Encapsulation,
    7.74 ++  IEEE_802_5_Encapsulation,
    7.75 ++  LLC_SNAP_ROUTED_Encapsulation,
    7.76 ++  LLC_SNAP_BRIDGED_Encapsulation
    7.77 ++} NDIS_ENCAPSULATION;
    7.78 ++
    7.79 ++typedef struct _NDIS_ENCAPSULATION_FORMAT {
    7.80 ++  NDIS_ENCAPSULATION  Encapsulation;
    7.81 ++  struct {
    7.82 ++    ULONG  FixedHeaderSize : 1;
    7.83 ++    ULONG  Reserved : 31;
    7.84 ++  } Flags;
    7.85 ++  ULONG  EncapsulationHeaderSize;
    7.86 ++} NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
    7.87 ++
    7.88 ++typedef struct _NDIS_TASK_OFFLOAD_HEADER
    7.89 ++{
    7.90 ++  ULONG Version;
    7.91 ++  ULONG Size;
    7.92 ++  ULONG Reserved;
    7.93 ++  UCHAR OffsetFirstTask;
    7.94 ++  NDIS_ENCAPSULATION_FORMAT EncapsulationFormat;
    7.95 ++} NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER;
    7.96 ++
    7.97 + typedef struct _NDIS_TASK_OFFLOAD {
    7.98 +   ULONG  Version;
    7.99 +   ULONG  Size;
   7.100 +@@ -926,24 +964,6 @@ typedef struct _NDIS_TASK_OFFLOAD {
   7.101 + 
   7.102 + /* NDIS_TASK_OFFLOAD_HEADER.Version constants */
   7.103 + #define NDIS_TASK_OFFLOAD_VERSION 1
   7.104 +-
   7.105 +-typedef enum _NDIS_ENCAPSULATION {
   7.106 +-  UNSPECIFIED_Encapsulation,
   7.107 +-  NULL_Encapsulation,
   7.108 +-  IEEE_802_3_Encapsulation,
   7.109 +-  IEEE_802_5_Encapsulation,
   7.110 +-  LLC_SNAP_ROUTED_Encapsulation,
   7.111 +-  LLC_SNAP_BRIDGED_Encapsulation
   7.112 +-} NDIS_ENCAPSULATION;
   7.113 +-
   7.114 +-typedef struct _NDIS_ENCAPSULATION_FORMAT {
   7.115 +-  NDIS_ENCAPSULATION  Encapsulation;
   7.116 +-  struct {
   7.117 +-    ULONG  FixedHeaderSize : 1;
   7.118 +-    ULONG  Reserved : 31;
   7.119 +-  } Flags;
   7.120 +-  ULONG  EncapsulationHeaderSize;
   7.121 +-} NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
   7.122 + 
   7.123 + typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
   7.124 +   struct {
   7.125 +@@ -1542,6 +1562,8 @@ NdisAllocatePacketPool(
   7.126 +   /*OUT*/ PNDIS_HANDLE  PoolHandle,
   7.127 +   /*IN*/ UINT  NumberOfDescriptors,
   7.128 +   /*IN*/ UINT  ProtocolReservedLength);
   7.129 ++
   7.130 ++#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
   7.131 + 
   7.132 + NDISAPI
   7.133 + VOID
   7.134 +@@ -1756,6 +1778,46 @@ NdisFreeBuffer(
   7.135 + 
   7.136 + /*
   7.137 +  * VOID
   7.138 ++ * NdisGetFirstBufferFromPacketSafe(
   7.139 ++ * IN PNDIS_PACKET  _Packet,
   7.140 ++ * OUT PNDIS_BUFFER  * _FirstBuffer,
   7.141 ++ * OUT PVOID  * _FirstBufferVA,
   7.142 ++ * OUT PUINT  _FirstBufferLength,
   7.143 ++ * OUT PUINT  _TotalBufferLength),
   7.144 ++ * IN MM_PAGE_PRIORITY _Priority)
   7.145 ++ */
   7.146 ++#define NdisGetFirstBufferFromPacketSafe(_Packet,         \
   7.147 ++                                     _FirstBuffer,        \
   7.148 ++                                     _FirstBufferVA,      \
   7.149 ++                                     _FirstBufferLength,  \
   7.150 ++                                     _TotalBufferLength,  \
   7.151 ++                                     _Priority)           \
   7.152 ++{                                                         \
   7.153 ++  PNDIS_BUFFER _Buffer;                                   \
   7.154 ++                                                          \
   7.155 ++  _Buffer         = (_Packet)->Private.Head;              \
   7.156 ++  *(_FirstBuffer) = _Buffer;                              \
   7.157 ++  if (_Buffer != NULL)                                    \
   7.158 ++    {                                                     \
   7.159 ++            *(_FirstBufferVA)     = MmGetSystemAddressForMdlSafe(_Buffer, _Priority);  \
   7.160 ++            *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer);         \
   7.161 ++            _Buffer = _Buffer->Next;                                    \
   7.162 ++                  *(_TotalBufferLength) = *(_FirstBufferLength);              \
   7.163 ++                  while (_Buffer != NULL) {                                   \
   7.164 ++                    *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer);      \
   7.165 ++                    _Buffer = _Buffer->Next;                                  \
   7.166 ++                  }                                                           \
   7.167 ++    }                             \
   7.168 ++  else                            \
   7.169 ++    {                             \
   7.170 ++      *(_FirstBufferVA) = 0;      \
   7.171 ++      *(_FirstBufferLength) = 0;  \
   7.172 ++      *(_TotalBufferLength) = 0;  \
   7.173 ++    } \
   7.174 ++}
   7.175 ++
   7.176 ++/*
   7.177 ++ * VOID
   7.178 +  * NdisQueryBuffer(
   7.179 +  * IN PNDIS_BUFFER  Buffer,
   7.180 +  * OUT PVOID  *VirtualAddress OPTIONAL,
   7.181 +@@ -2092,7 +2154,7 @@ NdisFreeBuffer(
   7.182 +  * NdisReinitializePacket(
   7.183 +  * IN OUT  PNDIS_PACKET  Packet);
   7.184 +  */
   7.185 +-#define NdisReinitializePacketCounts(Packet)    \
   7.186 ++#define NdisReinitializePacket(Packet)          \
   7.187 + {                                               \
   7.188 + 	(Packet)->Private.Head = (PNDIS_BUFFER)NULL;  \
   7.189 + 	(Packet)->Private.ValidCounts = FALSE;        \
   7.190 +@@ -2967,6 +3029,11 @@ NdisMWanIndicateReceive(
   7.191 +   /*IN*/ PUCHAR  PacketBuffer,
   7.192 +   /*IN*/ UINT  PacketSize);
   7.193 + 
   7.194 ++#define NdisMIndicateReceivePacket(_handle, _packets, _number) \
   7.195 ++{  \
   7.196 ++  (*((PNDIS_MINIPORT_BLOCK)(_handle))->PacketIndicateHandler)(_handle, _packets, _number); \
   7.197 ++}
   7.198 ++
   7.199 + NDISAPI
   7.200 + VOID
   7.201 + DDKAPI
   7.202 +@@ -3155,6 +3222,13 @@ DDKAPI
   7.203 + DDKAPI
   7.204 + NdisPacketPoolUsage(
   7.205 +   /*IN*/ NDIS_HANDLE  PoolHandle);
   7.206 ++
   7.207 ++NTOSAPI
   7.208 ++VOID
   7.209 ++DDKAPI
   7.210 ++NdisSetPacketPoolProtocolId(
   7.211 ++  /*IN*/ NDIS_HANDLE PacketPoolHandle,
   7.212 ++  /*IN*/ UINT ProtocolId);
   7.213 + 
   7.214 + NDISAPI
   7.215 + NDIS_STATUS
   7.216 +@@ -4517,6 +4591,29 @@ struct _NDIS_OPEN_BLOCK
   7.217 + 
   7.218 + /* Routines for NDIS miniport drivers */
   7.219 + 
   7.220 ++NTOSAPI
   7.221 ++VOID
   7.222 ++DDKAPI
   7.223 ++NdisMInitializeTimer(
   7.224 ++  /*IN*/ /*OUT*/ PNDIS_MINIPORT_TIMER Timer,
   7.225 ++  /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
   7.226 ++  /*IN*/ PNDIS_TIMER_FUNCTION TimerFunction,
   7.227 ++  /*IN*/ PVOID FunctionContext);
   7.228 ++
   7.229 ++NTOSAPI
   7.230 ++VOID
   7.231 ++DDKAPI
   7.232 ++NdisMSetPeriodicTimer(
   7.233 ++  /*IN*/ PNDIS_MINIPORT_TIMER Timer,
   7.234 ++  /*IN*/ UINT MillisecondsPeriod);
   7.235 ++
   7.236 ++NTOSAPI
   7.237 ++VOID
   7.238 ++DDKAPI
   7.239 ++NdisMCancelTimer(
   7.240 ++  /*IN*/ PNDIS_MINIPORT_TIMER Timer,
   7.241 ++  /*OUT*/ PBOOLEAN TimerCancelled);
   7.242 ++
   7.243 + NDISAPI
   7.244 + VOID
   7.245 + DDKAPI
   7.246 +diff -r 79e257d5a1f7 include/ddk/ntddndis.h
   7.247 +--- a/include/ddk/ntddndis.h	Tue Jul 08 22:16:37 2008 -0700
   7.248 ++++ b/include/ddk/ntddndis.h	Wed Jul 09 00:34:21 2008 -0700
   7.249 +@@ -179,6 +179,13 @@ typedef struct _NDIS_PNP_CAPABILITIES {
   7.250 + #define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS    0x00800000
   7.251 + #define NDIS_MINIPORT_64BITS_DMA                      0x01000000
   7.252 + 
   7.253 ++/* TCP offload OIDs */
   7.254 ++#define OID_TCP_TASK_OFFLOAD                0xFC010201
   7.255 ++#define OID_TCP_TASK_IPSEC_ADD_SA           0xFC010202
   7.256 ++#define OID_TCP_TASK_IPSEC_ADD_UDPESP_SA    0xFC010203
   7.257 ++#define OID_TCP_TASK_IPSEC_DELETE_SA        0xFC010204
   7.258 ++#define OID_TCP_TASK_IPSEC_DELETE_UDPESP_SA 0xFC010205
   7.259 ++
   7.260 + #pragma pack(pop)
   7.261 + 
   7.262 + #ifdef __cplusplus
   7.263 +diff -r 79e257d5a1f7 include/ddk/winddk.h
   7.264 +--- a/include/ddk/winddk.h	Tue Jul 08 22:16:37 2008 -0700
   7.265 ++++ b/include/ddk/winddk.h	Wed Jul 09 00:34:21 2008 -0700
   7.266 +@@ -4896,6 +4896,10 @@ RtlStringFromGUID(
   7.267 +   /*IN*/ REFGUID  Guid, 
   7.268 +   /*OUT*/ PUNICODE_STRING  GuidString);
   7.269 + 
   7.270 ++#define RtlStringCbCopyA(dst, dst_len, src) strncpy(dst, src, dst_len)
   7.271 ++#define RtlStringCbPrintfA(args...) snprintf(args)
   7.272 ++#define RtlStringCbVPrintfA(args...) vsnprintf(args)
   7.273 ++
   7.274 + NTOSAPI
   7.275 + BOOLEAN
   7.276 + DDKAPI
   7.277 +@@ -7726,38 +7730,18 @@ KeWaitForSingleObject(
   7.278 +   /*IN*/ BOOLEAN  Alertable,
   7.279 +   /*IN*/ PLARGE_INTEGER  Timeout  /*OPTIONAL*/);
   7.280 + 
   7.281 +-#if defined(_X86_)
   7.282 +-
   7.283 +-NTOSAPI
   7.284 +-VOID
   7.285 +-FASTCALL
   7.286 +-KfLowerIrql(
   7.287 +-  /*IN*/ KIRQL  NewIrql);
   7.288 +-
   7.289 +-NTOSAPI
   7.290 +-KIRQL
   7.291 +-FASTCALL
   7.292 +-KfRaiseIrql(
   7.293 +-  /*IN*/ KIRQL  NewIrql);
   7.294 +-
   7.295 +-#define KeLowerIrql(a) KfLowerIrql(a)
   7.296 +-#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
   7.297 +-
   7.298 +-#else
   7.299 +-
   7.300 +-NTOSAPI
   7.301 +-VOID
   7.302 +-DDKAPI
   7.303 ++NTOSAPI
   7.304 ++VOID
   7.305 ++DDKAPI
   7.306 ++KeRaiseIrql(
   7.307 ++  /*IN*/ KIRQL new_irql,
   7.308 ++  /*OUT*/ PKIRQL old_irql);
   7.309 ++
   7.310 ++NTOSAPI
   7.311 ++VOID
   7.312 ++DDKAPI
   7.313 + KeLowerIrql(
   7.314 +-  /*IN*/ KIRQL  NewIrql);
   7.315 +-
   7.316 +-NTOSAPI
   7.317 +-KIRQL
   7.318 +-DDKAPI
   7.319 +-KeRaiseIrql(
   7.320 +-  /*IN*/ KIRQL  NewIrql);
   7.321 +-
   7.322 +-#endif
   7.323 ++  /*IN*/ KIRQL irql);
   7.324 + 
   7.325 + NTOSAPI
   7.326 + KIRQL
   7.327 +diff -r 79e257d5a1f7 lib/ddk/ndis.def
   7.328 +--- a/lib/ddk/ndis.def	Tue Jul 08 22:16:37 2008 -0700
   7.329 ++++ b/lib/ddk/ndis.def	Wed Jul 09 00:34:21 2008 -0700
   7.330 +@@ -130,8 +130,8 @@ NdisImmediateReadSharedMemory@16
   7.331 + ;NdisImmediateWritePortUlong
   7.332 + ;NdisImmediateWritePortUshort
   7.333 + NdisImmediateWriteSharedMemory@16
   7.334 +-;NdisInitAnsiString DATA
   7.335 +-;NdisInitUnicodeString DATA
   7.336 ++NdisInitAnsiString@8
   7.337 ++NdisInitUnicodeString@8
   7.338 + ;NdisInitializeEvent
   7.339 + NdisInitializeReadWriteLock@4
   7.340 + ;NdisInitializeString
   7.341 +@@ -149,7 +149,7 @@ NdisMAllocateMapRegisters@20
   7.342 + NdisMAllocateMapRegisters@20
   7.343 + NdisMAllocateSharedMemory@20
   7.344 + NdisMAllocateSharedMemoryAsync@16
   7.345 +-;NdisMCancelTimer
   7.346 ++NdisMCancelTimer@8
   7.347 + NdisMCloseLog@4
   7.348 + NdisMCmActivateVc@8
   7.349 + NdisMCmCreateVc@16
   7.350 +@@ -179,7 +179,7 @@ NdisMGetDeviceProperty@24
   7.351 + ;NdisMIndicateStatus
   7.352 + ;NdisMIndicateStatusComplete
   7.353 + NdisMInitializeScatterGatherDma@12
   7.354 +-;NdisMInitializeTimer
   7.355 ++NdisMInitializeTimer@16
   7.356 + NdisMMapIoSpace@20
   7.357 + ;NdisMPciAssignResources
   7.358 + NdisMPromoteMiniport@4
   7.359 +@@ -202,7 +202,7 @@ NdisMSetAttributesEx@20
   7.360 + NdisMSetAttributesEx@20
   7.361 + ;NdisMSetInformationComplete
   7.362 + NdisMSetMiniportSecondary@8
   7.363 +-;NdisMSetPeriodicTimer
   7.364 ++NdisMSetPeriodicTimer@8
   7.365 + ;NdisMSetTimer
   7.366 + NdisMSleep@4
   7.367 + ;NdisMStartBufferPhysicalMapping
   7.368 +@@ -252,7 +252,7 @@ NdisSendPackets@12
   7.369 + NdisSendPackets@12
   7.370 + ;NdisSetEvent
   7.371 + ;NdisSetPacketCancelId
   7.372 +-;NdisSetPacketPoolProtocolId
   7.373 ++NdisSetPacketPoolProtocolId@8
   7.374 + ;NdisSetPacketStatus
   7.375 + ;NdisSetProtocolFilter
   7.376 + ;NdisSetTimer
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/xennet/makefile.mingw	Wed Jul 09 20:17:22 2008 +1000
     8.3 @@ -0,0 +1,7 @@
     8.4 +W32API_PATH=/home/agrover/temp/w32api-3.11
     8.5 +
     8.6 +CFLAGS = -Wall -L$(W32API_PATH)/lib/ddk -I$(W32API_PATH)/include/ddk -I../common/include -I../common/include/public -Wno-multichar -Wno-unknown-pragmas
     8.7 +
     8.8 +xennet.sys: xennet.c xennet_oid.c xennet_tx.c xennet_rx.c xennet_common.c ../mingw/mingw_extras.c
     8.9 +	i586-mingw32msvc-gcc $(CFLAGS) -o $@ -s -shared -Wl,--entry,_load@8 -nostdlib $^ -lntoskrnl -lhal -lndis
    8.10 +
     9.1 --- a/xennet/xennet.c	Wed Jul 09 20:16:36 2008 +1000
     9.2 +++ b/xennet/xennet.c	Wed Jul 09 20:17:22 2008 +1000
     9.3 @@ -22,9 +22,72 @@ Foundation, Inc., 51 Franklin Street, Fi
     9.4  #include <io/xenbus.h>
     9.5  #include "xennet.h"
     9.6  
     9.7 -/* This function copied from linux's lib/vsprintf.c, see it for attribution */
     9.8 -static unsigned long
     9.9 -simple_strtoul(const char *cp,char **endp,unsigned int base)
    9.10 +/* ----- BEGIN Other people's code --------- */
    9.11 +/* from linux/include/linux/ctype.h, used under GPLv2 */
    9.12 +#define _U      0x01    /* upper */
    9.13 +#define _L      0x02    /* lower */
    9.14 +#define _D      0x04    /* digit */
    9.15 +#define _C      0x08    /* cntrl */
    9.16 +#define _P      0x10    /* punct */
    9.17 +#define _S      0x20    /* white space (space/lf/tab) */
    9.18 +#define _X      0x40    /* hex digit */
    9.19 +#define _SP     0x80    /* hard space (0x20) */
    9.20 +
    9.21 +/* from linux/include/lib/ctype.c, used under GPLv2 */
    9.22 +unsigned char _ctype[] = {
    9.23 +_C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
    9.24 +_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
    9.25 +_C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
    9.26 +_C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
    9.27 +_S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
    9.28 +_P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
    9.29 +_D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
    9.30 +_D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
    9.31 +_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
    9.32 +_U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
    9.33 +_U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
    9.34 +_U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
    9.35 +_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
    9.36 +_L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
    9.37 +_L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
    9.38 +_L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
    9.39 +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
    9.40 +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
    9.41 +_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
    9.42 +_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
    9.43 +_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
    9.44 +_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
    9.45 +_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
    9.46 +_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
    9.47 +
    9.48 +/* from linux/include/linux/ctype.h, used under GPLv2 */
    9.49 +#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
    9.50 +
    9.51 +#define isalnum(c)      ((__ismask(c)&(_U|_L|_D)) != 0)
    9.52 +#define isalpha(c)      ((__ismask(c)&(_U|_L)) != 0)
    9.53 +#define iscntrl(c)      ((__ismask(c)&(_C)) != 0)