ReactOS  0.4.14-dev-556-g4c5b21f
imports.h
Go to the documentation of this file.
1 /*
2  imports.h
3 
4  Virtual Floppy Drive for Windows NT platform
5  Kernel mode driver: imported elements from various sources
6 
7  Copyright (C) 2003-2005 Ken Kato
8 
9  This file contains:
10 
11  a) #include directive for system headers
12 
13  b) Stuff imported from newer DDKs so that the driver built with older
14  DDKs can run on newer Windows.
15 
16  c) Stuff imported from ntifs.h (http://www.acc.umu.se/~bosse/) so that
17  the driver can be compiled without it.
18 
19  d) Prototypes of standard functions which are exported from ntoskrnl.exe
20  but not declared in regular DDK header files.
21 */
22 
23 #ifndef _IMPORTS_H_
24 #define _IMPORTS_H_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif // __cplusplus
29 
30 #ifdef _MSC_VER
31 #pragma warning(push,3)
32 #endif
33 #include <ntddk.h>
34 #include <ntdddisk.h>
35 #include <ntverp.h>
36 #ifdef _MSC_VER
37 #pragma warning(pop)
38 #endif
39 
40 #ifdef _MSC_VER
41 // disable unwanted (and trivial) warnings :
42 // 4054 - type cast from a function pointer to a data pointer
43 // 4201 - anonymous structure
44 // 4514 - unreferenced inline function
45 #pragma warning(disable: 4054 4201 4514)
46 #endif
47 
48 #if (VER_PRODUCTBUILD >= 2195)
49 #include <mountdev.h>
50 #else // (VER_PRODUCTBUILD < 2195)
51 //
52 // Imports from Windows 2000 DDK <ntddk.h>
53 //
54 typedef enum _MM_PAGE_PRIORITY {
59 
60 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
61 
62 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
63 
64 //
65 // Imports from Windows 2000 DDK <ntddstor.h>
66 //
67 #define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE( \
68  IOCTL_STORAGE_BASE, \
69  0x0200, \
70  METHOD_BUFFERED, \
71  FILE_ANY_ACCESS)
72 
73 //
74 // Imports from Windows 2000 DDK <mountmgr.h>, <mountdev.h>
75 //
76 #define MOUNTMGR_DEVICE_NAME L"\\Device\\MountPointManager"
77 #define MOUNTMGRCONTROLTYPE ((ULONG) 'm')
78 #define MOUNTDEVCONTROLTYPE ((ULONG) 'M')
79 
80 #define IOCTL_MOUNTDEV_QUERY_UNIQUE_ID CTL_CODE( \
81  MOUNTDEVCONTROLTYPE,\
82  0, \
83  METHOD_BUFFERED, \
84  FILE_ANY_ACCESS)
85 
86 #define IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY \
87  CTL_CODE( \
88  MOUNTDEVCONTROLTYPE,\
89  1, \
90  METHOD_BUFFERED, \
91  FILE_ANY_ACCESS)
92 
93 #define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME CTL_CODE( \
94  MOUNTDEVCONTROLTYPE,\
95  2, \
96  METHOD_BUFFERED, \
97  FILE_ANY_ACCESS)
98 
99 #define IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME \
100  CTL_CODE( \
101  MOUNTDEVCONTROLTYPE,\
102  3, \
103  METHOD_BUFFERED, \
104  FILE_ANY_ACCESS)
105 
106 #define IOCTL_MOUNTDEV_LINK_CREATED CTL_CODE( \
107  MOUNTDEVCONTROLTYPE,\
108  4, \
109  METHOD_BUFFERED, \
110  FILE_ANY_ACCESS)
111 
112 #define IOCTL_MOUNTDEV_LINK_DELETED CTL_CODE( \
113  MOUNTDEVCONTROLTYPE,\
114  5, \
115  METHOD_BUFFERED, \
116  FILE_ANY_ACCESS)
117 
118 #define IOCTL_MOUNTMGR_CREATE_POINT CTL_CODE( \
119  MOUNTMGRCONTROLTYPE,\
120  0, \
121  METHOD_BUFFERED, \
122  FILE_READ_ACCESS | FILE_WRITE_ACCESS)
123 
124 #define IOCTL_MOUNTMGR_DELETE_POINTS CTL_CODE( \
125  MOUNTMGRCONTROLTYPE,\
126  1, \
127  METHOD_BUFFERED, \
128  FILE_READ_ACCESS | FILE_WRITE_ACCESS)
129 
130 #define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION \
131  CTL_CODE( \
132  MOUNTMGRCONTROLTYPE,\
133  11, \
134  METHOD_BUFFERED, \
135  FILE_READ_ACCESS)
136 
137 typedef struct _MOUNTDEV_UNIQUE_ID {
141 
142 typedef struct _MOUNTDEV_NAME {
146 
152 
153 typedef struct _MOUNTMGR_TARGET_NAME {
157 
164 
165 typedef struct _MOUNTMGR_MOUNT_POINT {
173 
174 typedef struct _MOUNTMGR_MOUNT_POINTS {
179 
180 #endif // (VER_PRODUCTBUILD < 2195)
181 
182 #if (VER_PRODUCTBUILD < 2600)
183 //
184 // Imports from Windows XP DDK <ntdddisk.h>
185 //
186 #define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE( \
187  IOCTL_DISK_BASE, \
188  0x0012, \
189  METHOD_BUFFERED, \
190  FILE_ANY_ACCESS)
191 
192 #define IOCTL_DISK_GET_LENGTH_INFO CTL_CODE( \
193  IOCTL_DISK_BASE, \
194  0x0017, \
195  METHOD_BUFFERED, \
196  FILE_READ_ACCESS)
197 
198 typedef unsigned __int64 ULONG64, *PULONG64;
199 
200 typedef enum _PARTITION_STYLE {
204 
211 
216  WCHAR Name[36];
218 
225  union {
228  };
230 
231 typedef struct _GET_LENGTH_INFORMATION {
234 
235 //
236 // Imports from Windows XP DDK <ntddstor.h>
237 //
238 #define IOCTL_STORAGE_GET_HOTPLUG_INFO CTL_CODE( \
239  IOCTL_STORAGE_BASE, \
240  0x0305, \
241  METHOD_BUFFERED, \
242  FILE_ANY_ACCESS)
243 
244 typedef struct _STORAGE_HOTPLUG_INFO {
251 
252 //
253 // Imports from Windows XP DDK <mountdev.h>
254 //
255 #define IOCTL_MOUNTDEV_QUERY_STABLE_GUID CTL_CODE( \
256  MOUNTDEVCONTROLTYPE,\
257  6, \
258  METHOD_BUFFERED, \
259  FILE_ANY_ACCESS)
260 
261 typedef struct _MOUNTDEV_STABLE_GUID {
264 
265 #endif // (VER_PRODUCTBUILD < 2600)
266 
267 //
268 // Imports from ntifs.h
269 //
270 #define TOKEN_SOURCE_LENGTH 8
271 
272 typedef enum _TOKEN_TYPE {
275 } TOKEN_TYPE;
276 
277 typedef struct _TOKEN_SOURCE {
281 
282 typedef struct _TOKEN_CONTROL {
288 
289 typedef struct _SECURITY_CLIENT_CONTEXT {
297 
298 #define PsDereferenceImpersonationToken(T) \
299  if (ARGUMENT_PRESENT(T)) (ObDereferenceObject((T)))
300 
301 #define PsDereferencePrimaryToken(T) (ObDereferenceObject((T)))
302 
304 VOID
305 NTAPI
307  VOID
308 );
309 
311 NTSTATUS
312 NTAPI
315  IN PSECURITY_QUALITY_OF_SERVICE QualityOfService,
316  IN BOOLEAN RemoteClient,
318 );
319 
320 #define SeDeleteClientSecurity(C) \
321 { \
322  if (SeTokenType((C)->ClientToken) == TokenPrimary) { \
323  PsDereferencePrimaryToken((C)->ClientToken); \
324  } \
325  else { \
326  PsDereferenceImpersonationToken((C)->ClientToken); \
327  } \
328 }
329 
331 VOID
332 NTAPI
336 );
337 
340 NTAPI
341 SeTokenType (
343 );
344 
345 //
346 // Functions exported by ntoskrnl.exe, but not declared in DDK headers
347 //
348 int _snprintf(char *buffer, size_t count, const char *format, ...);
349 int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format, ...);
350 int sprintf(char *buffer, const char *format, ...);
351 int _swprintf(wchar_t *buffer, const wchar_t *format, ...);
352 
353 #ifdef __cplusplus
354 }
355 #endif // __cplusplus
356 
357 #endif // _IMPORTS_H_
#define IN
Definition: typedefs.h:38
WCHAR DeviceName[1]
Definition: imports.h:155
struct _MOUNTDEV_UNIQUE_ID * PMOUNTDEV_UNIQUE_ID
struct _PARTITION_INFORMATION_GPT * PPARTITION_INFORMATION_GPT
struct _MOUNTMGR_MOUNT_POINTS * PMOUNTMGR_MOUNT_POINTS
BOOLEAN DeviceHotplug
Definition: imports.h:248
NTKERNELAPI VOID NTAPI PsRevertToSelf(VOID)
Definition: security.c:556
_PARTITION_STYLE
Definition: imports.h:200
struct _MOUNTMGR_MOUNT_POINT MOUNTMGR_MOUNT_POINT
GLuint GLuint GLsizei count
Definition: gl.h:1545
enum _MM_PAGE_PRIORITY MM_PAGE_PRIORITY
_TOKEN_TYPE
Definition: imports.h:272
LONG NTSTATUS
Definition: precomp.h:26
USHORT UniqueIdLength
Definition: imports.h:138
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE Token
LUID AuthenticationId
Definition: imports.h:284
int _snprintf(char *buffer, size_t count, const char *format,...)
Definition: sprintf.c:718
GLuint buffer
Definition: glext.h:5915
struct _STORAGE_HOTPLUG_INFO * PSTORAGE_HOTPLUG_INFO
PARTITION_INFORMATION_MBR Mbr
Definition: imports.h:226
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
LARGE_INTEGER Length
Definition: imports.h:232
struct _MOUNTDEV_STABLE_GUID MOUNTDEV_STABLE_GUID
int sprintf(char *buffer, const char *format,...)
Definition: utprint.c:762
PARTITION_INFORMATION_GPT Gpt
Definition: imports.h:227
struct _PARTITION_INFORMATION_GPT PARTITION_INFORMATION_GPT
PARTITION_STYLE PartitionStyle
Definition: imports.h:220
struct _PARTITION_INFORMATION_MBR * PPARTITION_INFORMATION_MBR
BOOLEAN MediaHotplug
Definition: imports.h:247
LUID SourceIdentifier
Definition: imports.h:279
struct _PARTITION_INFORMATION_EX PARTITION_INFORMATION_EX
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
int _swprintf(wchar_t *buffer, const wchar_t *format,...)
struct _SECURITY_CLIENT_CONTEXT * PSECURITY_CLIENT_CONTEXT
struct _MOUNTDEV_NAME * PMOUNTDEV_NAME
struct _TOKEN_CONTROL TOKEN_CONTROL
struct _GET_LENGTH_INFORMATION GET_LENGTH_INFORMATION
struct _MOUNTMGR_TARGET_NAME * PMOUNTMGR_TARGET_NAME
struct _MOUNTDEV_NAME MOUNTDEV_NAME
unsigned char BOOLEAN
UINT CALLBACK ServerThread(_Inout_ PVOID Parameter)
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
#define NTKERNELAPI
NTKERNELAPI NTSTATUS NTAPI SeCreateClientSecurity(IN PETHREAD Thread, IN PSECURITY_QUALITY_OF_SERVICE QualityOfService, IN BOOLEAN RemoteClient, OUT PSECURITY_CLIENT_CONTEXT ClientContext)
Definition: access.c:506
LUID ModifiedId
Definition: imports.h:285
#define TOKEN_SOURCE_LENGTH
Definition: imports.h:270
USHORT DeviceNameLength
Definition: imports.h:171
BOOLEAN DirectAccessEffectiveOnly
Definition: imports.h:293
NTKERNELAPI TOKEN_TYPE NTAPI SeTokenType(IN PACCESS_TOKEN Token)
Definition: token.c:1780
struct _MOUNTMGR_TARGET_NAME MOUNTMGR_TARGET_NAME
struct _MOUNTDEV_UNIQUE_ID MOUNTDEV_UNIQUE_ID
BOOLEAN WriteCacheEnableOverride
Definition: imports.h:249
struct _TOKEN_SOURCE * PTOKEN_SOURCE
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CCHAR
Definition: typedefs.h:50
struct _TOKEN_SOURCE TOKEN_SOURCE
_In_ PVOID ClientContext
Definition: netioddk.h:55
struct _MOUNTDEV_SUGGESTED_LINK_NAME * PMOUNTDEV_SUGGESTED_LINK_NAME
SECURITY_QUALITY_OF_SERVICE SecurityQos
Definition: imports.h:290
struct _MOUNTMGR_MOUNT_POINT * PMOUNTMGR_MOUNT_POINT
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
LARGE_INTEGER PartitionLength
Definition: imports.h:222
struct _GET_LENGTH_INFORMATION * PGET_LENGTH_INFORMATION
struct _MOUNTMGR_MOUNT_POINTS MOUNTMGR_MOUNT_POINTS
unsigned __int64 ULONG64
Definition: imports.h:198
LARGE_INTEGER StartingOffset
Definition: imports.h:221
unsigned char UCHAR
Definition: xmlstorage.h:181
_MM_PAGE_PRIORITY
Definition: imports.h:54
enum _PARTITION_STYLE PARTITION_STYLE
enum _TOKEN_TYPE TOKEN_TYPE
CCHAR SourceName[TOKEN_SOURCE_LENGTH]
Definition: imports.h:278
struct _MOUNTDEV_STABLE_GUID * PMOUNTDEV_STABLE_GUID
MOUNTMGR_MOUNT_POINT MountPoints[1]
Definition: imports.h:177
struct _SECURITY_CLIENT_CONTEXT SECURITY_CLIENT_CONTEXT
struct _MOUNTMGR_CREATE_POINT_INPUT MOUNTMGR_CREATE_POINT_INPUT
struct _TOKEN_CONTROL * PTOKEN_CONTROL
USHORT DeviceNameLength
Definition: imports.h:154
NTKERNELAPI VOID NTAPI SeImpersonateClient(IN PSECURITY_CLIENT_CONTEXT ClientContext, IN PETHREAD ServerThread OPTIONAL)
Definition: access.c:623
struct _MOUNTDEV_SUGGESTED_LINK_NAME MOUNTDEV_SUGGESTED_LINK_NAME
unsigned short USHORT
Definition: pedump.c:61
TOKEN_SOURCE TokenSource
Definition: imports.h:286
USHORT NameLength
Definition: imports.h:143
TOKEN_CONTROL ClientTokenControl
Definition: imports.h:295
#define OUT
Definition: typedefs.h:39
ULONG SymbolicLinkNameOffset
Definition: imports.h:166
unsigned int ULONG
Definition: retypes.h:1
LUID TokenId
Definition: imports.h:283
USHORT SymbolicLinkNameLength
Definition: imports.h:167
unsigned __int64 * PULONG64
Definition: imports.h:198
BOOLEAN DirectlyAccessClientToken
Definition: imports.h:292
BOOLEAN MediaRemovable
Definition: imports.h:246
struct _PARTITION_INFORMATION_MBR PARTITION_INFORMATION_MBR
UCHAR UniqueId[1]
Definition: imports.h:139
PACCESS_TOKEN ClientToken
Definition: imports.h:291
struct _STORAGE_HOTPLUG_INFO STORAGE_HOTPLUG_INFO
struct _PARTITION_INFORMATION_EX * PPARTITION_INFORMATION_EX
#define __int64
Definition: basetyps.h:16
struct _MOUNTMGR_CREATE_POINT_INPUT * PMOUNTMGR_CREATE_POINT_INPUT
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68