home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / winnt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  56.7 KB  |  1,799 lines

  1. /*++ BUILD Version: 0093     Increment this if a change has global effects
  2.  
  3. Copyright (c) 1990-1998  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     winnt.h
  8.  
  9. Abstract:
  10.  
  11.     This module defines the 32-Bit Windows types and constants that are
  12.     defined by NT, but exposed through the Win32 API.
  13.  
  14. Revision History:
  15.  
  16. --*/
  17.  
  18. #ifndef _WINNT_
  19. #define _WINNT_
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25. /* These two are not in the Win95 winnt.h */
  26. typedef unsigned int size_t;
  27. #define offsetof(s,m) ((size_t)&(((s*)0)->m))
  28.  
  29. #include <ctype.h>
  30. #define ANYSIZE_ARRAY 1
  31. #if !defined(_M_IX86)
  32. #define UNALIGNED __unaligned
  33. #else
  34. #define UNALIGNED
  35. #endif
  36.  
  37. #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
  38. #define DECLSPEC_IMPORT __declspec(dllimport)
  39. #else
  40. #define DECLSPEC_IMPORT
  41. #endif
  42.  
  43. typedef void *PVOID;
  44.  
  45. #if (_MSC_VER >= 800)
  46. #define NTAPI __stdcall
  47. #else
  48. #define _cdecl
  49. #define NTAPI
  50. #endif
  51.  
  52. #include <string.h>
  53.  
  54. //
  55. // Define API decoration for direct importing system DLL references.
  56. //
  57.  
  58. #if !defined(_NTSYSTEM_)
  59. #define NTSYSAPI DECLSPEC_IMPORT
  60. #else
  61. #define NTSYSAPI
  62. #endif
  63.  
  64. //
  65. // Basics
  66. //
  67.  
  68. #ifndef VOID
  69. #define VOID void
  70. typedef char CHAR;
  71. typedef short SHORT;
  72. typedef long LONG;
  73. #endif
  74.  
  75. typedef LONG HRESULT;
  76.  
  77. //
  78. // UNICODE (Wide Character) types
  79. //
  80.  
  81. typedef wchar_t WCHAR;    // wc,   16-bit UNICODE character
  82.  
  83. typedef WCHAR *PWCHAR;
  84. typedef WCHAR *LPWCH, *PWCH;
  85. typedef CONST WCHAR *LPCWCH, *PCWCH;
  86. typedef WCHAR *NWPSTR;
  87. typedef WCHAR *LPWSTR, *PWSTR;
  88.  
  89. typedef CONST WCHAR *LPCWSTR, *PCWSTR;
  90.  
  91. //
  92. // ANSI (Multi-byte Character) types
  93. //
  94. typedef CHAR *PCHAR;
  95. typedef CHAR *LPCH, *PCH;
  96.  
  97. typedef CONST CHAR *LPCCH, *PCCH;
  98. typedef CHAR *NPSTR;
  99. typedef CHAR *LPSTR, *PSTR;
  100. typedef CONST CHAR *LPCSTR, *PCSTR;
  101.  
  102. //
  103. // Neutral ANSI/UNICODE types and macros
  104. //
  105. #ifdef  UNICODE
  106.  
  107. #ifndef _TCHAR_DEFINED
  108. typedef WCHAR TCHAR, *PTCHAR;
  109. typedef WCHAR TBYTE , *PTBYTE ;
  110. #define _TCHAR_DEFINED
  111. #endif /* !_TCHAR_DEFINED */
  112.  
  113. typedef LPWSTR LPTCH, PTCH;
  114. typedef LPWSTR PTSTR, LPTSTR;
  115. typedef LPCWSTR LPCTSTR;
  116. typedef LPWSTR LP;
  117. #define __TEXT(quote) L##quote
  118.  
  119. #else   /* UNICODE */
  120.  
  121. #ifndef _TCHAR_DEFINED
  122. typedef char TCHAR, *PTCHAR;
  123. typedef unsigned char TBYTE , *PTBYTE ;
  124. #define _TCHAR_DEFINED
  125. #endif /* !_TCHAR_DEFINED */
  126.  
  127. typedef LPSTR LPTCH, PTCH;
  128. typedef LPSTR PTSTR, LPTSTR;
  129. typedef LPCSTR LPCTSTR;
  130. #define __TEXT(quote) quote
  131.  
  132. #endif /* UNICODE */
  133. #define TEXT(quote) __TEXT(quote)
  134.  
  135.  
  136. typedef SHORT *PSHORT;
  137. typedef LONG *PLONG;
  138.  
  139. #ifdef STRICT
  140. typedef void *HANDLE;
  141. #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
  142. #else
  143. typedef PVOID HANDLE;
  144. #define DECLARE_HANDLE(name) typedef HANDLE name
  145. #endif
  146. typedef HANDLE *PHANDLE;
  147.  
  148. typedef char CCHAR;
  149. typedef DWORD LCID;
  150. typedef PDWORD PLCID;
  151. typedef WORD   LANGID;
  152. /*lint -e624 */
  153. /*lint +e624 */
  154. #define APPLICATION_ERROR_MASK       0x20000000
  155. #define ERROR_SEVERITY_SUCCESS       0x00000000
  156. #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
  157. #define ERROR_SEVERITY_WARNING       0x80000000
  158. #define ERROR_SEVERITY_ERROR         0xC0000000
  159.  
  160. //
  161. // __int64 is only supported by 2.0 and later midl.
  162. // __midl is set by the 2.0 midl and not by 1.0 midl.
  163. //
  164.  
  165. #if (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))
  166. typedef __int64 LONGLONG;
  167. typedef unsigned __int64 DWORDLONG;
  168. #else
  169. typedef double LONGLONG;
  170. typedef double DWORDLONG;
  171. #endif
  172.  
  173. typedef LONGLONG *PLONGLONG;
  174. typedef DWORDLONG *PDWORDLONG;
  175.  
  176. #if defined(MIDL_PASS)
  177. typedef struct _LARGE_INTEGER {
  178. #else // MIDL_PASS
  179. typedef union _LARGE_INTEGER {
  180.     struct {
  181.         DWORD LowPart;
  182.         LONG HighPart;
  183.     };
  184.     struct {
  185.         DWORD LowPart;
  186.         LONG HighPart;
  187.     } u;
  188. #endif //MIDL_PASS
  189.     LONGLONG QuadPart;
  190. } LARGE_INTEGER;
  191.  
  192. typedef LARGE_INTEGER *PLARGE_INTEGER;
  193.  
  194.  
  195. #if defined(MIDL_PASS)
  196. typedef struct _ULARGE_INTEGER {
  197. #else // MIDL_PASS
  198. typedef union _ULARGE_INTEGER {
  199.     struct {
  200.         DWORD LowPart;
  201.         DWORD HighPart;
  202.     };
  203.     struct {
  204.         DWORD LowPart;
  205.         DWORD HighPart;
  206.     } u;
  207. #endif //MIDL_PASS
  208.     DWORDLONG QuadPart;
  209. } ULARGE_INTEGER;
  210.  
  211. typedef ULARGE_INTEGER *PULARGE_INTEGER;
  212.  
  213. // end_ntminiport end_ntndis
  214.  
  215. //
  216. // Locally Unique Identifier
  217. //
  218.  
  219. typedef LARGE_INTEGER LUID, *PLUID;
  220.  
  221.  
  222. #define UNICODE_NULL ((WCHAR)0)
  223. typedef BYTE  BOOLEAN;
  224. typedef BOOLEAN *PBOOLEAN;
  225. //
  226. //  Doubly linked list structure.  Can be used as either a list head, or
  227. //  as link words.
  228. //
  229.  
  230. typedef struct _LIST_ENTRY {
  231.    struct _LIST_ENTRY *Flink;
  232.    struct _LIST_ENTRY *Blink;
  233. } LIST_ENTRY;
  234. typedef LIST_ENTRY *PLIST_ENTRY;
  235.  
  236. //
  237. //  Singly linked list structure. Can be used as either a list head, or
  238. //  as link words.
  239. //
  240.  
  241. typedef struct _SINGLE_LIST_ENTRY {
  242.     struct _SINGLE_LIST_ENTRY *Next;
  243. } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
  244. #define MINCHAR     0x80
  245. #define MAXCHAR     0x7f
  246. #define MINSHORT    0x8000
  247. #define MAXSHORT    0x7fff
  248. #define MINLONG     0x80000000
  249. #define MAXLONG     0x7fffffff
  250. #define MAXBYTE     0xff
  251. #define MAXWORD     0xffff
  252. #define MAXDWORD    0xffffffff
  253. //
  254. // Calculate the byte offset of a field in a structure of type type.
  255. //
  256.  
  257. #define FIELD_OFFSET(type, field)    ((LONG)&(((type *)0)->field))
  258.  
  259.  
  260. //
  261. // Calculate the address of the base of the structure given its type, and an
  262. // address of a field within the structure.
  263. //
  264.  
  265. #define CONTAINING_RECORD(address, type, field) ((type *)( \
  266.                                                   (PCHAR)(address) - \
  267.                                                   (PCHAR)(&((type *)0)->field)))
  268.  
  269. #define HEAP_NO_SERIALIZE               0x00000001      
  270. #define HEAP_GENERATE_EXCEPTIONS        0x00000004      
  271. #define HEAP_ZERO_MEMORY                0x00000008
  272. #define HEAP_REALLOC_IN_PLACE_ONLY        0x00000010
  273.  
  274. /*
  275.  *  Language IDs.
  276.  *
  277.  *  The following two combinations of primary language ID and
  278.  *  sublanguage ID have special semantics:
  279.  *
  280.  *    Primary Language ID   Sublanguage ID      Result
  281.  *    -------------------   ---------------     ------------------------
  282.  *    LANG_NEUTRAL          SUBLANG_NEUTRAL     Language neutral
  283.  *    LANG_NEUTRAL          SUBLANG_DEFAULT     User default language
  284.  *    LANG_NEUTRAL          SUBLANG_SYS_DEFAULT System default language
  285.  */
  286.  
  287. /*
  288.  *  Primary language IDs.
  289.  */
  290. #define LANG_NEUTRAL                     0x00
  291.  
  292. #define LANG_ARABIC                              0x01
  293. #define LANG_BULGARIAN                   0x02
  294. #define LANG_CHINESE                     0x04
  295. #define LANG_CROATIAN                    0x1a
  296. #define LANG_CZECH                       0x05
  297. #define LANG_DANISH                      0x06
  298. #define LANG_DUTCH                       0x13
  299. #define LANG_ENGLISH                     0x09
  300. #define LANG_FINNISH                     0x0b
  301. #define LANG_FRENCH                      0x0c
  302. #define LANG_GERMAN                      0x07
  303. #define LANG_GREEK                       0x08
  304. #define LANG_HEBREW                              0x0D
  305. #define LANG_HUNGARIAN                   0x0e
  306. #define LANG_ICELANDIC                   0x0f
  307. #define LANG_ITALIAN                     0x10
  308. #define LANG_JAPANESE                    0x11
  309. #define LANG_KOREAN                      0x12
  310. #define LANG_NORWEGIAN                   0x14
  311. #define LANG_POLISH                      0x15
  312. #define LANG_PORTUGUESE                  0x16
  313. #define LANG_ROMANIAN                    0x18
  314. #define LANG_RUSSIAN                     0x19
  315. #define LANG_SLOVAK                      0x1b
  316. #define LANG_SLOVENIAN                   0x24
  317. #define LANG_SPANISH                     0x0a
  318. #define LANG_SWEDISH                     0x1d
  319. #define LANG_TURKISH                     0x1f
  320.  
  321. /*
  322.  *  Sublanguage IDs.
  323.  *
  324.  *  The name immediately following SUBLANG_ dictates which primary
  325.  *  language ID that sublanguage ID can be combined with to form a
  326.  *  valid language ID.
  327.  */
  328. #define SUBLANG_NEUTRAL                  0x00    /* language neutral */
  329. #define SUBLANG_DEFAULT                  0x01    /* user default */
  330. #define SUBLANG_SYS_DEFAULT              0x02    /* system default */
  331.  
  332. #define SUBLANG_CHINESE_TRADITIONAL      0x01    /* Chinese (Taiwan) */
  333. #define SUBLANG_CHINESE_SIMPLIFIED       0x02    /* Chinese (PR China) */
  334. #define SUBLANG_CHINESE_HONGKONG         0x03    /* Chinese (Hong Kong) */
  335. #define SUBLANG_CHINESE_SINGAPORE        0x04    /* Chinese (Singapore) */
  336. #define SUBLANG_DUTCH                    0x01    /* Dutch */
  337. #define SUBLANG_DUTCH_BELGIAN            0x02    /* Dutch (Belgian) */
  338. #define SUBLANG_ENGLISH_US               0x01    /* English (USA) */
  339. #define SUBLANG_ENGLISH_UK               0x02    /* English (UK) */
  340. #define SUBLANG_ENGLISH_AUS              0x03    /* English (Australian) */
  341. #define SUBLANG_ENGLISH_CAN              0x04    /* English (Canadian) */
  342. #define SUBLANG_ENGLISH_NZ               0x05    /* English (New Zealand) */
  343. #define SUBLANG_ENGLISH_EIRE             0x06    /* English (Irish) */
  344. #define SUBLANG_FRENCH                   0x01    /* French */
  345. #define SUBLANG_FRENCH_BELGIAN           0x02    /* French (Belgian) */
  346. #define SUBLANG_FRENCH_CANADIAN          0x03    /* French (Canadian) */
  347. #define SUBLANG_FRENCH_SWISS             0x04    /* French (Swiss) */
  348. #define SUBLANG_GERMAN                   0x01    /* German */
  349. #define SUBLANG_GERMAN_SWISS             0x02    /* German (Swiss) */
  350. #define SUBLANG_GERMAN_AUSTRIAN          0x03    /* German (Austrian) */
  351. #define SUBLANG_ITALIAN                  0x01    /* Italian */
  352. #define SUBLANG_ITALIAN_SWISS            0x02    /* Italian (Swiss) */
  353. #define SUBLANG_NORWEGIAN_BOKMAL         0x01    /* Norwegian (Bokmal) */
  354. #define SUBLANG_NORWEGIAN_NYNORSK        0x02    /* Norwegian (Nynorsk) */
  355. #define SUBLANG_PORTUGUESE               0x02    /* Portuguese */
  356. #define SUBLANG_PORTUGUESE_BRAZILIAN     0x01    /* Portuguese (Brazilian) */
  357. #define SUBLANG_SPANISH                  0x01    /* Spanish (Castilian) */
  358. #define SUBLANG_SPANISH_MEXICAN          0x02    /* Spanish (Mexican) */
  359. #define SUBLANG_SPANISH_MODERN           0x03    /* Spanish (Modern) */
  360.  
  361. /*
  362.  *  Sorting IDs.
  363.  *
  364.  */
  365. #define SORT_DEFAULT                     0x0     /* sorting default */
  366.  
  367. #define SORT_JAPANESE_XJIS               0x0     /* Japanese XJIS order */
  368. #define SORT_JAPANESE_UNICODE            0x1     /* Japanese Unicode order */
  369.  
  370. #define SORT_CHINESE_BIG5                0x0     /* Chinese BIG5 order */
  371. #define SORT_CHINESE_UNICODE             0x1     /* Chinese Unicode order */
  372. #define SORT_CHINESE_PRC                 0x2     // PRC Chinese Stroke Count order
  373.  
  374. #define SORT_KOREAN_KSC                  0x0     /* Korean KSC order */
  375. #define SORT_KOREAN_UNICODE              0x1     /* Korean Unicode order */
  376.  
  377.  
  378. /*
  379.  *  A language ID is a 16 bit value which is the combination of a
  380.  *  primary language ID and a secondary language ID.  The bits are
  381.  *  allocated as follows:
  382.  *
  383.  *       +-----------------------+-------------------------+
  384.  *       |     Sublanguage ID    |   Primary Language ID   |
  385.  *       +-----------------------+-------------------------+
  386.  *        15                   10 9                       0   bit
  387.  *
  388.  *
  389.  *  Language ID creation/extraction macros:
  390.  *
  391.  *    MAKELANGID    - construct language id from a primary language id and
  392.  *                    a sublanguage id.
  393.  *    PRIMARYLANGID - extract primary language id from a language id.
  394.  *    SUBLANGID     - extract sublanguage id from a language id.
  395.  */
  396. #define MAKELANGID(p, s)       ((((WORD  )(s)) << 10) | (WORD  )(p))
  397. #define PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
  398. #define SUBLANGID(lgid)        ((WORD  )(lgid) >> 10)
  399.  
  400. /*
  401.  *  A locale ID is a 32 bit value which is the combination of a
  402.  *  language ID, a sort ID, and a reserved area.  The bits are
  403.  *  allocated as follows:
  404.  *
  405.  *       +-------------+---------+-------------------------+
  406.  *       |   Reserved  | Sort ID |      Language ID        |
  407.  *       +-------------+---------+-------------------------+
  408.  *        31         20 19     16 15                      0   bit
  409.  *
  410.  *
  411.  *  Locale ID creation/extraction macros:
  412.  *
  413.  *    MAKELCID       - construct locale id from a language id and a sort id.
  414.  *    LANGIDFROMLCID - extract language id from a locale id.
  415.  *    SORTIDFROMLCID - extract sort id from a locale id.
  416.  */
  417. #define NLS_VALID_LOCALE_MASK  0x000fffff
  418.  
  419. #define MAKELCID(lgid, srtid)  ((DWORD)((((DWORD)((WORD  )(srtid))) << 16) |  \
  420.                                          ((DWORD)((WORD  )(lgid)))))
  421. #define LANGIDFROMLCID(lcid)   ((WORD  )(lcid))
  422. #define SORTIDFROMLCID(lcid)   ((WORD  )((((DWORD)(lcid)) & NLS_VALID_LOCALE_MASK) >> 16))
  423.  
  424. /*
  425.  *  Default System and User IDs for language and locale.
  426.  */
  427. #define LANG_SYSTEM_DEFAULT    (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
  428. #define LANG_USER_DEFAULT      (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
  429.  
  430. #define LOCALE_SYSTEM_DEFAULT  (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
  431. #define LOCALE_USER_DEFAULT    (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
  432.  
  433. #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
  434.  
  435. // begin_ntminiport begin_ntndis
  436.  
  437. //
  438. // Macros used to eliminate compiler warning generated when formal
  439. // parameters or local variables are not declared.
  440. //
  441. // Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet
  442. // referenced but will be once the module is completely developed.
  443. //
  444. // Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet
  445. // referenced but will be once the module is completely developed.
  446. //
  447. // Use UNREFERENCED_PARAMETER() if a parameter will never be referenced.
  448. //
  449. // DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will
  450. // eventually be made into a null macro to help determine whether there
  451. // is unfinished work.
  452. //
  453.  
  454. #if ! (defined(lint) || defined(_lint))
  455. #define UNREFERENCED_PARAMETER(P)          (P)
  456. #define DBG_UNREFERENCED_PARAMETER(P)      (P)
  457. #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V)
  458.  
  459. #else // lint or _lint
  460.  
  461. // Note: lint -e530 says don't complain about uninitialized variables for
  462. // this.  line +e530 turns that checking back on.  Error 527 has to do with
  463. // unreachable code.
  464.  
  465. #define UNREFERENCED_PARAMETER(P)          \
  466.     /*lint -e527 -e530 */ \
  467.     { \
  468.         (P) = (P); \
  469.     } \
  470.     /*lint +e527 +e530 */
  471. #define DBG_UNREFERENCED_PARAMETER(P)      \
  472.     /*lint -e527 -e530 */ \
  473.     { \
  474.         (P) = (P); \
  475.     } \
  476.     /*lint +e527 +e530 */
  477. #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \
  478.     /*lint -e527 -e530 */ \
  479.     { \
  480.         (V) = (V); \
  481.     } \
  482.     /*lint +e527 +e530 */
  483.  
  484. #endif // lint or _lint
  485.  
  486.  
  487. /*lint -save -e767 */
  488. #define STATUS_SUCCESS                   ((DWORD   )0x00000000L)
  489. #define STATUS_UNSUCCESSFUL              ((DWORD   )0xC0000001L)
  490. #define STATUS_WAIT_0                    ((DWORD   )0x00000000L)
  491. #define STATUS_ABANDONED_WAIT_0          ((DWORD   )0x00000080L)
  492. #define STATUS_USER_APC                  ((DWORD   )0x000000C0L)
  493. #define STATUS_TIMEOUT                   ((DWORD   )0x00000102L)
  494. #define STATUS_PENDING                   ((DWORD   )0x00000103L)
  495. #define STATUS_GUARD_PAGE_VIOLATION      ((DWORD   )0x80000001L)
  496. #define STATUS_DATATYPE_MISALIGNMENT     ((DWORD   )0x80000002L)
  497. #define STATUS_BREAKPOINT                ((DWORD   )0x80000003L)
  498. #define STATUS_SINGLE_STEP               ((DWORD   )0x80000004L)
  499. #define STATUS_ACCESS_VIOLATION          ((DWORD   )0xC0000005L)
  500. #define STATUS_IN_PAGE_ERROR             ((DWORD   )0xC0000006L)
  501. #define STATUS_INVALID_PARAMETER         ((DWORD   )0xC000000DL)
  502. #define STATUS_NO_MEMORY                 ((DWORD   )0xC0000017L)
  503. #define STATUS_INVALID_SYSTEM_SERVICE      ((DWORD   )0xC000001CL)
  504. #define STATUS_ILLEGAL_INSTRUCTION       ((DWORD   )0xC000001DL)
  505. #define STATUS_NONCONTINUABLE_EXCEPTION  ((DWORD   )0xC0000025L)
  506. #define STATUS_INVALID_DISPOSITION       ((DWORD   )0xC0000026L)
  507. #define STATUS_ARRAY_BOUNDS_EXCEEDED     ((DWORD   )0xC000008CL)
  508. #define STATUS_FLOAT_DENORMAL_OPERAND    ((DWORD   )0xC000008DL)
  509. #define STATUS_FLOAT_DIVIDE_BY_ZERO      ((DWORD   )0xC000008EL)
  510. #define STATUS_FLOAT_INEXACT_RESULT      ((DWORD   )0xC000008FL)
  511. #define STATUS_FLOAT_INVALID_OPERATION   ((DWORD   )0xC0000090L)
  512. #define STATUS_FLOAT_OVERFLOW            ((DWORD   )0xC0000091L)
  513. #define STATUS_FLOAT_STACK_CHECK         ((DWORD   )0xC0000092L)
  514. #define STATUS_FLOAT_UNDERFLOW           ((DWORD   )0xC0000093L)
  515. #define STATUS_INTEGER_DIVIDE_BY_ZERO    ((DWORD   )0xC0000094L)
  516. #define STATUS_INTEGER_OVERFLOW          ((DWORD   )0xC0000095L)
  517. #define STATUS_PRIVILEGED_INSTRUCTION    ((DWORD   )0xC0000096L)
  518. #define STATUS_STACK_OVERFLOW            ((DWORD   )0xC00000FDL)
  519. #define STATUS_USER_BREAK                ((DWORD   )0x80000113L)
  520. #define STATUS_CONTROL_C_EXIT            ((DWORD   )0xC000013AL)
  521. #define STATUS_INSTRUCTION_MISALIGNMENT  ((DWORD   )0xC00000AAL)
  522. /*lint -restore */
  523. #define MAXIMUM_WAIT_OBJECTS 64     // Maximum number of wait objects
  524.  
  525. #define MAXIMUM_SUSPEND_COUNT MAXCHAR // Maximum times thread can be suspended
  526. typedef DWORD KSPIN_LOCK;
  527.  
  528. #if defined(x86)  || defined(_X86_)
  529.  
  530. //
  531. // Disable these two pramas that evaluate to "sti" "cli" on x86 so that driver
  532. // writers to not leave them inadvertantly in their code.
  533. //
  534.  
  535. #if !defined(MIDL_PASS)
  536. #if !defined(RC_INVOKED)
  537.  
  538. #pragma warning(disable:4164)   // disable C4164 warning so that apps that
  539.                                 // build with /Od don't get weird errors !
  540. #ifdef _M_IX86
  541. #pragma function(_enable)
  542. #pragma function(_disable)
  543. #endif
  544.  
  545. #pragma warning(default:4164)   // reenable C4164 warning
  546.  
  547. #endif
  548. #endif
  549.  
  550.  
  551. //
  552. //  Define the size of the 80387 save area, which is in the context frame.
  553. //
  554.  
  555. #define SIZE_OF_80387_REGISTERS      80
  556.  
  557. //
  558. // The following flags control the contents of the CONTEXT structure.
  559. //
  560.  
  561. #define CONTEXT_i386    0x00010000    // this assumes that i386 and
  562. #define CONTEXT_i486    0x00010000    // i486 have identical context records
  563.  
  564. #define CONTEXT_CONTROL         (CONTEXT_i386 | 0x00000001L) // SS:SP, CS:IP, FLAGS, BP
  565. #define CONTEXT_INTEGER         (CONTEXT_i386 | 0x00000002L) // AX, BX, CX, DX, SI, DI
  566. #define CONTEXT_SEGMENTS        (CONTEXT_i386 | 0x00000004L) // DS, ES, FS, GS
  567. #define CONTEXT_FLOATING_POINT  (CONTEXT_i386 | 0x00000008L) // 387 state
  568. #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) // DB 0-3,6,7
  569.  
  570. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |\
  571.                       CONTEXT_SEGMENTS)
  572.  
  573. typedef struct _FLOATING_SAVE_AREA {
  574.     DWORD   ControlWord;
  575.     DWORD   StatusWord;
  576.     DWORD   TagWord;
  577.     DWORD   ErrorOffset;
  578.     DWORD   ErrorSelector;
  579.     DWORD   DataOffset;
  580.     DWORD   DataSelector;
  581.     BYTE    RegisterArea[SIZE_OF_80387_REGISTERS];
  582.     DWORD   Cr0NpxState;
  583. } FLOATING_SAVE_AREA;
  584.  
  585. typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA;
  586.  
  587. //
  588. // Context Frame
  589. //
  590. //  This frame has a several purposes: 1) it is used as an argument to
  591. //  NtContinue, 2) is is used to constuct a call frame for APC delivery,
  592. //  and 3) it is used in the user level thread creation routines.
  593. //
  594. //  The layout of the record conforms to a standard call frame.
  595. //
  596.  
  597. typedef struct _CONTEXT {
  598.  
  599.     //
  600.     // The flags values within this flag control the contents of
  601.     // a CONTEXT record.
  602.     //
  603.     // If the context record is used as an input parameter, then
  604.     // for each portion of the context record controlled by a flag
  605.     // whose value is set, it is assumed that that portion of the
  606.     // context record contains valid context. If the context record
  607.     // is being used to modify a threads context, then only that
  608.     // portion of the threads context will be modified.
  609.     //
  610.     // If the context record is used as an IN OUT parameter to capture
  611.     // the context of a thread, then only those portions of the thread's
  612.     // context corresponding to set flags will be returned.
  613.     //
  614.     // The context record is never used as an OUT only parameter.
  615.     //
  616.  
  617.     DWORD ContextFlags;
  618.  
  619.     //
  620.     // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
  621.     // set in ContextFlags.  Note that CONTEXT_DEBUG_REGISTERS is NOT
  622.     // included in CONTEXT_FULL.
  623.     //
  624.  
  625.     DWORD   Dr0;
  626.     DWORD   Dr1;
  627.     DWORD   Dr2;
  628.     DWORD   Dr3;
  629.     DWORD   Dr6;
  630.     DWORD   Dr7;
  631.  
  632.     //
  633.     // This section is specified/returned if the
  634.     // ContextFlags word contians the flag CONTEXT_FLOATING_POINT.
  635.     //
  636.  
  637.     FLOATING_SAVE_AREA FloatSave;
  638.  
  639.     //
  640.     // This section is specified/returned if the
  641.     // ContextFlags word contians the flag CONTEXT_SEGMENTS.
  642.     //
  643.  
  644.     DWORD   SegGs;
  645.     DWORD   SegFs;
  646.     DWORD   SegEs;
  647.     DWORD   SegDs;
  648.  
  649.     //
  650.     // This section is specified/returned if the
  651.     // ContextFlags word contians the flag CONTEXT_INTEGER.
  652.     //
  653.  
  654.     DWORD   Edi;
  655.     DWORD   Esi;
  656.     DWORD   Ebx;
  657.     DWORD   Edx;
  658.     DWORD   Ecx;
  659.     DWORD   Eax;
  660.  
  661.     //
  662.     // This section is specified/returned if the
  663.     // ContextFlags word contians the flag CONTEXT_CONTROL.
  664.     //
  665.  
  666.     DWORD   Ebp;
  667.     DWORD   Eip;
  668.     DWORD   SegCs;              // MUST BE SANITIZED
  669.     DWORD   EFlags;             // MUST BE SANITIZED
  670.     DWORD   Esp;
  671.     DWORD   SegSs;
  672.  
  673. } CONTEXT;
  674.  
  675.  
  676.  
  677. typedef CONTEXT *PCONTEXT;
  678.  
  679. // begin_ntminiport
  680.  
  681. #endif //_X86_
  682.  
  683. typedef struct _LDT_ENTRY {
  684.     WORD    LimitLow;
  685.     WORD    BaseLow;
  686.     union {
  687.         struct {
  688.             BYTE    BaseMid;
  689.             BYTE    Flags1;     // Declare as bytes to avoid alignment
  690.             BYTE    Flags2;     // Problems.
  691.             BYTE    BaseHi;
  692.         } Bytes;
  693.         struct {
  694.             DWORD   BaseMid : 8;
  695.             DWORD   Type : 5;
  696.             DWORD   Dpl : 2;
  697.             DWORD   Pres : 1;
  698.             DWORD   LimitHi : 4;
  699.             DWORD   Sys : 1;
  700.             DWORD   Reserved_0 : 1;
  701.             DWORD   Default_Big : 1;
  702.             DWORD   Granularity : 1;
  703.             DWORD   BaseHi : 8;
  704.         } Bits;
  705.     } HighWord;
  706. } LDT_ENTRY, *PLDT_ENTRY;
  707.  
  708.  
  709. #if defined(SHx)
  710.  
  711. //These are the debug or break registers on the SH3
  712. typedef struct _DEBUG_REGISTERS {
  713.     ULONG  BarA;
  714.     UCHAR  BasrA;
  715.     UCHAR  BamrA;
  716.     USHORT BbrA;
  717.     ULONG  BarB;
  718.     UCHAR  BasrB;
  719.     UCHAR  BamrB;
  720.     USHORT BbrB;
  721.     ULONG  BdrB;
  722.     ULONG  BdmrB;
  723.     USHORT Brcr;
  724.     USHORT Align;
  725. } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
  726.  
  727. //
  728. // The following flags control the contents of the CONTEXT structure.
  729. //
  730.  
  731. #define CONTEXT_SH3        0x00000040
  732. #define CONTEXT_SH4        0x000000c0    // CONTEXT_SH3 | 0x80 - must contain the SH3 bits
  733.  
  734. #ifdef SH3
  735. #define CONTEXT_CONTROL         (CONTEXT_SH3 | 0x00000001L)
  736. #define CONTEXT_INTEGER         (CONTEXT_SH3 | 0x00000002L)
  737. #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
  738. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
  739. #else    // SH4
  740. #define CONTEXT_CONTROL         (CONTEXT_SH4 | 0x00000001L)
  741. #define CONTEXT_INTEGER         (CONTEXT_SH4 | 0x00000002L)
  742. #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
  743. #define CONTEXT_FLOATING_POINT  (CONTEXT_SH4 | 0x00000004L)
  744. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
  745. #endif
  746. //
  747. // Context Frame
  748. //
  749. //  This frame is used to store a limited processor context into the
  750. // Thread structure for CPUs which have no floating point support.
  751. //
  752.  
  753. typedef struct _CONTEXT {
  754.     //
  755.     // The flags values within this flag control the contents of
  756.     // a CONTEXT record.
  757.     //
  758.     // If the context record is used as an input parameter, then
  759.     // for each portion of the context record controlled by a flag
  760.     // whose value is set, it is assumed that that portion of the
  761.     // context record contains valid context. If the context record
  762.     // is being used to modify a thread's context, then only that
  763.     // portion of the threads context will be modified.
  764.     //
  765.     // If the context record is used as an IN OUT parameter to capture
  766.     // the context of a thread, then only those portions of the thread's
  767.     // context corresponding to set flags will be returned.
  768.     //
  769.     // The context record is never used as an OUT only parameter.
  770.     //
  771.  
  772.     ULONG ContextFlags;
  773.  
  774.     //
  775.     // This section is specified/returned if the ContextFlags word contains
  776.     // the flag CONTEXT_INTEGER.
  777.     //
  778.     // N.B. The registers RA and R15 are defined in this section, but are
  779.     //  considered part of the control context rather than part of the integer
  780.     //  context.
  781.     //
  782.  
  783.     ULONG PR;
  784.     ULONG MACH;
  785.     ULONG MACL;
  786.     ULONG GBR;
  787.     ULONG R0;
  788.     ULONG R1;
  789.     ULONG R2;
  790.     ULONG R3;
  791.     ULONG R4;
  792.     ULONG R5;
  793.     ULONG R6;
  794.     ULONG R7;
  795.     ULONG R8;
  796.     ULONG R9;
  797.     ULONG R10;
  798.     ULONG R11;
  799.     ULONG R12;
  800.     ULONG R13;
  801.     ULONG R14;
  802.     ULONG R15;
  803.  
  804.     //
  805.     // This section is specified/returned if the ContextFlags word contains
  806.     // the flag CONTEXT_CONTROL.
  807.     //
  808.     // N.B. The registers r15 and ra are defined in the integer section,
  809.     //   but are considered part of the control context rather than part of
  810.     //   the integer context.
  811.     //
  812.  
  813.     ULONG Fir;
  814.     ULONG Psr;
  815.  
  816. #if !defined(SH3e) && !defined(SH4)
  817.     ULONG    OldStuff[2];
  818.     DEBUG_REGISTERS DebugRegisters;
  819. #else
  820.     ULONG    Fpscr;
  821.     ULONG    Fpul;
  822.     ULONG    FRegs[16];
  823. #if defined(SH4)
  824.     ULONG    xFRegs[16];
  825. #endif
  826. #endif
  827. } CONTEXT;
  828.  
  829. typedef CONTEXT *PCONTEXT;
  830.  
  831. #endif // SHx
  832.  
  833.  
  834. #if defined(MIPS)
  835.  
  836. // begin_ntddk begin_nthal
  837. //
  838. // The following flags control the contents of the CONTEXT structure.
  839. //
  840.  
  841. #define CONTEXT_R4000   0x00010000    // r4000 context
  842.  
  843. #define CONTEXT_CONTROL         (CONTEXT_R4000 | 0x00000001L)
  844. #define CONTEXT_FLOATING_POINT  (CONTEXT_R4000 | 0x00000002L)
  845. #define CONTEXT_INTEGER         (CONTEXT_R4000 | 0x00000004L)
  846.  
  847. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
  848.  
  849. //
  850. // Context Frame
  851. //
  852. //  N.B. This frame must be exactly a multiple of 16 bytes in length.
  853. //
  854. //  This frame has a several purposes: 1) it is used as an argument to
  855. //  NtContinue, 2) it is used to constuct a call frame for APC delivery,
  856. //  3) it is used to construct a call frame for exception dispatching
  857. //  in user mode, and 4) it is used in the user level thread creation
  858. //  routines.
  859. //
  860. //  The layout of the record conforms to a standard call frame.
  861. //
  862.  
  863. typedef struct _CONTEXT {
  864.  
  865.     //
  866.     // This section is always present and is used as an argument build
  867.     // area.
  868.     //
  869.  
  870.     DWORD Argument[4];
  871.  
  872.     //
  873.     // This section is specified/returned if the ContextFlags word contains
  874.     // the flag CONTEXT_FLOATING_POINT.
  875.     //
  876.  
  877.     DWORD FltF0;
  878.     DWORD FltF1;
  879.     DWORD FltF2;
  880.     DWORD FltF3;
  881.     DWORD FltF4;
  882.     DWORD FltF5;
  883.     DWORD FltF6;
  884.     DWORD FltF7;
  885.     DWORD FltF8;
  886.     DWORD FltF9;
  887.     DWORD FltF10;
  888.     DWORD FltF11;
  889.     DWORD FltF12;
  890.     DWORD FltF13;
  891.     DWORD FltF14;
  892.     DWORD FltF15;
  893.     DWORD FltF16;
  894.     DWORD FltF17;
  895.     DWORD FltF18;
  896.     DWORD FltF19;
  897.     DWORD FltF20;
  898.     DWORD FltF21;
  899.     DWORD FltF22;
  900.     DWORD FltF23;
  901.     DWORD FltF24;
  902.     DWORD FltF25;
  903.     DWORD FltF26;
  904.     DWORD FltF27;
  905.     DWORD FltF28;
  906.     DWORD FltF29;
  907.     DWORD FltF30;
  908.     DWORD FltF31;
  909.  
  910.     //
  911.     // This section is specified/returned if the ContextFlags word contains
  912.     // the flag CONTEXT_INTEGER.
  913.     //
  914.     // N.B. The registers gp, sp, and ra are defined in this section, but are
  915.     //  considered part of the control context rather than part of the integer
  916.     //  context.
  917.     //
  918.     // N.B. Register zero is not stored in the frame.
  919.     //
  920.  
  921.     DWORD IntZero;
  922.     DWORD IntAt;
  923.     DWORD IntV0;
  924.     DWORD IntV1;
  925.     DWORD IntA0;
  926.     DWORD IntA1;
  927.     DWORD IntA2;
  928.     DWORD IntA3;
  929.     DWORD IntT0;
  930.     DWORD IntT1;
  931.     DWORD IntT2;
  932.     DWORD IntT3;
  933.     DWORD IntT4;
  934.     DWORD IntT5;
  935.     DWORD IntT6;
  936.     DWORD IntT7;
  937.     DWORD IntS0;
  938.     DWORD IntS1;
  939.     DWORD IntS2;
  940.     DWORD IntS3;
  941.     DWORD IntS4;
  942.     DWORD IntS5;
  943.     DWORD IntS6;
  944.     DWORD IntS7;
  945.     DWORD IntT8;
  946.     DWORD IntT9;
  947.     DWORD IntK0;
  948.     DWORD IntK1;
  949.     DWORD IntGp;
  950.     DWORD IntSp;
  951.     DWORD IntS8;
  952.     DWORD IntRa;
  953.     DWORD IntLo;
  954.     DWORD IntHi;
  955.  
  956.     //
  957.     // This section is specified/returned if the ContextFlags word contains
  958.     // the flag CONTEXT_FLOATING_POINT.
  959.     //
  960.  
  961.     DWORD Fsr;
  962.  
  963.     //
  964.     // This section is specified/returned if the ContextFlags word contains
  965.     // the flag CONTEXT_CONTROL.
  966.     //
  967.     // N.B. The registers gp, sp, and ra are defined in the integer section,
  968.     //   but are considered part of the control context rather than part of
  969.     //   the integer context.
  970.     //
  971.  
  972.     DWORD Fir;
  973.     DWORD Psr;
  974.  
  975.     //
  976.     // The flags values within this flag control the contents of
  977.     // a CONTEXT record.
  978.     //
  979.     // If the context record is used as an input parameter, then
  980.     // for each portion of the context record controlled by a flag
  981.     // whose value is set, it is assumed that that portion of the
  982.     // context record contains valid context. If the context record
  983.     // is being used to modify a thread's context, then only that
  984.     // portion of the threads context will be modified.
  985.     //
  986.     // If the context record is used as an IN OUT parameter to capture
  987.     // the context of a thread, then only those portions of the thread's
  988.     // context corresponding to set flags will be returned.
  989.     //
  990.     // The context record is never used as an OUT only parameter.
  991.     //
  992.  
  993.     DWORD ContextFlags;
  994.  
  995.     DWORD Fill[2];
  996. } CONTEXT, *PCONTEXT;
  997.  
  998. // end_ntddk end_nthal
  999.  
  1000. #endif // MIPS
  1001.  
  1002.  
  1003. #if defined(MIPS)
  1004.  
  1005. VOID
  1006. __jump_unwind (
  1007.     PVOID Fp,
  1008.     PVOID TargetPc
  1009.     );
  1010.  
  1011. #endif // MIPS
  1012.  
  1013.  
  1014. #if defined(PPC)
  1015.  
  1016. // begin_ntddk begin_nthal
  1017. //
  1018. // The following flags control the contents of the CONTEXT structure.
  1019. //
  1020.  
  1021. #define CONTEXT_CONTROL         0x00000001L
  1022. #define CONTEXT_FLOATING_POINT  0x00000002L
  1023. #define CONTEXT_INTEGER         0x00000004L
  1024. #define CONTEXT_DEBUG_REGISTERS 0x00000008L
  1025.  
  1026. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
  1027.  
  1028. //
  1029. // Context Frame
  1030. //
  1031. //  N.B. This frame must be exactly a multiple of 16 bytes in length.
  1032. //
  1033. //  This frame has a several purposes: 1) it is used as an argument to
  1034. //  NtContinue, 2) it is used to constuct a call frame for APC delivery,
  1035. //  3) it is used to construct a call frame for exception dispatching
  1036. //  in user mode, and 4) it is used in the user level thread creation
  1037. //  routines.
  1038. //
  1039. //  Requires at least 8-byte alignment (double)
  1040. //
  1041.  
  1042. typedef struct _CONTEXT {
  1043.  
  1044.     //
  1045.     // This section is specified/returned if the ContextFlags word contains
  1046.     // the flag CONTEXT_FLOATING_POINT.
  1047.     //
  1048.  
  1049.     double Fpr0;                        // Floating registers 0..31
  1050.     double Fpr1;
  1051.     double Fpr2;
  1052.     double Fpr3;
  1053.     double Fpr4;
  1054.     double Fpr5;
  1055.     double Fpr6;
  1056.     double Fpr7;
  1057.     double Fpr8;
  1058.     double Fpr9;
  1059.     double Fpr10;
  1060.     double Fpr11;
  1061.     double Fpr12;
  1062.     double Fpr13;
  1063.     double Fpr14;
  1064.     double Fpr15;
  1065.     double Fpr16;
  1066.     double Fpr17;
  1067.     double Fpr18;
  1068.     double Fpr19;
  1069.     double Fpr20;
  1070.     double Fpr21;
  1071.     double Fpr22;
  1072.     double Fpr23;
  1073.     double Fpr24;
  1074.     double Fpr25;
  1075.     double Fpr26;
  1076.     double Fpr27;
  1077.     double Fpr28;
  1078.     double Fpr29;
  1079.     double Fpr30;
  1080.     double Fpr31;
  1081.     double Fpscr;                       // Floating point status/control reg
  1082.  
  1083.     //
  1084.     // This section is specified/returned if the ContextFlags word contains
  1085.     // the flag CONTEXT_INTEGER.
  1086.     //
  1087.  
  1088.     DWORD Gpr0;                         // General registers 0..31
  1089.     DWORD Gpr1;
  1090.     DWORD Gpr2;
  1091.     DWORD Gpr3;
  1092.     DWORD Gpr4;
  1093.     DWORD Gpr5;
  1094.     DWORD Gpr6;
  1095.     DWORD Gpr7;
  1096.     DWORD Gpr8;
  1097.     DWORD Gpr9;
  1098.     DWORD Gpr10;
  1099.     DWORD Gpr11;
  1100.     DWORD Gpr12;
  1101.     DWORD Gpr13;
  1102.     DWORD Gpr14;
  1103.     DWORD Gpr15;
  1104.     DWORD Gpr16;
  1105.     DWORD Gpr17;
  1106.     DWORD Gpr18;
  1107.     DWORD Gpr19;
  1108.     DWORD Gpr20;
  1109.     DWORD Gpr21;
  1110.     DWORD Gpr22;
  1111.     DWORD Gpr23;
  1112.     DWORD Gpr24;
  1113.     DWORD Gpr25;
  1114.     DWORD Gpr26;
  1115.     DWORD Gpr27;
  1116.     DWORD Gpr28;
  1117.     DWORD Gpr29;
  1118.     DWORD Gpr30;
  1119.     DWORD Gpr31;
  1120.  
  1121.     DWORD Cr;                           // Condition register
  1122.     DWORD Xer;                          // Fixed point exception register
  1123.  
  1124.     //
  1125.     // This section is specified/returned if the ContextFlags word contains
  1126.     // the flag CONTEXT_CONTROL.
  1127.     //
  1128.  
  1129.     DWORD Msr;                          // Machine status register
  1130.     DWORD Iar;                          // Instruction address register
  1131.     DWORD Lr;                           // Link register
  1132.     DWORD Ctr;                          // Count register
  1133.  
  1134.     //
  1135.     // The flags values within this flag control the contents of
  1136.     // a CONTEXT record.
  1137.     //
  1138.     // If the context record is used as an input parameter, then
  1139.     // for each portion of the context record controlled by a flag
  1140.     // whose value is set, it is assumed that that portion of the
  1141.     // context record contains valid context. If the context record
  1142.     // is being used to modify a thread's context, then only that
  1143.     // portion of the threads context will be modified.
  1144.     //
  1145.     // If the context record is used as an IN OUT parameter to capture
  1146.     // the context of a thread, then only those portions of the thread's
  1147.     // context corresponding to set flags will be returned.
  1148.     //
  1149.     // The context record is never used as an OUT only parameter.
  1150.     //
  1151.  
  1152.     DWORD ContextFlags;
  1153.  
  1154.     DWORD Fill[3];                      // Pad out to multiple of 16 bytes
  1155.  
  1156.     //
  1157.     // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
  1158.     // set in ContextFlags.  Note that CONTEXT_DEBUG_REGISTERS is NOT
  1159.     // included in CONTEXT_FULL.
  1160.     //
  1161.     DWORD Dr0;                          // Breakpoint Register 1
  1162.     DWORD Dr1;                          // Breakpoint Register 2
  1163.     DWORD Dr2;                          // Breakpoint Register 3
  1164.     DWORD Dr3;                          // Breakpoint Register 4
  1165.     DWORD Dr4;                          // Breakpoint Register 5
  1166.     DWORD Dr5;                          // Breakpoint Register 6
  1167.     DWORD Dr6;                          // Debug Status Register
  1168.     DWORD Dr7;                          // Debug Control Register
  1169.  
  1170. } CONTEXT, *PCONTEXT;
  1171.  
  1172. // end_ntddk end_nthal
  1173.  
  1174.  
  1175. //
  1176. // Stack frame header
  1177. //
  1178. //   Order of appearance in stack frame:
  1179. //      Header (six words)
  1180. //      Parameters (at least eight words)
  1181. //      Local variables
  1182. //      Saved GPRs
  1183. //      Saved FPRs
  1184. //
  1185. //   Minimum alignment is 8 bytes
  1186.  
  1187. typedef struct _STACK_FRAME_HEADER {    // GPR 1 points here
  1188.     DWORD BackChain;                    // Addr of previous frame
  1189.     DWORD Reserved1;                    // Reserved
  1190.  
  1191.     DWORD Parameter0;                   // First 8 parameter words are
  1192.     DWORD Parameter1;                   //   always present
  1193.     DWORD Parameter2;
  1194.     DWORD Parameter3;
  1195.     DWORD Parameter4;
  1196.     DWORD Parameter5;
  1197.     DWORD Parameter6;
  1198.     DWORD Parameter7;
  1199.  
  1200. } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
  1201.  
  1202. #endif // PPC
  1203.  
  1204.  
  1205. #if defined(ARM)
  1206. //
  1207. // The following flags control the contents of the CONTEXT structure.
  1208. //
  1209.  
  1210. #define CONTEXT_ARM    0x0000040
  1211. #define CONTEXT_CONTROL         (CONTEXT_ARM | 0x00000001L)
  1212. #define CONTEXT_INTEGER         (CONTEXT_ARM | 0x00000002L)
  1213.  
  1214. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
  1215.  
  1216. //
  1217. // Context Frame
  1218. //
  1219. //  This frame is used to store a limited processor context into the
  1220. // Thread structure for CPUs which have no floating point support.
  1221. //
  1222.  
  1223. typedef struct _CONTEXT {
  1224.     //
  1225.     // The flags values within this flag control the contents of
  1226.     // a CONTEXT record.
  1227.     //
  1228.     // If the context record is used as an input parameter, then
  1229.     // for each portion of the context record controlled by a flag
  1230.     // whose value is set, it is assumed that that portion of the
  1231.     // context record contains valid context. If the context record
  1232.     // is being used to modify a thread's context, then only that
  1233.     // portion of the threads context will be modified.
  1234.     //
  1235.     // If the context record is used as an IN OUT parameter to capture
  1236.     // the context of a thread, then only those portions of the thread's
  1237.     // context corresponding to set flags will be returned.
  1238.     //
  1239.     // The context record is never used as an OUT only parameter.
  1240.     //
  1241.  
  1242.     ULONG ContextFlags;
  1243.  
  1244.     //
  1245.     // This section is specified/returned if the ContextFlags word contains
  1246.     // the flag CONTEXT_INTEGER.
  1247.     //
  1248.     ULONG R0;
  1249.     ULONG R1;
  1250.     ULONG R2;
  1251.     ULONG R3;
  1252.     ULONG R4;
  1253.     ULONG R5;
  1254.     ULONG R6;
  1255.     ULONG R7;
  1256.     ULONG R8;
  1257.     ULONG R9;
  1258.     ULONG R10;
  1259.     ULONG R11;
  1260.     ULONG R12;
  1261.  
  1262.     //
  1263.     // This section is specified/returned if the ContextFlags word contains
  1264.     // the flag CONTEXT_CONTROL.
  1265.     //
  1266.     ULONG Sp;
  1267.     ULONG Lr;
  1268.     ULONG Pc;
  1269.     ULONG Psr;
  1270. } CONTEXT;
  1271.  
  1272. typedef CONTEXT *PCONTEXT;
  1273.  
  1274. #endif // ARM
  1275.  
  1276.  
  1277. #if defined(PPC)
  1278.  
  1279. // **FINISH** This may need alteration for PowerPC
  1280.  
  1281. VOID
  1282. __jump_unwind (
  1283.     PVOID Fp,
  1284.     PVOID TargetPc
  1285.     );
  1286.  
  1287. #endif // PPC
  1288.  
  1289. #define EXCEPTION_NONCONTINUABLE 0x1    // Noncontinuable exception
  1290. #define EXCEPTION_UNWINDING 0x2         // Unwind is in progress
  1291. #define EXCEPTION_EXIT_UNWIND 0x4       // Exit unwind is in progress
  1292. #define EXCEPTION_STACK_INVALID 0x8     // Stack out of limits or unaligned
  1293. #define EXCEPTION_NESTED_CALL 0x10      // Nested exception handler call
  1294. #define EXCEPTION_TARGET_UNWIND 0x20    // Target unwind in progress
  1295. #define EXCEPTION_COLLIDED_UNWIND 0x40  // Collided exception handler call
  1296.  
  1297. #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \
  1298.                           EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND)
  1299.  
  1300. #define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
  1301. #define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0)
  1302. #define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
  1303.  
  1304. #define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
  1305.  
  1306. //
  1307. // Exception record definition.
  1308. //
  1309.  
  1310. typedef struct _EXCEPTION_RECORD {
  1311.     /*lint -e18 */  // Don't complain about different definitions
  1312.     DWORD    ExceptionCode;
  1313.     /*lint +e18 */  // Resume checking for different definitions
  1314.     DWORD ExceptionFlags;
  1315.     struct _EXCEPTION_RECORD *ExceptionRecord;
  1316.     PVOID ExceptionAddress;
  1317.     DWORD NumberParameters;
  1318.     DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
  1319.     } EXCEPTION_RECORD;
  1320.  
  1321. typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
  1322.  
  1323. //
  1324. // Typedef for pointer returned by exception_info()
  1325. //
  1326.  
  1327. typedef struct _EXCEPTION_POINTERS {
  1328.     PEXCEPTION_RECORD ExceptionRecord;
  1329.     PCONTEXT ContextRecord;
  1330. } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
  1331. #define PROCESS_TERMINATE         (0x0001)
  1332. #define PROCESS_CREATE_THREAD     (0x0002)
  1333. #define PROCESS_VM_OPERATION      (0x0008)
  1334. #define PROCESS_VM_READ           (0x0010)
  1335. #define PROCESS_VM_WRITE          (0x0020)
  1336. #define PROCESS_DUP_HANDLE        (0x0040)
  1337. #define PROCESS_CREATE_PROCESS    (0x0080)
  1338. #define PROCESS_SET_QUOTA         (0x0100)
  1339. #define PROCESS_SET_INFORMATION   (0x0200)
  1340. #define PROCESS_QUERY_INFORMATION (0x0400)
  1341. #define PROCESS_ALL_ACCESS        (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
  1342.                                    0xFFF)
  1343.  
  1344. #define THREAD_TERMINATE               (0x0001)
  1345. #define THREAD_SUSPEND_RESUME          (0x0002)
  1346. #define THREAD_GET_CONTEXT             (0x0008)
  1347. #define THREAD_SET_CONTEXT             (0x0010)
  1348. #define THREAD_SET_INFORMATION         (0x0020)
  1349. #define THREAD_QUERY_INFORMATION       (0x0040)
  1350. #define THREAD_SET_THREAD_TOKEN        (0x0080)
  1351. #define THREAD_IMPERSONATE             (0x0100)
  1352. #define THREAD_DIRECT_IMPERSONATION    (0x0200)
  1353. // begin_ntddk
  1354.  
  1355. #define THREAD_ALL_ACCESS         (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
  1356.                                    0x3FF)
  1357.  
  1358. // end_ntddk
  1359. #define TLS_MINIMUM_AVAILABLE 64
  1360. #define THREAD_BASE_PRIORITY_LOWRT  15  // value that gets a thread to LowRealtime-1
  1361. #define THREAD_BASE_PRIORITY_MAX    2   // maximum thread base priority boost
  1362. #define THREAD_BASE_PRIORITY_MIN    -2  // minimum thread base priority boost
  1363. #define THREAD_BASE_PRIORITY_IDLE   -15 // value that gets a thread to idle
  1364. #define EVENT_MODIFY_STATE      0x0002
  1365. #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
  1366. #define MUTANT_QUERY_STATE      0x0001
  1367.  
  1368. #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|\
  1369.                           MUTANT_QUERY_STATE)
  1370. #define SEMAPHORE_MODIFY_STATE      0x0002
  1371. #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
  1372. #define TIME_ZONE_ID_UNKNOWN  0
  1373. #define TIME_ZONE_ID_STANDARD 1
  1374. #define TIME_ZONE_ID_DAYLIGHT 2
  1375.  
  1376. #define PROCESSOR_ARCHITECTURE_INTEL 0
  1377. #define PROCESSOR_ARCHITECTURE_MIPS  1
  1378. #define PROCESSOR_ARCHITECTURE_ALPHA 2
  1379. #define PROCESSOR_ARCHITECTURE_PPC   3
  1380. #define PROCESSOR_ARCHITECTURE_SHx   4
  1381. #define PROCESSOR_ARCHITECTURE_ARM   5
  1382. #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
  1383.  
  1384. #define PROCESSOR_INTEL_386     386
  1385. #define PROCESSOR_INTEL_486     486
  1386. #define PROCESSOR_INTEL_PENTIUM 586
  1387. #define PROCESSOR_INTEL_860     860
  1388. #define PROCESSOR_MIPS_R2000    2000
  1389. #define PROCESSOR_MIPS_R3000    3000
  1390. #define PROCESSOR_MIPS_R4000    4000
  1391. #define PROCESSOR_HITACHI_SH3    10003
  1392. #define PROCESSOR_HITACHI_SH4    10005
  1393. #define PROCESSOR_ALPHA_21064   21064
  1394. #define PROCESSOR_PPC_601       601
  1395. #define PROCESSOR_PPC_603       603
  1396. #define PROCESSOR_PPC_604       604
  1397. #define PROCESSOR_PPC_620       620
  1398. #define PROCESSOR_PPC_821       821
  1399. #define PROCESSOR_SHx_SH3        103
  1400. #define PROCESSOR_SHx_SH4        104
  1401. #define PROCESSOR_STRONGARM        2577    // 0xA11
  1402. #define PROCESSOR_ARM720        1824    // 0x720
  1403. #define PROCESSOR_ARM820        2080    // 0x820
  1404. #define PROCESSOR_ARM920        2336    // 0x920
  1405.  
  1406. typedef struct _MEMORY_BASIC_INFORMATION {
  1407.     PVOID BaseAddress;
  1408.     PVOID AllocationBase;
  1409.     DWORD AllocationProtect;
  1410.     DWORD RegionSize;
  1411.     DWORD State;
  1412.     DWORD Protect;
  1413.     DWORD Type;
  1414. } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
  1415. #define SECTION_QUERY       0x0001
  1416. #define SECTION_MAP_WRITE   0x0002
  1417. #define SECTION_MAP_READ    0x0004
  1418. #define SECTION_MAP_EXECUTE 0x0008
  1419. #define SECTION_EXTEND_SIZE 0x0010
  1420.  
  1421. #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\
  1422.                             SECTION_MAP_WRITE |      \
  1423.                             SECTION_MAP_READ |       \
  1424.                             SECTION_MAP_EXECUTE |    \
  1425.                             SECTION_EXTEND_SIZE)
  1426. #define PAGE_NOACCESS          0x01
  1427. #define PAGE_READONLY          0x02
  1428. #define PAGE_READWRITE         0x04
  1429. #define PAGE_WRITECOPY         0x08
  1430. #define PAGE_EXECUTE           0x10
  1431. #define PAGE_EXECUTE_READ      0x20
  1432. #define PAGE_EXECUTE_READWRITE 0x40
  1433. #define PAGE_EXECUTE_WRITECOPY 0x80
  1434. #define PAGE_GUARD            0x100
  1435. #define PAGE_NOCACHE          0x200
  1436. #define PAGE_PHYSICAL          0x400
  1437. #define MEM_COMMIT           0x1000
  1438. #define MEM_RESERVE          0x2000
  1439. #define MEM_DECOMMIT         0x4000
  1440. #define MEM_RELEASE          0x8000
  1441. #define MEM_FREE            0x10000
  1442. #define MEM_PRIVATE         0x20000
  1443. #define MEM_MAPPED          0x40000
  1444. #define MEM_TOP_DOWN       0x100000
  1445. #define MEM_AUTO_COMMIT    0x200000
  1446. #define SEC_FILE           0x800000
  1447. #define SEC_IMAGE         0x1000000
  1448. #define SEC_RESERVE       0x4000000
  1449. #define SEC_COMMIT        0x8000000
  1450. #define SEC_NOCACHE      0x10000000
  1451. #define MEM_IMAGE         SEC_IMAGE
  1452.  
  1453. // Subsystem Values
  1454.  
  1455. #define IMAGE_SUBSYSTEM_UNKNOWN              0   // Unknown subsystem.
  1456. #define IMAGE_SUBSYSTEM_NATIVE               1   // Image doesn't require a subsystem.
  1457. #define IMAGE_SUBSYSTEM_WINDOWS_GUI          2   // Image runs in the Windows GUI subsystem.
  1458. #define IMAGE_SUBSYSTEM_WINDOWS_CUI          3   // Image runs in the Windows character subsystem.
  1459. #define IMAGE_SUBSYSTEM_WINDOWS_OLD_CE_GUI   4   // Image runs in the Windows CE GUI subsystem (obsolete).
  1460. #define IMAGE_SUBSYSTEM_OS2_CUI              5   // image runs in the OS/2 character subsystem.
  1461. #define IMAGE_SUBSYSTEM_POSIX_CUI            7   // image run  in the Posix character subsystem.
  1462. #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI         9     // Image runs in the Windows CE GUI subsystem.
  1463.  
  1464. //
  1465. // Define access rights to files and directories
  1466. //
  1467.  
  1468. //
  1469. // The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in
  1470. // devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these
  1471. // constants *MUST* always be in sync.
  1472. // The values are redefined in devioctl.h because they must be available to
  1473. // both DOS and NT.
  1474. //
  1475.  
  1476. #define FILE_READ_DATA            ( 0x0001 )    // file & pipe
  1477. #define FILE_LIST_DIRECTORY       ( 0x0001 )    // directory
  1478.  
  1479. #define FILE_WRITE_DATA           ( 0x0002 )    // file & pipe
  1480. #define FILE_ADD_FILE             ( 0x0002 )    // directory
  1481.  
  1482. #define FILE_APPEND_DATA          ( 0x0004 )    // file
  1483. #define FILE_ADD_SUBDIRECTORY     ( 0x0004 )    // directory
  1484. #define FILE_CREATE_PIPE_INSTANCE ( 0x0004 )    // named pipe
  1485.  
  1486. #define FILE_READ_EA              ( 0x0008 )    // file & directory
  1487. #define FILE_READ_PROPERTIES      FILE_READ_EA
  1488.  
  1489. #define FILE_WRITE_EA             ( 0x0010 )    // file & directory
  1490. #define FILE_WRITE_PROPERTIES     FILE_WRITE_EA
  1491.  
  1492. #define FILE_EXECUTE              ( 0x0020 )    // file
  1493. #define FILE_TRAVERSE             ( 0x0020 )    // directory
  1494.  
  1495. #define FILE_DELETE_CHILD         ( 0x0040 )    // directory
  1496.  
  1497. #define FILE_READ_ATTRIBUTES      ( 0x0080 )    // all
  1498.  
  1499. #define FILE_WRITE_ATTRIBUTES     ( 0x0100 )    // all
  1500.  
  1501. #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF)
  1502.  
  1503. #define FILE_GENERIC_READ         (STANDARD_RIGHTS_READ     |\
  1504.                                    FILE_READ_DATA           |\
  1505.                                    FILE_READ_ATTRIBUTES     |\
  1506.                                    FILE_READ_EA             |\
  1507.                                    SYNCHRONIZE)
  1508.  
  1509.  
  1510. #define FILE_GENERIC_WRITE        (STANDARD_RIGHTS_WRITE    |\
  1511.                                    FILE_WRITE_DATA          |\
  1512.                                    FILE_WRITE_ATTRIBUTES    |\
  1513.                                    FILE_WRITE_EA            |\
  1514.                                    FILE_APPEND_DATA         |\
  1515.                                    SYNCHRONIZE)
  1516.  
  1517.  
  1518. #define FILE_GENERIC_EXECUTE      (STANDARD_RIGHTS_EXECUTE  |\
  1519.                                    FILE_READ_ATTRIBUTES     |\
  1520.                                    FILE_EXECUTE             |\
  1521.                                    SYNCHRONIZE)
  1522.  
  1523. #define FILE_SHARE_READ                 0x00000001
  1524. #define FILE_SHARE_WRITE                0x00000002
  1525. #define FILE_ATTRIBUTE_READONLY         0x00000001
  1526. #define FILE_ATTRIBUTE_HIDDEN           0x00000002
  1527. #define FILE_ATTRIBUTE_SYSTEM           0x00000004
  1528. #define FILE_ATTRIBUTE_DIRECTORY        0x00000010
  1529. #define FILE_ATTRIBUTE_ARCHIVE          0x00000020
  1530. #define FILE_ATTRIBUTE_INROM            0x00000040
  1531. #define FILE_ATTRIBUTE_NORMAL           0x00000080
  1532. #define FILE_ATTRIBUTE_TEMPORARY        0x00000100
  1533. #define FILE_ATTRIBUTE_ATOMIC_WRITE     0x00000200
  1534. #define FILE_ATTRIBUTE_XACTION_WRITE    0x00000400
  1535. #define FILE_ATTRIBUTE_COMPRESSED       0x00000800
  1536. #define FILE_ATTRIBUTE_ROMSTATICREF        0x00001000
  1537. #define FILE_ATTRIBUTE_ROMMODULE        0x00002000
  1538. #define FILE_NOTIFY_CHANGE_FILE_NAME    0x00000001
  1539. #define FILE_NOTIFY_CHANGE_DIR_NAME     0x00000002
  1540. #define FILE_NOTIFY_CHANGE_ATTRIBUTES   0x00000004
  1541. #define FILE_NOTIFY_CHANGE_SIZE         0x00000008
  1542. #define FILE_NOTIFY_CHANGE_LAST_WRITE   0x00000010
  1543. #define FILE_NOTIFY_CHANGE_SECURITY     0x00000100
  1544. #define MAILSLOT_NO_MESSAGE             ((DWORD)-1)
  1545. #define MAILSLOT_WAIT_FOREVER           ((DWORD)-1)
  1546. #define FILE_CASE_SENSITIVE_SEARCH      0x00000001
  1547. #define FILE_CASE_PRESERVED_NAMES       0x00000002
  1548. #define FILE_UNICODE_ON_DISK            0x00000004
  1549. #define FILE_PERSISTENT_ACLS            0x00000008
  1550. #define FILE_FILE_COMPRESSION           0x00000010
  1551. #define FILE_VOLUME_IS_COMPRESSED       0x00008000
  1552. #define IO_COMPLETION_MODIFY_STATE  0x0002
  1553. #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
  1554. #define DUPLICATE_CLOSE_SOURCE      0x00000001
  1555. #define DUPLICATE_SAME_ACCESS       0x00000002
  1556. typedef PVOID PACCESS_TOKEN;
  1557. typedef PVOID PSECURITY_DESCRIPTOR;
  1558. typedef PVOID PSID;
  1559.  
  1560.  
  1561. ////////////////////////////////////////////////////////////////////////
  1562. //                                                                    //
  1563. //                             ACCESS MASK                            //
  1564. //                                                                    //
  1565. ////////////////////////////////////////////////////////////////////////
  1566.  
  1567. //
  1568. //  Define the access mask as a longword sized structure divided up as
  1569. //  follows:
  1570. //
  1571. //       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  1572. //       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
  1573. //      +---------------+---------------+-------------------------------+
  1574. //      |G|G|G|G|Res'd|A| StandardRights|         SpecificRights        |
  1575. //      |R|W|E|A|     |S|               |                               |
  1576. //      +-+-------------+---------------+-------------------------------+
  1577. //
  1578. //      typedef struct _ACCESS_MASK {
  1579. //          WORD   SpecificRights;
  1580. //          BYTE  StandardRights;
  1581. //          BYTE  AccessSystemAcl : 1;
  1582. //          BYTE  Reserved : 3;
  1583. //          BYTE  GenericAll : 1;
  1584. //          BYTE  GenericExecute : 1;
  1585. //          BYTE  GenericWrite : 1;
  1586. //          BYTE  GenericRead : 1;
  1587. //      } ACCESS_MASK;
  1588. //      typedef ACCESS_MASK *PACCESS_MASK;
  1589. //
  1590. //  but to make life simple for programmer's we'll allow them to specify
  1591. //  a desired access mask by simply OR'ing together mulitple single rights
  1592. //  and treat an access mask as a DWORD.  For example
  1593. //
  1594. //      DesiredAccess = DELETE | READ_CONTROL
  1595. //
  1596. //  So we'll declare ACCESS_MASK as DWORD
  1597. //
  1598.  
  1599. // begin_ntddk begin_nthal begin_ntifs
  1600. typedef DWORD ACCESS_MASK;
  1601. typedef ACCESS_MASK *PACCESS_MASK;
  1602.  
  1603.  
  1604. ////////////////////////////////////////////////////////////////////////
  1605. //                                                                    //
  1606. //                             ACCESS TYPES                           //
  1607. //                                                                    //
  1608. ////////////////////////////////////////////////////////////////////////
  1609.  
  1610.  
  1611. // begin_ntddk begin_nthal begin_ntifs
  1612. //
  1613. //  The following are masks for the predefined standard access types
  1614. //
  1615.  
  1616. #define DELETE                           (0x00010000L)
  1617. #define READ_CONTROL                     (0x00020000L)
  1618. #define WRITE_DAC                        (0x00040000L)
  1619. #define WRITE_OWNER                      (0x00080000L)
  1620. #define SYNCHRONIZE                      (0x00100000L)
  1621.  
  1622. #define STANDARD_RIGHTS_REQUIRED         (0x000F0000L)
  1623.  
  1624. #define STANDARD_RIGHTS_READ             (READ_CONTROL)
  1625. #define STANDARD_RIGHTS_WRITE            (READ_CONTROL)
  1626. #define STANDARD_RIGHTS_EXECUTE          (READ_CONTROL)
  1627.  
  1628. #define STANDARD_RIGHTS_ALL              (0x001F0000L)
  1629.  
  1630. #define SPECIFIC_RIGHTS_ALL              (0x0000FFFFL)
  1631.  
  1632. //
  1633. // AccessSystemAcl access type
  1634. //
  1635.  
  1636. #define ACCESS_SYSTEM_SECURITY           (0x01000000L)
  1637.  
  1638. //
  1639. // MaximumAllowed access type
  1640. //
  1641.  
  1642. #define MAXIMUM_ALLOWED                  (0x02000000L)
  1643.  
  1644. //
  1645. //  These are the generic rights.
  1646. //
  1647.  
  1648. #define GENERIC_READ                     (0x80000000L)
  1649. #define GENERIC_WRITE                    (0x40000000L)
  1650. #define GENERIC_EXECUTE                  (0x20000000L)
  1651. #define GENERIC_ALL                      (0x10000000L)
  1652.  
  1653.  
  1654. //
  1655. //  Define the generic mapping array.  This is used to denote the
  1656. //  mapping of each generic access right to a specific access mask.
  1657. //
  1658.  
  1659. typedef struct _GENERIC_MAPPING {
  1660.     ACCESS_MASK GenericRead;
  1661.     ACCESS_MASK GenericWrite;
  1662.     ACCESS_MASK GenericExecute;
  1663.     ACCESS_MASK GenericAll;
  1664. } GENERIC_MAPPING;
  1665. typedef GENERIC_MAPPING *PGENERIC_MAPPING;
  1666.  
  1667. #define DLL_PROCESS_ATTACH 1
  1668. #define DLL_THREAD_ATTACH  2
  1669. #define DLL_THREAD_DETACH  3
  1670. #define DLL_PROCESS_DETACH 0
  1671. #define DLL_PROCESS_EXITING 4
  1672. #define DLL_SYSTEM_STARTED 5
  1673. #define DLL_MEMORY_LOW 6
  1674.  
  1675. #define DBG_CONTINUE                    ((DWORD   )0x00010002L) 
  1676. #define DBG_EXCEPTION_NOT_HANDLED       ((DWORD   )0x80010001L) 
  1677.  
  1678. // begin_ntddk begin_nthal
  1679. //
  1680. // Registry Specific Access Rights.
  1681. //
  1682.  
  1683. #define KEY_QUERY_VALUE         (0x0001)
  1684. #define KEY_SET_VALUE           (0x0002)
  1685. #define KEY_CREATE_SUB_KEY      (0x0004)
  1686. #define KEY_ENUMERATE_SUB_KEYS  (0x0008)
  1687. #define KEY_NOTIFY              (0x0010)
  1688. #define KEY_CREATE_LINK         (0x0020)
  1689.  
  1690. #define KEY_READ                ((STANDARD_RIGHTS_READ       |\
  1691.                                   KEY_QUERY_VALUE            |\
  1692.                                   KEY_ENUMERATE_SUB_KEYS     |\
  1693.                                   KEY_NOTIFY)                 \
  1694.                                   &                           \
  1695.                                  (~SYNCHRONIZE))
  1696.  
  1697.  
  1698. #define KEY_WRITE               ((STANDARD_RIGHTS_WRITE      |\
  1699.                                   KEY_SET_VALUE              |\
  1700.                                   KEY_CREATE_SUB_KEY)         \
  1701.                                   &                           \
  1702.                                  (~SYNCHRONIZE))
  1703.  
  1704. #define KEY_EXECUTE             ((KEY_READ)                   \
  1705.                                   &                           \
  1706.                                  (~SYNCHRONIZE))
  1707.  
  1708. #define KEY_ALL_ACCESS          ((STANDARD_RIGHTS_ALL        |\
  1709.                                   KEY_QUERY_VALUE            |\
  1710.                                   KEY_SET_VALUE              |\
  1711.                                   KEY_CREATE_SUB_KEY         |\
  1712.                                   KEY_ENUMERATE_SUB_KEYS     |\
  1713.                                   KEY_NOTIFY                 |\
  1714.                                   KEY_CREATE_LINK)            \
  1715.                                   &                           \
  1716.                                  (~SYNCHRONIZE))
  1717.  
  1718. //
  1719. // Open/Create Options
  1720. //
  1721.  
  1722. #define REG_OPTION_RESERVED         (0x00000000L)   // Parameter is reserved
  1723.  
  1724. #define REG_OPTION_NON_VOLATILE     (0x00000000L)   // Key is preserved
  1725.                                                     // when system is rebooted
  1726.  
  1727. #define REG_OPTION_VOLATILE         (0x00000001L)   // Key is not preserved
  1728.                                                     // when system is rebooted
  1729.  
  1730. #define REG_OPTION_CREATE_LINK      (0x00000002L)   // Created key is a
  1731.                                                     // symbolic link
  1732.  
  1733. #define REG_OPTION_BACKUP_RESTORE   (0x00000004L)   // open for backup or restore
  1734.                                                     // special access rules
  1735.                                                     // privilege required
  1736.  
  1737. #define REG_LEGAL_OPTION            \
  1738.                 (REG_OPTION_RESERVED            |\
  1739.                  REG_OPTION_NON_VOLATILE        |\
  1740.                  REG_OPTION_VOLATILE            |\
  1741.                  REG_OPTION_CREATE_LINK         |\
  1742.                  REG_OPTION_BACKUP_RESTORE)
  1743.  
  1744. //
  1745. // Key creation/open disposition
  1746. //
  1747.  
  1748. #define REG_CREATED_NEW_KEY         (0x00000001L)   // New Registry Key created
  1749. #define REG_OPENED_EXISTING_KEY     (0x00000002L)   // Existing Key opened
  1750.  
  1751. //
  1752. // Key restore flags
  1753. //
  1754.  
  1755. #define REG_WHOLE_HIVE_VOLATILE     (0x00000001L)   // Restore whole hive volatile
  1756. #define REG_REFRESH_HIVE            (0x00000002L)   // Unwind changes to last flush
  1757.  
  1758. // end_ntddk end_nthal
  1759.  
  1760. //
  1761. // Notify filter values
  1762. //
  1763. #define REG_NOTIFY_CHANGE_NAME          (0x00000001L) // Create or delete (child)
  1764. #define REG_NOTIFY_CHANGE_ATTRIBUTES    (0x00000002L)
  1765. #define REG_NOTIFY_CHANGE_LAST_SET      (0x00000004L) // time stamp
  1766. #define REG_NOTIFY_CHANGE_SECURITY      (0x00000008L)
  1767.  
  1768. #define REG_LEGAL_CHANGE_FILTER                 \
  1769.                 (REG_NOTIFY_CHANGE_NAME          |\
  1770.                  REG_NOTIFY_CHANGE_ATTRIBUTES    |\
  1771.                  REG_NOTIFY_CHANGE_LAST_SET      |\
  1772.                  REG_NOTIFY_CHANGE_SECURITY)
  1773.  
  1774. //
  1775. //
  1776. // Predefined Value Types.
  1777. //
  1778.  
  1779. #define REG_NONE                    ( 0 )   // No value type
  1780. #define REG_SZ                      ( 1 )   // Unicode nul terminated string
  1781. #define REG_EXPAND_SZ               ( 2 )   // Unicode nul terminated string
  1782.                                             // (with environment variable references)
  1783. #define REG_BINARY                  ( 3 )   // Free form binary
  1784. #define REG_DWORD                   ( 4 )   // 32-bit number
  1785. #define REG_DWORD_LITTLE_ENDIAN     ( 4 )   // 32-bit number (same as REG_DWORD)
  1786. #define REG_DWORD_BIG_ENDIAN        ( 5 )   // 32-bit number
  1787. #define REG_LINK                    ( 6 )   // Symbolic Link (unicode)
  1788. #define REG_MULTI_SZ                ( 7 )   // Multiple Unicode strings
  1789. #define REG_RESOURCE_LIST           ( 8 )   // Resource list in the resource map
  1790. #define REG_FULL_RESOURCE_DESCRIPTOR ( 9 )  // Resource list in the hardware description
  1791. #define REG_RESOURCE_REQUIREMENTS_LIST ( 10 )
  1792.  
  1793. #ifdef __cplusplus
  1794. }
  1795. #endif
  1796.  
  1797. #endif /* _WINNT_ */
  1798.  
  1799.