2010-06-12 14:55:02 +00:00
|
|
|
/*
|
|
|
|
* ntdef.h
|
|
|
|
*
|
|
|
|
* This file is part of the ReactOS PSDK package.
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS NOT COPYRIGHTED
|
|
|
|
*
|
|
|
|
* This source code is offered for use in the public domain. You may
|
|
|
|
* use, modify or distribute it freely.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful but
|
|
|
|
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
|
|
|
* DISCLAIMED. This includes but is not limited to warranties of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-03-29 10:35:31 +00:00
|
|
|
#ifndef _NTDEF_
|
|
|
|
#define _NTDEF_
|
2007-08-04 08:26:58 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Dependencies */
|
2008-12-01 15:12:23 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <basetsd.h>
|
2007-08-04 08:26:58 +00:00
|
|
|
#include <excpt.h>
|
2008-12-01 15:12:23 +00:00
|
|
|
#include <sdkddkver.h>
|
2012-01-09 21:55:56 +00:00
|
|
|
#include <specstrings.h>
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
// FIXME: Shouldn't be included!
|
2008-12-01 15:12:23 +00:00
|
|
|
#include <stdarg.h>
|
2008-12-24 23:31:09 +00:00
|
|
|
#include <string.h>
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-02-27 14:01:48 +00:00
|
|
|
/* Helper macro to enable gcc's extension. */
|
|
|
|
#ifndef __GNU_EXTENSION
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define __GNU_EXTENSION __extension__
|
|
|
|
#else
|
|
|
|
#define __GNU_EXTENSION
|
|
|
|
#endif
|
|
|
|
#endif
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Pseudo Modifiers for Input Parameters */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
|
|
|
#ifndef IN
|
|
|
|
#define IN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef OUT
|
|
|
|
#define OUT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef OPTIONAL
|
|
|
|
#define OPTIONAL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NOTHING
|
|
|
|
#define NOTHING
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CRITICAL
|
|
|
|
#define CRITICAL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FAR
|
|
|
|
#define FAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Defines the "size" of an any-size array */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef ANYSIZE_ARRAY
|
|
|
|
#define ANYSIZE_ARRAY 1
|
|
|
|
#endif
|
2007-08-04 08:26:58 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Constant modifier */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef CONST
|
|
|
|
#define CONST const
|
|
|
|
#endif
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* TRUE/FALSE */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define FALSE 0
|
|
|
|
#define TRUE 1
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* NULL/NULL64 */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef NULL
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define NULL 0
|
|
|
|
#define NULL64 0
|
|
|
|
#else
|
|
|
|
#define NULL ((void *)0)
|
|
|
|
#define NULL64 ((void * POINTER_64)0)
|
|
|
|
#endif
|
2010-03-29 05:28:59 +00:00
|
|
|
#endif /* NULL */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-06 00:59:29 +00:00
|
|
|
|
2008-12-01 15:12:23 +00:00
|
|
|
//
|
|
|
|
// FIXME
|
|
|
|
// We should use the -fms-extensions compiler flag for gcc,
|
|
|
|
// and clean up the mess.
|
|
|
|
//
|
2010-02-27 14:43:32 +00:00
|
|
|
#ifndef __ANONYMOUS_DEFINED
|
|
|
|
#define __ANONYMOUS_DEFINED
|
|
|
|
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef NONAMELESSUNION
|
2009-08-01 19:10:16 +00:00
|
|
|
#ifdef __GNUC__
|
2010-02-27 14:01:48 +00:00
|
|
|
#define _ANONYMOUS_UNION __GNU_EXTENSION
|
|
|
|
#define _ANONYMOUS_STRUCT __GNU_EXTENSION
|
2008-12-01 15:12:23 +00:00
|
|
|
#elif defined(__WATCOMC__) || defined(_MSC_VER)
|
|
|
|
#define _ANONYMOUS_UNION
|
|
|
|
#define _ANONYMOUS_STRUCT
|
|
|
|
#endif /* __GNUC__/__WATCOMC__ */
|
2009-08-01 19:10:16 +00:00
|
|
|
#endif /* NONAMELESSUNION */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
|
|
|
#ifndef _ANONYMOUS_UNION
|
|
|
|
#define _ANONYMOUS_UNION
|
|
|
|
#define _UNION_NAME(x) x
|
|
|
|
#define DUMMYUNIONNAME u
|
|
|
|
#define DUMMYUNIONNAME2 u2
|
|
|
|
#define DUMMYUNIONNAME3 u3
|
|
|
|
#define DUMMYUNIONNAME4 u4
|
|
|
|
#define DUMMYUNIONNAME5 u5
|
|
|
|
#define DUMMYUNIONNAME6 u6
|
|
|
|
#define DUMMYUNIONNAME7 u7
|
|
|
|
#define DUMMYUNIONNAME8 u8
|
|
|
|
#else
|
|
|
|
#define _UNION_NAME(x)
|
|
|
|
#define DUMMYUNIONNAME
|
|
|
|
#define DUMMYUNIONNAME2
|
|
|
|
#define DUMMYUNIONNAME3
|
|
|
|
#define DUMMYUNIONNAME4
|
|
|
|
#define DUMMYUNIONNAME5
|
|
|
|
#define DUMMYUNIONNAME6
|
|
|
|
#define DUMMYUNIONNAME7
|
|
|
|
#define DUMMYUNIONNAME8
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _ANONYMOUS_STRUCT
|
|
|
|
#define _ANONYMOUS_STRUCT
|
|
|
|
#define _STRUCT_NAME(x) x
|
|
|
|
#define DUMMYSTRUCTNAME s
|
|
|
|
#define DUMMYSTRUCTNAME2 s2
|
|
|
|
#define DUMMYSTRUCTNAME3 s3
|
2010-02-27 14:43:32 +00:00
|
|
|
#define DUMMYSTRUCTNAME4 s4
|
|
|
|
#define DUMMYSTRUCTNAME5 s5
|
2008-12-01 15:12:23 +00:00
|
|
|
#else
|
|
|
|
#define _STRUCT_NAME(x)
|
|
|
|
#define DUMMYSTRUCTNAME
|
|
|
|
#define DUMMYSTRUCTNAME2
|
|
|
|
#define DUMMYSTRUCTNAME3
|
2010-02-27 14:43:32 +00:00
|
|
|
#define DUMMYSTRUCTNAME4
|
|
|
|
#define DUMMYSTRUCTNAME5
|
2008-12-01 15:12:23 +00:00
|
|
|
#endif
|
|
|
|
|
2010-02-27 14:43:32 +00:00
|
|
|
#endif /* __ANONYMOUS_DEFINED */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-07-17 21:19:38 +00:00
|
|
|
#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64)
|
|
|
|
#define ALIGNMENT_MACHINE
|
|
|
|
#define UNALIGNED __unaligned
|
|
|
|
#if defined(_WIN64)
|
|
|
|
#define UNALIGNED64 __unaligned
|
|
|
|
#else
|
|
|
|
#define UNALIGNED64
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#undef ALIGNMENT_MACHINE
|
2008-12-01 15:12:23 +00:00
|
|
|
#define UNALIGNED
|
2010-07-17 21:19:38 +00:00
|
|
|
#define UNALIGNED64
|
|
|
|
#endif
|
|
|
|
|
2012-01-09 21:55:56 +00:00
|
|
|
#if defined(_WIN64) || defined(_M_ALPHA)
|
|
|
|
#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
|
|
|
|
#define MEMORY_ALLOCATION_ALIGNMENT 16
|
|
|
|
#else
|
|
|
|
#define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
|
|
|
|
#define MEMORY_ALLOCATION_ALIGNMENT 8
|
|
|
|
#endif
|
|
|
|
|
2010-07-17 21:19:38 +00:00
|
|
|
#if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED)
|
|
|
|
#define RESTRICTED_POINTER __restrict
|
|
|
|
#else
|
2005-06-21 23:42:58 +00:00
|
|
|
#define RESTRICTED_POINTER
|
2010-07-17 21:19:38 +00:00
|
|
|
#endif
|
2005-05-08 17:44:37 +00:00
|
|
|
|
2010-03-12 16:37:33 +00:00
|
|
|
#define ARGUMENT_PRESENT(ArgumentPointer) \
|
|
|
|
((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Returns the base address of a structure from a structure member */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef CONTAINING_RECORD
|
|
|
|
#define CONTAINING_RECORD(address, type, field) \
|
|
|
|
((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
|
|
|
|
#endif
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Returns the byte offset of the specified structure's member */
|
2009-05-27 10:55:41 +00:00
|
|
|
#ifndef __GNUC__
|
2009-07-25 19:38:52 +00:00
|
|
|
#define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
|
2009-05-27 10:55:41 +00:00
|
|
|
#else
|
|
|
|
#define FIELD_OFFSET(Type, Field) __builtin_offsetof(Type, Field)
|
|
|
|
#endif
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Returns the type's alignment */
|
2009-07-25 19:38:52 +00:00
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
|
|
|
#define TYPE_ALIGNMENT(t) __alignof(t)
|
|
|
|
#else
|
2010-08-22 13:25:10 +00:00
|
|
|
#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
|
2009-07-25 19:38:52 +00:00
|
|
|
#endif
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2012-01-09 21:55:56 +00:00
|
|
|
#if defined(_AMD64_) || defined(_X86_)
|
|
|
|
#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(ULONG)
|
|
|
|
#elif defined(_IA64_) || defined(_ARM_)
|
|
|
|
#define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT(ULONG))
|
|
|
|
#else
|
|
|
|
#error "unknown architecture"
|
|
|
|
#endif
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Calling Conventions */
|
2008-12-01 15:12:23 +00:00
|
|
|
#if defined(_M_IX86)
|
|
|
|
#define FASTCALL __fastcall
|
|
|
|
#else
|
|
|
|
#define FASTCALL
|
|
|
|
#endif
|
|
|
|
|
2005-05-08 17:44:37 +00:00
|
|
|
#define NTAPI __stdcall
|
2008-12-01 15:12:23 +00:00
|
|
|
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Import and Export Specifiers */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Done the same way as in windef.h for now */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define DECLSPEC_IMPORT __declspec(dllimport)
|
2010-01-24 01:37:13 +00:00
|
|
|
#define DECLSPEC_NORETURN __declspec(noreturn)
|
2008-12-01 15:12:23 +00:00
|
|
|
|
|
|
|
#ifndef DECLSPEC_ADDRSAFE
|
|
|
|
#if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
|
|
|
|
#define DECLSPEC_ADDRSAFE __declspec(address_safe)
|
|
|
|
#else
|
|
|
|
#define DECLSPEC_ADDRSAFE
|
|
|
|
#endif
|
2010-08-22 13:25:10 +00:00
|
|
|
#endif /* DECLSPEC_ADDRSAFE */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2012-03-12 21:27:15 +00:00
|
|
|
#ifndef NOP_FUNCTION
|
|
|
|
#if (_MSC_VER >= 1210)
|
|
|
|
#define NOP_FUNCTION __noop
|
|
|
|
#else
|
|
|
|
#define NOP_FUNCTION (void)0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2008-12-01 15:12:23 +00:00
|
|
|
#if !defined(_NTSYSTEM_)
|
|
|
|
#define NTSYSAPI DECLSPEC_IMPORT
|
|
|
|
#define NTSYSCALLAPI DECLSPEC_IMPORT
|
|
|
|
#else
|
|
|
|
#define NTSYSAPI
|
|
|
|
#if defined(_NTDLLBUILD_)
|
|
|
|
#define NTSYSCALLAPI
|
|
|
|
#else
|
|
|
|
#define NTSYSCALLAPI DECLSPEC_ADDRSAFE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Inlines */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef FORCEINLINE
|
2010-08-22 13:25:10 +00:00
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
2008-12-01 15:12:23 +00:00
|
|
|
#define FORCEINLINE __forceinline
|
2010-08-22 13:25:10 +00:00
|
|
|
#elif defined(_MSC_VER)
|
2008-12-01 15:12:23 +00:00
|
|
|
#define FORCEINLINE __inline
|
2010-08-22 13:25:10 +00:00
|
|
|
#else /* __GNUC__ */
|
2012-07-30 12:55:13 +00:00
|
|
|
# if ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
|
|
|
|
# define FORCEINLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
|
|
|
|
# else
|
|
|
|
# define FORCEINLINE extern __inline__ __attribute__((__always_inline__))
|
|
|
|
# endif
|
2008-12-01 15:12:23 +00:00
|
|
|
#endif
|
2010-08-22 13:25:10 +00:00
|
|
|
#endif /* FORCEINLINE */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2008-12-24 23:31:09 +00:00
|
|
|
#ifndef DECLSPEC_NOINLINE
|
2008-12-01 15:12:23 +00:00
|
|
|
#if (_MSC_VER >= 1300)
|
|
|
|
#define DECLSPEC_NOINLINE __declspec(noinline)
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
#define DECLSPEC_NOINLINE __attribute__((noinline))
|
|
|
|
#else
|
|
|
|
#define DECLSPEC_NOINLINE
|
|
|
|
#endif
|
2010-08-22 13:25:10 +00:00
|
|
|
#endif /* DECLSPEC_NOINLINE */
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2005-09-06 05:30:39 +00:00
|
|
|
#if !defined(_M_CEE_PURE)
|
|
|
|
#define NTAPI_INLINE NTAPI
|
|
|
|
#else
|
|
|
|
#define NTAPI_INLINE
|
|
|
|
#endif
|
2005-09-04 23:48:19 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Use to specify structure alignment */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef DECLSPEC_ALIGN
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
|
|
|
|
#define DECLSPEC_ALIGN(x) __declspec(align(x))
|
|
|
|
#elif defined(__GNUC__)
|
2010-08-22 13:25:10 +00:00
|
|
|
#define DECLSPEC_ALIGN(x) __attribute__ ((__aligned__ (x)))
|
2008-12-01 15:12:23 +00:00
|
|
|
#else
|
|
|
|
#define DECLSPEC_ALIGN(x)
|
|
|
|
#endif
|
2010-08-22 13:25:10 +00:00
|
|
|
#endif /* DECLSPEC_ALIGN */
|
2006-01-08 06:23:17 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Use to silence unused variable warnings when it is intentional */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define UNREFERENCED_PARAMETER(P) {(P)=(P);}
|
|
|
|
#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
|
|
|
|
#define DBG_UNREFERENCED_PARAMETER(P)
|
|
|
|
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* min/max helper macros */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef NOMINMAX
|
|
|
|
|
|
|
|
#ifndef min
|
|
|
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef max
|
|
|
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
#endif /* NOMINMAX */
|
2010-03-29 04:14:34 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Tell windef.h that we have defined some basic types */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define BASETYPES
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Void Pointers */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef void *PVOID;
|
2008-12-24 23:31:09 +00:00
|
|
|
//typedef void * POINTER_64 PVOID64;
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef PVOID PVOID64; // FIXME!
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Handle Type */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifdef STRICT
|
|
|
|
typedef void *HANDLE;
|
|
|
|
#define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
|
|
|
|
#else
|
|
|
|
typedef PVOID HANDLE;
|
|
|
|
#define DECLARE_HANDLE(n) typedef HANDLE n
|
|
|
|
#endif
|
|
|
|
typedef HANDLE *PHANDLE;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Upper-Case Versions of Some Standard C Types */
|
2008-12-01 15:12:23 +00:00
|
|
|
#ifndef VOID
|
|
|
|
#define VOID void
|
|
|
|
typedef char CHAR;
|
|
|
|
typedef short SHORT;
|
|
|
|
typedef long LONG;
|
|
|
|
#if !defined(MIDL_PASS)
|
|
|
|
typedef int INT;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
typedef double DOUBLE;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Unsigned Types */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef unsigned char UCHAR, *PUCHAR;
|
|
|
|
typedef unsigned short USHORT, *PUSHORT;
|
|
|
|
typedef unsigned long ULONG, *PULONG;
|
|
|
|
typedef CONST UCHAR *PCUCHAR;
|
|
|
|
typedef CONST USHORT *PCUSHORT;
|
|
|
|
typedef CONST ULONG *PCULONG;
|
|
|
|
typedef UCHAR FCHAR;
|
|
|
|
typedef USHORT FSHORT;
|
|
|
|
typedef ULONG FLONG;
|
2010-03-29 05:28:59 +00:00
|
|
|
typedef UCHAR BOOLEAN, *PBOOLEAN;
|
2010-03-06 00:59:29 +00:00
|
|
|
typedef ULONG LOGICAL;
|
|
|
|
typedef ULONG *PLOGICAL;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Signed Types */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef SHORT *PSHORT;
|
|
|
|
typedef LONG *PLONG;
|
2012-01-22 15:17:55 +00:00
|
|
|
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef NTSTATUS *PNTSTATUS;
|
|
|
|
typedef signed char SCHAR;
|
|
|
|
typedef SCHAR *PSCHAR;
|
|
|
|
|
|
|
|
#ifndef _HRESULT_DEFINED
|
|
|
|
#define _HRESULT_DEFINED
|
|
|
|
typedef LONG HRESULT;
|
2005-05-08 17:44:37 +00:00
|
|
|
#endif
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* 64-bit types */
|
2010-02-27 14:01:48 +00:00
|
|
|
__GNU_EXTENSION typedef __int64 LONGLONG, *PLONGLONG;
|
|
|
|
__GNU_EXTENSION typedef unsigned __int64 ULONGLONG, *PULONGLONG;
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef ULONGLONG DWORDLONG, *PDWORDLONG;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Update Sequence Number */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef LONGLONG USN;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* ANSI (Multi-byte Character) types */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef CHAR *PCHAR, *LPCH, *PCH;
|
|
|
|
typedef CONST CHAR *LPCCH, *PCCH;
|
2012-01-09 21:55:56 +00:00
|
|
|
typedef _Null_terminated_ CHAR *NPSTR, *LPSTR, *PSTR;
|
|
|
|
typedef _Null_terminated_ PSTR *PZPSTR;
|
|
|
|
typedef _Null_terminated_ CONST PSTR *PCZPSTR;
|
|
|
|
typedef _Null_terminated_ CONST CHAR *LPCSTR, *PCSTR;
|
|
|
|
typedef _Null_terminated_ PCSTR *PZPCSTR;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Pointer to an Asciiz string */
|
2012-01-22 15:17:55 +00:00
|
|
|
typedef _Null_terminated_ CHAR *PSZ;
|
|
|
|
typedef _Null_terminated_ CONST char *PCSZ;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* UNICODE (Wide Character) types */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef wchar_t WCHAR;
|
|
|
|
typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
|
|
|
|
typedef CONST WCHAR *LPCWCH, *PCWCH;
|
2012-01-09 21:55:56 +00:00
|
|
|
typedef _Null_terminated_ WCHAR *NWPSTR, *LPWSTR, *PWSTR;
|
|
|
|
typedef _Null_terminated_ PWSTR *PZPWSTR;
|
|
|
|
typedef _Null_terminated_ CONST PWSTR *PCZPWSTR;
|
|
|
|
typedef _Null_terminated_ WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
|
|
|
|
typedef _Null_terminated_ CONST WCHAR *LPCWSTR, *PCWSTR;
|
|
|
|
typedef _Null_terminated_ PCWSTR *PZPCWSTR;
|
|
|
|
typedef _Null_terminated_ CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
|
2012-01-22 15:17:55 +00:00
|
|
|
typedef _NullNull_terminated_ WCHAR *PZZWSTR;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Cardinal Data Types */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef char CCHAR, *PCCHAR;
|
|
|
|
typedef short CSHORT, *PCSHORT;
|
|
|
|
typedef ULONG CLONG, *PCLONG;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* NLS basics (Locale and Language Ids) */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef ULONG LCID;
|
|
|
|
typedef PULONG PLCID;
|
|
|
|
typedef USHORT LANGID;
|
|
|
|
|
2012-05-07 18:50:45 +00:00
|
|
|
typedef enum {
|
|
|
|
UNSPECIFIED_COMPARTMENT_ID = 0,
|
|
|
|
DEFAULT_COMPARTMENT_ID
|
|
|
|
} COMPARTMENT_ID, *PCOMPARTMENT_ID;
|
|
|
|
|
2010-03-29 10:35:31 +00:00
|
|
|
/* Used to store a non-float 8 byte aligned structure */
|
|
|
|
typedef struct _QUAD
|
|
|
|
{
|
|
|
|
_ANONYMOUS_UNION union
|
|
|
|
{
|
|
|
|
__GNU_EXTENSION __int64 UseThisFieldToCopy;
|
|
|
|
double DoNotUseThisField;
|
|
|
|
} DUMMYUNIONNAME;
|
|
|
|
} QUAD, *PQUAD, UQUAD, *PUQUAD;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Large Integer Unions */
|
2008-12-01 15:12:23 +00:00
|
|
|
#if defined(MIDL_PASS)
|
|
|
|
typedef struct _LARGE_INTEGER {
|
|
|
|
#else
|
|
|
|
typedef union _LARGE_INTEGER {
|
|
|
|
_ANONYMOUS_STRUCT struct
|
|
|
|
{
|
2009-08-08 15:10:01 +00:00
|
|
|
ULONG LowPart;
|
2008-12-01 15:12:23 +00:00
|
|
|
LONG HighPart;
|
|
|
|
} DUMMYSTRUCTNAME;
|
|
|
|
struct
|
|
|
|
{
|
2009-08-08 15:10:01 +00:00
|
|
|
ULONG LowPart;
|
2008-12-01 15:12:23 +00:00
|
|
|
LONG HighPart;
|
|
|
|
} u;
|
2010-03-29 05:28:59 +00:00
|
|
|
#endif /* MIDL_PASS */
|
2008-12-01 15:12:23 +00:00
|
|
|
LONGLONG QuadPart;
|
|
|
|
} LARGE_INTEGER, *PLARGE_INTEGER;
|
|
|
|
|
|
|
|
#if defined(MIDL_PASS)
|
|
|
|
typedef struct _ULARGE_INTEGER {
|
|
|
|
#else
|
|
|
|
typedef union _ULARGE_INTEGER {
|
|
|
|
_ANONYMOUS_STRUCT struct
|
|
|
|
{
|
2009-08-08 15:10:01 +00:00
|
|
|
ULONG LowPart;
|
|
|
|
ULONG HighPart;
|
2008-12-01 15:12:23 +00:00
|
|
|
} DUMMYSTRUCTNAME;
|
|
|
|
struct
|
|
|
|
{
|
2009-08-08 15:10:01 +00:00
|
|
|
ULONG LowPart;
|
|
|
|
ULONG HighPart;
|
2008-12-01 15:12:23 +00:00
|
|
|
} u;
|
2010-03-29 05:28:59 +00:00
|
|
|
#endif /* MIDL_PASS */
|
2008-12-01 15:12:23 +00:00
|
|
|
ULONGLONG QuadPart;
|
|
|
|
} ULARGE_INTEGER, *PULARGE_INTEGER;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Physical Addresses are always treated as 64-bit wide */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Locally Unique Identifier */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef struct _LUID {
|
|
|
|
ULONG LowPart;
|
|
|
|
LONG HighPart;
|
|
|
|
} LUID, *PLUID;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Native API Return Value Macros */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
|
|
|
|
#define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
|
|
|
|
#define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
|
|
|
|
#define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* String Types */
|
2005-05-08 17:44:37 +00:00
|
|
|
typedef struct _UNICODE_STRING {
|
|
|
|
USHORT Length;
|
|
|
|
USHORT MaximumLength;
|
|
|
|
PWSTR Buffer;
|
|
|
|
} UNICODE_STRING, *PUNICODE_STRING;
|
|
|
|
typedef const UNICODE_STRING* PCUNICODE_STRING;
|
2008-12-01 15:12:23 +00:00
|
|
|
#define UNICODE_NULL ((WCHAR)0)
|
2011-07-09 13:37:47 +00:00
|
|
|
#define UNICODE_STRING_MAX_BYTES ((USHORT) 65534)
|
|
|
|
#define UNICODE_STRING_MAX_CHARS (32767)
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2006-11-19 21:14:49 +00:00
|
|
|
typedef struct _CSTRING {
|
|
|
|
USHORT Length;
|
|
|
|
USHORT MaximumLength;
|
|
|
|
CONST CHAR *Buffer;
|
|
|
|
} CSTRING, *PCSTRING;
|
2008-12-01 15:12:23 +00:00
|
|
|
#define ANSI_NULL ((CHAR)0)
|
|
|
|
|
|
|
|
typedef struct _STRING {
|
|
|
|
USHORT Length;
|
|
|
|
USHORT MaximumLength;
|
2012-01-22 15:17:55 +00:00
|
|
|
#ifdef MIDL_PASS
|
|
|
|
[size_is(MaximumLength), length_is(Length) ]
|
|
|
|
#endif
|
|
|
|
_Field_size_bytes_part_opt_(MaximumLength, Length) PCHAR Buffer;
|
2008-12-01 15:12:23 +00:00
|
|
|
} STRING, *PSTRING;
|
|
|
|
|
2005-05-08 17:44:37 +00:00
|
|
|
typedef STRING ANSI_STRING;
|
|
|
|
typedef PSTRING PANSI_STRING;
|
|
|
|
typedef STRING OEM_STRING;
|
|
|
|
typedef PSTRING POEM_STRING;
|
2005-09-05 18:06:20 +00:00
|
|
|
typedef CONST STRING* PCOEM_STRING;
|
|
|
|
typedef STRING CANSI_STRING;
|
|
|
|
typedef PSTRING PCANSI_STRING;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2009-12-16 23:39:20 +00:00
|
|
|
typedef struct _STRING32 {
|
|
|
|
USHORT Length;
|
|
|
|
USHORT MaximumLength;
|
|
|
|
ULONG Buffer;
|
2012-01-09 21:55:56 +00:00
|
|
|
} STRING32, *PSTRING32,
|
|
|
|
UNICODE_STRING32, *PUNICODE_STRING32,
|
2009-12-16 23:39:20 +00:00
|
|
|
ANSI_STRING32, *PANSI_STRING32;
|
|
|
|
|
|
|
|
typedef struct _STRING64 {
|
|
|
|
USHORT Length;
|
|
|
|
USHORT MaximumLength;
|
|
|
|
ULONGLONG Buffer;
|
|
|
|
} STRING64, *PSTRING64,
|
2012-01-09 21:55:56 +00:00
|
|
|
UNICODE_STRING64, *PUNICODE_STRING64,
|
2009-12-16 23:39:20 +00:00
|
|
|
ANSI_STRING64, *PANSI_STRING64;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* LangID and NLS */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p))
|
|
|
|
#define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff)
|
|
|
|
#define SUBLANGID(lgid) ((USHORT)(lgid) >> 10)
|
|
|
|
|
|
|
|
#define NLS_VALID_LOCALE_MASK 0x000fffff
|
|
|
|
|
|
|
|
#define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \
|
|
|
|
((ULONG)((USHORT)(lgid)))))
|
2010-08-22 13:25:10 +00:00
|
|
|
#define MAKESORTLCID(lgid, srtid, ver) \
|
2008-12-01 15:12:23 +00:00
|
|
|
((ULONG)((MAKELCID(lgid, srtid)) | \
|
|
|
|
(((ULONG)((USHORT)(ver))) << 20)))
|
|
|
|
#define LANGIDFROMLCID(lcid) ((USHORT)(lcid))
|
|
|
|
#define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf))
|
|
|
|
#define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf))
|
|
|
|
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Object Attributes */
|
2005-05-08 17:44:37 +00:00
|
|
|
typedef struct _OBJECT_ATTRIBUTES {
|
|
|
|
ULONG Length;
|
|
|
|
HANDLE RootDirectory;
|
|
|
|
PUNICODE_STRING ObjectName;
|
2005-05-09 01:50:07 +00:00
|
|
|
ULONG Attributes;
|
|
|
|
PVOID SecurityDescriptor;
|
2005-05-08 17:44:37 +00:00
|
|
|
PVOID SecurityQualityOfService;
|
|
|
|
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Values for the Attributes member */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define OBJ_INHERIT 0x00000002
|
|
|
|
#define OBJ_PERMANENT 0x00000010
|
|
|
|
#define OBJ_EXCLUSIVE 0x00000020
|
|
|
|
#define OBJ_CASE_INSENSITIVE 0x00000040
|
|
|
|
#define OBJ_OPENIF 0x00000080
|
|
|
|
#define OBJ_OPENLINK 0x00000100
|
|
|
|
#define OBJ_KERNEL_HANDLE 0x00000200
|
|
|
|
#define OBJ_FORCE_ACCESS_CHECK 0x00000400
|
|
|
|
#define OBJ_VALID_ATTRIBUTES 0x000007F2
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Helper Macro */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define InitializeObjectAttributes(p,n,a,r,s) { \
|
|
|
|
(p)->Length = sizeof(OBJECT_ATTRIBUTES); \
|
|
|
|
(p)->RootDirectory = (r); \
|
|
|
|
(p)->Attributes = (a); \
|
|
|
|
(p)->ObjectName = (n); \
|
|
|
|
(p)->SecurityDescriptor = (s); \
|
|
|
|
(p)->SecurityQualityOfService = NULL; \
|
|
|
|
}
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Product Types */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef enum _NT_PRODUCT_TYPE {
|
2010-08-22 13:25:10 +00:00
|
|
|
NtProductWinNt = 1,
|
|
|
|
NtProductLanManNt,
|
|
|
|
NtProductServer
|
2008-12-01 15:12:23 +00:00
|
|
|
} NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
|
|
|
|
|
2010-03-29 10:35:31 +00:00
|
|
|
typedef enum _EVENT_TYPE {
|
|
|
|
NotificationEvent,
|
|
|
|
SynchronizationEvent
|
|
|
|
} EVENT_TYPE;
|
|
|
|
|
|
|
|
typedef enum _TIMER_TYPE {
|
2010-08-22 13:25:10 +00:00
|
|
|
NotificationTimer,
|
|
|
|
SynchronizationTimer
|
2010-03-29 10:35:31 +00:00
|
|
|
} TIMER_TYPE;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 10:35:31 +00:00
|
|
|
typedef enum _WAIT_TYPE {
|
|
|
|
WaitAll,
|
|
|
|
WaitAny
|
|
|
|
} WAIT_TYPE;
|
2010-03-23 16:42:06 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Doubly Linked Lists */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef struct _LIST_ENTRY {
|
2010-08-22 13:25:10 +00:00
|
|
|
struct _LIST_ENTRY *Flink;
|
|
|
|
struct _LIST_ENTRY *Blink;
|
2008-12-01 15:12:23 +00:00
|
|
|
} LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
|
- Add EXCEPTION_RECORD64 and LIST_ENTRY64, KeTryToAcquireSpinLockAtDpcLevel, BREAKPOINT_COMMAND_STRING, Ke386SetCr2, Ke386SetDr3, Ke386SetDr6.
- Remove non-kernel routines from kdfuncs.h and remove deprecated routines from ke.h.
- Implement KiRestoreProcessorControlState, KeFreezeExecution, KeThawExecution, ExAcquireTimeRefreshLock, ExReleaseTimeRefreshLock.
- Rename ModuleLoadList to PsLoadedModuleList. Add PsNtosImageBase and set value in it.
- Add skeleton wdbgexts.h with what's needed until now, this is a PSDK header.
- Add kddll.h for KDCOM/1394/USB2.DLL prototypes.
- Add windbgkd.h with KD protocol definitions. Used to be an NT5 DDK header, but was removed, so this goes into include\reactos.
svn path=/branches/alex-kd-branch/; revision=25833
2007-02-18 07:21:03 +00:00
|
|
|
|
2010-08-22 13:25:10 +00:00
|
|
|
typedef struct LIST_ENTRY32 {
|
|
|
|
ULONG Flink;
|
|
|
|
ULONG Blink;
|
2008-12-01 15:12:23 +00:00
|
|
|
} LIST_ENTRY32, *PLIST_ENTRY32;
|
- Add EXCEPTION_RECORD64 and LIST_ENTRY64, KeTryToAcquireSpinLockAtDpcLevel, BREAKPOINT_COMMAND_STRING, Ke386SetCr2, Ke386SetDr3, Ke386SetDr6.
- Remove non-kernel routines from kdfuncs.h and remove deprecated routines from ke.h.
- Implement KiRestoreProcessorControlState, KeFreezeExecution, KeThawExecution, ExAcquireTimeRefreshLock, ExReleaseTimeRefreshLock.
- Rename ModuleLoadList to PsLoadedModuleList. Add PsNtosImageBase and set value in it.
- Add skeleton wdbgexts.h with what's needed until now, this is a PSDK header.
- Add kddll.h for KDCOM/1394/USB2.DLL prototypes.
- Add windbgkd.h with KD protocol definitions. Used to be an NT5 DDK header, but was removed, so this goes into include\reactos.
svn path=/branches/alex-kd-branch/; revision=25833
2007-02-18 07:21:03 +00:00
|
|
|
|
2010-08-22 13:25:10 +00:00
|
|
|
typedef struct LIST_ENTRY64 {
|
|
|
|
ULONGLONG Flink;
|
|
|
|
ULONGLONG Blink;
|
2008-12-01 15:12:23 +00:00
|
|
|
} LIST_ENTRY64, *PLIST_ENTRY64;
|
- Add EXCEPTION_RECORD64 and LIST_ENTRY64, KeTryToAcquireSpinLockAtDpcLevel, BREAKPOINT_COMMAND_STRING, Ke386SetCr2, Ke386SetDr3, Ke386SetDr6.
- Remove non-kernel routines from kdfuncs.h and remove deprecated routines from ke.h.
- Implement KiRestoreProcessorControlState, KeFreezeExecution, KeThawExecution, ExAcquireTimeRefreshLock, ExReleaseTimeRefreshLock.
- Rename ModuleLoadList to PsLoadedModuleList. Add PsNtosImageBase and set value in it.
- Add skeleton wdbgexts.h with what's needed until now, this is a PSDK header.
- Add kddll.h for KDCOM/1394/USB2.DLL prototypes.
- Add windbgkd.h with KD protocol definitions. Used to be an NT5 DDK header, but was removed, so this goes into include\reactos.
svn path=/branches/alex-kd-branch/; revision=25833
2007-02-18 07:21:03 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Singly Linked Lists */
|
2008-12-01 15:12:23 +00:00
|
|
|
typedef struct _SINGLE_LIST_ENTRY {
|
2010-08-22 13:25:10 +00:00
|
|
|
struct _SINGLE_LIST_ENTRY *Next;
|
2008-12-01 15:12:23 +00:00
|
|
|
} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
|
|
|
|
|
2010-03-10 20:41:13 +00:00
|
|
|
typedef struct _PROCESSOR_NUMBER {
|
|
|
|
USHORT Group;
|
|
|
|
UCHAR Number;
|
|
|
|
UCHAR Reserved;
|
|
|
|
} PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
|
|
|
|
|
2010-04-06 00:00:00 +00:00
|
|
|
struct _CONTEXT;
|
|
|
|
struct _EXCEPTION_RECORD;
|
|
|
|
|
2012-01-22 15:17:55 +00:00
|
|
|
_IRQL_requires_same_
|
|
|
|
_Function_class_(EXCEPTION_ROUTINE)
|
2010-03-12 16:37:33 +00:00
|
|
|
typedef EXCEPTION_DISPOSITION
|
2010-03-29 05:28:59 +00:00
|
|
|
(NTAPI *PEXCEPTION_ROUTINE)(
|
2012-01-22 15:17:55 +00:00
|
|
|
_Inout_ struct _EXCEPTION_RECORD *ExceptionRecord,
|
|
|
|
_In_ PVOID EstablisherFrame,
|
|
|
|
_Inout_ struct _CONTEXT *ContextRecord,
|
|
|
|
_In_ PVOID DispatcherContext);
|
2010-03-12 16:37:33 +00:00
|
|
|
|
2010-03-29 10:35:31 +00:00
|
|
|
typedef struct _GROUP_AFFINITY {
|
|
|
|
KAFFINITY Mask;
|
|
|
|
USHORT Group;
|
|
|
|
USHORT Reserved[3];
|
|
|
|
} GROUP_AFFINITY, *PGROUP_AFFINITY;
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Helper Macros */
|
2012-05-07 18:50:45 +00:00
|
|
|
|
|
|
|
#define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
|
|
|
|
#define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
|
|
|
|
#define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
|
|
|
|
|
2005-05-08 18:02:41 +00:00
|
|
|
#define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2006-07-19 23:21:19 +00:00
|
|
|
#define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-09-25 05:15:47 +00:00
|
|
|
#define RTL_SIZEOF_THROUGH_FIELD(type, field) \
|
|
|
|
(FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
|
|
|
|
|
|
|
|
#define RTL_CONTAINS_FIELD(Struct, Size, Field) \
|
|
|
|
( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) )
|
|
|
|
|
2006-07-19 23:21:19 +00:00
|
|
|
#define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
|
|
|
|
#define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
|
|
|
|
#ifdef ENABLE_RTL_NUMBER_OF_V2
|
|
|
|
#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
|
|
|
|
#else
|
|
|
|
#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
|
2008-11-21 18:18:12 +00:00
|
|
|
#endif
|
2006-07-19 23:21:19 +00:00
|
|
|
#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
|
2008-12-01 15:12:23 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Type Limits */
|
2005-08-09 03:29:51 +00:00
|
|
|
#define MINCHAR 0x80
|
|
|
|
#define MAXCHAR 0x7f
|
|
|
|
#define MINSHORT 0x8000
|
|
|
|
#define MAXSHORT 0x7fff
|
|
|
|
#define MINLONG 0x80000000
|
|
|
|
#define MAXLONG 0x7fffffff
|
|
|
|
#define MAXUCHAR 0xff
|
|
|
|
#define MAXUSHORT 0xffff
|
|
|
|
#define MAXULONG 0xffffffff
|
2006-11-12 22:27:10 +00:00
|
|
|
#define MAXLONGLONG (0x7fffffffffffffffLL)
|
2008-04-22 23:09:05 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Multiplication and Shift Operations */
|
2008-12-01 15:12:23 +00:00
|
|
|
#define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
|
|
|
|
#define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
|
|
|
|
#define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
|
|
|
|
#define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
|
|
|
|
#define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* C_ASSERT Definition */
|
2009-12-16 23:39:20 +00:00
|
|
|
#define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
|
2006-10-01 15:52:10 +00:00
|
|
|
|
2010-08-22 13:25:10 +00:00
|
|
|
#define VER_WORKSTATION_NT 0x40000000
|
|
|
|
#define VER_SERVER_NT 0x80000000
|
|
|
|
#define VER_SUITE_SMALLBUSINESS 0x00000001
|
|
|
|
#define VER_SUITE_ENTERPRISE 0x00000002
|
|
|
|
#define VER_SUITE_BACKOFFICE 0x00000004
|
|
|
|
#define VER_SUITE_COMMUNICATIONS 0x00000008
|
|
|
|
#define VER_SUITE_TERMINAL 0x00000010
|
|
|
|
#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
|
|
|
|
#define VER_SUITE_EMBEDDEDNT 0x00000040
|
|
|
|
#define VER_SUITE_DATACENTER 0x00000080
|
|
|
|
#define VER_SUITE_SINGLEUSERTS 0x00000100
|
|
|
|
#define VER_SUITE_PERSONAL 0x00000200
|
|
|
|
#define VER_SUITE_BLADE 0x00000400
|
|
|
|
#define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
|
|
|
|
#define VER_SUITE_SECURITY_APPLIANCE 0x00001000
|
|
|
|
#define VER_SUITE_STORAGE_SERVER 0x00002000
|
|
|
|
#define VER_SUITE_COMPUTE_SERVER 0x00004000
|
|
|
|
#define VER_SUITE_WH_SERVER 0x00008000
|
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
/* Primary language IDs. */
|
2010-08-22 13:25:10 +00:00
|
|
|
#define LANG_NEUTRAL 0x00
|
|
|
|
#define LANG_INVARIANT 0x7f
|
|
|
|
|
|
|
|
#define LANG_AFRIKAANS 0x36
|
|
|
|
#define LANG_ALBANIAN 0x1c
|
|
|
|
#define LANG_ALSATIAN 0x84
|
|
|
|
#define LANG_AMHARIC 0x5e
|
|
|
|
#define LANG_ARABIC 0x01
|
|
|
|
#define LANG_ARMENIAN 0x2b
|
|
|
|
#define LANG_ASSAMESE 0x4d
|
|
|
|
#define LANG_AZERI 0x2c
|
|
|
|
#define LANG_BASHKIR 0x6d
|
|
|
|
#define LANG_BASQUE 0x2d
|
|
|
|
#define LANG_BELARUSIAN 0x23
|
|
|
|
#define LANG_BENGALI 0x45
|
|
|
|
#define LANG_BRETON 0x7e
|
|
|
|
#define LANG_BOSNIAN 0x1a
|
|
|
|
#define LANG_BOSNIAN_NEUTRAL 0x781a
|
|
|
|
#define LANG_BULGARIAN 0x02
|
|
|
|
#define LANG_CATALAN 0x03
|
|
|
|
#define LANG_CHINESE 0x04
|
|
|
|
#define LANG_CHINESE_SIMPLIFIED 0x04
|
|
|
|
#define LANG_CHINESE_TRADITIONAL 0x7c04
|
|
|
|
#define LANG_CORSICAN 0x83
|
|
|
|
#define LANG_CROATIAN 0x1a
|
|
|
|
#define LANG_CZECH 0x05
|
|
|
|
#define LANG_DANISH 0x06
|
|
|
|
#define LANG_DARI 0x8c
|
|
|
|
#define LANG_DIVEHI 0x65
|
|
|
|
#define LANG_DUTCH 0x13
|
|
|
|
#define LANG_ENGLISH 0x09
|
|
|
|
#define LANG_ESTONIAN 0x25
|
|
|
|
#define LANG_FAEROESE 0x38
|
|
|
|
#define LANG_FARSI 0x29
|
|
|
|
#define LANG_FILIPINO 0x64
|
|
|
|
#define LANG_FINNISH 0x0b
|
|
|
|
#define LANG_FRENCH 0x0c
|
|
|
|
#define LANG_FRISIAN 0x62
|
|
|
|
#define LANG_GALICIAN 0x56
|
|
|
|
#define LANG_GEORGIAN 0x37
|
|
|
|
#define LANG_GERMAN 0x07
|
|
|
|
#define LANG_GREEK 0x08
|
|
|
|
#define LANG_GREENLANDIC 0x6f
|
|
|
|
#define LANG_GUJARATI 0x47
|
|
|
|
#define LANG_HAUSA 0x68
|
|
|
|
#define LANG_HEBREW 0x0d
|
|
|
|
#define LANG_HINDI 0x39
|
|
|
|
#define LANG_HUNGARIAN 0x0e
|
|
|
|
#define LANG_ICELANDIC 0x0f
|
|
|
|
#define LANG_IGBO 0x70
|
|
|
|
#define LANG_INDONESIAN 0x21
|
|
|
|
#define LANG_INUKTITUT 0x5d
|
|
|
|
#define LANG_IRISH 0x3c
|
|
|
|
#define LANG_ITALIAN 0x10
|
|
|
|
#define LANG_JAPANESE 0x11
|
|
|
|
#define LANG_KANNADA 0x4b
|
|
|
|
#define LANG_KASHMIRI 0x60
|
|
|
|
#define LANG_KAZAK 0x3f
|
|
|
|
#define LANG_KHMER 0x53
|
|
|
|
#define LANG_KICHE 0x86
|
|
|
|
#define LANG_KINYARWANDA 0x87
|
|
|
|
#define LANG_KONKANI 0x57
|
|
|
|
#define LANG_KOREAN 0x12
|
|
|
|
#define LANG_KYRGYZ 0x40
|
|
|
|
#define LANG_LAO 0x54
|
|
|
|
#define LANG_LATVIAN 0x26
|
|
|
|
#define LANG_LITHUANIAN 0x27
|
|
|
|
#define LANG_LOWER_SORBIAN 0x2e
|
|
|
|
#define LANG_LUXEMBOURGISH 0x6e
|
|
|
|
#define LANG_MACEDONIAN 0x2f
|
|
|
|
#define LANG_MALAY 0x3e
|
|
|
|
#define LANG_MALAYALAM 0x4c
|
|
|
|
#define LANG_MALTESE 0x3a
|
|
|
|
#define LANG_MANIPURI 0x58
|
|
|
|
#define LANG_MAORI 0x81
|
|
|
|
#define LANG_MAPUDUNGUN 0x7a
|
|
|
|
#define LANG_MARATHI 0x4e
|
|
|
|
#define LANG_MOHAWK 0x7c
|
|
|
|
#define LANG_MONGOLIAN 0x50
|
|
|
|
#define LANG_NEPALI 0x61
|
|
|
|
#define LANG_NORWEGIAN 0x14
|
|
|
|
#define LANG_OCCITAN 0x82
|
|
|
|
#define LANG_ORIYA 0x48
|
|
|
|
#define LANG_PASHTO 0x63
|
|
|
|
#define LANG_PERSIAN 0x29
|
|
|
|
#define LANG_POLISH 0x15
|
|
|
|
#define LANG_PORTUGUESE 0x16
|
|
|
|
#define LANG_PUNJABI 0x46
|
|
|
|
#define LANG_QUECHUA 0x6b
|
|
|
|
#define LANG_ROMANIAN 0x18
|
|
|
|
#define LANG_ROMANSH 0x17
|
|
|
|
#define LANG_RUSSIAN 0x19
|
|
|
|
#define LANG_SAMI 0x3b
|
|
|
|
#define LANG_SANSKRIT 0x4f
|
|
|
|
#define LANG_SERBIAN 0x1a
|
|
|
|
#define LANG_SERBIAN_NEUTRAL 0x7c1a
|
|
|
|
#define LANG_SINDHI 0x59
|
|
|
|
#define LANG_SINHALESE 0x5b
|
|
|
|
#define LANG_SLOVAK 0x1b
|
|
|
|
#define LANG_SLOVENIAN 0x24
|
|
|
|
#define LANG_SOTHO 0x6c
|
|
|
|
#define LANG_SPANISH 0x0a
|
|
|
|
#define LANG_SWAHILI 0x41
|
|
|
|
#define LANG_SWEDISH 0x1d
|
|
|
|
#define LANG_SYRIAC 0x5a
|
|
|
|
#define LANG_TAJIK 0x28
|
|
|
|
#define LANG_TAMAZIGHT 0x5f
|
|
|
|
#define LANG_TAMIL 0x49
|
|
|
|
#define LANG_TATAR 0x44
|
|
|
|
#define LANG_TELUGU 0x4a
|
|
|
|
#define LANG_THAI 0x1e
|
|
|
|
#define LANG_TIBETAN 0x51
|
|
|
|
#define LANG_TIGRIGNA 0x73
|
|
|
|
#define LANG_TSWANA 0x32
|
|
|
|
#define LANG_TURKISH 0x1f
|
|
|
|
#define LANG_TURKMEN 0x42
|
|
|
|
#define LANG_UIGHUR 0x80
|
|
|
|
#define LANG_UKRAINIAN 0x22
|
|
|
|
#define LANG_UPPER_SORBIAN 0x2e
|
|
|
|
#define LANG_URDU 0x20
|
|
|
|
#define LANG_UZBEK 0x43
|
|
|
|
#define LANG_VIETNAMESE 0x2a
|
|
|
|
#define LANG_WELSH 0x52
|
|
|
|
#define LANG_WOLOF 0x88
|
|
|
|
#define LANG_XHOSA 0x34
|
|
|
|
#define LANG_YAKUT 0x85
|
|
|
|
#define LANG_YI 0x78
|
|
|
|
#define LANG_YORUBA 0x6a
|
|
|
|
#define LANG_ZULU 0x35
|
2010-06-24 22:23:02 +00:00
|
|
|
|
2010-03-29 05:28:59 +00:00
|
|
|
#endif /* _NTDEF_ */
|