xref: /reactos/sdk/include/xdk/ntdef.template.h (revision b957229c)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * ntdef.h
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * This file is part of the ReactOS PSDK package.
5c2c66affSColin Finck  *
6c2c66affSColin Finck  * Contributors:
7c2c66affSColin Finck  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
8c2c66affSColin Finck  *
9c2c66affSColin Finck  * THIS SOFTWARE IS NOT COPYRIGHTED
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * This source code is offered for use in the public domain. You may
12c2c66affSColin Finck  * use, modify or distribute it freely.
13c2c66affSColin Finck  *
14c2c66affSColin Finck  * This code is distributed in the hope that it will be useful but
15c2c66affSColin Finck  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16c2c66affSColin Finck  * DISCLAIMED. This includes but is not limited to warranties of
17c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18c2c66affSColin Finck  *
19c2c66affSColin Finck  */
20c2c66affSColin Finck 
21c2c66affSColin Finck #ifndef _NTDEF_
22c2c66affSColin Finck #define _NTDEF_
23c2c66affSColin Finck #pragma once
24c2c66affSColin Finck 
25c2c66affSColin Finck /* Dependencies */
26c2c66affSColin Finck #include <ctype.h>
27c2c66affSColin Finck $if(0)
28c2c66affSColin Finck //#include <winapifamily.h>
$endif()29c2c66affSColin Finck $endif()
30c2c66affSColin Finck #include <basetsd.h>
31c2c66affSColin Finck #include <guiddef.h>
32c2c66affSColin Finck #include <excpt.h>
33c2c66affSColin Finck #include <sdkddkver.h>
34c2c66affSColin Finck #include <specstrings.h>
35c2c66affSColin Finck #include <kernelspecs.h>
36c2c66affSColin Finck 
37c2c66affSColin Finck #ifdef __cplusplus
38c2c66affSColin Finck extern "C" {
39c2c66affSColin Finck #endif
40c2c66affSColin Finck 
41c2c66affSColin Finck /* Default to strict */
42c2c66affSColin Finck #ifndef NO_STRICT
43c2c66affSColin Finck #ifndef STRICT
44c2c66affSColin Finck #define STRICT 1
45c2c66affSColin Finck #endif
46c2c66affSColin Finck #endif
47c2c66affSColin Finck 
48c2c66affSColin Finck /* Pseudo Modifiers for Input Parameters */
49c2c66affSColin Finck 
50c2c66affSColin Finck #ifndef IN
51c2c66affSColin Finck #define IN
52c2c66affSColin Finck #endif
53c2c66affSColin Finck 
54c2c66affSColin Finck #ifndef OUT
55c2c66affSColin Finck #define OUT
56c2c66affSColin Finck #endif
57c2c66affSColin Finck 
58c2c66affSColin Finck #ifndef OPTIONAL
59c2c66affSColin Finck #define OPTIONAL
60c2c66affSColin Finck #endif
61c2c66affSColin Finck 
62c2c66affSColin Finck #ifndef NOTHING
63c2c66affSColin Finck #define NOTHING
64c2c66affSColin Finck #endif
65c2c66affSColin Finck 
66c2c66affSColin Finck #ifndef CRITICAL
67c2c66affSColin Finck #define CRITICAL
68c2c66affSColin Finck #endif
69c2c66affSColin Finck 
70c2c66affSColin Finck /* Constant modifier */
71c2c66affSColin Finck #ifndef CONST
72c2c66affSColin Finck #define CONST const
73c2c66affSColin Finck #endif
74c2c66affSColin Finck 
75c2c66affSColin Finck /* TRUE/FALSE */
76c2c66affSColin Finck #define FALSE   0
77c2c66affSColin Finck #define TRUE    1
78c2c66affSColin Finck 
79c2c66affSColin Finck /* NULL/NULL64 */
80c2c66affSColin Finck #ifndef NULL
81c2c66affSColin Finck #ifdef __cplusplus
82c2c66affSColin Finck #define NULL    0
83c2c66affSColin Finck #define NULL64  0
84c2c66affSColin Finck #else
85c2c66affSColin Finck #define NULL    ((void *)0)
86c2c66affSColin Finck #define NULL64  ((void * POINTER_64)0)
87c2c66affSColin Finck #endif
88c2c66affSColin Finck #endif /* NULL */
89c2c66affSColin Finck 
90c2c66affSColin Finck #define ARGUMENT_PRESENT(ArgumentPointer) \
91c2c66affSColin Finck   ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
92c2c66affSColin Finck 
93c2c66affSColin Finck #if defined(_MANAGED)
94c2c66affSColin Finck  #define FASTCALL __stdcall
95c2c66affSColin Finck #elif defined(_M_IX86)
96c2c66affSColin Finck  #define FASTCALL __fastcall
97c2c66affSColin Finck #else
98c2c66affSColin Finck  #define FASTCALL
99c2c66affSColin Finck #endif /* _MANAGED */
100c2c66affSColin Finck 
101c2c66affSColin Finck /* min/max helper macros */
102c2c66affSColin Finck #ifndef NOMINMAX
103c2c66affSColin Finck # ifndef min
104c2c66affSColin Finck #  define min(a,b) (((a) < (b)) ? (a) : (b))
105c2c66affSColin Finck # endif
106c2c66affSColin Finck # ifndef max
107c2c66affSColin Finck #  define max(a,b) (((a) > (b)) ? (a) : (b))
108c2c66affSColin Finck # endif
109c2c66affSColin Finck #endif /* NOMINMAX */
110c2c66affSColin Finck 
111c2c66affSColin Finck /* Tell windef.h that we have defined some basic types */
112c2c66affSColin Finck #define BASETYPES
113c2c66affSColin Finck 
114c2c66affSColin Finck $define(_NTDEF_)
115c2c66affSColin Finck $define(ULONG=ULONG)
116c2c66affSColin Finck $define(USHORT=USHORT)
117c2c66affSColin Finck $define(UCHAR=UCHAR)
118c2c66affSColin Finck $include(ntbasedef.h)
119c2c66affSColin Finck 
120c2c66affSColin Finck typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
121c2c66affSColin Finck typedef NTSTATUS *PNTSTATUS;
122c2c66affSColin Finck 
123c2c66affSColin Finck #ifndef __SECSTATUS_DEFINED__
124c2c66affSColin Finck typedef long SECURITY_STATUS;
125c2c66affSColin Finck #define __SECSTATUS_DEFINED__
126c2c66affSColin Finck #endif
127c2c66affSColin Finck 
128c2c66affSColin Finck /* Physical Addresses are always treated as 64-bit wide */
129c2c66affSColin Finck typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
130c2c66affSColin Finck 
131c2c66affSColin Finck #define TIME LARGE_INTEGER
132c2c66affSColin Finck #define _TIME _LARGE_INTEGER
133c2c66affSColin Finck #define PTIME PLARGE_INTEGER
134c2c66affSColin Finck #define LowTime LowPart
135c2c66affSColin Finck #define HighTime HighPart
136c2c66affSColin Finck 
137c2c66affSColin Finck /* Used to store a non-float 8 byte aligned structure */
138c2c66affSColin Finck typedef struct _QUAD
139c2c66affSColin Finck {
140c2c66affSColin Finck     _ANONYMOUS_UNION union
141c2c66affSColin Finck     {
142c2c66affSColin Finck         __GNU_EXTENSION __int64 UseThisFieldToCopy;
143c2c66affSColin Finck         double DoNotUseThisField;
144c2c66affSColin Finck     } DUMMYUNIONNAME;
145c2c66affSColin Finck } QUAD, *PQUAD, UQUAD, *PUQUAD;
146c2c66affSColin Finck 
147c2c66affSColin Finck #if (_WIN32_WINNT >= 0x0600) || (defined(__cplusplus) && defined(WINDOWS_ENABLE_CPLUSPLUS))
148c2c66affSColin Finck typedef CONST UCHAR *PCUCHAR;
149c2c66affSColin Finck typedef CONST USHORT *PCUSHORT;
150c2c66affSColin Finck typedef CONST ULONG *PCULONG;
151c2c66affSColin Finck typedef CONST UQUAD *PCUQUAD;
152c2c66affSColin Finck typedef CONST SCHAR *PCSCHAR;
153c2c66affSColin Finck #endif /* (/_WIN32_WINNT >= 0x0600) */
154c2c66affSColin Finck #if (_WIN32_WINNT >= 0x0600)
155c2c66affSColin Finck typedef CONST NTSTATUS *PCNTSTATUS;
156c2c66affSColin Finck #endif /* (/_WIN32_WINNT >= 0x0600) */
157c2c66affSColin Finck 
158c2c66affSColin Finck /* String Types */
159c2c66affSColin Finck typedef struct _STRING {
160c2c66affSColin Finck   USHORT Length;
161c2c66affSColin Finck   USHORT MaximumLength;
162c2c66affSColin Finck #ifdef MIDL_PASS
163c2c66affSColin Finck   [size_is(MaximumLength), length_is(Length) ]
164c2c66affSColin Finck #endif
165c2c66affSColin Finck   _Field_size_bytes_part_opt_(MaximumLength, Length) PCHAR Buffer;
166c2c66affSColin Finck } STRING, *PSTRING,
167c2c66affSColin Finck   ANSI_STRING, *PANSI_STRING,
168c2c66affSColin Finck   OEM_STRING, *POEM_STRING;
169c2c66affSColin Finck 
170c2c66affSColin Finck typedef CONST STRING* PCOEM_STRING;
171c2c66affSColin Finck typedef STRING CANSI_STRING;
172c2c66affSColin Finck typedef PSTRING PCANSI_STRING;
173c2c66affSColin Finck 
174c2c66affSColin Finck typedef struct _STRING32 {
175c2c66affSColin Finck   USHORT   Length;
176c2c66affSColin Finck   USHORT   MaximumLength;
177c2c66affSColin Finck   $ULONG  Buffer;
178c2c66affSColin Finck } STRING32, *PSTRING32,
179c2c66affSColin Finck   UNICODE_STRING32, *PUNICODE_STRING32,
180c2c66affSColin Finck   ANSI_STRING32, *PANSI_STRING32;
181c2c66affSColin Finck 
182c2c66affSColin Finck typedef struct _STRING64 {
183c2c66affSColin Finck   USHORT   Length;
184c2c66affSColin Finck   USHORT   MaximumLength;
185c2c66affSColin Finck   ULONGLONG  Buffer;
186c2c66affSColin Finck } STRING64, *PSTRING64,
187c2c66affSColin Finck   UNICODE_STRING64, *PUNICODE_STRING64,
188c2c66affSColin Finck   ANSI_STRING64, *PANSI_STRING64;
189c2c66affSColin Finck 
190c2c66affSColin Finck typedef struct _CSTRING {
191c2c66affSColin Finck   USHORT Length;
192c2c66affSColin Finck   USHORT MaximumLength;
193c2c66affSColin Finck   CONST CHAR *Buffer;
194c2c66affSColin Finck } CSTRING, *PCSTRING;
195c2c66affSColin Finck 
196c2c66affSColin Finck typedef struct _UNICODE_STRING {
197c2c66affSColin Finck   USHORT Length;
198c2c66affSColin Finck   USHORT MaximumLength;
199c2c66affSColin Finck #ifdef MIDL_PASS
200c2c66affSColin Finck   [size_is(MaximumLength / 2), length_is((Length) / 2)] PUSHORT Buffer;
201c2c66affSColin Finck #else
202c2c66affSColin Finck   _Field_size_bytes_part_(MaximumLength, Length) PWCH Buffer;
203c2c66affSColin Finck #endif
204c2c66affSColin Finck } UNICODE_STRING, *PUNICODE_STRING;
205c2c66affSColin Finck typedef const UNICODE_STRING* PCUNICODE_STRING;
206c2c66affSColin Finck 
207c2c66affSColin Finck typedef USHORT RTL_STRING_LENGTH_TYPE;
208c2c66affSColin Finck 
209c2c66affSColin Finck #ifdef __cplusplus
210c2c66affSColin Finck extern "C++" template<typename _Type> struct _RTL_remove_const_template;
211c2c66affSColin Finck extern "C++" template<typename _Type> struct _RTL_remove_const_template<const _Type&> { typedef _Type type; };
212c2c66affSColin Finck #define _RTL_CONSTANT_STRING_remove_const_macro(s) \
213c2c66affSColin Finck     (const_cast<_RTL_remove_const_template<decltype((s)[0])>::type*>(s))
214c2c66affSColin Finck extern "C++" template<class _Ty> struct _RTL_CONSTANT_STRING_type_check_template;
215c2c66affSColin Finck extern "C++" template<class _Ty, int _Count>	struct _RTL_CONSTANT_STRING_type_check_template<const _Ty (&)[_Count]> { typedef char type; };
216c2c66affSColin Finck #define _RTL_CONSTANT_STRING_type_check(s) _RTL_CONSTANT_STRING_type_check_template<decltype(s)>::type
217c2c66affSColin Finck #else
218c2c66affSColin Finck # define _RTL_CONSTANT_STRING_remove_const_macro(s) (s)
219c2c66affSColin Finck char _RTL_CONSTANT_STRING_type_check(const void *s);
220c2c66affSColin Finck #endif
221c2c66affSColin Finck #define RTL_CONSTANT_STRING(s) { \
222c2c66affSColin Finck     sizeof(s)-sizeof((s)[0]), \
223*b957229cSThomas Faber     sizeof(s) / (sizeof(_RTL_CONSTANT_STRING_type_check(s))), \
224c2c66affSColin Finck     _RTL_CONSTANT_STRING_remove_const_macro(s) }
225c2c66affSColin Finck 
226c2c66affSColin Finck #ifdef _MSC_VER
227c2c66affSColin Finck #define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
228c2c66affSColin Finck   WCHAR _var ## _buffer[_size]; \
229c2c66affSColin Finck   __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
230c2c66affSColin Finck   UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer } \
231c2c66affSColin Finck   __pragma(warning(pop))
232c2c66affSColin Finck 
233c2c66affSColin Finck #define DECLARE_CONST_UNICODE_STRING(_var, _string) \
234c2c66affSColin Finck   const WCHAR _var##_buffer[] = _string; \
235c2c66affSColin Finck   __pragma(warning(push)) __pragma(warning(disable:4221)) __pragma(warning(disable:4204)) \
236c2c66affSColin Finck   const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer } \
237c2c66affSColin Finck   __pragma(warning(pop))
238c2c66affSColin Finck #else
239c2c66affSColin Finck #define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
240c2c66affSColin Finck   WCHAR _var ## _buffer[_size]; \
241c2c66affSColin Finck   UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer }
242c2c66affSColin Finck 
243c2c66affSColin Finck #define DECLARE_CONST_UNICODE_STRING(_var, _string) \
244c2c66affSColin Finck   const WCHAR _var##_buffer[] = _string; \
245c2c66affSColin Finck   const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH)_var##_buffer }
246c2c66affSColin Finck #endif
247c2c66affSColin Finck 
248c2c66affSColin Finck #define DECLARE_GLOBAL_CONST_UNICODE_STRING(_var, _str) \
249c2c66affSColin Finck   extern const __declspec(selectany) UNICODE_STRING _var = RTL_CONSTANT_STRING(_str)
250c2c66affSColin Finck 
251c2c66affSColin Finck /* Object Attributes */
252c2c66affSColin Finck typedef struct _OBJECT_ATTRIBUTES {
253c2c66affSColin Finck   ULONG Length;
254c2c66affSColin Finck   HANDLE RootDirectory;
255c2c66affSColin Finck   PUNICODE_STRING ObjectName;
256c2c66affSColin Finck   ULONG Attributes;
257c2c66affSColin Finck   PVOID SecurityDescriptor;
258c2c66affSColin Finck   PVOID SecurityQualityOfService;
259c2c66affSColin Finck } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
260c2c66affSColin Finck typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
261c2c66affSColin Finck 
262c2c66affSColin Finck typedef struct _OBJECT_ATTRIBUTES32 {
263c2c66affSColin Finck   ULONG Length;
264c2c66affSColin Finck   ULONG RootDirectory;
265c2c66affSColin Finck   ULONG ObjectName;
266c2c66affSColin Finck   ULONG Attributes;
267c2c66affSColin Finck   ULONG SecurityDescriptor;
268c2c66affSColin Finck   ULONG SecurityQualityOfService;
269c2c66affSColin Finck } OBJECT_ATTRIBUTES32, *POBJECT_ATTRIBUTES32;
270c2c66affSColin Finck typedef CONST OBJECT_ATTRIBUTES32 *PCOBJECT_ATTRIBUTES32;
271c2c66affSColin Finck 
272c2c66affSColin Finck typedef struct _OBJECT_ATTRIBUTES64 {
273c2c66affSColin Finck   ULONG Length;
274c2c66affSColin Finck   ULONG64 RootDirectory;
275c2c66affSColin Finck   ULONG64 ObjectName;
276c2c66affSColin Finck   ULONG Attributes;
277c2c66affSColin Finck   ULONG64 SecurityDescriptor;
278c2c66affSColin Finck   ULONG64 SecurityQualityOfService;
279c2c66affSColin Finck } OBJECT_ATTRIBUTES64, *POBJECT_ATTRIBUTES64;
280c2c66affSColin Finck typedef CONST OBJECT_ATTRIBUTES64 *PCOBJECT_ATTRIBUTES64;
281c2c66affSColin Finck 
282c2c66affSColin Finck #define OBJ_HANDLE_TAGBITS      0x00000003L
283c2c66affSColin Finck 
284c2c66affSColin Finck /* Values for the Attributes member */
285c2c66affSColin Finck #define OBJ_INHERIT             0x00000002L
286c2c66affSColin Finck #define OBJ_PERMANENT           0x00000010L
287c2c66affSColin Finck #define OBJ_EXCLUSIVE           0x00000020L
288c2c66affSColin Finck #define OBJ_CASE_INSENSITIVE    0x00000040L
289c2c66affSColin Finck #define OBJ_OPENIF              0x00000080L
290c2c66affSColin Finck #define OBJ_OPENLINK            0x00000100L
291c2c66affSColin Finck #define OBJ_KERNEL_HANDLE       0x00000200L
292c2c66affSColin Finck #define OBJ_FORCE_ACCESS_CHECK  0x00000400L
293c2c66affSColin Finck #define OBJ_VALID_ATTRIBUTES    0x000007F2L
294c2c66affSColin Finck 
295c2c66affSColin Finck /* Helper Macro */
296c2c66affSColin Finck #define InitializeObjectAttributes(p,n,a,r,s) { \
297c2c66affSColin Finck   (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
298c2c66affSColin Finck   (p)->RootDirectory = (r); \
299c2c66affSColin Finck   (p)->ObjectName = (n); \
300c2c66affSColin Finck   (p)->Attributes = (a); \
301c2c66affSColin Finck   (p)->SecurityDescriptor = (s); \
302c2c66affSColin Finck   (p)->SecurityQualityOfService = NULL; \
303c2c66affSColin Finck }
304c2c66affSColin Finck 
305c2c66affSColin Finck #define RTL_CONSTANT_OBJECT_ATTRIBUTES(n,a) { \
306c2c66affSColin Finck   sizeof(OBJECT_ATTRIBUTES), \
307c2c66affSColin Finck   NULL, \
308c2c66affSColin Finck   RTL_CONST_CAST(PUNICODE_STRING)(n), \
309c2c66affSColin Finck   a, \
310c2c66affSColin Finck   NULL, \
311c2c66affSColin Finck   NULL  \
312c2c66affSColin Finck }
313c2c66affSColin Finck 
314c2c66affSColin Finck #define RTL_INIT_OBJECT_ATTRIBUTES(n, a) \
315c2c66affSColin Finck     RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
316c2c66affSColin Finck 
317c2c66affSColin Finck #ifdef _MSC_VER
318c2c66affSColin Finck  #pragma warning(push)
319c2c66affSColin Finck  #pragma warning(disable:4214) /* Bit fields of other types than int */
320c2c66affSColin Finck #endif /* _MSC_VER */
321c2c66affSColin Finck typedef struct _RTL_BALANCED_NODE
322c2c66affSColin Finck {
323c2c66affSColin Finck     _ANONYMOUS_UNION union
324c2c66affSColin Finck     {
325c2c66affSColin Finck         struct _RTL_BALANCED_NODE *Children[2];
326c2c66affSColin Finck         _ANONYMOUS_STRUCT struct
327c2c66affSColin Finck         {
328c2c66affSColin Finck             struct _RTL_BALANCED_NODE *Left;
329c2c66affSColin Finck             struct _RTL_BALANCED_NODE *Right;
330c2c66affSColin Finck         } DUMMYSTRUCTNAME;
331c2c66affSColin Finck     } DUMMYUNIONNAME;
332c2c66affSColin Finck     _ANONYMOUS_UNION union
333c2c66affSColin Finck     {
334c2c66affSColin Finck         UCHAR Red : 1;
335c2c66affSColin Finck         UCHAR Balance : 2;
336c2c66affSColin Finck         ULONG_PTR ParentValue;
337c2c66affSColin Finck     } DUMMYUNIONNAME2;
338c2c66affSColin Finck } RTL_BALANCED_NODE, *PRTL_BALANCED_NODE;
339c2c66affSColin Finck #ifdef _MSC_VER
340c2c66affSColin Finck  #pragma warning(pop)
341c2c66affSColin Finck #endif /* _MSC_VER */
342c2c66affSColin Finck 
343c2c66affSColin Finck #define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3
344c2c66affSColin Finck #define RTL_BALANCED_NODE_GET_PARENT_POINTER(Node) \
345c2c66affSColin Finck     ((PRTL_BALANCED_NODE)((Node)->ParentValue & \
346c2c66affSColin Finck                           ~RTL_BALANCED_NODE_RESERVED_PARENT_MASK))
347c2c66affSColin Finck 
348c2c66affSColin Finck /* Product Types */
349c2c66affSColin Finck typedef enum _NT_PRODUCT_TYPE {
350c2c66affSColin Finck   NtProductWinNt = 1,
351c2c66affSColin Finck   NtProductLanManNt,
352c2c66affSColin Finck   NtProductServer
353c2c66affSColin Finck } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
354c2c66affSColin Finck 
355c2c66affSColin Finck typedef enum _EVENT_TYPE {
356c2c66affSColin Finck   NotificationEvent,
357c2c66affSColin Finck   SynchronizationEvent
358c2c66affSColin Finck } EVENT_TYPE;
359c2c66affSColin Finck 
360c2c66affSColin Finck typedef enum _TIMER_TYPE {
361c2c66affSColin Finck   NotificationTimer,
362c2c66affSColin Finck   SynchronizationTimer
363c2c66affSColin Finck } TIMER_TYPE;
364c2c66affSColin Finck 
365c2c66affSColin Finck typedef enum _WAIT_TYPE {
366c2c66affSColin Finck   WaitAll,
367c2c66affSColin Finck   WaitAny
368c2c66affSColin Finck } WAIT_TYPE;
369c2c66affSColin Finck 
370c2c66affSColin Finck #ifndef MIDL_PASS
371c2c66affSColin Finck FORCEINLINE
372c2c66affSColin Finck VOID
373c2c66affSColin Finck ListEntry32To64(
374c2c66affSColin Finck     _In_ PLIST_ENTRY32 ListEntry32,
375c2c66affSColin Finck     _Out_ PLIST_ENTRY64 ListEntry64)
376c2c66affSColin Finck {
377c2c66affSColin Finck     ListEntry64->Flink = ListEntry32->Flink;
378c2c66affSColin Finck     ListEntry64->Blink = ListEntry32->Blink;
379c2c66affSColin Finck }
380c2c66affSColin Finck 
381c2c66affSColin Finck FORCEINLINE
382c2c66affSColin Finck VOID
383c2c66affSColin Finck ListEntry64To32(
384c2c66affSColin Finck     _In_ PLIST_ENTRY64 ListEntry64,
385c2c66affSColin Finck     _Out_ PLIST_ENTRY32 ListEntry32)
386c2c66affSColin Finck {
387c2c66affSColin Finck     /* ASSERT without ASSERT or intrinsics ... */
388c2c66affSColin Finck     if (((ListEntry64->Flink >> 32) != 0) ||
389c2c66affSColin Finck         ((ListEntry64->Blink >> 32) != 0))
390c2c66affSColin Finck     {
391c2c66affSColin Finck         (VOID)*(volatile LONG*)(LONG_PTR)-1;
392c2c66affSColin Finck     }
393c2c66affSColin Finck     ListEntry32->Flink = ListEntry64->Flink & 0xFFFFFFFF;
394c2c66affSColin Finck     ListEntry32->Blink = ListEntry64->Blink & 0xFFFFFFFF;
395c2c66affSColin Finck }
396c2c66affSColin Finck #endif /* !MIDL_PASS */
397c2c66affSColin Finck 
398c2c66affSColin Finck #ifdef __cplusplus
399c2c66affSColin Finck } // extern "C"
400c2c66affSColin Finck #endif
401c2c66affSColin Finck 
402c2c66affSColin Finck #endif /* _NTDEF_ */
403