/*++ BUILD Version: 0095 Increment this if a change has global effects
Copyright (c) 1990-1998 Microsoft Corporation
Module Name:
winnt.h
Abstract:
This module defines the 32-Bit Windows types and constants that are
defined by NT, but exposed through the Win32 API.
Revision History:
--*/
#ifndef _WINNT_
#define _WINNT_
#ifdef __cplusplus
extern "C" {
#endif
#include <ctype.h>
#define ANYSIZE_ARRAY 1
#if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED)
#define RESTRICTED_POINTER __restrict
#else
#define RESTRICTED_POINTER
#endif
#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || (defined(_M_IA64) && !defined(__ICL))
#define UNALIGNED __unaligned
#else
#define UNALIGNED
#endif
#if defined(_M_IA64) && defined(_GENIA64_)
#define __ptr64
#endif
#if defined(_WIN64) || defined(_M_ALPHA)
#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
#else
#define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
#endif
//
// TYPE_ALIGNMENT will return the alignment requirements of a given type for
// the current platform.
//
#ifndef __cplusplus
#pragma warning(disable:4116)
#define TYPE_ALIGNMENT( t ) \
FIELD_OFFSET( struct { char x; t test; }, test )
#endif
//
// C_ASSERT() can be used to perform many compile-time assertions:
// type sizes, field offsets, etc.
//
// An assertion failure results in error C2118: negative subscript.
//
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
#if !defined(_MAC) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_IA64)) && (_MSC_VER >= 1100) && !(defined(MIDL_PASS) || defined(RC_INVOKED))
#define POINTER_64 __ptr64
typedef unsigned __int64 POINTER_64_INT;
#if defined(_AXP64_)
#define POINTER_32 __ptr32
#else
#define POINTER_32
#endif
#else
#if defined(_MAC) && defined(_MAC_INT_64)
#define POINTER_64 __ptr64
typedef unsigned __int64 POINTER_64_INT;
#else
#define POINTER_64
typedef unsigned long POINTER_64_INT;
#endif
#define POINTER_32
#endif
#include <basetsd.h>
#if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64)) && !defined(MIDL_PASS)
#define DECLSPEC_IMPORT __declspec(dllimport)
#else
#define DECLSPEC_IMPORT
#endif
#if (_MSC_VER >= 1200)
#define DECLSPEC_NORETURN __declspec(noreturn)
#else
#define DECLSPEC_NORETURN
#endif
typedef void *PVOID;
typedef void * POINTER_64 PVOID64;
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#define NTAPI __stdcall
#else
#define _cdecl
#define NTAPI
#endif
//
// Define API decoration for direct importing system DLL references.
//
#if !defined(_NTSYSTEM_)
#define NTSYSAPI DECLSPEC_IMPORT
#else
#define NTSYSAPI
#endif
//
// Basics
//
#ifndef VOID
#define VOID void
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
#endif
//
// UNICODE (Wide Character) types
//
#ifndef _MAC
typedef wchar_t WCHAR; // wc, 16-bit UNICODE character
#else
// some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char
typedef unsigned short WCHAR; // wc, 16-bit UNICODE character
#endif
typedef WCHAR *PWCHAR;
typedef WCHAR *LPWCH, *PWCH;
typedef CONST WCHAR *LPCWCH, *PCWCH;
typedef WCHAR *NWPSTR;
typedef WCHAR *LPWSTR, *PWSTR;
typedef CONST WCHAR *LPCWSTR, *PCWSTR;
//
// ANSI (Multi-byte Character) types
//
typedef CHAR *PCHAR;
typedef CHAR *LPCH, *PCH;
typedef CONST CHAR *LPCCH, *PCCH;
typedef CHAR *NPSTR;
typedef CHAR *LPSTR, *PSTR;
typedef CONST CHAR *LPCSTR, *PCSTR;
//
// Neutral ANSI/UNICODE types and macros
//
#ifdef UNICODE // r_winnt
#ifndef _TCHAR_DEFINED
typedef WCHAR TCHAR, *PTCHAR;
typedef WCHAR TBYTE , *PTBYTE ;
#define _TCHAR_DEFINED
#endif /* !_TCHAR_DEFINED */
typedef LPWSTR LPTCH, PTCH;
typedef LPWSTR PTSTR, LPTSTR;
typedef LPCWSTR LPCTSTR;
typedef LPWSTR LP;
#define __TEXT(quote) L##quote // r_winnt
#else /* UNICODE */ // r_winnt
#ifndef _TCHAR_DEFINED
typedef char TCHAR, *PTCHAR;
typedef unsigned char TBYTE , *PTBYTE ;
#define _TCHAR_DEFINED
#endif /* !_TCHAR_DEFINED */
typedef LPSTR LPTCH, PTCH;
typedef LPSTR PTSTR, LPTSTR;
typedef LPCSTR LPCTSTR;
#define __TEXT(quote) quote // r_winnt
#endif /* UNICODE */ // r_winnt
#define TEXT(quote) __TEXT(quote) // r_winnt
typedef SHORT *PSHORT;
typedef LONG *PLONG;
#ifdef STRICT
typedef void *HANDLE;
#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
#else
typedef PVOID HANDLE;
#define DECLARE_HANDLE(name) typedef HANDLE name
#endif
typedef HANDLE *PHANDLE;
//
// Flag (bit) fields
//
typedef BYTE FCHAR;
typedef WORD FSHORT;
typedef DWORD FLONG;
// Component Object Model defines, and macros
#ifndef _HRESULT_DEFINED
#define _HRESULT_DEFINED
typedef LONG HRESULT;
#endif // !_HRESULT_DEFINED
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif
#if defined(_WIN32) || defined(_MPPC_)
// Win32 doesn't support __export
#ifdef _68K_
#define STDMETHODCALLTYPE __cdecl
#else
#define STDMETHODCALLTYPE __stdcall
#endif
#define STDMETHODVCALLTYPE __cdecl
#define STDAPICALLTYPE __stdcall
#define STDAPIVCALLTYPE __cdecl
#else
#define STDMETHODCALLTYPE __export __stdcall
#define STDMETHODVCALLTYPE __export __cdecl
#define STDAPICALLTYPE __export __stdcall
#define STDAPIVCALLTYPE __export __cdecl
#endif
#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
#define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
#define STDMETHODIMP_(type) type STDMETHODCALLTYPE
// The 'V' versions allow Variable Argument lists.
#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
typedef char CCHAR;
typedef DWORD LCID;
typedef PDWORD PLCID;
typedef WORD LANGID;
/*lint -e624 */
/*lint +e624 */
#define APPLICATION_ERROR_MASK 0x20000000
#define ERROR_SEVERITY_SUCCESS 0x00000000
#define ERROR_SEVERITY_INFORMATIONAL 0x40000000
#define ERROR_SEVERITY_WARNING 0x80000000
#define ERROR_SEVERITY_ERROR 0xC0000000
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
typedef struct _FLOAT128 {
__int64 LowPart;
__int64 HighPart;
} FLOAT128;
typedef FLOAT128 *PFLOAT128;
#if defined(_M_IA64)
#pragma force_align _FLOAT128 16
#endif // _M_IA64
//
// __int64 is only supported by 2.0 and later midl.
// __midl is set by the 2.0 midl and not by 1.0 midl.
//
#define _ULONGLONG_
#if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)))
typedef __int64 LONGLONG;
typedef unsigned __int64 ULONGLONG;
#define MAXLONGLONG (0x7fffffffffffffff)
#else
#if defined(_MAC) && defined(_MAC_INT_64)
typedef __int64 LONGLONG;
typedef unsigned __int64 ULONGLONG;
#define MAXLONGLONG (0x7fffffffffffffff)
#else
typedef double LONGLONG;
typedef double ULONGLONG;
#endif //_MAC and int64
#endif
typedef LONGLONG *PLONGLONG;
typedef ULONGLONG *PULONGLONG;
// Update Sequence Number
typedef LONGLONG USN;
#if defined(MIDL_PASS)
typedef struct _LARGE_INTEGER {
#else // MIDL_PASS
typedef union _LARGE_INTEGER {
struct {
DWORD LowPart;
LONG HighPart;
};
struct {
DWORD LowPart;
LONG HighPart;
} u;
#endif //MIDL_PASS
LONGLONG QuadPart;
} LARGE_INTEGER;
typedef LARGE_INTEGER *PLARGE_INTEGER;
#if defined(MIDL_PASS)
typedef struct _ULARGE_INTEGER {
#else // MIDL_PASS
typedef union _ULARGE_INTEGER {
struct {
DWORD LowPart;
DWORD HighPart;
};
struct {
DWORD LowPart;
DWORD HighPart;
} u;
#endif //MIDL_PASS
ULONGLONG QuadPart;
} ULARGE_INTEGER;
typedef ULARGE_INTEGER *PULARGE_INTEGER;
// end_ntminiport end_ntndis end_ntminitape
//
// Locally Unique Identifier
//
typedef struct _LUID {
DWORD LowPart;
LONG HighPart;
} LUID, *PLUID;
#define _DWORDLONG_
typedef ULONGLONG DWORDLONG;
typedef DWORDLONG *PDWORDLONG;
//
// Define operations to logically shift an int64 by 0..31 bits and to multiply
// 32-bits by 32-bits to form a 64-bit product.
//
#if defined(MIDL_PASS) || defined(RC_INVOKED)
//
// Midl does not understand inline assembler. Therefore, the Rtl functions
// are used for shifts by 0.31 and multiplies of 32-bits times 32-bits to
// form a 64-bit product.
//
#define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
#define UInt32x32To64(a, b) ((ULONGLONG)((DWORD)(a)) * (ULONGLONG)((DWORD)(b)))
#define Int64ShllMod32(a, b) ((ULONGLONG)(a) << (b))
#define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
#define Int64ShrlMod32(a, b) ((ULONGLONG)(a) >> (b))
#elif defined(_M_MRX000)
//
// MIPS uses intrinsic functions to perform shifts by 0..31 and multiplies of
// 32-bits times 32-bits to 64-bits.
//
#define Int32x32To64 __emul
#define UInt32x32To64 __emulu
#define Int64ShllMod32 __ll_lshift
#define Int64ShraMod32 __ll_rshift
#define Int64ShrlMod32 __ull_rshift
#if defined (__cplusplus)
extern "C" {
#endif
LONGLONG
NTAPI
Int32x32To64 (
LONG Multiplier,
LONG Multiplicand
);
ULONGLONG
NTAPI
UInt32x32To64 (
DWORD Multiplier,
DWORD Multiplicand
);
ULONGLONG
NTAPI
Int64ShllMod32 (
ULONGLONG Value,
DWORD ShiftCount
);
LONGLONG
NTAPI
Int64ShraMod32 (
LONGLONG Value,
DWORD ShiftCount
);
ULONGLONG
NTAPI
Int64ShrlMod32 (
ULONGLONG Value,
DWORD ShiftCount
);
#if defined (__cplusplus)
};
#endif
#pragma intrinsic(__emul)
#pragma intrinsic(__emulu)
#pragma intrinsic(__ll_lshift)
#pragma intrinsic(__ll_rshift)
#pragma intrinsic(__ull_rshift)
#elif defined(_M_IX86)
//
// The x86 C compiler understands inline assembler. Therefore, inline functions
// that employ inline assembler are used for shifts of 0..31. The multiplies
// rely on the compiler recognizing the cast of the multiplicand to int64 to
// generate the optimal code inline.
//
#define Int32x32To64( a, b ) (LONGLONG)((LONGLONG)(LONG)(a) * (LONG)(b))
#define UInt32x32To64( a, b ) (ULONGLONG)((ULONGLONG)(DWORD)(a) * (DWORD)(b))
ULONGLONG
NTAPI
Int64ShllMod32 (
ULONGLONG Value,
DWORD ShiftCount
);
LONGLONG
NTAPI
Int64ShraMod32 (
LONGLONG Value,
DWORD ShiftCount
);
ULONGLONG
NTAPI
Int64ShrlMod32 (
ULONGLONG Value,
DWORD ShiftCount
);
#pragma warning(disable:4035) // re-enable below
__inline ULONGLONG
NTAPI
Int64ShllMod32 (
ULONGLONG Value,
DWORD ShiftCount
)
{
__asm {
mov ecx, ShiftCount
mov eax, dword ptr [Value]
mov edx, dword ptr [Value+4]
shld edx, eax, cl
shl eax, cl
}
}
__inline LONGLONG
NTAPI
Int64ShraMod32 (
LONGLONG Value,
DWORD ShiftCount
)
{
__asm {
mov ecx, ShiftCount
mov eax, dword ptr [Value]
mov edx, dword ptr [Value+4]
shrd eax, edx, cl
sar edx, cl
}
}
__inline ULONGLONG
NTAPI
Int64ShrlMod32 (
ULONGLONG Value,
DWORD ShiftCount
)
{
__asm {
mov ecx, ShiftCount
mov eax, dword ptr [Value]
mov edx, dword ptr [Value+4]
shrd eax, edx, cl
shr edx, cl
}
}
#pragma warning(default:4035)
#elif defined(_M_ALPHA)
//
// Alpha has native 64-bit operations that are just as fast as their 32-bit
// counter parts. Therefore, the int64 data type is used directly to form
// shifts of 0..31 and multiplies of 32-bits times 32-bits to form a 64-bit
// product.
//
#define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
#define UInt32x32To64(a, b) ((ULONGLONG)((DWORD)(a)) * (ULONGLONG)((DWORD)(b)))
#define Int64ShllMod32(a, b) ((ULONGLONG)(a) << (b))
#define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
#define Int64ShrlMod32(a, b) ((ULONGLONG)(a) >> (b))
#elif defined(_M_PPC)
#define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
#define UInt32x32To64(a, b) ((ULONGLONG)((DWORD)(a)) * (ULONGLONG)((DWORD)(b)))
#define Int64ShllMod32(a, b) ((ULONGLONG)(a) << (b))
#define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
#define Int64ShrlMod32(a, b) ((ULONGLONG)(a) >> (b))
#elif defined(_68K_) || defined(_MPPC_)
//
// The Macintosh 68K and PowerPC compilers do not currently support int64.
//
#define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
#define UInt32x32To64(a, b) ((DWORDLONG)((DWORD)(a)) * (DWORDLONG)((DWORD)(b)))
#define Int64ShllMod32(a, b) ((DWORDLONG)(a) << (b))
#define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
#define Int64ShrlMod32(a, b) ((DWORDLONG)(a) >> (b))
#elif defined(_M_IA64)
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
#define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
#define UInt32x32To64(a, b) ((ULONGLONG)((DWORD)(a)) * (ULONGLONG)((DWORD)(b)))
#define Int64ShllMod32(a, b) ((ULONGLONG)(a) << (b))
#define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
#define Int64ShrlMod32(a, b) ((ULONGLONG)(a) >> (b))
#else
#error Must define a target architecture.
#endif
#define ANSI_NULL ((CHAR)0)
#define UNICODE_NULL ((WCHAR)0)
typedef BYTE BOOLEAN;
typedef BOOLEAN *PBOOLEAN;
//
// Doubly linked list structure. Can be used as either a list head, or
// as link words.
//
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *Flink;
struct _LIST_ENTRY *Blink;
} LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY;
//
// Singly linked list structure. Can be used as either a list head, or
// as link words.
//
typedef struct _SINGLE_LIST_ENTRY {
struct _SINGLE_LIST_ENTRY *Next;
} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
//
// Base data structures for OLE support
//
#ifndef GUID_DEFINED
#define GUID_DEFINED
typedef struct _GUID { // size is 16
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[8];
} GUID;
#endif // !GUID_DEFINED
#ifndef __OBJECTID_DEFINED
#define __OBJECTID_DEFINED
typedef struct _OBJECTID { // size is 20
GUID Lineage;
DWORD Uniquifier;
} OBJECTID;
#endif // !_OBJECTID_DEFINED
#define MINCHAR 0x80
#define MAXCHAR 0x7f
#define MINSHORT 0x8000
#define MAXSHORT 0x7fff
#define MINLONG 0x80000000
#define MAXLONG 0x7fffffff
#define MAXBYTE 0xff
#define MAXWORD 0xffff
#define MAXDWORD 0xffffffff
//
// Calculate the byte offset of a field in a structure of type type.
//
#define FIELD_OFFSET(type, field) ((LONG)(INT_PTR)&(((type *)0)->field))
//
// Calculate the address of the base of the structure given its type, and an
// address of a field within the structure.
//
#define CONTAINING_RECORD(address, type, field) ((type *)( \
(PCHAR)(address) - \
(UINT_PTR)(&((type *)0)->field)))
//
// Language IDs.
//
// The following two combinations of primary language ID and
// sublanguage ID have special semantics:
//
// Primary Language ID Sublanguage ID Result
// ------------------- --------------- ------------------------
// LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral
// LANG_NEUTRAL SUBLANG_DEFAULT User default language
// LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language
//
//
// Primary language IDs.
//
#define LANG_NEUTRAL 0x00
#define LANG_AFRIKAANS 0x36
#define LANG_ALBANIAN 0x1c
#define LANG_ARABIC 0x01
#define LANG_ARMENIAN 0x2b
#define LANG_ASSAMESE 0x4d
#define LANG_AZERI 0x2c
#define LANG_BASQUE 0x2d
#define LANG_BELARUSIAN 0x23
#define LANG_BENGALI 0x45
#define LANG_BULGARIAN 0x02
#define LANG_CATALAN 0x03
#define LANG_CHINESE 0x04
#define LANG_CROATIAN 0x1a
#define LANG_CZECH 0x05
#define LANG_DANISH 0x06
#define LANG_DUTCH 0x13
#define LANG_ENGLISH 0x09
#define LANG_ESTONIAN 0x25
#define LANG_FAEROESE 0x38
#define LANG_FARSI 0x29
#define LANG_FINNISH 0x0b
#define LANG_FRENCH 0x0c
#define LANG_GEORGIAN 0x37
#define LANG_GERMAN 0x07
#define LANG_GREEK 0x08
#define LANG_GUJARATI 0x47
#define LANG_HEBREW 0x0d
#define LANG_HINDI 0x39
#define LANG_HUNGARIAN 0x0e
#define LANG_ICELANDIC 0x0f
#define LANG_INDONESIAN 0x21
#define LANG_ITALIAN 0x10
#define LANG_JAPANESE 0x11
#define LANG_KANNADA 0x4b
#define LANG_KASHMIRI 0x60
#define LANG_KAZAK 0x3f
#define LANG_KONKANI 0x57
#define LANG_KOREAN 0x12
#define LANG_LATVIAN 0x26
#define LANG_LITHUANIAN 0x27
#define LANG_MACEDONIAN 0x2f
#define LANG_MALAY 0x3e
#define LANG_MALAYALAM 0x4c
#define LANG_MANIPURI 0x58
#define LANG_MARATHI 0x4e
#define LANG_NEPALI 0x61
#define LANG_NORWEGIAN 0x14
#define LANG_ORIYA 0x48
#define LANG_POLISH 0x15
#define LANG_PORTUGUESE 0x16
#define LANG_PUNJABI 0x46
#define LANG_ROMANIAN 0x18
#define LANG_RUSSIAN 0x19
#define LANG_SANSKRIT 0x4f
#define LANG_SERBIAN 0x1a
#define LANG_SINDHI 0x59
#define LANG_SLOVAK 0x1b
#define LANG_SLOVENIAN 0x24
#define LANG_SPANISH 0x0a
#define LANG_SWAHILI 0x41
#define LANG_SWEDISH 0x1d
#define LANG_TAMIL 0x49
#define LANG_TATAR 0x44
#define LANG_TELUGU 0x4a
#define LANG_THAI 0x1e
#define LANG_TURKISH 0x1f
#define LANG_UKRAINIAN 0x22
#define LANG_URDU 0x20
#define LANG_UZBEK 0x43
#define LANG_VIETNAMESE 0x2a
//
// Sublanguage IDs.
//
// The name immediately following SUBLANG_ dictates which primary
// language ID that sublanguage ID can be combined with to form a
// valid language ID.
//
#define SUBLANG_NEUTRAL 0x00 // language neutral
#define SUBLANG_DEFAULT 0x01 // user default
#define SUBLANG_SYS_DEFAULT 0x02 // system default
#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 // Arabic (Saudi Arabia)
#define SUBLANG_ARABIC_IRAQ 0x02 // Arabic (Iraq)
#define SUBLANG_ARABIC_EGYPT 0x03 // Arabic (Egypt)
#define SUBLANG_ARABIC_LIBYA 0x04 // Arabic (Libya)
#define SUBLANG_ARABIC_ALGERIA 0x05 // Arabic (Algeria)
#define SUBLANG_ARABIC_MOROCCO 0x06 // Arabic (Morocco)
#define SUBLANG_ARABIC_TUNISIA 0x07 // Arabic (Tunisia)
#define SUBLANG_ARABIC_OMAN 0x08 // Arabic (Oman)
#define SUBLANG_ARABIC_YEMEN 0x09 // Arabic (Yemen)
#define SUBLANG_ARABIC_SYRIA 0x0a // Arabic (Syria)
#define SUBLANG_ARABIC_JORDAN 0x0b // Arabic (Jordan)
#define SUBLANG_ARABIC_LEBANON 0x0c // Arabic (Lebanon)
#define SUBLANG_ARABIC_KUWAIT 0x0d // Arabic (Kuwait)
#define SUBLANG_ARABIC_UAE 0x0e // Arabic (U.A.E)
#define SUBLANG_ARABIC_BAHRAIN 0x0f // Arabic (Bahrain)
#define SUBLANG_ARABIC_QATAR 0x10 // Arabic (Qatar)
#define SUBLANG_AZERI_LATIN 0x01 // Azeri (Latin)
#define SUBLANG_AZERI_CYRILLIC 0x02 // Azeri (Cyrillic)
#define SUBLANG_CHINESE_TRADITIONAL 0x01 // Chinese (Taiwan Region)
#define SUBLANG_CHINESE_SIMPLIFIED 0x02 // Chinese (PR China)
#define SUBLANG_CHINESE_HONGKONG 0x03 // Chinese (Hong Kong)
#define SUBLANG_CHINESE_SINGAPORE 0x04 // Chinese (Singapore)
#define SUBLANG_CHINESE_MACAU 0x05 // Chinese (Macau)
#define SUBLANG_DUTCH 0x01 // Dutch
#define SUBLANG_DUTCH_BELGIAN 0x02 // Dutch (Belgian)
#define SUBLANG_ENGLISH_US 0x01 // English (USA)
#define SUBLANG_ENGLISH_UK 0x02 // English (UK)
#define SUBLANG_ENGLISH_AUS 0x03 // English (Australian)
#define SUBLANG_ENGLISH_CAN 0x04 // English (Canadian)
#define SUBLANG_ENGLISH_NZ 0x05 // English (New Zealand)
#define SUBLANG_ENGLISH_EIRE 0x06 // English (Irish)
#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 // English (South Africa)
#define SUBLANG_ENGLISH_JAMAICA 0x08 // English (Jamaica)
#define SUBLANG_ENGLISH_CARIBBEAN 0x09 // English (Caribbean)
#define SUBLANG_ENGLISH_BELIZE 0x0a // English (Belize)
#define SUBLANG_ENGLISH_TRINIDAD 0x0b // English (Trinidad)
#define SUBLANG_ENGLISH_ZIMBABWE 0x0c // English (Zimbabwe)
#define SUBLANG_ENGLISH_PHILIPPINES 0x0d // English (Philippines)
#define SUBLANG_FRENCH 0x01 // French
#define SUBLANG_FRENCH_BELGIAN 0x02 // French (Belgian)
#define SUBLANG_FRENCH_CANADIAN 0x03 // French (Canadian)
#define SUBLANG_FRENCH_SWISS 0x04 // French (Swiss)
#define SUBLANG_FRENCH_LUXEMBOURG 0x05 // French (Luxembourg)
#define SUBLANG_FRENCH_MONACO 0x06 // French (Monaco)
#define SUBLANG_GERMAN 0x01 // German
#define SUBLANG_GERMAN_SWISS 0x02 // German (Swiss)
#define SUBLANG_GERMAN_AUSTRIAN 0x03 // German (Austrian)
#define SUBLANG_GERMAN_LUXEMBOURG 0x04 // German (Luxembourg)
#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 // German (Liechtenstein)
#define SUBLANG_ITALIAN 0x01 // Italian
#define SUBLANG_ITALIAN_SWISS 0x02 // Italian (Swiss)
#define SUBLANG_KASHMIRI_INDIA 0x02 // Kashmiri (India)
#define SUBLANG_KOREAN 0x01 // Korean (Extended Wansung)
#define SUBLANG_LITHUANIAN 0x01 // Lithuanian
#define SUBLANG_LITHUANIAN_CLASSIC 0x02 // Lithuanian (Classic)
#define SUBLANG_MALAY_MALAYSIA 0x01 // Malay (Malaysia)
#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 // Malay (Brunei Darussalam)
#define SUBLANG_NEPALI_INDIA 0x02 // Nepali (India)
#define SUBLANG_NORWEGIAN_BOKMAL 0x01 // Norwegian (Bokmal)
#define SUBLANG_NORWEGIAN_NYNORSK 0x02 // Norwegian (Nynorsk)
#define SUBLANG_PORTUGUESE 0x02 // Portuguese
#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 // Portuguese (Brazilian)
#define SUBLANG_SERBIAN_LATIN 0x02 // Serbian (Latin)
#define SUBLANG_SERBIAN_CYRILLIC 0x03 // Serbian (Cyrillic)
#define SUBLANG_SPANISH 0x01 // Spanish (Castilian)
#define SUBLANG_SPANISH_MEXICAN 0x02 // Spanish (Mexican)
#define SUBLANG_SPANISH_MODERN 0x03 // Spanish (Modern)
#define SUBLANG_SPANISH_GUATEMALA 0x04 // Spanish (Guatemala)
#define SUBLANG_SPANISH_COSTA_RICA 0x05 // Spanish (Costa Rica)
#define SUBLANG_SPANISH_PANAMA 0x06 // Spanish (Panama)
#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 // Spanish (Dominican Republic)
#define SUBLANG_SPANISH_VENEZUELA 0x08 // Spanish (Venezuela)
#define SUBLANG_SPANISH_COLOMBIA 0x09 // Spanish (Colombia)
#define SUBLANG_SPANISH_PERU 0x0a // Spanish (Peru)
#define SUBLANG_SPANISH_ARGENTINA 0x0b // Spanish (Argentina)
#define SUBLANG_SPANISH_ECUADOR 0x0c // Spanish (Ecuador)
#define SUBLANG_SPANISH_CHILE 0x0d // Spanish (Chile)
#define SUBLANG_SPANISH_URUGUAY 0x0e // Spanish (Uruguay)
#define SUBLANG_SPANISH_PARAGUAY 0x0f // Spanish (Paraguay)
#define SUBLANG_SPANISH_BOLIVIA 0x10 // Spanish (Bolivia)
#define SUBLANG_SPANISH_EL_SALVADOR 0x11 // Spanish (El Salvador)
#define SUBLANG_SPANISH_HONDURAS 0x12 // Spanish (Honduras)
#define SUBLANG_SPANISH_NICARAGUA 0x13 // Spanish (Nicaragua)
#define SUBLANG_SPANISH_PUERTO_RICO 0x14 // Spanish (Puerto Rico)
#define SUBLANG_SWEDISH 0x01 // Swedish
#define SUBLANG_SWEDISH_FINLAND 0x02 // Swedish (Finland)
#define SUBLANG_URDU_PAKISTAN 0x01 // Urdu (Pakistan)
#define SUBLANG_URDU_INDIA 0x02 // Urdu (India)
#define SUBLANG_UZBEK_LATIN 0x01 // Uzbek (Latin)
#define SUBLANG_UZBEK_CYRILLIC 0x02 // Uzbek (Cyrillic)
//
// Sorting IDs.
//
#define SORT_DEFAULT 0x0 // sorting default
#define SORT_JAPANESE_XJIS 0x0 // Japanese XJIS order
#define SORT_JAPANESE_UNICODE 0x1 // Japanese Unicode order
#define SORT_CHINESE_BIG5 0x0 // Chinese BIG5 order
#define SORT_CHINESE_PRCP 0x0 // PRC Chinese Phonetic order
#define SORT_CHINESE_UNICODE 0x1 // Chinese Unicode order
#define SORT_CHINESE_PRC 0x2 // PRC Chinese Stroke Count order
#define SORT_CHINESE_BOPOMOFO 0x3 // Traditional Chinese Bopomofo order
#define SORT_KOREAN_KSC 0x0 // Korean KSC order
#define SORT_KOREAN_UNICODE 0x1 // Korean Unicode order
#define SORT_GERMAN_PHONE_BOOK 0x1 // German Phone Book order
#define SORT_HUNGARIAN_DEFAULT 0x0 // Hungarian Default order
#define SORT_HUNGARIAN_TECHNICAL 0x1 // Hungarian Technical order
#define SORT_GEORGIAN_TRADITIONAL 0x0 // Georgian Traditional order
#define SORT_GEORGIAN_MODERN 0x1 // Georgian Modern order
// end_r_winnt
//
// A language ID is a 16 bit value which is the combination of a
// primary language ID and a secondary language ID. The bits are
// allocated as follows:
//
// +-----------------------+-------------------------+
// | Sublanguage ID | Primary Language ID |
// +-----------------------+-------------------------+
// 15 10 9 0 bit
//
//
// Language ID creation/extraction macros:
//
// MAKELANGID - construct language id from a primary language id and
// a sublanguage id.
// PRIMARYLANGID - extract primary language id from a language id.
// SUBLANGID - extract sublanguage id from a language id.
//
#define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
#define SUBLANGID(lgid) ((WORD )(lgid) >> 10)
//
// A locale ID is a 32 bit value which is the combination of a
// language ID, a sort ID, and a reserved area. The bits are
// allocated as follows:
//
// +-------------+---------+-------------------------+
// | Reserved | Sort ID | Language ID |
// +-------------+---------+-------------------------+
// 31 20 19 16 15 0 bit
//
//
// Locale ID creation/extraction macros:
//
// MAKELCID - construct the locale id from a language id and a sort id.
// MAKESORTLCID - construct the locale id from a language id, sort id, and sort version.
// LANGIDFROMLCID - extract the language id from a locale id.
// SORTIDFROMLCID - extract the sort id from a locale id.
// SORTVERSIONFROMLCID - extract the sort version from a locale id.
//
#define NLS_VALID_LOCALE_MASK 0x000fffff
#define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD )(srtid))) << 16) | \
((DWORD)((WORD )(lgid)))))
#define MAKESORTLCID(lgid, srtid, ver) \
((DWORD)((MAKELCID(lgid, srtid)) | \
(((DWORD)((WORD )(ver))) << 20)))
#define LANGIDFROMLCID(lcid) ((WORD )(lcid))
#define SORTIDFROMLCID(lcid) ((WORD )((((DWORD)(lcid)) >> 16) & 0xf))
#define SORTVERSIONFROMLCID(lcid) ((WORD )((((DWORD)(lcid)) >> 20) & 0xf))
//
// Default System and User IDs for language and locale.
//
#define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
#define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
#define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
#define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
#define LOCALE_NEUTRAL \
(MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
// begin_ntminiport begin_ntndis begin_ntminitape
//
// Macros used to eliminate compiler warning generated when formal
// parameters or local variables are not declared.
//
// Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet
// referenced but will be once the module is completely developed.
//
// Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet
// referenced but will be once the module is completely developed.
//
// Use UNREFERENCED_PARAMETER() if a parameter will never be referenced.
//
// DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will
// eventually be made into a null macro to help determine whether there
// is unfinished work.
//
#if ! (defined(lint) || defined(_lint))
#define UNREFERENCED_PARAMETER(P) (P)
#define DBG_UNREFERENCED_PARAMETER(P) (P)
#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V)
#else // lint or _lint
// Note: lint -e530 says don't complain about uninitialized variables for
// this. line +e530 turns that checking back on. Error 527 has to do with
// unreachable code.
#define UNREFERENCED_PARAMETER(P) \
/*lint -e527 -e530 */ \
{ \
(P) = (P); \
} \
/*lint +e527 +e530 */
#define DBG_UNREFERENCED_PARAMETER(P) \
/*lint -e527 -e530 */ \
{ \
(P) = (P); \
} \
/*lint +e527 +e530 */
#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \
/*lint -e527 -e530 */ \
{ \
(V) = (V); \
} \
/*lint +e527 +e530 */
#endif // lint or _lint
#ifndef WIN32_NO_STATUS
/*lint -save -e767 */
#define STATUS_WAIT_0 ((DWORD )0x00000000L)
#define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L)
#define STATUS_USER_APC ((DWORD )0x000000C0L)
#define STATUS_TIMEOUT ((DWORD )0x00000102L)
#define STATUS_PENDING ((DWORD )0x00000103L)
#define STATUS_SEGMENT_NOTIFICATION ((DWORD )0x40000005L)
#define STATUS_GUARD_PAGE_VIOLATION ((DWORD )0x80000001L)
#define STATUS_DATATYPE_MISALIGNMENT ((DWORD )0x80000002L)
#define STATUS_BREAKPOINT ((DWORD )0x80000003L)
#define STATUS_SINGLE_STEP ((DWORD )0x80000004L)
#define STATUS_ACCESS_VIOLATION ((DWORD )0xC0000005L)
#define STATUS_IN_PAGE_ERROR ((DWORD )0xC0000006L)
#define STATUS_INVALID_HANDLE ((DWORD )0xC0000008L)
#define STATUS_NO_MEMORY ((DWORD )0xC0000017L)
#define STATUS_ILLEGAL_INSTRUCTION ((DWORD )0xC000001DL)
#define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD )0xC0000025L)
#define STATUS_INVALID_DISPOSITION ((DWORD )0xC0000026L)
#define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD )0xC000008CL)
#define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD )0xC000008DL)
#define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD )0xC000008EL)
#define STATUS_FLOAT_INEXACT_RESULT ((DWORD )0xC000008FL)
#define STATUS_FLOAT_INVALID_OPERATION ((DWORD )0xC0000090L)
#define STATUS_FLOAT_OVERFLOW ((DWORD )0xC0000091L)
#define STATUS_FLOAT_STACK_CHECK ((DWORD )0xC0000092L)
#define STATUS_FLOAT_UNDERFLOW ((DWORD )0xC0000093L)
#define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD )0xC0000094L)
#define STATUS_INTEGER_OVERFLOW ((DWORD )0xC0000095L)
#define STATUS_PRIVILEGED_INSTRUCTION ((DWORD )0xC0000096L)
#define STATUS_STACK_OVERFLOW ((DWORD )0xC00000FDL)
#define STATUS_CONTROL_C_EXIT ((DWORD )0xC000013AL)
#define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD )0xC00002B4L)
#define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD )0xC00002B5L)
#define STATUS_ILLEGAL_VLM_REFERENCE ((DWORD )0xC00002C0L)
/*lint -restore */
#endif
#define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of wait objects
#define MAXIMUM_SUSPEND_COUNT MAXCHAR // Maximum times thread can be suspended
typedef UINT_PTR KSPIN_LOCK;
typedef KSPIN_LOCK *PKSPIN_LOCK;
//
// Define function to return the current Thread Environment Block
//
#ifdef _ALPHA_ // winnt
void *_rdteb(void); // winnt
#if defined(_M_ALPHA) // winnt
#pragma intrinsic(_rdteb) // winnt
#endif // winnt
#endif // winnt
#if defined(_M_ALPHA)
#define NtCurrentTeb() ((struct _TEB *)_rdteb())
#else
struct _TEB *
NtCurrentTeb(void);
#endif
//
// Define functions to get the address of the current fiber and the
// current fiber data.
//
#ifdef _ALPHA_
#define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData)
#define GetFiberData() (*(PVOID *)(GetCurrentFiber()))
// begin_ntddk begin_nthal
//
// The following flags control the contents of the CONTEXT structure.
//
#if !defined(RC_INVOKED)
#define CONTEXT_PORTABLE_32BIT 0x00100000
#define CONTEXT_ALPHA 0x00020000
#define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
#define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
#define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
#endif
#ifndef _PORTABLE_32BIT_CONTEXT
//
// Context Frame
//
// This frame has a several purposes: 1) it is used as an argument to
// NtContinue, 2) it is used to construct a call frame for APC delivery,
// 3) it is used to construct a call frame for exception dispatching
// in user mode, 4) it is used in the user level thread creation
// routines, and 5) it is used to to pass thread state to debuggers.
//
// N.B. Because this record is used as a call frame, it must be EXACTLY
// a multiple of 16 bytes in length.
//
// There are two variations of the context structure. This is the real one.
//
typedef struct _CONTEXT {
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_FLOATING_POINT.
//
ULONGLONG FltF0;
ULONGLONG FltF1;
ULONGLONG FltF2;
ULONGLONG FltF3;
ULONGLONG FltF4;
ULONGLONG FltF5;
ULONGLONG FltF6;
ULONGLONG FltF7;
ULONGLONG FltF8;
ULONGLONG FltF9;
ULONGLONG FltF10;
ULONGLONG FltF11;
ULONGLONG FltF12;
ULONGLONG FltF13;
ULONGLONG FltF14;
ULONGLONG FltF15;
ULONGLONG FltF16;
ULONGLONG FltF17;
ULONGLONG FltF18;
ULONGLONG FltF19;
ULONGLONG FltF20;
ULONGLONG FltF21;
ULONGLONG FltF22;
ULONGLONG FltF23;
ULONGLONG FltF24;
ULONGLONG FltF25;
ULONGLONG FltF26;
ULONGLONG FltF27;
ULONGLONG FltF28;
ULONGLONG FltF29;
ULONGLONG FltF30;
ULONGLONG FltF31;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_INTEGER.
//
// N.B. The registers gp, sp, and ra are defined in this section, but are
// considered part of the control context rather than part of the integer
// context.
//
ULONGLONG IntV0; // $0: return value register, v0
ULONGLONG IntT0; // $1: temporary registers, t0 - t7
ULONGLONG IntT1; // $2:
ULONGLONG IntT2; // $3:
ULONGLONG IntT3; // $4:
ULONGLONG IntT4; // $5:
ULONGLONG IntT5; // $6:
ULONGLONG IntT6; // $7:
ULONGLONG IntT7; // $8:
ULONGLONG IntS0; // $9: nonvolatile registers, s0 - s5
ULONGLONG IntS1; // $10:
ULONGLONG IntS2; // $11:
ULONGLONG IntS3; // $12:
ULONGLONG IntS4; // $13:
ULONGLONG IntS5; // $14:
ULONGLONG IntFp; // $15: frame pointer register, fp/s6
ULONGLONG IntA0; // $16: argument registers, a0 - a5
ULONGLONG IntA1; // $17:
ULONGLONG IntA2; // $18:
ULONGLONG IntA3; // $19:
ULONGLONG IntA4; // $20:
ULONGLONG IntA5; // $21:
ULONGLONG IntT8; // $22: temporary registers, t8 - t11
ULONGLONG IntT9; // $23:
ULONGLONG IntT10; // $24:
ULONGLONG IntT11; // $25:
ULONGLONG IntRa; // $26: return address register, ra
ULONGLONG IntT12; // $27: temporary register, t12
ULONGLONG IntAt; // $28: assembler temp register, at
ULONGLONG IntGp; // $29: global pointer register, gp
ULONGLONG IntSp; // $30: stack pointer register, sp
ULONGLONG IntZero; // $31: zero register, zero
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_FLOATING_POINT.
//
ULONGLONG Fpcr; // floating point control register
ULONGLONG SoftFpcr; // software extension to FPCR
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_CONTROL.
//
// N.B. The registers gp, sp, and ra are defined in the integer section,
// but are considered part of the control context rather than part of
// the integer context.
//
ULONGLONG Fir; // (fault instruction) continuation address
DWORD Psr; // processor status
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
DWORD ContextFlags;
DWORD Fill[4]; // padding for 16-byte stack frame alignment
} CONTEXT, *PCONTEXT;
#else
//
// 32-bit Context Frame
//
// This alternate version of the Alpha context structure parallels that
// of MIPS and IX86 in style for the first 64 entries: 32-bit machines
// can operate on the fields, and a value declared as a pointer to an
// array of int's can be used to index into the fields. This makes life
// with windbg and ntsd vastly easier.
//
// There are two parts: the first contains the lower 32-bits of each
// element in the 64-bit definition above. The second part contains
// the upper 32-bits of each 64-bit element above.
//
// The names in the first part are identical to the 64-bit names.
// The second part names are prefixed with "High".
//
// 1st half: at 32 bits each, (containing the low parts of 64-bit values)
// 32 floats, 32 ints, fpcrs, fir, psr, contextflags
// 2nd half: at 32 bits each
// 32 floats, 32 ints, fpcrs, fir, fill
//
// There is no external support for the 32-bit version of the context
// structure. It is only used internally by windbg and ntsd.
//
// This structure must be the same size as the 64-bit version above.
//
typedef struct _CONTEXT {
DWORD FltF0;
DWORD FltF1;
DWORD FltF2;
DWORD FltF3;
DWORD FltF4;
DWORD FltF5;
DWORD FltF6;
DWORD FltF7;
DWORD FltF8;
DWORD FltF9;
DWORD FltF10;
DWORD FltF11;
DWORD FltF12;
DWORD FltF13;
DWORD FltF14;
DWORD FltF15;
DWORD FltF16;
DWORD FltF17;
DWORD FltF18;
DWORD FltF19;
DWORD FltF20;
DWORD FltF21;
DWORD FltF22;
DWORD FltF23;
DWORD FltF24;
DWORD FltF25;
DWORD FltF26;
DWORD FltF27;
DWORD FltF28;
DWORD FltF29;
DWORD FltF30;
DWORD FltF31;
DWORD IntV0; // $0: return value register, v0
DWORD IntT0; // $1: temporary registers, t0 - t7
DWORD IntT1; // $2:
DWORD IntT2; // $3:
DWORD IntT3; // $4:
DWORD IntT4; // $5:
DWORD IntT5; // $6:
DWORD IntT6; // $7:
DWORD IntT7; // $8:
DWORD IntS0; // $9: nonvolatile registers, s0 - s5
DWORD IntS1; // $10:
DWORD IntS2; // $11:
DWORD IntS3; // $12:
DWORD IntS4; // $13:
DWORD IntS5; // $14:
DWORD IntFp; // $15: frame pointer register, fp/s6
DWORD IntA0; // $16: argument registers, a0 - a5
DWORD IntA1; // $17:
DWORD IntA2; // $18:
DWORD IntA3; // $19:
DWORD IntA4; // $20:
DWORD IntA5; // $21:
DWORD IntT8; // $22: temporary registers, t8 - t11
DWORD IntT9; // $23:
DWORD IntT10; // $24:
DWORD IntT11; // $25:
DWORD IntRa; // $26: return address register, ra
DWORD IntT12; // $27: temporary register, t12
DWORD IntAt; // $28: assembler temp register, at
DWORD IntGp; // $29: global pointer register, gp
DWORD IntSp; // $30: stack pointer register, sp
DWORD IntZero; // $31: zero register, zero
DWORD Fpcr; // floating point control register
DWORD SoftFpcr; // software extension to FPCR
DWORD Fir; // (fault instruction) continuation address
DWORD Psr; // processor status
DWORD ContextFlags;
//
// Beginning of the "second half".
// The name "High" parallels the HighPart of a LargeInteger.
//
DWORD HighFltF0;
DWORD HighFltF1;
DWORD HighFltF2;
DWORD HighFltF3;
DWORD HighFltF4;
DWORD HighFltF5;
DWORD HighFltF6;
DWORD HighFltF7;
DWORD HighFltF8;
DWORD HighFltF9;
DWORD HighFltF10;
DWORD HighFltF11;
DWORD HighFltF12;
DWORD HighFltF13;
DWORD HighFltF14;
DWORD HighFltF15;
DWORD HighFltF16;
DWORD HighFltF17;
DWORD HighFltF18;
DWORD HighFltF19;
DWORD HighFltF20;
DWORD HighFltF21;
DWORD HighFltF22;
DWORD HighFltF23;
DWORD HighFltF24;
DWORD HighFltF25;
DWORD HighFltF26;
DWORD HighFltF27;
DWORD HighFltF28;
DWORD HighFltF29;
DWORD HighFltF30;
DWORD HighFltF31;
DWORD HighIntV0; // $0: return value register, v0
DWORD HighIntT0; // $1: temporary registers, t0 - t7
DWORD HighIntT1; // $2:
DWORD HighIntT2; // $3:
DWORD HighIntT3; // $4:
DWORD HighIntT4; // $5:
DWORD HighIntT5; // $6:
DWORD HighIntT6; // $7:
DWORD HighIntT7; // $8:
DWORD HighIntS0; // $9: nonvolatile registers, s0 - s5
DWORD HighIntS1; // $10:
DWORD HighIntS2; // $11:
DWORD HighIntS3; // $12:
DWORD HighIntS4; // $13:
DWORD HighIntS5; // $14:
DWORD HighIntFp; // $15: frame pointer register, fp/s6
DWORD HighIntA0; // $16: argument registers, a0 - a5
DWORD HighIntA1; // $17:
DWORD HighIntA2; // $18:
DWORD HighIntA3; // $19:
DWORD HighIntA4; // $20:
DWORD HighIntA5; // $21:
DWORD HighIntT8; // $22: temporary registers, t8 - t11
DWORD HighIntT9; // $23:
DWORD HighIntT10; // $24:
DWORD HighIntT11; // $25:
DWORD HighIntRa; // $26: return address register, ra
DWORD HighIntT12; // $27: temporary register, t12
DWORD HighIntAt; // $28: assembler temp register, at
DWORD HighIntGp; // $29: global pointer register, gp
DWORD HighIntSp; // $30: stack pointer register, sp
DWORD HighIntZero; // $31: zero register, zero
DWORD HighFpcr; // floating point control register
DWORD HighSoftFpcr; // software extension to FPCR
DWORD HighFir; // processor status
double DoNotUseThisField; // to force quadword structure alignment
DWORD HighFill[2]; // padding for 16-byte stack frame alignment
} CONTEXT, *PCONTEXT;
//
// These should name the fields in the _PORTABLE_32BIT structure
// that overlay the Psr and ContextFlags in the normal structure.
//
#define _QUAD_PSR_OFFSET HighSoftFpcr
#define _QUAD_FLAGS_OFFSET HighFir
#endif // _PORTABLE_32BIT_CONTEXT
// end_ntddk end_nthal
#endif // _ALPHA_
#ifdef _ALPHA_
VOID
__jump_unwind (
PVOID VirtualFramePointer,
PVOID TargetPc
);
#endif // _ALPHA_
#ifdef _X86_
//
// Disable these two pramas that evaluate to "sti" "cli" on x86 so that driver
// writers to not leave them inadvertantly in their code.
//
#if !defined(MIDL_PASS)
#if !defined(RC_INVOKED)
#pragma warning(disable:4164) // disable C4164 warning so that apps that
// build with /Od don't get weird errors !
#ifdef _M_IX86
#pragma function(_enable)
#pragma function(_disable)
#endif
#pragma warning(default:4164) // reenable C4164 warning
#endif
#endif
#if !defined(MIDL_PASS) && defined(_M_IX86)
#pragma warning (disable:4035) // disable 4035 (function must return something)
_inline PVOID GetFiberData( void ) { __asm {
mov eax, fs:[0x10]
mov eax,[eax]
}
}
_inline PVOID GetCurrentFiber( void ) { __asm mov eax, fs:[0x10] }
#pragma warning (default:4035) // Reenable it
#endif
// begin_ntddk begin_wx86
//
// Define the size of the 80387 save area, which is in the context frame.
//
#define SIZE_OF_80387_REGISTERS 80
//
// The following flags control the contents of the CONTEXT structure.
//
#if !defined(RC_INVOKED)
#define CONTEXT_i386 0x00010000 // this assumes that i386 and
#define CONTEXT_i486 0x00010000 // i486 have identical context records
// end_wx86
#define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) // SS:SP, CS:IP, FLAGS, BP
#define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) // AX, BX, CX, DX, SI, DI
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) // DS, ES, FS, GS
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) // 387 state
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) // DB 0-3,6,7
#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x00000020L) // cpu specific extensions
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |\
CONTEXT_SEGMENTS)
// begin_wx86
#endif
#define MAXIMUM_SUPPORTED_EXTENSION 512
typedef struct _FLOATING_SAVE_AREA {
DWORD ControlWord;
DWORD StatusWord;
DWORD TagWord;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
DWORD Cr0NpxState;
} FLOATING_SAVE_AREA;
typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA;
//
// Context Frame
//
// This frame has a several purposes: 1) it is used as an argument to
// NtContinue, 2) is is used to constuct a call frame for APC delivery,
// and 3) it is used in the user level thread creation routines.
//
// The layout of the record conforms to a standard call frame.
//
typedef struct _CONTEXT {
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a threads context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
DWORD ContextFlags;
//
// This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
// set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT
// included in CONTEXT_FULL.
//
DWORD Dr0;
DWORD Dr1;
DWORD Dr2;
DWORD Dr3;
DWORD Dr6;
DWORD Dr7;
//
// This section is specified/returned if the
// ContextFlags word contians the flag CONTEXT_FLOATING_POINT.
//
FLOATING_SAVE_AREA FloatSave;
//
// This section is specified/returned if the
// ContextFlags word contians the flag CONTEXT_SEGMENTS.
//
DWORD SegGs;
DWORD SegFs;
DWORD SegEs;
DWORD SegDs;
//
// This section is specified/returned if the
// ContextFlags word contians the flag CONTEXT_INTEGER.
//
DWORD Edi;
DWORD Esi;
DWORD Ebx;
DWORD Edx;
DWORD Ecx;
DWORD Eax;
//
// This section is specified/returned if the
// ContextFlags word contians the flag CONTEXT_CONTROL.
//
DWORD Ebp;
DWORD Eip;
DWORD SegCs; // MUST BE SANITIZED
DWORD EFlags; // MUST BE SANITIZED
DWORD Esp;
DWORD SegSs;
//
// This section is specified/returned if the ContextFlags word
// contains the flag CONTEXT_EXTENDED_REGISTERS.
// The format and contexts are processor specific
//
BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
} CONTEXT;
typedef CONTEXT *PCONTEXT;
// begin_ntminiport
#endif //_X86_
#ifndef _LDT_ENTRY_DEFINED
#define _LDT_ENTRY_DEFINED
typedef struct _LDT_ENTRY {
WORD LimitLow;
WORD BaseLow;
union {
struct {
BYTE BaseMid;
BYTE Flags1; // Declare as bytes to avoid alignment
BYTE Flags2; // Problems.
BYTE BaseHi;
} Bytes;
struct {
DWORD BaseMid : 8;
DWORD Type : 5;
DWORD Dpl : 2;
DWORD Pres : 1;
DWORD LimitHi : 4;
DWORD Sys : 1;
DWORD Reserved_0 : 1;
DWORD Default_Big : 1;
DWORD Granularity : 1;
DWORD BaseHi : 8;
} Bits;
} HighWord;
} LDT_ENTRY, *PLDT_ENTRY;
#endif
#if defined(_MIPS_)
//
// Define functions to get the address of the current fiber and the
// current fiber data.
//
#define GetCurrentFiber() ((*(PNT_TIB *)0x7ffff4a8)->FiberData)
#define GetFiberData() (*(PVOID *)(GetCurrentFiber()))
// begin_ntddk begin_nthal
//
// The following flags control the contents of the CONTEXT structure.
//
#if !defined(RC_INVOKED)
#define CONTEXT_R4000 0x00010000 // r4000 context
#define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
#define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
#define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
#define CONTEXT_EXTENDED_FLOAT (CONTEXT_FLOATING_POINT | 0x00000008)
#define CONTEXT_EXTENDED_INTEGER (CONTEXT_INTEGER | 0x00000010)
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | \
CONTEXT_INTEGER | CONTEXT_EXTENDED_INTEGER)
#endif
//
// Context Frame
//
// N.B. This frame must be exactly a multiple of 16 bytes in length.
//
// This frame has a several purposes: 1) it is used as an argument to
// NtContinue, 2) it is used to constuct a call frame for APC delivery,
// 3) it is used to construct a call frame for exception dispatching
// in user mode, and 4) it is used in the user level thread creation
// routines.
//
// The layout of the record conforms to a standard call frame.
//
typedef struct _CONTEXT {
//
// This section is always present and is used as an argument build
// area.
//
// N.B. Context records are 0 mod 8 aligned starting with NT 4.0.
//
union {
DWORD Argument[4];
ULONGLONG Alignment;
};
//
// The following union defines the 32-bit and 64-bit register context.
//
union {
//
// 32-bit context.
//
struct {
//
// This section is specified/returned if the ContextFlags contains
// the flag CONTEXT_FLOATING_POINT.
//
// N.B. This section contains the 16 double floating registers f0,
// f2, ..., f30.
//
DWORD FltF0;
DWORD FltF1;
DWORD FltF2;
DWORD FltF3;
DWORD FltF4;
DWORD FltF5;
DWORD FltF6;
DWORD FltF7;
DWORD FltF8;
DWORD FltF9;
DWORD FltF10;
DWORD FltF11;
DWORD FltF12;
DWORD FltF13;
DWORD FltF14;
DWORD FltF15;
DWORD FltF16;
DWORD FltF17;
DWORD FltF18;
DWORD FltF19;
DWORD FltF20;
DWORD FltF21;
DWORD FltF22;
DWORD FltF23;
DWORD FltF24;
DWORD FltF25;
DWORD FltF26;
DWORD FltF27;
DWORD FltF28;
DWORD FltF29;
DWORD FltF30;
DWORD FltF31;
//
// This section is specified/returned if the ContextFlags contains
// the flag CONTEXT_INTEGER.
//
// N.B. The registers gp, sp, and ra are defined in this section,
// but are considered part of the control context rather than
// part of the integer context.
//
// N.B. Register zero is not stored in the frame.
//
DWORD IntZero;
DWORD IntAt;
DWORD IntV0;
DWORD IntV1;
DWORD IntA0;
DWORD IntA1;
DWORD IntA2;
DWORD IntA3;
DWORD IntT0;
DWORD IntT1;
DWORD IntT2;
DWORD IntT3;
DWORD IntT4;
DWORD IntT5;
DWORD IntT6;
DWORD IntT7;
DWORD IntS0;
DWORD IntS1;
DWORD IntS2;
DWORD IntS3;
DWORD IntS4;
DWORD IntS5;
DWORD IntS6;
DWORD IntS7;
DWORD IntT8;
DWORD IntT9;
DWORD IntK0;
DWORD IntK1;
DWORD IntGp;
DWORD IntSp;
DWORD IntS8;
DWORD IntRa;
DWORD IntLo;
DWORD IntHi;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_FLOATING_POINT.
//
DWORD Fsr;
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_CONTROL.
//
// N.B. The registers gp, sp, and ra are defined in the integer section,
// but are considered part of the control context rather than part of
// the integer context.
//
DWORD Fir;
DWORD Psr;
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
DWORD ContextFlags;
};
//
// 64-bit context.
//
struct {
//
// This section is specified/returned if the ContextFlags contains
// the flag CONTEXT_EXTENDED_FLOAT.
//
// N.B. This section contains the 32 double floating registers f0,
// f1, ..., f31.
//
ULONGLONG XFltF0;
ULONGLONG XFltF1;
ULONGLONG XFltF2;
ULONGLONG XFltF3;
ULONGLONG XFltF4;
ULONGLONG XFltF5;
ULONGLONG XFltF6;
ULONGLONG XFltF7;
ULONGLONG XFltF8;
ULONGLONG XFltF9;
ULONGLONG XFltF10;
ULONGLONG XFltF11;
ULONGLONG XFltF12;
ULONGLONG XFltF13;
ULONGLONG XFltF14;
ULONGLONG XFltF15;
ULONGLONG XFltF16;
ULONGLONG XFltF17;
ULONGLONG XFltF18;
ULONGLONG XFltF19;
ULONGLONG XFltF20;
ULONGLONG XFltF21;
ULONGLONG XFltF22;
ULONGLONG XFltF23;
ULONGLONG XFltF24;
ULONGLONG XFltF25;
ULONGLONG XFltF26;
ULONGLONG XFltF27;
ULONGLONG XFltF28;
ULONGLONG XFltF29;
ULONGLONG XFltF30;
ULONGLONG XFltF31;
//
// The following sections must exactly overlay the 32-bit context.
//
DWORD Fill1;
DWORD Fill2;
//
// This section is specified/returned if the ContextFlags contains
// the flag CONTEXT_FLOATING_POINT.
//
DWORD XFsr;
//
// This section is specified/returned if the ContextFlags contains
// the flag CONTEXT_CONTROL.
//
// N.B. The registers gp, sp, and ra are defined in the integer
// section, but are considered part of the control context
// rather than part of the integer context.
//
DWORD XFir;
DWORD XPsr;
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
DWORD XContextFlags;
//
// This section is specified/returned if the ContextFlags contains
// the flag CONTEXT_EXTENDED_INTEGER.
//
// N.B. The registers gp, sp, and ra are defined in this section,
// but are considered part of the control context rather than
// part of the integer context.
//
// N.B. Register zero is not stored in the frame.
//
ULONGLONG XIntZero;
ULONGLONG XIntAt;
ULONGLONG XIntV0;
ULONGLONG XIntV1;
ULONGLONG XIntA0;
ULONGLONG XIntA1;
ULONGLONG XIntA2;
ULONGLONG XIntA3;
ULONGLONG XIntT0;
ULONGLONG XIntT1;
ULONGLONG XIntT2;
ULONGLONG XIntT3;
ULONGLONG XIntT4;
ULONGLONG XIntT5;
ULONGLONG XIntT6;
ULONGLONG XIntT7;
ULONGLONG XIntS0;
ULONGLONG XIntS1;
ULONGLONG XIntS2;
ULONGLONG XIntS3;
ULONGLONG XIntS4;
ULONGLONG XIntS5;
ULONGLONG XIntS6;
ULONGLONG XIntS7;
ULONGLONG XIntT8;
ULONGLONG XIntT9;
ULONGLONG XIntK0;
ULONGLONG XIntK1;
ULONGLONG XIntGp;
ULONGLONG XIntSp;
ULONGLONG XIntS8;
ULONGLONG XIntRa;
ULONGLONG XIntLo;
ULONGLONG XIntHi;
};
};
} CONTEXT, *PCONTEXT;
// end_ntddk end_nthal
#define CONTEXT32_LENGTH 0x130 // The original 32-bit Context length (pre NT 4.0)
#endif // MIPS
#if defined(_MIPS_)
VOID
__jump_unwind (
PVOID Fp,
PVOID TargetPc
);
#endif // MIPS
#if defined(_PPC_)
//
// The address of the TEB is placed into GPR 13 at context switch time
// and should never be destroyed. To get the address of the TEB use
// the compiler intrinsic to access it directly from GPR 13.
//
#if defined(_M_PPC) && defined(_MSC_VER) && (_MSC_VER>=1000)
unsigned __gregister_get( unsigned const regnum );
#define NtCurrentTeb() ((struct _TEB *)__gregister_get(13))
#elif defined(_M_PPC)
struct _TEB * __builtin_get_gpr13(VOID);
#define NtCurrentTeb() ((struct _TEB *)__builtin_get_gpr13())
#endif
//
// Define functions to get the address of the current fiber and the
// current fiber data.
//
#define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData)
#define GetFiberData() (*(PVOID *)(GetCurrentFiber()))
// begin_ntddk begin_nthal
//
// The following flags control the contents of the CONTEXT structure.
//
#if !defined(RC_INVOKED)
#define CONTEXT_CONTROL 0x00000001L
#define CONTEXT_FLOATING_POINT 0x00000002L
#define CONTEXT_INTEGER 0x00000004L
#define CONTEXT_DEBUG_REGISTERS 0x00000008L
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
#endif
//
// Context Frame
//
// N.B. This frame must be exactly a multiple of 16 bytes in length.
//
// This frame has a several purposes: 1) it is used as an argument to
// NtContinue, 2) it is used to constuct a call frame for APC delivery,
// 3) it is used to construct a call frame for exception dispatching
// in user mode, and 4) it is used in the user level thread creation
// routines.
//
// Requires at least 8-byte alignment (double)
//
typedef struct _CONTEXT {
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_FLOATING_POINT.
//
double Fpr0; // Floating registers 0..31
double Fpr1;
double Fpr2;
double Fpr3;
double Fpr4;
double Fpr5;
double Fpr6;
double Fpr7;
double Fpr8;
double Fpr9;
double Fpr10;
double Fpr11;
double Fpr12;
double Fpr13;
double Fpr14;
double Fpr15;
double Fpr16;
double Fpr17;
double Fpr18;
double Fpr19;
double Fpr20;
double Fpr21;
double Fpr22;
double Fpr23;
double Fpr24;
double Fpr25;
double Fpr26;
double Fpr27;
double Fpr28;
double Fpr29;
double Fpr30;
double Fpr31;
double Fpscr; // Floating point status/control reg
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_INTEGER.
//
DWORD Gpr0; // General registers 0..31
DWORD Gpr1;
DWORD Gpr2;
DWORD Gpr3;
DWORD Gpr4;
DWORD Gpr5;
DWORD Gpr6;
DWORD Gpr7;
DWORD Gpr8;
DWORD Gpr9;
DWORD Gpr10;
DWORD Gpr11;
DWORD Gpr12;
DWORD Gpr13;
DWORD Gpr14;
DWORD Gpr15;
DWORD Gpr16;
DWORD Gpr17;
DWORD Gpr18;
DWORD Gpr19;
DWORD Gpr20;
DWORD Gpr21;
DWORD Gpr22;
DWORD Gpr23;
DWORD Gpr24;
DWORD Gpr25;
DWORD Gpr26;
DWORD Gpr27;
DWORD Gpr28;
DWORD Gpr29;
DWORD Gpr30;
DWORD Gpr31;
DWORD Cr; // Condition register
DWORD Xer; // Fixed point exception register
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_CONTROL.
//
DWORD Msr; // Machine status register
DWORD Iar; // Instruction address register
DWORD Lr; // Link register
DWORD Ctr; // Count register
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
DWORD ContextFlags;
DWORD Fill[3]; // Pad out to multiple of 16 bytes
//
// This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
// set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT
// included in CONTEXT_FULL.
//
DWORD Dr0; // Breakpoint Register 1
DWORD Dr1; // Breakpoint Register 2
DWORD Dr2; // Breakpoint Register 3
DWORD Dr3; // Breakpoint Register 4
DWORD Dr4; // Breakpoint Register 5
DWORD Dr5; // Breakpoint Register 6
DWORD Dr6; // Debug Status Register
DWORD Dr7; // Debug Control Register
} CONTEXT, *PCONTEXT;
// end_ntddk end_nthal
//
// Stack frame header
//
// Order of appearance in stack frame:
// Header (six words)
// Parameters (at least eight words)
// Local variables
// Saved GPRs
// Saved FPRs
//
// Minimum alignment is 8 bytes
typedef struct _STACK_FRAME_HEADER { // GPR 1 points here
DWORD BackChain; // Addr of previous frame
DWORD GlueSaved1; // Used by glue code
DWORD GlueSaved2;
DWORD Reserved1; // Reserved
DWORD Spare1; // Used by tracing, profiling, ...
DWORD Spare2;
DWORD Parameter0; // First 8 parameter words are
DWORD Parameter1; // always present
DWORD Parameter2;
DWORD Parameter3;
DWORD Parameter4;
DWORD Parameter5;
DWORD Parameter6;
DWORD Parameter7;
} STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
VOID
__jump_unwind (
PVOID Fp,
PVOID TargetPc
);
#endif // defined(_PPC_)
#if defined(_MPPC_)
//
// The address of the TEB is placed into GPR 13 at context switch time
// and should never be destroyed. To get the address of the TEB use
// the compiler intrinsic to access it directly from GPR 13.
//
#if defined(_M_PPC) && defined(_MSC_VER) && (_MSC_VER>=1000)
unsigned __gregister_get( unsigned const regnum );
#define NtCurrentTeb() ((struct _TEB *)__gregister_get(13))
#elif defined(_M_PPC)
struct _TEB * __builtin_get_gpr13(VOID);
#define NtCurrentTeb() ((struct _TEB *)__builtin_get_gpr13())
#endif
//
// Define functions to get the address of the current fiber and the
// current fiber data.
//
#define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData)
#define GetFiberData() (*(PVOID *)(GetCurrentFiber()))
// begin_ntddk begin_nthal
//
// The following flags control the contents of the CONTEXT structure.
//
#if !defined(RC_INVOKED)
#define CONTEXT_CONTROL 0x00000001L
#define CONTEXT_FLOATING_POINT 0x00000002L
#define CONTEXT_INTEGER 0x00000004L
#define CONTEXT_DEBUG_REGISTERS 0x00000008L
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
#endif
//
// Context Frame
//
// N.B. This frame must be exactly a multiple of 16 bytes in length.
//
// This frame has a several purposes: 1) it is used as an argument to
// NtContinue, 2) it is used to constuct a call frame for APC delivery,
// 3) it is used to construct a call frame for exception dispatching
// in user mode, and 4) it is used in the user level thread creation
// routines.
//
// Requires at least 8-byte alignment (double)
//
typedef struct _CONTEXT {
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_FLOATING_POINT.
//
double Fpr0; // Floating registers 0..31
double Fpr1;
double Fpr2;
double Fpr3;
double Fpr4;
double Fpr5;
double Fpr6;
double Fpr7;
double Fpr8;
double Fpr9;
double Fpr10;
double Fpr11;
double Fpr12;
double Fpr13;
double Fpr14;
double Fpr15;
double Fpr16;
double Fpr17;
double Fpr18;
double Fpr19;
double Fpr20;
double Fpr21;
double Fpr22;
double Fpr23;
double Fpr24;
double Fpr25;
double Fpr26;
double Fpr27;
double Fpr28;
double Fpr29;
double Fpr30;
double Fpr31;
double Fpscr; // Floating point status/control reg
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_INTEGER.
//
DWORD Gpr0; // General registers 0..31
DWORD Gpr1;
DWORD Gpr2;
DWORD Gpr3;
DWORD Gpr4;
DWORD Gpr5;
DWORD Gpr6;
DWORD Gpr7;
DWORD Gpr8;
DWORD Gpr9;
DWORD Gpr10;
DWORD Gpr11;
DWORD Gpr12;
DWORD Gpr13;
DWORD Gpr14;
DWORD Gpr15;
DWORD Gpr16;
DWORD Gpr17;
DWORD Gpr18;
DWORD Gpr19;
DWORD Gpr20;
DWORD Gpr21;
DWORD Gpr22;
DWORD Gpr23;
DWORD Gpr24;
DWORD Gpr25;
DWORD Gpr26;
DWORD Gpr27;
DWORD Gpr28;
DWORD Gpr29;
DWORD Gpr30;
DWORD Gpr31;
DWORD Cr; // Condition register
DWORD Xer; // Fixed point exception register
//
// This section is specified/returned if the ContextFlags word contains
// the flag CONTEXT_CONTROL.
//
DWORD Msr; // Machine status register
DWORD Iar; // Instruction address register
DWORD Lr; // Link register
DWORD Ctr; // Count register
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
DWORD ContextFlags;
DWORD Fill[3]; // Pad out to multiple of 16 bytes
//
// This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
// set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT
// included in CONTEXT_FULL.
//
DWORD Dr0; // Breakpoint Register 1
DWORD Dr1; // Breakpoint Register 2
DWORD Dr2; // Breakpoint Register 3
DWORD Dr3; // Breakpoint Register 4
DWORD Dr4; // Breakpoint Register 5
DWORD Dr5; // Breakpoint Register 6
DWORD Dr6; // Debug Status Register
DWORD Dr7; // Debug Control Register
} CONTEXT, *PCONTEXT;
// end_ntddk end_nthal
//
// Stack frame header
//
// Order of appearance in stack frame:
// Header (six words)
// Parameters (at least eight words)
// Local variables
// Saved GPRs
// Saved FPRs
//
// Minimum alignment is 8 bytes
typedef struct _STACK_FRAME_HEADER { // GPR 1 points here
DWORD BackChain; // Addr of previous frame
DWORD GlueSaved1; // Used by glue code
DWORD GlueSaved2;
DWORD Reserved1; // Reserved
DWORD Spare1; // Used by tracing, profiling, ...
DWORD Spare2;
DWORD Parameter0; // First 8 parameter words are
DWORD Parameter1; // always present
DWORD Parameter2;
DWORD Parameter3;
DWORD Parameter4;
DWORD Parameter5;
DWORD Parameter6;
DWORD Parameter7;
} STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
VOID
__jump_unwind (
PVOID Fp,
PVOID TargetPc
);
#endif // defined(_MPPC_)
#if !defined(__midl) && !defined(GENUTIL) && !defined(_GENIA64_) && defined(_M_IA64)
void *_rdteb(void);
#pragma intrinsic (_rdteb)
#define NtCurrentTeb() ((struct _TEB *)_rdteb())
//
// Define functions to get the address of the current fiber and the
// current fiber data.
//
#define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData)
#define GetFiberData() (*(PVOID *)(GetCurrentFiber()))
#endif // !defined(__midl) && !defined(GENUTIL) && !defined(_GENIA64_) && defined(_M_IA64)
#ifdef _IA64_
// begin_ntddk begin_nthal
//
// Pointer swizzling operation: 32-bit pointer to 64-bit pointer
//
#if !defined(__midl) && !defined(GENUTIL) && !defined(_GENIA64_) && defined(_M_IA64)
#ifdef _WIN64
#define P32ToP64(p64) ( (ULONGLONG)(p64) )
#else
#define P32ToP64(p32) ( (ULONGLONG)_P32ToP64(p32) )
#endif
extern ULONGLONG _P32ToP64(PVOID);
#else
#if defined(_M_IX86) || defined(_M_ALPHA)
#define P32ToP64(p32) ( (ULONGLONG)_P32ToP64(p32) )
static ULONGLONG _P32ToP64(DWORD *p)
{
ULONGLONG P32ToP64Local = (LONG)p; // sign extend p to 64-bit
return P32ToP64Local;
}
#endif // (_M_IX86 || _M_ALPHA_)
#endif // !defined(__midl) && !defined(GENUTIL) && !defined(_GENIA64_) && defined(_M_IA64)
//
// The following flags control the contents of the CONTEXT structure.
//
#if !defined(RC_INVOKED)
#define CONTEXT_IA64 0x00080000 // IA64 context
#define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001L)
#define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L)
#define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L)
#define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008L)
#define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010L)
#define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
#endif // !defined(RC_INVOKED)
//
// Context Frame
//
// This frame has a several purposes: 1) it is used as an argument to
// NtContinue, 2) it is used to construct a call frame for APC delivery,
// 3) it is used to construct a call frame for exception dispatching
// in user mode, 4) it is used in the user level thread creation
// routines, and 5) it is used to to pass thread state to debuggers.
//
// N.B. Because this record is used as a call frame, it must be EXACTLY
// a multiple of 16 bytes in length and aligned on a 16-byte boundary.
//
typedef struct _CONTEXT {
//
// The flags values within this flag control the contents of
// a CONTEXT record.
//
// If the context record is used as an input parameter, then
// for each portion of the context record controlled by a flag
// whose value is set, it is assumed that that portion of the
// context record contains valid context. If the context record
// is being used to modify a thread's context, then only that
// portion of the threads context will be modified.
//
// If the context record is used as an IN OUT parameter to capture
// the context of a thread, then only those portions of the thread's
// context corresponding to set flags will be returned.
//
// The context record is never used as an OUT only parameter.
//
DWORD ContextFlags;
DWORD Fill1[3]; // for alignment of following on 16-byte boundary
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment
// Comment