- Forgot to commit these for MSVC build...
[reactos.git] / reactos / include / ndk / umtypes.h
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 #undef WIN32_NO_STATUS
23 #define NTOS_MODE_USER
24
25 //
26 // Dependencies
27 //
28 #include <winioctl.h>
29 #include <ntnls.h>
30 #include <ntstatus.h>
31
32 //
33 // Compiler Definitions
34 //
35 #ifndef _MANAGED
36 #if defined(_M_IX86)
37 #define FASTCALL _fastcall
38 #else
39 #define FASTCALL
40 #endif
41 #else
42 #define FASTCALL NTAPI
43 #endif
44
45 #if !defined(_M_CEE_PURE)
46 #define NTAPI_INLINE NTAPI
47 #else
48 #define NTAPI_INLINE
49 #endif
50
51 //
52 // Alignment Macros
53 //
54 #define ALIGN_DOWN(s, t) \
55 ((ULONG)(s) & ~(sizeof(t) - 1))
56
57 #define ALIGN_UP(s, t) \
58 (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
59
60 #define ALIGN_DOWN_POINTER(p, t) \
61 ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
62
63 #define ALIGN_UP_POINTER(p, t) \
64 (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
65
66 //
67 // Native API Return Value Macros
68 //
69 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
70 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
71 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
72 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
73
74 //
75 // Limits
76 //
77 #define MINCHAR 0x80
78 #define MAXCHAR 0x7f
79 #define MINSHORT 0x8000
80 #define MAXSHORT 0x7fff
81 #define MINLONG 0x80000000
82 #define MAXLONG 0x7fffffff
83 #define MAXUCHAR 0xff
84 #define MAXUSHORT 0xffff
85 #define MAXULONG 0xffffffff
86
87 //
88 // Basic Types that aren't defined in User-Mode Headers
89 //
90 typedef CONST int CINT;
91 typedef CONST char *PCSZ;
92 typedef ULONG CLONG;
93 typedef short CSHORT;
94 typedef CSHORT *PCSHORT;
95 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
96 typedef LONG KPRIORITY;
97 typedef LONG NTSTATUS, *PNTSTATUS;
98
99 //
100 // Basic NT Types
101 //
102 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_)
103
104 typedef struct _UNICODE_STRING
105 {
106 USHORT Length;
107 USHORT MaximumLength;
108 PWSTR Buffer;
109 } UNICODE_STRING, *PUNICODE_STRING;
110
111 typedef struct _STRING
112 {
113 USHORT Length;
114 USHORT MaximumLength;
115 PCHAR Buffer;
116 } STRING, *PSTRING;
117
118 #endif
119
120 typedef struct _OBJECT_ATTRIBUTES
121 {
122 ULONG Length;
123 HANDLE RootDirectory;
124 PUNICODE_STRING ObjectName;
125 ULONG Attributes;
126 PVOID SecurityDescriptor;
127 PVOID SecurityQualityOfService;
128 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
129
130 typedef const UNICODE_STRING* PCUNICODE_STRING;
131 typedef STRING ANSI_STRING;
132 typedef PSTRING PANSI_STRING;
133 typedef STRING OEM_STRING;
134 typedef PSTRING POEM_STRING;
135 typedef CONST STRING* PCOEM_STRING;
136 typedef STRING CANSI_STRING;
137 typedef PSTRING PCANSI_STRING;
138
139 #endif