ReactOS  0.4.11-dev-195-gef016bf
umtypes.h
Go to the documentation of this file.
1 /*++ NDK Version: 0095
2 
3 Copyright (c) Alex Ionescu. All rights reserved.
4 
5 Header Name:
6 
7  umtypes.h
8 
9 Abstract:
10 
11  Type definitions for the basic native types.
12 
13 Author:
14 
15  Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16 
17 --*/
18 
19 #if !defined(_NTDEF_) && !defined(_NTDEF_H)
20 #define _NTDEF_
21 #define _NTDEF_H
22 
23 //
24 // Use dummy macros, if SAL 2 is not available
25 //
26 #include <sal.h>
27 #if (_SAL_VERSION < 20)
28 #include <no_sal2.h>
29 #endif
30 
31 //
32 // Don't use the SDK status values
33 //
34 #ifndef WIN32_NO_STATUS
35 #define WIN32_NO_STATUS
36 #endif
37 
38 //
39 // Let the NDK know we're in Application Mode
40 //
41 #define NTOS_MODE_USER
42 
43 //
44 // Dependencies
45 //
46 #include <windef.h>
47 #undef WIN32_NO_STATUS
48 #include <ntstatus.h>
49 #include <winioctl.h>
50 #include <ntnls.h>
51 
52 //
53 // Compiler Definitions
54 //
55 #ifndef _MANAGED
56 #if defined(_M_IX86)
57 #ifndef FASTCALL
58 #define FASTCALL __fastcall
59 #endif
60 #else
61 #define FASTCALL
62 #endif
63 #else
64 #define FASTCALL NTAPI
65 #endif
66 
67 #if !defined(_M_CEE_PURE)
68 #define NTAPI_INLINE NTAPI
69 #else
70 #define NTAPI_INLINE
71 #endif
72 
73 //
74 // Alignment Macros
75 //
76 #define ALIGN_DOWN_BY(size, align) \
77  ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
78 
79 #define ALIGN_UP_BY(size, align) \
80  (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
81 
82 #define ALIGN_DOWN_POINTER_BY(ptr, align) \
83  ((PVOID)ALIGN_DOWN_BY(ptr, align))
84 
85 #define ALIGN_UP_POINTER_BY(ptr, align) \
86  ((PVOID)ALIGN_UP_BY(ptr, align))
87 
88 #define ALIGN_DOWN(size, type) \
89  ALIGN_DOWN_BY(size, sizeof(type))
90 
91 #define ALIGN_UP(size, type) \
92  ALIGN_UP_BY(size, sizeof(type))
93 
94 #define ALIGN_DOWN_POINTER(ptr, type) \
95  ALIGN_DOWN_POINTER_BY(ptr, sizeof(type))
96 
97 #define ALIGN_UP_POINTER(ptr, type) \
98  ALIGN_UP_POINTER_BY(ptr, sizeof(type))
99 
100 //
101 // Native API Return Value Macros
102 //
103 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
104 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
105 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
106 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
107 
108 //
109 // Limits
110 //
111 #define MINCHAR 0x80
112 #define MAXCHAR 0x7f
113 #define MINSHORT 0x8000
114 #define MAXSHORT 0x7fff
115 #define MINLONG 0x80000000
116 #define MAXLONG 0x7fffffff
117 #define MAXUCHAR 0xff
118 #define MAXUSHORT 0xffff
119 #define MAXULONG 0xffffffff
120 
121 //
122 // Basic Types that aren't defined in User-Mode Headers
123 //
124 typedef CONST int CINT;
125 typedef CONST char *PCSZ;
126 typedef ULONG CLONG;
127 typedef short CSHORT;
128 typedef CSHORT *PCSHORT;
130 typedef LONG KPRIORITY;
131 
132 //
133 // Basic NT Types
134 //
135 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_)
136 
137 #if !defined(__BCRYPT_H__) && !defined(__WINE_BCRYPT_H)
139 #endif
140 
141 typedef struct _UNICODE_STRING
142 {
143  USHORT Length;
145  PWSTR Buffer;
147 
148 typedef struct _STRING
149 {
153 } STRING, *PSTRING;
154 
155 typedef struct _CSTRING
156 {
160 } CSTRING, *PCSTRING;
161 
162 #endif
163 
164 typedef struct _STRING32 {
168 } STRING32, *PSTRING32,
171 
172 typedef struct _STRING64 {
176 } STRING64, *PSTRING64,
179 
180 
181 typedef struct _OBJECT_ATTRIBUTES
182 {
185  PUNICODE_STRING ObjectName;
190 
191 //
192 // ClientID Structure
193 //
194 typedef struct _CLIENT_ID
195 {
199 
202 typedef PSTRING PANSI_STRING;
204 typedef PSTRING POEM_STRING;
207 typedef PSTRING PCANSI_STRING;
208 
209 #endif
DWORD *typedef PVOID
Definition: winlogon.h:61
signed char * PCHAR
Definition: retypes.h:7
* PNTSTATUS
Definition: strlen.c:14
CONST char * PCSZ
Definition: umtypes.h:125
CONST int CINT
Definition: umtypes.h:124
USHORT MaximumLength
Definition: umtypes.h:174
LARGE_INTEGER PHYSICAL_ADDRESS
Definition: umtypes.h:129
struct _STRING64 * PANSI_STRING64
struct _OBJECT_ATTRIBUTES * POBJECT_ATTRIBUTES
Definition: file.c:85
struct _CSTRING * PCSTRING
USHORT MaximumLength
Definition: env_spec_w32.h:370
CONST CHAR * Buffer
Definition: umtypes.h:159
struct _STRING STRING
char CHAR
Definition: xmlstorage.h:175
PSTRING PCANSI_STRING
Definition: umtypes.h:207
struct _CLIENT_ID * PCLIENT_ID
struct _STRING32 UNICODE_STRING32
PVOID *typedef PWSTR
Definition: winlogon.h:66
struct _CLIENT_ID CLIENT_ID
STRING OEM_STRING
Definition: umtypes.h:203
HANDLE UniqueProcess
Definition: compat.h:474
USHORT Length
Definition: umtypes.h:157
PSTRING PANSI_STRING
Definition: umtypes.h:202
struct _STRING64 UNICODE_STRING64
PSTRING POEM_STRING
Definition: umtypes.h:204
struct _STRING64 STRING64
LARGE_INTEGER * PPHYSICAL_ADDRESS
Definition: umtypes.h:129
struct _UNICODE_STRING * PUNICODE_STRING
ULONG CLONG
Definition: umtypes.h:126
USHORT MaximumLength
Definition: umtypes.h:166
struct _STRING32 ANSI_STRING32
STRING CANSI_STRING
Definition: umtypes.h:206
struct _STRING64 ANSI_STRING64
long LONG
Definition: pedump.c:60
struct _STRING * PSTRING
LONG KPRIORITY
Definition: umtypes.h:130
struct _STRING64 * PSTRING64
#define CONST
Definition: compiler.h:170
struct _OBJECT_ATTRIBUTES OBJECT_ATTRIBUTES
LONG NTSTATUS
Definition: precomp.h:26
uint64_t ULONGLONG
Definition: typedefs.h:65
ULONGLONG Buffer
Definition: umtypes.h:175
unsigned long
Definition: typeof.h:99
struct _UNICODE_STRING UNICODE_STRING
struct _STRING32 STRING32
CONST STRING * PCOEM_STRING
Definition: umtypes.h:205
struct _STRING32 * PANSI_STRING32
CSHORT * PCSHORT
Definition: umtypes.h:128
HANDLE UniqueThread
Definition: compat.h:475
std::wstring STRING
Definition: fontsub.cpp:33
const UNICODE_STRING * PCUNICODE_STRING
Definition: umtypes.h:200
struct _CSTRING CSTRING
struct _STRING64 * PUNICODE_STRING64
USHORT Length
Definition: umtypes.h:150
struct _STRING32 * PUNICODE_STRING32
STRING ANSI_STRING
Definition: umtypes.h:201
typedef _Return_type_success_(return >=0) long NTSTATUS
DWORD *typedef HANDLE
Definition: winlogon.h:61
PVOID SecurityDescriptor
Definition: umtypes.h:187
unsigned short USHORT
Definition: pedump.c:61
USHORT MaximumLength
Definition: umtypes.h:158
PVOID SecurityQualityOfService
Definition: umtypes.h:188
PUNICODE_STRING ObjectName
Definition: umtypes.h:185
HANDLE RootDirectory
Definition: umtypes.h:184
unsigned int ULONG
Definition: retypes.h:1
ULONG Buffer
Definition: umtypes.h:167
USHORT MaximumLength
Definition: umtypes.h:151
USHORT Length
Definition: umtypes.h:173
USHORT Length
Definition: umtypes.h:165
PCHAR Buffer
Definition: umtypes.h:152
short CSHORT
Definition: umtypes.h:127
struct _STRING32 * PSTRING32