ifndef _NTDEF_
define _NTDEF_

include ctype.inc
include winapifamily.inc

ifndef ANYSIZE_ARRAY
define ANYSIZE_ARRAY 1
endif

include specstrings.inc
include kernelspecs.inc

if defined(_WIN64) OR defined(_M_ALPHA)
define MAX_NATURAL_ALIGNMENT	   8
define MEMORY_ALLOCATION_ALIGNMENT 16
else
define MAX_NATURAL_ALIGNMENT	   4
define MEMORY_ALLOCATION_ALIGNMENT 8
endif

TYPE_ALIGNMENT macro t
  local S1
  S1 STRUC
  l1 db ?
  l2 t ?
  S1 ENDS
  exitm<S1.l2>
  endm

PROBE_ALIGNMENT32 macro	 _s
  exitm<TYPE_ALIGNMENT( ULONG )>
  endm

ifndef SORTPP_PASS
C_ASSERT macro e
if e
  exitm<>
else
  .err<e>
endif
  endm
else
C_ASSERT macro e
  exitm<>
  endm
endif

include basetsd.inc

ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
if defined(_AMD64_) OR defined(_X86_)
define SYSTEM_CACHE_ALIGNMENT_SIZE 64
else
define SYSTEM_CACHE_ALIGNMENT_SIZE 128
endif
endif

PVOID			typedef ptr
PVOID64			typedef ptr

CHAR			typedef sbyte
LONG			typedef sdword

PWCH			typedef ptr WCHAR
PCWCH			typedef ptr WCHAR

PWSTR			typedef ptr WCHAR
PZPWSTR			typedef ptr PWSTR
PCZPWSTR		typedef ptr PWSTR
PUWSTR			typedef ptr WCHAR
PCWSTR			typedef ptr WCHAR
PZPCWSTR		typedef ptr PCWSTR
PCZPCWSTR		typedef ptr PCWSTR
PCUWSTR			typedef ptr WCHAR

PZZWSTR			typedef ptr WCHAR
PCZZWSTR		typedef ptr WCHAR
PUZZWSTR		typedef ptr WCHAR
PCUZZWSTR		typedef ptr WCHAR

PNZWCH			typedef ptr WCHAR
PCNZWCH			typedef ptr WCHAR
PUNZWCH			typedef ptr WCHAR
PCUNZWCH		typedef ptr WCHAR

if _WIN32_WINNT GE 0x0600 OR (defined(__cplusplus) AND defined(WINDOWS_ENABLE_CPLUSPLUS))

PCWCHAR			typedef ptr WCHAR
PCUWCHAR		typedef ptr WCHAR
UCSCHAR			typedef DWORD

UCSCHAR_INVALID_CHARACTER equ (0xffffffff)

MIN_UCSCHAR		equ (0)
MAX_UCSCHAR		equ (0x0010FFFF)

PUCSCHAR		typedef ptr UCSCHAR
PCUCSCHAR		typedef ptr UCSCHAR
PUCSSTR			typedef ptr UCSCHAR
PUUCSSTR		typedef ptr UCSCHAR
PCUCSSTR		typedef ptr UCSCHAR
PCUUCSSTR		typedef ptr UCSCHAR
PUUCSCHAR		typedef ptr UCSCHAR
PCUUCSCHAR		typedef ptr UCSCHAR

endif

PCH			typedef ptr CHAR
PCCH			typedef ptr CHAR
PSTR			typedef ptr CHAR
PZPSTR			typedef ptr PSTR
PCZPSTR			typedef ptr PSTR
PCSTR			typedef ptr CHAR
PZPCSTR			typedef ptr PCSTR
PCZPCSTR		typedef ptr PCSTR
PZZSTR			typedef ptr CHAR
PCZZSTR			typedef ptr CHAR
PNZCH			typedef ptr CHAR
PCNZCH			typedef ptr CHAR

ifdef  _UNICODE

ifndef _TCHAR_DEFINED
define _TCHAR_DEFINED
TCHAR			typedef word
PTCHAR			typedef ptr word
PTBYTE			typedef ptr word
endif

PTCH			typedef LPWCH
LPTCH			typedef LPWCH
PCTCH			typedef LPCWCH
LPCTCH			typedef LPCWCH
PTSTR			typedef LPWSTR
LPTSTR			typedef LPWSTR
PCTSTR			typedef LPCWSTR
LPCTSTR			typedef LPCWSTR
LPUTSTR			typedef LPUWSTR
PUTSTR			typedef LPUWSTR
PCUTSTR			typedef LPCUWSTR
LPCUTSTR		typedef LPCUWSTR

PZZTSTR			typedef PZZWSTR
PCZZTSTR		typedef PCZZWSTR
PUZZTSTR		typedef PUZZWSTR
PCUZZTSTR		typedef PCUZZWSTR
PZPTSTR			typedef PZPWSTR
PNZTCH			typedef PNZWCH
PCNZTCH			typedef PCNZWCH
PUNZTCH			typedef PUNZWCH
PCUNZTCH		typedef PCUNZWCH
__TEXT macro quote
	exitm<L&quote&>
	endm

else

ifndef _TCHAR_DEFINED
define _TCHAR_DEFINED
TCHAR			typedef sbyte
PTCHAR			typedef ptr sbyte
PTBYTE			typedef ptr sbyte
endif

PTCH			typedef LPCH
LPTCH			typedef LPCH
PCTCH			typedef LPCCH
LPCTCH			typedef LPCCH
PTSTR			typedef LPSTR
LPTSTR			typedef LPSTR
PUTSTR			typedef LPSTR
LPUTSTR			typedef LPSTR
PCTSTR			typedef LPCSTR
LPCTSTR			typedef LPCSTR
PCUTSTR			typedef LPCSTR
LPCUTSTR		typedef LPCSTR
__TEXT macro quote
	exitm<quote>
	endm

endif
TEXT macro quote
	exitm<__TEXT(quote)>
	endm


DOUBLE typedef real8

QUAD STRUC
UNION
 UseThisFieldToCopy	sqword ?
 DoNotUseThisField	real8 ?
ENDS
QUAD ENDS
PQUAD typedef ptr QUAD

define BASETYPES

UCHAR			typedef BYTE
USHORT			typedef WORD
ULONG			typedef DWORD
UQUAD			typedef QWORD

PUCHAR			typedef ptr UCHAR
PUSHORT			typedef ptr USHORT
PULONG			typedef ptr ULONG
PUQUAD			typedef ptr UQUAD

if _WIN32_WINNT GE 0x0600 OR (defined(__cplusplus) AND defined(WINDOWS_ENABLE_CPLUSPLUS))
PCUCHAR			typedef ptr UCHAR
PCUSHORT		typedef ptr USHORT
PCULONG			typedef ptr ULONG
PCUQUAD			typedef ptr UQUAD
endif

SCHAR			typedef SBYTE
PSCHAR			typedef ptr SCHAR

if _WIN32_WINNT GE 0x0600 OR (defined(__cplusplus) AND defined(WINDOWS_ENABLE_CPLUSPLUS))
PCSCHAR			typedef ptr SCHAR
endif

ifndef NO_STRICT
ifndef STRICT
STRICT			equ 1
endif
endif

ALL_PROCESSOR_GROUPS	equ 0xffff

PROCESSOR_NUMBER	STRUC
_Group			USHORT ?
Number			UCHAR ?
Reserved		UCHAR ?
PROCESSOR_NUMBER	ENDS
PPROCESSOR_NUMBER	typedef ptr PROCESSOR_NUMBER

GROUP_AFFINITY		STRUC
Mask			KAFFINITY ?
_Group			USHORT ?
Reserved		USHORT 3 dup(?)
GROUP_AFFINITY		ENDS
PGROUP_AFFINITY		typedef ptr GROUP_AFFINITY

HANDLE	typedef ptr
PHANDLE typedef ptr HANDLE

ifdef STRICT
DECLARE_HANDLE macro h_name
&h_name&__ struc
unused	SINT ?
&h_name&__ ends
	exitm<h_name typedef ptr &h_name&__>
	endm
else
DECLARE_HANDLE macro name
	exitm<name typedef HANDLE>
	endm
endif

FCHAR	typedef UCHAR
FSHORT	typedef USHORT
FLONG	typedef ULONG

ifndef _HRESULT_DEFINED
define _HRESULT_DEFINED
HRESULT typedef LONG
endif

OBJ_HANDLE_TAGBITS	equ 0x00000003

CCHAR			typedef SBYTE
CSHORT			typedef SWORD
CLONG			typedef ULONG

PCCHAR			typedef ptr CCHAR
PCSHORT			typedef ptr CSHORT
PCLONG			typedef ptr CLONG

LCID			typedef ULONG
PLCID			typedef PULONG
LANGID			typedef USHORT

ifndef __COMPARTMENT_ID_DEFINED__
define __COMPARTMENT_ID_DEFINED__
.enum COMPARTMENT_ID {
    UNSPECIFIED_COMPARTMENT_ID = 0,
    DEFAULT_COMPARTMENT_ID
    }
endif

LOGICAL			typedef ULONG
PLOGICAL		typedef ptr ULONG

NTSTATUS		typedef LONG
PNTSTATUS		typedef ptr NTSTATUS

if _WIN32_WINNT GE 0x0600
PCNTSTATUS		typedef ptr NTSTATUS
endif

NT_SUCCESS macro Status
	exitm<((Status) !>= 0)>
	endm

ifndef NT_INFORMATION
NT_INFORMATION proto watcall Status:NTSTATUS {
    shr	    eax,30
    retm    <(eax == 1)>
    }
endif

ifndef NT_WARNING
NT_WARNING proto watcall Status:NTSTATUS {
    shr	    eax,30
    retm    <(eax == 2)>
    }
endif

ifndef NT_ERROR
NT_ERROR proto watcall Status:NTSTATUS {
    shr	    eax,30
    retm    <(eax == 3)>
    }
endif


APPLICATION_ERROR_MASK	equ 0x20000000
ERROR_SEVERITY_SUCCESS	equ 0x00000000
ERROR_SEVERITY_INFORMATIONAL equ 0x40000000
ERROR_SEVERITY_WARNING	equ 0x80000000
ERROR_SEVERITY_ERROR	equ 0xC0000000

ifndef __SECSTATUS_DEFINED__
define __SECSTATUS_DEFINED__
SECURITY_STATUS typedef LONG
endif

FLOAT128		STRUC
LowPart			int64_t ?
HighPart		int64_t ?
FLOAT128		ENDS

PFLOAT128		typedef ptr FLOAT128

define _ULONGLONG_
LONGLONG		typedef SQWORD
ULONGLONG		typedef QWORD
MAXLONGLONG		equ (0x7fffffffffffffff)

PLONGLONG		typedef ptr LONGLONG
PULONGLONG		typedef ptr ULONGLONG
USN			typedef LONGLONG

LARGE_INTEGER	UNION
    STRUC
      LowPart	dd ?
      HighPart	LONG ?
    ENDS
    STRUC u
      LowPart	dd ?
      HighPart	LONG ?
    ENDS
    QuadPart	LONGLONG ?
LARGE_INTEGER	ENDS
PLARGE_INTEGER	typedef PTR LARGE_INTEGER

ULARGE_INTEGER	UNION
    STRUC
      LowPart	dd ?
      HighPart	dd ?
    ENDS
    STRUC u
      LowPart	dd ?
      HighPart	dd ?
    ENDS
    QuadPart	ULONGLONG ?
ULARGE_INTEGER	ENDS
PULARGE_INTEGER typedef PTR ULARGE_INTEGER


RTL_REFERENCE_COUNT	typedef LONG_PTR
PRTL_REFERENCE_COUNT	typedef ptr LONG_PTR

LUID			STRUC
LowPart			ULONG ?
HighPart		LONG ?
LUID			ENDS
PLUID			typedef ptr LUID

_DWORDLONG_		equ 1
DWORDLONG		typedef ULONGLONG
PDWORDLONG		typedef ptr DWORDLONG

PHYSICAL_ADDRESS	typedef LARGE_INTEGER
PPHYSICAL_ADDRESS	typedef ptr LARGE_INTEGER

if defined(MIDL_PASS)	OR \
   defined(_M_CEE_PURE) OR \
   defined(_68K_)	OR \
   defined(_MPPC_)	OR \
   defined(_M_IA64)	OR \
   defined(_M_AMD64)	OR \
   defined(_M_ARM)

Int32x32To64 proto fastcall :int_t, :int_t {
	movsxd	rax, ecx
	movsxd	rdx, edx
	imul	rax, rdx
	}
UInt32x32To64 proto fastcall :ULONG, :ULONG {
	mov	eax, ecx
	imul	rax, rdx
	}
Int64ShllMod32 proto fastcall :ULONGLONG, :ULONG {
	mov	rax, rcx
	mov	ecx, edx
	shl	rax, cl
	}
Int64ShraMod32 proto fastcall :LONGLONG, :ULONG {
	mov	rax, rcx
	mov	ecx, edx
	sar	rax, cl
	}
Int64ShrlMod32 proto fastcall :ULONGLONG, :ULONG {
	mov	rax, rcx
	mov	ecx, edx
	shr	rax, cl
	}

elseifdef _M_IX86

Int32x32To64 proto watcall :LONG, :LONG {
	imul	edx
	}
UInt32x32To64 proto watcall :ULONG, :ULONG {
	mul	edx
	}
Int64ShllMod32 proto watcall :ULONGLONG, :ULONG {
	shld	edx, eax, cl
	shl	eax, cl
	}
Int64ShraMod32 proto watcall :LONGLONG, :ULONG {
	shrd	eax, edx, cl
	sar	edx, cl
	}
Int64ShrlMod32 proto watcall :ULONGLONG, :ULONG {
	shrd	eax, edx, cl
	shr	edx, cl
	}
else
.err <Must define a target architecture.>
endif

ifdef _M_AMD64
RotateLeft8		equ <_rotl8>
RotateLeft16		equ <_rotl16>
RotateRight8		equ <_rotr8>
RotateRight16		equ <_rotr16>
endif

if _MSC_VER GE 1300
RotateLeft32		equ <_rotl>
RotateLeft64		equ <_rotl64>
RotateRight32		equ <_rotr>
RotateRight64		equ <_rotr64>
endif

.enum EVENT_TYPE {
    NotificationEvent,
    SynchronizationEvent
    }

.enum TIMER_TYPE {
    NotificationTimer,
    SynchronizationTimer
    }

.enum WAIT_TYPE {
    WaitAll,
    WaitAny,
    WaitNotification
    }

PSZ			typedef ptr sbyte
PCSZ			typedef ptr sbyte

RTL_STRING_LENGTH_TYPE	typedef USHORT

STRING			STRUC
Length			USHORT ?
MaximumLength		USHORT ?
Buffer			PCHAR ?
STRING			ENDS
PSTRING			typedef ptr STRING
ANSI_STRING		typedef STRING
PANSI_STRING		typedef PSTRING

OEM_STRING		typedef STRING
POEM_STRING		typedef PSTRING
PCOEM_STRING		typedef ptr STRING

CSTRING			STRUC
Length			USHORT ?
MaximumLength		USHORT ?
Buffer			LPSTR ?
CSTRING			ENDS
PCSTRING		typedef ptr CSTRING
ANSI_NULL		equ (0)

CANSI_STRING		typedef STRING
PCANSI_STRING		typedef PSTRING

UNICODE_STRING		STRUC
Length			USHORT ?
MaximumLength		USHORT ?
Buffer			PWCH ?
UNICODE_STRING		ENDS
PUNICODE_STRING		typedef ptr UNICODE_STRING
PCUNICODE_STRING	typedef ptr UNICODE_STRING

UNICODE_NULL		equ (0)

if _WIN32_WINNT GE 0x0500

UNICODE_STRING_MAX_BYTES equ (65534)
UNICODE_STRING_MAX_CHARS equ (32767)

DECLARE_CONST_UNICODE_STRING macro _var, _string
	.const
	_var UNICODE_STRING { sizeof(_string) - sizeof(WCHAR), sizeof(_string), &_var&_buffer }
	&_var&_buffer WCHAR _string,0
	@CurSeg ends
	exitm<>
	endm

DECLARE_GLOBAL_CONST_UNICODE_STRING macro _var, _str
	public _var
	exitm<DECLARE_CONST_UNICODE_STRING(_var, _str)>
	endm

DECLARE_UNICODE_STRING_SIZE macro _var, _size
	.const
	_var UNICODE_STRING { 0, (_size) * sizeof(WCHAR), &_var&_buffer }
	&_var&_buffer WCHAR _size dup(0)
	@CurSeg ends
	exitm<>
	endm

endif

LIST_ENTRY		STRUC
Flink			ptr_t ?
Blink			ptr_t ?
LIST_ENTRY		ENDS
PLIST_ENTRY		typedef ptr LIST_ENTRY
PRLIST_ENTRY		typedef ptr LIST_ENTRY

SINGLE_LIST_ENTRY	STRUC
Next			ptr_t ?
SINGLE_LIST_ENTRY	ENDS
PSINGLE_LIST_ENTRY	typedef ptr SINGLE_LIST_ENTRY

RTL_BALANCED_NODE_RESERVED_PARENT_MASK equ 3

RTL_BALANCED_NODE	STRUC
UNION
 Children		ptr_t 2 dup(?)
 STRUC
  Left			ptr_t ?
  Right			ptr_t ?
 ENDS
ENDS
UNION
 RedBalance		UCHAR ?	 ; Red : 1, Balance : 2
 ParentValue		ULONG_PTR ?
ENDS
RTL_BALANCED_NODE	ENDS
PRTL_BALANCED_NODE	typedef ptr RTL_BALANCED_NODE

RTL_BALANCED_NODE_GET_PARENT_POINTER macro Node
	exitm<>
	endm


LIST_ENTRY32		STRUC
Flink			ULONG ?
Blink			ULONG ?
LIST_ENTRY32		ENDS
PLIST_ENTRY32		typedef ptr LIST_ENTRY32

LIST_ENTRY64		STRUC
Flink			ULONGLONG ?
Blink			ULONGLONG ?
LIST_ENTRY64		ENDS
PLIST_ENTRY64		typedef ptr LIST_ENTRY64

SINGLE_LIST_ENTRY32	STRUC
Next			ULONG ?
SINGLE_LIST_ENTRY32	ENDS
PSINGLE_LIST_ENTRY32	typedef ptr SINGLE_LIST_ENTRY32


ifndef MIDL_PASS
ListEntry32To64 proto fastcall :PLIST_ENTRY32, :PLIST_ENTRY64 {
	mov [_2].LIST_ENTRY64.Flink,[_1].LIST_ENTRY32.Flink
	mov [_2].LIST_ENTRY64.Blink,[_1].LIST_ENTRY32.Blink
	}
ListEntry64To32 proto fastcall :PLIST_ENTRY64, :PLIST_ENTRY32 {
	mov [_2].LIST_ENTRY32.Flink,[_1].LIST_ENTRY64.Flink
	mov [_2].LIST_ENTRY32.Blink,[_1].LIST_ENTRY64.Blink
	}
endif

STRING32		STRUC
Length			USHORT ?
MaximumLength		USHORT ?
Buffer			ULONG ?
STRING32		ENDS
PSTRING32		typedef ptr STRING32

UNICODE_STRING32	typedef STRING32
PUNICODE_STRING32	typedef ptr UNICODE_STRING32

ANSI_STRING32		typedef STRING32
PANSI_STRING32		typedef ptr ANSI_STRING32


STRING64		STRUC
Length			USHORT ?
MaximumLength		USHORT ?
Buffer			ULONGLONG ?
STRING64		ENDS
PSTRING64		typedef ptr STRING64

UNICODE_STRING64	typedef STRING64
PUNICODE_STRING64	typedef ptr UNICODE_STRING64

ANSI_STRING64		typedef STRING64
PANSI_STRING64		typedef ptr ANSI_STRING64

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_IGNORE_IMPERSONATED_DEVICEMAP   0x00000800
define OBJ_DONT_REPARSE			   0x00001000
define OBJ_VALID_ATTRIBUTES		   0x00001FF2

OBJECT_ATTRIBUTES64	STRUC
Length			ULONG ?
RootDirectory		ULONG64 ?
ObjectName		ULONG64 ?
Attributes		ULONG ?
SecurityDescriptor	ULONG64 ?
SecurityQualityOfService ULONG64 ?
OBJECT_ATTRIBUTES64	ENDS
POBJECT_ATTRIBUTES64	typedef ptr OBJECT_ATTRIBUTES64
PCOBJECT_ATTRIBUTES64	typedef ptr OBJECT_ATTRIBUTES64

OBJECT_ATTRIBUTES32	STRUC
Length			ULONG ?
RootDirectory		ULONG ?
ObjectName		ULONG ?
Attributes		ULONG ?
SecurityDescriptor	ULONG ?
SecurityQualityOfService ULONG ?
OBJECT_ATTRIBUTES32	ENDS
POBJECT_ATTRIBUTES32	typedef ptr OBJECT_ATTRIBUTES32
PCOBJECT_ATTRIBUTES32	typedef ptr OBJECT_ATTRIBUTES32


OBJECT_ATTRIBUTES	STRUC
Length			ULONG ?
RootDirectory		HANDLE ?
ObjectName		PUNICODE_STRING ?
Attributes		ULONG ?
SecurityDescriptor	PVOID ?
SecurityQualityOfService PVOID ?
OBJECT_ATTRIBUTES	ENDS
POBJECT_ATTRIBUTES	typedef ptr OBJECT_ATTRIBUTES
PCOBJECT_ATTRIBUTES	typedef ptr OBJECT_ATTRIBUTES

InitializeObjectAttributes proto fastcall :ptr, :abs, :abs, :abs, :abs {
    mov [_1].OBJECT_ATTRIBUTES.Length,sizeof( OBJECT_ATTRIBUTES )
    mov [_1].OBJECT_ATTRIBUTES.RootDirectory,_4
    mov [_1].OBJECT_ATTRIBUTES.Attributes,_3
    mov [_1].OBJECT_ATTRIBUTES.ObjectName,_2
    mov [_1].OBJECT_ATTRIBUTES.SecurityDescriptor,_5
    mov [_1].OBJECT_ATTRIBUTES.SecurityQualityOfService,NULL
    }

RTL_CONSTANT_OBJECT_ATTRIBUTES macro n, a
	exitm<{ sizeof(OBJECT_ATTRIBUTES), NULL, n, a, NULL, NULL }>
	endm

RTL_INIT_OBJECT_ATTRIBUTES macro n, a
	exitm<RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)>
	endm


FALSE			equ 0
TRUE			equ 1
ifndef NULL
NULL			equ 0
NULL64			equ 0
endif

include guiddef.inc

ifndef __OBJECTID_DEFINED
__OBJECTID_DEFINED equ <>
OBJECTID		STRUC
Lineage			GUID <>
Uniquifier		ULONG ?
OBJECTID		ENDS
endif

MINCHAR			equ 0x80
MAXCHAR			equ 0x7f
MINSHORT		equ 0x8000
MAXSHORT		equ 0x7fff
MINLONG			equ 0x80000000
MAXLONG			equ 0x7fffffff
MAXUCHAR		equ 0xff
MAXUSHORT		equ 0xffff
MAXULONG		equ 0xffffffff

ARGUMENT_PRESENT macro ArgumentPointer
	exitm<(ArgumentPointer) NE (NULL)>
	endm
FIELD_OFFSET macro x, field
	exitm<x.field>
	endm
RTL_FIELD_SIZE macro type, field
	exitm<sizeof(type.field)>
	endm
RTL_SIZEOF_THROUGH_FIELD macro type, field
	exitm<(FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))>
	endm
RTL_CONTAINS_FIELD macro x, z, Field
	exitm<(x.Field + sizeof(x.Field) LE x+z)>
	endm
RTL_NUMBER_OF_V1 macro A
	exitm<lengthof(A)>
	endm

if defined(__cplusplus) and \
    not defined(MIDL_PASS) and \
    not defined(RC_INVOKED) and \
    not defined(_PREFAST_) and \
    (_MSC_FULL_VER ge 13009466) and \
    not defined(SORTPP_PASS)

if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
endif

else
RTL_NUMBER_OF_V2 macro A
	exitm<RTL_NUMBER_OF_V1(A)>
	endm
endif

ifdef ENABLE_RTL_NUMBER_OF_V2
RTL_NUMBER_OF macro A
	exitm<RTL_NUMBER_OF_V2(A)>
	endm
else
RTL_NUMBER_OF macro A
	exitm<RTL_NUMBER_OF_V1(A)>
	endm
endif

ARRAYSIZE macro A
	exitm<RTL_NUMBER_OF_V2(A)>
	endm
_ARRAYSIZE macro A
	exitm<RTL_NUMBER_OF_V1(A)>
	endm

RTL_FIELD_TYPE macro type, field
	exitm<type.field>
	endm
RTL_NUMBER_OF_FIELD macro type, field
	exitm<(RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field)))>
	endm

RTL_PADDING_BETWEEN_FIELDS macro T, F1, F2
	if FIELD_OFFSET(T, F2) GT FIELD_OFFSET(T, F1)
	    exitm<(FIELD_OFFSET(T, F2) - FIELD_OFFSET(T, F1) - RTL_FIELD_SIZE(T, F1))>
	else
	    exitm<(FIELD_OFFSET(T, F1) - FIELD_OFFSET(T, F2) - RTL_FIELD_SIZE(T, F2))>
	endif
	endm

RTL_CONST_CAST macro type
	exitm<(type)>
	endm

ifdef __cplusplus
_RTL_CONSTANT_STRING_remove_const_macro macro s
	exitm<>
	endm
else
_RTL_CONSTANT_STRING_remove_const_macro macro s
	exitm<>
	endm
endif
RTL_CONSTANT_STRING macro s
	exitm<>
	endm

RTL_BITS_OF macro sizeOfArg
	exitm<(sizeof(sizeOfArg) * 8)>
	endm

RTL_BITS_OF_FIELD macro type, field
	exitm<(RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))>
	endm

.inline CONTAINING_RECORD fastcall address:ptr, type:abs, field:abs {
	lea rax,[rcx+type.field]
	}

include excpt.inc

CALLBACK(PEXCEPTION_ROUTINE, :PEXCEPTION_RECORD, :PVOID, :ptr CONTEXT, :PVOID)

KIRQL			typedef UCHAR
PKIRQL			typedef ptr KIRQL

.enum NT_PRODUCT_TYPE {
    NtProductWinNt = 1,
    NtProductLanManNt,
    NtProductServer
    }

.enum SUITE_TYPE {
    SmallBusiness,
    Enterprise,
    BackOffice,
    CommunicationServer,
    TerminalServer,
    SmallBusinessRestricted,
    EmbeddedNT,
    DataCenter,
    SingleUserTS,
    Personal,
    Blade,
    EmbeddedRestricted,
    SecurityAppliance,
    StorageServer,
    ComputeServer,
    WHServer,
    PhoneNT,
    MaxSuiteType
    }

VER_SERVER_NT		equ 0x80000000
VER_WORKSTATION_NT	equ 0x40000000
VER_SUITE_SMALLBUSINESS equ 0x00000001
VER_SUITE_ENTERPRISE	equ 0x00000002
VER_SUITE_BACKOFFICE	equ 0x00000004
VER_SUITE_COMMUNICATIONS equ 0x00000008
VER_SUITE_TERMINAL	equ 0x00000010
VER_SUITE_SMALLBUSINESS_RESTRICTED equ 0x00000020
VER_SUITE_EMBEDDEDNT	equ 0x00000040
VER_SUITE_DATACENTER	equ 0x00000080
VER_SUITE_SINGLEUSERTS	equ 0x00000100
VER_SUITE_PERSONAL	equ 0x00000200
VER_SUITE_BLADE		equ 0x00000400
VER_SUITE_EMBEDDED_RESTRICTED equ 0x00000800
VER_SUITE_SECURITY_APPLIANCE equ 0x00001000
VER_SUITE_STORAGE_SERVER equ 0x00002000
VER_SUITE_COMPUTE_SERVER equ 0x00004000
VER_SUITE_WH_SERVER	equ 0x00008000

PRODUCT_UNDEFINED	equ 0x00000000

PRODUCT_ULTIMATE	equ 0x00000001
PRODUCT_HOME_BASIC	equ 0x00000002
PRODUCT_HOME_PREMIUM	equ 0x00000003
PRODUCT_ENTERPRISE	equ 0x00000004
PRODUCT_HOME_BASIC_N	equ 0x00000005
PRODUCT_BUSINESS	equ 0x00000006
PRODUCT_STANDARD_SERVER equ 0x00000007
PRODUCT_DATACENTER_SERVER equ 0x00000008
PRODUCT_SMALLBUSINESS_SERVER equ 0x00000009
PRODUCT_ENTERPRISE_SERVER equ 0x0000000A
PRODUCT_STARTER		equ 0x0000000B
PRODUCT_DATACENTER_SERVER_CORE equ 0x0000000C
PRODUCT_STANDARD_SERVER_CORE equ 0x0000000D
PRODUCT_ENTERPRISE_SERVER_CORE equ 0x0000000E
PRODUCT_ENTERPRISE_SERVER_IA64 equ 0x0000000F
PRODUCT_BUSINESS_N	equ 0x00000010
PRODUCT_WEB_SERVER	equ 0x00000011
PRODUCT_CLUSTER_SERVER	equ 0x00000012
PRODUCT_HOME_SERVER	equ 0x00000013
PRODUCT_STORAGE_EXPRESS_SERVER equ 0x00000014
PRODUCT_STORAGE_STANDARD_SERVER equ 0x00000015
PRODUCT_STORAGE_WORKGROUP_SERVER equ 0x00000016
PRODUCT_STORAGE_ENTERPRISE_SERVER equ 0x00000017
PRODUCT_SERVER_FOR_SMALLBUSINESS equ 0x00000018
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM equ 0x00000019
PRODUCT_HOME_PREMIUM_N	equ 0x0000001A
PRODUCT_ENTERPRISE_N	equ 0x0000001B
PRODUCT_ULTIMATE_N	equ 0x0000001C
PRODUCT_WEB_SERVER_CORE equ 0x0000001D
PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT equ 0x0000001E
PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY equ 0x0000001F
PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING equ 0x00000020
PRODUCT_SERVER_FOUNDATION equ 0x00000021
PRODUCT_HOME_PREMIUM_SERVER equ 0x00000022
PRODUCT_SERVER_FOR_SMALLBUSINESS_V equ 0x00000023
PRODUCT_STANDARD_SERVER_V equ 0x00000024
PRODUCT_DATACENTER_SERVER_V equ 0x00000025
PRODUCT_ENTERPRISE_SERVER_V equ 0x00000026
PRODUCT_DATACENTER_SERVER_CORE_V equ 0x00000027
PRODUCT_STANDARD_SERVER_CORE_V equ 0x00000028
PRODUCT_ENTERPRISE_SERVER_CORE_V equ 0x00000029
PRODUCT_HYPERV		equ 0x0000002A
PRODUCT_STORAGE_EXPRESS_SERVER_CORE equ 0x0000002B
PRODUCT_STORAGE_STANDARD_SERVER_CORE equ 0x0000002C
PRODUCT_STORAGE_WORKGROUP_SERVER_CORE equ 0x0000002D
PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE equ 0x0000002E
PRODUCT_STARTER_N	equ 0x0000002F
PRODUCT_PROFESSIONAL	equ 0x00000030
PRODUCT_PROFESSIONAL_N	equ 0x00000031
PRODUCT_SB_SOLUTION_SERVER equ 0x00000032
PRODUCT_SERVER_FOR_SB_SOLUTIONS equ 0x00000033
PRODUCT_STANDARD_SERVER_SOLUTIONS equ 0x00000034
PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE equ 0x00000035
PRODUCT_SB_SOLUTION_SERVER_EM equ 0x00000036
PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM equ 0x00000037
PRODUCT_SOLUTION_EMBEDDEDSERVER equ 0x00000038
PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE equ 0x00000039
PRODUCT_PROFESSIONAL_EMBEDDED equ 0x0000003A
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT equ 0x0000003B
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL equ 0x0000003C
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC equ 0x0000003D
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC equ 0x0000003E
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE equ 0x0000003F
PRODUCT_CLUSTER_SERVER_V equ 0x00000040
PRODUCT_EMBEDDED	equ 0x00000041
PRODUCT_STARTER_E	equ 0x00000042
PRODUCT_HOME_BASIC_E	equ 0x00000043
PRODUCT_HOME_PREMIUM_E	equ 0x00000044
PRODUCT_PROFESSIONAL_E	equ 0x00000045
PRODUCT_ENTERPRISE_E	equ 0x00000046
PRODUCT_ULTIMATE_E	equ 0x00000047
PRODUCT_ENTERPRISE_EVALUATION equ 0x00000048
PRODUCT_MULTIPOINT_STANDARD_SERVER equ 0x0000004C
PRODUCT_MULTIPOINT_PREMIUM_SERVER equ 0x0000004D
PRODUCT_STANDARD_EVALUATION_SERVER equ 0x0000004F
PRODUCT_DATACENTER_EVALUATION_SERVER equ 0x00000050
PRODUCT_ENTERPRISE_N_EVALUATION equ 0x00000054
PRODUCT_EMBEDDED_AUTOMOTIVE equ 0x00000055
PRODUCT_EMBEDDED_INDUSTRY_A equ 0x00000056
PRODUCT_THINPC		equ 0x00000057
PRODUCT_EMBEDDED_A	equ 0x00000058
PRODUCT_EMBEDDED_INDUSTRY equ 0x00000059
PRODUCT_EMBEDDED_E	equ 0x0000005A
PRODUCT_EMBEDDED_INDUSTRY_E equ 0x0000005B
PRODUCT_EMBEDDED_INDUSTRY_A_E equ 0x0000005C
PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER equ 0x0000005F
PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER equ 0x00000060
PRODUCT_CORE_ARM	equ 0x00000061
PRODUCT_CORE_N		equ 0x00000062
PRODUCT_CORE_COUNTRYSPECIFIC equ 0x00000063
PRODUCT_CORE_SINGLELANGUAGE equ 0x00000064
PRODUCT_CORE		equ 0x00000065
PRODUCT_PROFESSIONAL_WMC equ 0x00000067
PRODUCT_MOBILE_CORE	equ 0x00000068
PRODUCT_EMBEDDED_INDUSTRY_EVAL equ 0x00000069
PRODUCT_EMBEDDED_INDUSTRY_E_EVAL equ 0x0000006A
PRODUCT_EMBEDDED_EVAL	equ 0x0000006B
PRODUCT_EMBEDDED_E_EVAL equ 0x0000006C
PRODUCT_CORE_SERVER	equ 0x0000006D
PRODUCT_CLOUD_STORAGE_SERVER equ 0x0000006E
PRODUCT_CORE_CONNECTED	equ 0x0000006F
PRODUCT_PROFESSIONAL_STUDENT equ 0x00000070
PRODUCT_CORE_CONNECTED_N equ 0x00000071
PRODUCT_PROFESSIONAL_STUDENT_N equ 0x00000072
PRODUCT_CORE_CONNECTED_SINGLELANGUAGE equ 0x00000073
PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC equ 0x00000074

PRODUCT_UNLICENSED	equ 0xABCDABCD

include sdkddkver.inc

LANG_NEUTRAL		equ 0x00
LANG_INVARIANT		equ 0x7f

LANG_AFRIKAANS		equ 0x36
LANG_ALBANIAN		equ 0x1c
LANG_ALSATIAN		equ 0x84
LANG_AMHARIC		equ 0x5e
LANG_ARABIC		equ 0x01
LANG_ARMENIAN		equ 0x2b
LANG_ASSAMESE		equ 0x4d
LANG_AZERI		equ 0x2c
LANG_AZERBAIJANI	equ 0x2c
LANG_BANGLA		equ 0x45
LANG_BASHKIR		equ 0x6d
LANG_BASQUE		equ 0x2d
LANG_BELARUSIAN		equ 0x23
LANG_BENGALI		equ 0x45
LANG_BRETON		equ 0x7e
LANG_BOSNIAN		equ 0x1a
LANG_BOSNIAN_NEUTRAL	equ 0x781a
LANG_BULGARIAN		equ 0x02
LANG_CATALAN		equ 0x03
LANG_CENTRAL_KURDISH	equ 0x92
LANG_CHEROKEE		equ 0x5c
LANG_CHINESE		equ 0x04
LANG_CHINESE_SIMPLIFIED equ 0x04
LANG_CHINESE_TRADITIONAL equ 0x7c04
LANG_CORSICAN		equ 0x83
LANG_CROATIAN		equ 0x1a
LANG_CZECH		equ 0x05
LANG_DANISH		equ 0x06
LANG_DARI		equ 0x8c
LANG_DIVEHI		equ 0x65
LANG_DUTCH		equ 0x13
LANG_ENGLISH		equ 0x09
LANG_ESTONIAN		equ 0x25
LANG_FAEROESE		equ 0x38
LANG_FARSI		equ 0x29
LANG_FILIPINO		equ 0x64
LANG_FINNISH		equ 0x0b
LANG_FRENCH		equ 0x0c
LANG_FRISIAN		equ 0x62
LANG_FULAH		equ 0x67
LANG_GALICIAN		equ 0x56
LANG_GEORGIAN		equ 0x37
LANG_GERMAN		equ 0x07
LANG_GREEK		equ 0x08
LANG_GREENLANDIC	equ 0x6f
LANG_GUJARATI		equ 0x47
LANG_HAUSA		equ 0x68
LANG_HAWAIIAN		equ 0x75
LANG_HEBREW		equ 0x0d
LANG_HINDI		equ 0x39
LANG_HUNGARIAN		equ 0x0e
LANG_ICELANDIC		equ 0x0f
LANG_IGBO		equ 0x70
LANG_INDONESIAN		equ 0x21
LANG_INUKTITUT		equ 0x5d
LANG_IRISH		equ 0x3c
LANG_ITALIAN		equ 0x10
LANG_JAPANESE		equ 0x11
LANG_KANNADA		equ 0x4b
LANG_KASHMIRI		equ 0x60
LANG_KAZAK		equ 0x3f
LANG_KHMER		equ 0x53
LANG_KICHE		equ 0x86
LANG_KINYARWANDA	equ 0x87
LANG_KONKANI		equ 0x57
LANG_KOREAN		equ 0x12
LANG_KYRGYZ		equ 0x40
LANG_LAO		equ 0x54
LANG_LATVIAN		equ 0x26
LANG_LITHUANIAN		equ 0x27
LANG_LOWER_SORBIAN	equ 0x2e
LANG_LUXEMBOURGISH	equ 0x6e
LANG_MACEDONIAN		equ 0x2f
LANG_MALAY		equ 0x3e
LANG_MALAYALAM		equ 0x4c
LANG_MALTESE		equ 0x3a
LANG_MANIPURI		equ 0x58
LANG_MAORI		equ 0x81
LANG_MAPUDUNGUN		equ 0x7a
LANG_MARATHI		equ 0x4e
LANG_MOHAWK		equ 0x7c
LANG_MONGOLIAN		equ 0x50
LANG_NEPALI		equ 0x61
LANG_NORWEGIAN		equ 0x14
LANG_OCCITAN		equ 0x82
LANG_ODIA		equ 0x48
LANG_ORIYA		equ 0x48
LANG_PASHTO		equ 0x63
LANG_PERSIAN		equ 0x29
LANG_POLISH		equ 0x15
LANG_PORTUGUESE		equ 0x16
LANG_PULAR		equ 0x67
LANG_PUNJABI		equ 0x46
LANG_QUECHUA		equ 0x6b
LANG_ROMANIAN		equ 0x18
LANG_ROMANSH		equ 0x17
LANG_RUSSIAN		equ 0x19
LANG_SAKHA		equ 0x85
LANG_SAMI		equ 0x3b
LANG_SANSKRIT		equ 0x4f
LANG_SCOTTISH_GAELIC	equ 0x91
LANG_SERBIAN		equ 0x1a
LANG_SERBIAN_NEUTRAL	equ 0x7c1a
LANG_SINDHI		equ 0x59
LANG_SINHALESE		equ 0x5b
LANG_SLOVAK		equ 0x1b
LANG_SLOVENIAN		equ 0x24
LANG_SOTHO		equ 0x6c
LANG_SPANISH		equ 0x0a
LANG_SWAHILI		equ 0x41
LANG_SWEDISH		equ 0x1d
LANG_SYRIAC		equ 0x5a
LANG_TAJIK		equ 0x28
LANG_TAMAZIGHT		equ 0x5f
LANG_TAMIL		equ 0x49
LANG_TATAR		equ 0x44
LANG_TELUGU		equ 0x4a
LANG_THAI		equ 0x1e
LANG_TIBETAN		equ 0x51
LANG_TIGRIGNA		equ 0x73
LANG_TIGRINYA		equ 0x73
LANG_TSWANA		equ 0x32
LANG_TURKISH		equ 0x1f
LANG_TURKMEN		equ 0x42
LANG_UIGHUR		equ 0x80
LANG_UKRAINIAN		equ 0x22
LANG_UPPER_SORBIAN	equ 0x2e
LANG_URDU		equ 0x20
LANG_UZBEK		equ 0x43
LANG_VALENCIAN		equ 0x03
LANG_VIETNAMESE		equ 0x2a
LANG_WELSH		equ 0x52
LANG_WOLOF		equ 0x88
LANG_XHOSA		equ 0x34
LANG_YAKUT		equ 0x85
LANG_YI			equ 0x78
LANG_YORUBA		equ 0x6a
LANG_ZULU		equ 0x35

SUBLANG_NEUTRAL		equ 0x00
SUBLANG_DEFAULT		equ 0x01
SUBLANG_SYS_DEFAULT	equ 0x02
SUBLANG_CUSTOM_DEFAULT	equ 0x03
SUBLANG_CUSTOM_UNSPECIFIED equ 0x04
SUBLANG_UI_CUSTOM_DEFAULT equ 0x05


SUBLANG_AFRIKAANS_SOUTH_AFRICA equ 0x01
SUBLANG_ALBANIAN_ALBANIA equ 0x01
SUBLANG_ALSATIAN_FRANCE equ 0x01
SUBLANG_AMHARIC_ETHIOPIA equ 0x01
SUBLANG_ARABIC_SAUDI_ARABIA equ 0x01
SUBLANG_ARABIC_IRAQ	equ 0x02
SUBLANG_ARABIC_EGYPT	equ 0x03
SUBLANG_ARABIC_LIBYA	equ 0x04
SUBLANG_ARABIC_ALGERIA	equ 0x05
SUBLANG_ARABIC_MOROCCO	equ 0x06
SUBLANG_ARABIC_TUNISIA	equ 0x07
SUBLANG_ARABIC_OMAN	equ 0x08
SUBLANG_ARABIC_YEMEN	equ 0x09
SUBLANG_ARABIC_SYRIA	equ 0x0a
SUBLANG_ARABIC_JORDAN	equ 0x0b
SUBLANG_ARABIC_LEBANON	equ 0x0c
SUBLANG_ARABIC_KUWAIT	equ 0x0d
SUBLANG_ARABIC_UAE	equ 0x0e
SUBLANG_ARABIC_BAHRAIN	equ 0x0f
SUBLANG_ARABIC_QATAR	equ 0x10
SUBLANG_ARMENIAN_ARMENIA equ 0x01
SUBLANG_ASSAMESE_INDIA	equ 0x01
SUBLANG_AZERI_LATIN	equ 0x01
SUBLANG_AZERI_CYRILLIC	equ 0x02
SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN equ 0x01
SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC equ 0x02
SUBLANG_BANGLA_INDIA	equ 0x01
SUBLANG_BANGLA_BANGLADESH equ 0x02
SUBLANG_BASHKIR_RUSSIA	equ 0x01
SUBLANG_BASQUE_BASQUE	equ 0x01
SUBLANG_BELARUSIAN_BELARUS equ 0x01
SUBLANG_BENGALI_INDIA	equ 0x01
SUBLANG_BENGALI_BANGLADESH equ 0x02
SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN equ 0x05
SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC equ 0x08
SUBLANG_BRETON_FRANCE	equ 0x01
SUBLANG_BULGARIAN_BULGARIA equ 0x01
SUBLANG_CATALAN_CATALAN equ 0x01
SUBLANG_CENTRAL_KURDISH_IRAQ equ 0x01
SUBLANG_CHEROKEE_CHEROKEE equ 0x01
SUBLANG_CHINESE_TRADITIONAL equ 0x01
SUBLANG_CHINESE_SIMPLIFIED equ 0x02
SUBLANG_CHINESE_HONGKONG equ 0x03
SUBLANG_CHINESE_SINGAPORE equ 0x04
SUBLANG_CHINESE_MACAU	equ 0x05
SUBLANG_CORSICAN_FRANCE equ 0x01
SUBLANG_CZECH_CZECH_REPUBLIC equ 0x01
SUBLANG_CROATIAN_CROATIA equ 0x01
SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN equ 0x04
SUBLANG_DANISH_DENMARK	equ 0x01
SUBLANG_DARI_AFGHANISTAN equ 0x01
SUBLANG_DIVEHI_MALDIVES equ 0x01
SUBLANG_DUTCH		equ 0x01
SUBLANG_DUTCH_BELGIAN	equ 0x02
SUBLANG_ENGLISH_US	equ 0x01
SUBLANG_ENGLISH_UK	equ 0x02
SUBLANG_ENGLISH_AUS	equ 0x03
SUBLANG_ENGLISH_CAN	equ 0x04
SUBLANG_ENGLISH_NZ	equ 0x05
SUBLANG_ENGLISH_EIRE	equ 0x06
SUBLANG_ENGLISH_SOUTH_AFRICA equ 0x07
SUBLANG_ENGLISH_JAMAICA equ 0x08
SUBLANG_ENGLISH_CARIBBEAN equ 0x09
SUBLANG_ENGLISH_BELIZE	equ 0x0a
SUBLANG_ENGLISH_TRINIDAD equ 0x0b
SUBLANG_ENGLISH_ZIMBABWE equ 0x0c
SUBLANG_ENGLISH_PHILIPPINES equ 0x0d
SUBLANG_ENGLISH_INDIA	equ 0x10
SUBLANG_ENGLISH_MALAYSIA equ 0x11
SUBLANG_ENGLISH_SINGAPORE equ 0x12
SUBLANG_ESTONIAN_ESTONIA equ 0x01
SUBLANG_FAEROESE_FAROE_ISLANDS equ 0x01
SUBLANG_FILIPINO_PHILIPPINES equ 0x01
SUBLANG_FINNISH_FINLAND equ 0x01
SUBLANG_FRENCH		equ 0x01
SUBLANG_FRENCH_BELGIAN	equ 0x02
SUBLANG_FRENCH_CANADIAN equ 0x03
SUBLANG_FRENCH_SWISS	equ 0x04
SUBLANG_FRENCH_LUXEMBOURG equ 0x05
SUBLANG_FRENCH_MONACO	equ 0x06
SUBLANG_FRISIAN_NETHERLANDS equ 0x01
SUBLANG_FULAH_SENEGAL	equ 0x02
SUBLANG_GALICIAN_GALICIAN equ 0x01
SUBLANG_GEORGIAN_GEORGIA equ 0x01
SUBLANG_GERMAN		equ 0x01
SUBLANG_GERMAN_SWISS	equ 0x02
SUBLANG_GERMAN_AUSTRIAN equ 0x03
SUBLANG_GERMAN_LUXEMBOURG equ 0x04
SUBLANG_GERMAN_LIECHTENSTEIN equ 0x05
SUBLANG_GREEK_GREECE	equ 0x01
SUBLANG_GREENLANDIC_GREENLAND equ 0x01
SUBLANG_GUJARATI_INDIA	equ 0x01
SUBLANG_HAUSA_NIGERIA_LATIN equ 0x01
SUBLANG_HAWAIIAN_US	equ 0x01
SUBLANG_HEBREW_ISRAEL	equ 0x01
SUBLANG_HINDI_INDIA	equ 0x01
SUBLANG_HUNGARIAN_HUNGARY equ 0x01
SUBLANG_ICELANDIC_ICELAND equ 0x01
SUBLANG_IGBO_NIGERIA	equ 0x01
SUBLANG_INDONESIAN_INDONESIA equ 0x01
SUBLANG_INUKTITUT_CANADA equ 0x01
SUBLANG_INUKTITUT_CANADA_LATIN equ 0x02
SUBLANG_IRISH_IRELAND	equ 0x02
SUBLANG_ITALIAN		equ 0x01
SUBLANG_ITALIAN_SWISS	equ 0x02
SUBLANG_JAPANESE_JAPAN	equ 0x01
SUBLANG_KANNADA_INDIA	equ 0x01
SUBLANG_KASHMIRI_SASIA	equ 0x02
SUBLANG_KASHMIRI_INDIA	equ 0x02
SUBLANG_KAZAK_KAZAKHSTAN equ 0x01
SUBLANG_KHMER_CAMBODIA	equ 0x01
SUBLANG_KICHE_GUATEMALA equ 0x01
SUBLANG_KINYARWANDA_RWANDA equ 0x01
SUBLANG_KONKANI_INDIA	equ 0x01
SUBLANG_KOREAN		equ 0x01
SUBLANG_KYRGYZ_KYRGYZSTAN equ 0x01
SUBLANG_LAO_LAO		equ 0x01
SUBLANG_LATVIAN_LATVIA	equ 0x01
SUBLANG_LITHUANIAN	equ 0x01
SUBLANG_LOWER_SORBIAN_GERMANY equ 0x02
SUBLANG_LUXEMBOURGISH_LUXEMBOURG equ 0x01
SUBLANG_MACEDONIAN_MACEDONIA equ 0x01
SUBLANG_MALAY_MALAYSIA	equ 0x01
SUBLANG_MALAY_BRUNEI_DARUSSALAM equ 0x02
SUBLANG_MALAYALAM_INDIA equ 0x01
SUBLANG_MALTESE_MALTA	equ 0x01
SUBLANG_MAORI_NEW_ZEALAND equ 0x01
SUBLANG_MAPUDUNGUN_CHILE equ 0x01
SUBLANG_MARATHI_INDIA	equ 0x01
SUBLANG_MOHAWK_MOHAWK	equ 0x01
SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA equ 0x01
SUBLANG_MONGOLIAN_PRC	equ 0x02
SUBLANG_NEPALI_INDIA	equ 0x02
SUBLANG_NEPALI_NEPAL	equ 0x01
SUBLANG_NORWEGIAN_BOKMAL equ 0x01
SUBLANG_NORWEGIAN_NYNORSK equ 0x02
SUBLANG_OCCITAN_FRANCE	equ 0x01
SUBLANG_ODIA_INDIA	equ 0x01
SUBLANG_ORIYA_INDIA	equ 0x01
SUBLANG_PASHTO_AFGHANISTAN equ 0x01
SUBLANG_PERSIAN_IRAN	equ 0x01
SUBLANG_POLISH_POLAND	equ 0x01
SUBLANG_PORTUGUESE	equ 0x02
SUBLANG_PORTUGUESE_BRAZILIAN equ 0x01
SUBLANG_PULAR_SENEGAL	equ 0x02
SUBLANG_PUNJABI_INDIA	equ 0x01
SUBLANG_PUNJABI_PAKISTAN equ 0x02
SUBLANG_QUECHUA_BOLIVIA equ 0x01
SUBLANG_QUECHUA_ECUADOR equ 0x02
SUBLANG_QUECHUA_PERU	equ 0x03
SUBLANG_ROMANIAN_ROMANIA equ 0x01
SUBLANG_ROMANSH_SWITZERLAND equ 0x01
SUBLANG_RUSSIAN_RUSSIA	equ 0x01
SUBLANG_SAKHA_RUSSIA	equ 0x01
SUBLANG_SAMI_NORTHERN_NORWAY equ 0x01
SUBLANG_SAMI_NORTHERN_SWEDEN equ 0x02
SUBLANG_SAMI_NORTHERN_FINLAND equ 0x03
SUBLANG_SAMI_LULE_NORWAY equ 0x04
SUBLANG_SAMI_LULE_SWEDEN equ 0x05
SUBLANG_SAMI_SOUTHERN_NORWAY equ 0x06
SUBLANG_SAMI_SOUTHERN_SWEDEN equ 0x07
SUBLANG_SAMI_SKOLT_FINLAND equ 0x08
SUBLANG_SAMI_INARI_FINLAND equ 0x09
SUBLANG_SANSKRIT_INDIA	equ 0x01
SUBLANG_SCOTTISH_GAELIC equ 0x01
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN equ 0x06
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC equ 0x07
SUBLANG_SERBIAN_MONTENEGRO_LATIN equ 0x0b
SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC equ 0x0c
SUBLANG_SERBIAN_SERBIA_LATIN equ 0x09
SUBLANG_SERBIAN_SERBIA_CYRILLIC equ 0x0a
SUBLANG_SERBIAN_CROATIA equ 0x01
SUBLANG_SERBIAN_LATIN	equ 0x02
SUBLANG_SERBIAN_CYRILLIC equ 0x03
SUBLANG_SINDHI_INDIA	equ 0x01
SUBLANG_SINDHI_PAKISTAN equ 0x02
SUBLANG_SINDHI_AFGHANISTAN equ 0x02
SUBLANG_SINHALESE_SRI_LANKA equ 0x01
SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA equ 0x01
SUBLANG_SLOVAK_SLOVAKIA equ 0x01
SUBLANG_SLOVENIAN_SLOVENIA equ 0x01
SUBLANG_SPANISH		equ 0x01
SUBLANG_SPANISH_MEXICAN equ 0x02
SUBLANG_SPANISH_MODERN	equ 0x03
SUBLANG_SPANISH_GUATEMALA equ 0x04
SUBLANG_SPANISH_COSTA_RICA equ 0x05
SUBLANG_SPANISH_PANAMA	equ 0x06
SUBLANG_SPANISH_DOMINICAN_REPUBLIC equ 0x07
SUBLANG_SPANISH_VENEZUELA equ 0x08
SUBLANG_SPANISH_COLOMBIA equ 0x09
SUBLANG_SPANISH_PERU	equ 0x0a
SUBLANG_SPANISH_ARGENTINA equ 0x0b
SUBLANG_SPANISH_ECUADOR equ 0x0c
SUBLANG_SPANISH_CHILE	equ 0x0d
SUBLANG_SPANISH_URUGUAY equ 0x0e
SUBLANG_SPANISH_PARAGUAY equ 0x0f
SUBLANG_SPANISH_BOLIVIA equ 0x10
SUBLANG_SPANISH_EL_SALVADOR equ 0x11
SUBLANG_SPANISH_HONDURAS equ 0x12
SUBLANG_SPANISH_NICARAGUA equ 0x13
SUBLANG_SPANISH_PUERTO_RICO equ 0x14
SUBLANG_SPANISH_US	equ 0x15
SUBLANG_SWAHILI_KENYA	equ 0x01
SUBLANG_SWEDISH		equ 0x01
SUBLANG_SWEDISH_FINLAND equ 0x02
SUBLANG_SYRIAC_SYRIA	equ 0x01
SUBLANG_TAJIK_TAJIKISTAN equ 0x01
SUBLANG_TAMAZIGHT_ALGERIA_LATIN equ 0x02
SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH equ 0x04
SUBLANG_TAMIL_INDIA	equ 0x01
SUBLANG_TAMIL_SRI_LANKA equ 0x02
SUBLANG_TATAR_RUSSIA	equ 0x01
SUBLANG_TELUGU_INDIA	equ 0x01
SUBLANG_THAI_THAILAND	equ 0x01
SUBLANG_TIBETAN_PRC	equ 0x01
SUBLANG_TIGRIGNA_ERITREA equ 0x02
SUBLANG_TIGRINYA_ERITREA equ 0x02
SUBLANG_TIGRINYA_ETHIOPIA equ 0x01
SUBLANG_TSWANA_BOTSWANA equ 0x02
SUBLANG_TSWANA_SOUTH_AFRICA equ 0x01
SUBLANG_TURKISH_TURKEY	equ 0x01
SUBLANG_TURKMEN_TURKMENISTAN equ 0x01
SUBLANG_UIGHUR_PRC	equ 0x01
SUBLANG_UKRAINIAN_UKRAINE equ 0x01
SUBLANG_UPPER_SORBIAN_GERMANY equ 0x01
SUBLANG_URDU_PAKISTAN	equ 0x01
SUBLANG_URDU_INDIA	equ 0x02
SUBLANG_UZBEK_LATIN	equ 0x01
SUBLANG_UZBEK_CYRILLIC	equ 0x02
SUBLANG_VALENCIAN_VALENCIA equ 0x02
SUBLANG_VIETNAMESE_VIETNAM equ 0x01
SUBLANG_WELSH_UNITED_KINGDOM equ 0x01
SUBLANG_WOLOF_SENEGAL	equ 0x01
SUBLANG_XHOSA_SOUTH_AFRICA equ 0x01
SUBLANG_YAKUT_RUSSIA	equ 0x01
SUBLANG_YI_PRC		equ 0x01
SUBLANG_YORUBA_NIGERIA	equ 0x01
SUBLANG_ZULU_SOUTH_AFRICA equ 0x01


SORT_DEFAULT		equ 0x0

SORT_INVARIANT_MATH	equ 0x1

SORT_JAPANESE_XJIS	equ 0x0
SORT_JAPANESE_UNICODE	equ 0x1
SORT_JAPANESE_RADICALSTROKE equ 0x4

SORT_CHINESE_BIG5	equ 0x0
SORT_CHINESE_PRCP	equ 0x0
SORT_CHINESE_UNICODE	equ 0x1
SORT_CHINESE_PRC	equ 0x2
SORT_CHINESE_BOPOMOFO	equ 0x3
SORT_CHINESE_RADICALSTROKE equ 0x4

SORT_KOREAN_KSC		equ 0x0
SORT_KOREAN_UNICODE	equ 0x1

SORT_GERMAN_PHONE_BOOK	equ 0x1

SORT_HUNGARIAN_DEFAULT	equ 0x0
SORT_HUNGARIAN_TECHNICAL equ 0x1

SORT_GEORGIAN_TRADITIONAL equ 0x0
SORT_GEORGIAN_MODERN	equ 0x1

MAKELANGID macro p, s
	exitm<((((s) SHL 10) OR (p)) and 0xffff)>
	endm
PRIMARYLANGID macro lgid
	exitm<((lgid) AND 0x3ff)>
	endm
SUBLANGID macro lgid
	exitm<((lgid) SHR 10)>
	endm

NLS_VALID_LOCALE_MASK equ 0x000fffff

MAKELCID MACRO wLanguageID, wSortID
	EXITM<((wSortID SHL 16) OR wLanguageID)>
	ENDM

MAKESORTLCID macro lgid, srtid, ver
	exitm<(MAKELCID(lgid, srtid) or (ver shl 20))>
	endm

LANGIDFROMLCID macro lcid
	exitm<((lcid) and 0xffff)>
	endm
SORTIDFROMLCID macro lcid
	exitm<(((((lcid)) SHR 16) AND 0xf) and 0xffff)>
	endm
SORTVERSIONFROMLCID macro lcid
	exitm<(((((lcid)) SHR 20) AND 0xf) and 0xffff)>
	endm

LOCALE_NAME_MAX_LENGTH	equ 85

LANG_SYSTEM_DEFAULT	equ MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT)
LANG_USER_DEFAULT	equ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)

LOCALE_SYSTEM_DEFAULT	equ MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT)
LOCALE_USER_DEFAULT	equ MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT)
LOCALE_CUSTOM_DEFAULT	equ MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT)
LOCALE_CUSTOM_UNSPECIFIED equ MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT)
LOCALE_CUSTOM_UI_DEFAULT equ MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT)
LOCALE_NEUTRAL		equ MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT)
LOCALE_INVARIANT	equ MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)

LOCALE_TRANSIENT_KEYBOARD1 equ 0x2000
LOCALE_TRANSIENT_KEYBOARD2 equ 0x2400
LOCALE_TRANSIENT_KEYBOARD3 equ 0x2800
LOCALE_TRANSIENT_KEYBOARD4 equ 0x2c00

LOCALE_UNASSIGNED_LCID	equ LOCALE_CUSTOM_UNSPECIFIED

ifndef UNREFERENCED_PARAMETER
ifdef __DEBUG__
UNREFERENCED_PARAMETER macro P
	exitm<lea rax,P>
	endm
DBG_UNREFERENCED_PARAMETER macro P
	exitm<lea rax,P>
	endm
DBG_UNREFERENCED_LOCAL_VARIABLE macro V
	exitm<lea rax,P>
	endm
else
UNREFERENCED_PARAMETER macro P
	exitm<>
	endm
DBG_UNREFERENCED_PARAMETER macro P
	exitm<>
	endm
DBG_UNREFERENCED_LOCAL_VARIABLE macro V
	exitm<>
	endm
endif
endif

if (_MSC_VER GT 1200)
DEFAULT_UNREACHABLE	equ <.default __assume(0)>
else
DEFAULT_UNREACHABLE equ 1
endif

COMPILETIME_OR_2FLAGS macro a,b
	exitm<((a) OR (b))>
	endm
COMPILETIME_OR_3FLAGS macro a,b,c
	exitm<((a) OR (b) OR (c))>
	endm
COMPILETIME_OR_4FLAGS macro a,b,c,d
	exitm<((a) OR (b) OR (c) OR (d))>
	endm
COMPILETIME_OR_5FLAGS macro a,b,c,d,e
	exitm<((a) OR (b) OR (c) OR (d) OR (e))>
	endm

endif ;; _NTDEF_
