404b035a7e06d1680990ae9611f76fb80a3aef57
[reactos.git] / reactos / w32api / include / ntdef.h
1 #ifndef _NTDEF_H
2 #define _NTDEF_H
3 #if __GNUC__ >=3
4 #pragma GCC system_header
5 #endif
6
7 /* TODO: some compilers support this */
8 #define RESTRICTED_POINTER
9
10 #define NTAPI __stdcall
11
12 #define OBJ_INHERIT 0x00000002
13 #define OBJ_PERMANENT 0x00000010
14 #define OBJ_EXCLUSIVE 0x00000020
15 #define OBJ_CASE_INSENSITIVE 0x00000040
16 #define OBJ_OPENIF 0x00000080
17 #define OBJ_OPENLINK 0x00000100
18 #define OBJ_KERNEL_HANDLE 0x00000200
19 #define OBJ_VALID_ATTRIBUTES (OBJ_KERNEL_HANDLE | OBJ_OPENLINK | \
20 OBJ_OPENIF | OBJ_CASE_INSENSITIVE | OBJ_EXCLUSIVE | \
21 OBJ_PERMANENT | OBJ_INHERIT)
22 #define InitializeObjectAttributes(p,n,a,r,s) { \
23 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
24 (p)->RootDirectory = (r); \
25 (p)->Attributes = (a); \
26 (p)->ObjectName = (n); \
27 (p)->SecurityDescriptor = (s); \
28 (p)->SecurityQualityOfService = NULL; \
29 }
30 #ifndef NT_SUCCESS
31 #define NT_SUCCESS(x) ((x)>=0)
32 #define STATUS_SUCCESS ((NTSTATUS)0)
33 #endif
34 #define NT_WARNING(x) ((ULONG)(x)>>30==2)
35 #define NT_ERROR(x) ((ULONG)(x)>>30==3)
36 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H)
37 typedef LONG NTSTATUS, *PNTSTATUS;
38 typedef struct _UNICODE_STRING {
39 USHORT Length;
40 USHORT MaximumLength;
41 PWSTR Buffer;
42 } UNICODE_STRING, *PUNICODE_STRING;
43 typedef const UNICODE_STRING* PCUNICODE_STRING;
44 typedef struct _STRING {
45 USHORT Length;
46 USHORT MaximumLength;
47 PCHAR Buffer;
48 } STRING, *PSTRING;
49 #endif
50 typedef STRING ANSI_STRING;
51 typedef PSTRING PANSI_STRING;
52 typedef STRING OEM_STRING;
53 typedef PSTRING POEM_STRING;
54 typedef CONST STRING* PCOEM_STRING;
55 typedef STRING CANSI_STRING;
56 typedef PSTRING PCANSI_STRING;
57 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
58 typedef enum _SECTION_INHERIT {
59 ViewShare = 1,
60 ViewUnmap = 2
61 } SECTION_INHERIT;
62 typedef enum _NT_PRODUCT_TYPE {
63 NtProductWinNt = 1,
64 NtProductLanManNt,
65 NtProductServer
66 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
67 #if !defined(_NTSECAPI_H)
68 typedef struct _OBJECT_ATTRIBUTES {
69 ULONG Length;
70 HANDLE RootDirectory;
71 PUNICODE_STRING ObjectName;
72 ULONG Attributes;
73 PVOID SecurityDescriptor;
74 PVOID SecurityQualityOfService;
75 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
76 #endif
77 #define NOTHING
78 #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
79 #define TYPE_ALIGNMENT( t ) FIELD_OFFSET( struct { char x; t test; }, test )
80
81 #define MINCHAR 0x80
82 #define MAXCHAR 0x7f
83 #define MINSHORT 0x8000
84 #define MAXSHORT 0x7fff
85 #define MINLONG 0x80000000
86 #define MAXLONG 0x7fffffff
87 #define MAXUCHAR 0xff
88 #define MAXUSHORT 0xffff
89 #define MAXULONG 0xffffffff
90 #endif /* _NTDEF_H */