📄 ntdef.inc
字号:
comment ^
Module Name:
ntdef.inc
Abstract:
Type definitions for the basic types.
Author:
Four-F (four-f@mail.ru)
Last updated:
27-August-2004
IMPORTANT:
Hand made -> Bugs are very possible :(
Your bug report is very welcome.
Comments:
Some fields name have been changed because of collision with masm reserved words.
All such words are prefixed with underscore ('_') symbol.
^
IFNDEF _NTDEF_
_NTDEF_ equ 1
CALLBACK typedef proto STDCALL
WINAPI typedef proto STDCALL
NTAPI typedef proto STDCALL
BOOL typedef DWORD
PBYTE typedef PTR BYTE
PWORD typedef PTR DORD
PDWORD typedef PTR DWORD
PVOID typedef PTR
PVOID64 typedef PTR
PCVOID typedef PTR
PSTR typedef PTR BYTE
PCSTR typedef PTR BYTE
PWSTR typedef PTR WORD
PDWORD_PTR typedef PTR DWORD
UINT typedef DWORD
HFILE typedef DWORD
IFNDEF ANYSIZE_ARRAY
ANYSIZE_ARRAY equ 1 ; winnt
ENDIF
; Basics
char typedef BYTE
CHAR typedef BYTE
long typedef SDWORD
LONG typedef SDWORD
; UNICODE (Wide Character) types
WCHAR typedef WORD ; wc, 16-bit UNICODE character
wchar_t typedef WORD ; wc, 16-bit UNICODE character
PWCHAR typedef PTR WORD
LPWCH typedef PTR WORD
PWCH typedef PTR WORD
LPCWCH typedef PTR WORD
PCWCH typedef PTR WORD
NWPSTR typedef PTR WORD
LPWSTR typedef PTR WORD
PWSTR typedef PTR WORD
LPCWSTR typedef PTR WORD
PCWSTR typedef PTR WORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; ANSI (Multi-byte Character) types
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PCHAR typedef PTR BYTE
LPCH typedef PTR BYTE
PCH typedef PTR BYTE
LPCCH typedef PTR BYTE
PCCH typedef PTR BYTE
NPSTR typedef PTR BYTE
LPSTR typedef PTR BYTE
PSTR typedef PTR BYTE
LPCSTR typedef PTR BYTE
PCSTR typedef PTR BYTE
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Neutral ANSI/UNICODE types and macros
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
IFDEF UNICODE
TCHAR typedef WORD
PTCHAR typedef PTR WORD
TUCHAR typedef WORD
PTUCHAR typedef PTR WORD
LPTCH typedef PTR WORD
PTCH typedef PTR WORD
PTSTR typedef PTR WORD
LPTSTR typedef PTR WORD
PCTSTR typedef PTR WORD
LPCTSTR typedef PTR WORD
LP typedef PTR WORD
ELSE ; UNICODE
TCHAR typedef SBYTE
PTCHAR typedef PTR SBYTE
TUCHAR typedef BYTE
PTUCHAR typedef PTR BYTE
ENDIF ; UNICODE
comment ^
typedef LPSTR LPTCH, PTCH;
typedef LPSTR PTSTR, LPTSTR;
typedef LPCSTR PCTSTR, LPCTSTR;
^
double typedef QWORD
DOUBLE typedef QWORD
QUAD STRUCT ; QUAD is for those times we want
DoNotUseThisField QWORD ? ; an 8 byte aligned 8 byte long structure
QUAD ENDS ; which is NOT really a floating point
; number. Use DOUBLE if you want an FP
; number.
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Pointer to Basics
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PSHORT typedef SWORD
PLONG typedef PTR SDWORD
PQUAD typedef PTR QWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Unsigned Basics
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Tell windef.h that some types are already defined.
; #define BASETYPES
UCHAR typedef BYTE
USHORT typedef WORD
ULONG typedef DWORD
UQUAD typedef QWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Pointer to Unsigned Basics
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PUCHAR typedef PTR BYTE
PUSHORT typedef PTR WORD
PULONG typedef PTR DWORD
PUQUAD typedef PTR QWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Signed characters
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SCHAR typedef SBYTE
PSCHAR typedef PTR SBYTE
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Handle to an Object
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HANDLE typedef DWORD
PHANDLE typedef PTR DWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Flag (bit) fields
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FCHAR typedef BYTE
FSHORT typedef WORD
FLONG typedef DWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Low order two bits of a handle are ignored by the system and available
; for use by application code as tag bits. The remaining bits are opaque
; and used to store a serial number and table index.
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Cardinal Data Types [0 - 2**N-2)
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CCHAR typedef BYTE
CSHORT typedef SWORD
CLONG typedef SDWORD
PCCHAR typedef PTR BYTE
PCSHORT typedef PTR SWORD
PCLONG typedef PTR SDWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; NLS basics (Locale and Language Ids)
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
LCID typedef DWORD
PLCID typedef PTR DWORD
LANGID typedef WORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Logical Data Type - These are 32-bit logical values.
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
LOGICAL typedef DWORD
PLOGICAL typedef PTR DWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; NTSTATUS
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NTSTATUS typedef SDWORD
PNTSTATUS typedef PTR SDWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Status values are 32 bit values layed out as follows:
;
; 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
; 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
; +---+-+-------------------------+-------------------------------+
; |Sev|C| Facility | Code |
; +---+-+-------------------------+-------------------------------+
;
; where
;
; Sev - is the severity code
;
; 00 - Success
; 01 - Informational
; 10 - Warning
; 11 - Error
;
; C - is the Customer code flag
;
; Facility - is the facility code
;
; Code - is the facility's status code
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
APPLICATION_ERROR_MASK equ 020000000h
ERROR_SEVERITY_SUCCESS equ 000000000h
ERROR_SEVERITY_INFORMATIONAL equ 040000000h
ERROR_SEVERITY_WARNING equ 080000000h
ERROR_SEVERITY_ERROR equ 0C0000000h
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Large (64-bit) integer types and operations
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
TIME UNION
struct
union
LowPart DWORD ?
LowTime DWORD ?
ends
union
HighPart SDWORD ?
HighTime SDWORD ?
ends
ends
struct u
union
LowPart DWORD ?
LowTime DWORD ?
ends
union
HighPart SDWORD ?
HighTime SDWORD ?
ends
ends
QuadPart QWORD ? ; signed
TIME ENDS
PTIME typedef PTR TIME
LONGLONG typedef QWORD
ULONGLONG typedef QWORD
PLONGLONG typedef PTR QWORD
PULONGLONG typedef PTR QWORD
USN typedef QWORD
LARGE_INTEGER UNION
struct
LowPart DWORD ?
HighPart SDWORD ?
ends
struct u
LowPart DWORD ?
HighPart SDWORD ?
ends
QuadPart QWORD ? ; signed
LARGE_INTEGER ENDS
PLARGE_INTEGER typedef PTR LARGE_INTEGER
ULARGE_INTEGER UNION
struct
LowPart DWORD ?
HighPart DWORD ?
ends
struct u
LowPart DWORD ?
HighPart DWORD ?
ends
QuadPart QWORD ?
ULARGE_INTEGER ENDS
PULARGE_INTEGER typedef PTR ULARGE_INTEGER
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Locally Unique Identifier
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
LUID STRUCT
LowPart DWORD ?
HighPart SDWORD ?
LUID ENDS
PLUID typedef PTR LUID
DWORDLONG typedef QWORD
PDWORDLONG typedef PTR QWORD
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Physical address.
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PHYSICAL_ADDRESS UNION
struct
LowPart DWORD ?
HighPart SDWORD ?
ends
struct u
LowPart DWORD ?
HighPart SDWORD ?
ends
QuadPart QWORD ? ; signed
PHYSICAL_ADDRESS ENDS
PPHYSICAL_ADDRESS typedef PTR PHYSICAL_ADDRESS
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; 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.
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Event type
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;typedef enum _EVENT_TYPE {
NotificationEvent equ 0
SynchronizationEvent equ 1
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Timer type
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;typedef enum _TIMER_TYPE {
NotificationTimer equ 0
SynchronizationTimer equ 1
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Wait type
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;typedef enum _WAIT_TYPE {
WaitAll equ 0
WaitAny equ 1
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Pointer to an Asciiz string
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PSZ typedef PTR BYTE
PCSZ typedef PTR BYTE
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Counted String
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
_STRING STRUCT
_Length WORD ?
MaximumLength WORD ?
Buffer DWORD ? ; PCHAR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -