Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. precomp.h
  5. Abstract:
  6. This header file is used to cause the correct machine/platform specific
  7. data structures to be used when compiling for a non-hosted platform.
  8. --*/
  9. // This is a 64 bit aware debugger extension
  10. #define KDEXT_64BIT
  11. #include <nt.h>
  12. #include <ntrtl.h>
  13. #include <nturtl.h>
  14. #include <windows.h>
  15. #include <wdbgexts.h>
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include <dbgeng.h>
  20. #define STRSAFE_NO_DEPRECATE
  21. #include <strsafe.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. //
  26. // undef the wdbgexts
  27. //
  28. #undef DECLARE_API
  29. #define DECLARE_API(extension) \
  30. CPPMOD HRESULT CALLBACK extension(PDEBUG_CLIENT Client, PCSTR args)
  31. #define INIT_API() \
  32. HRESULT Status; \
  33. if ((Status = ExtQuery(Client)) != S_OK) return Status;
  34. #define EXIT_API ExtRelease
  35. // Safe release and NULL.
  36. #define EXT_RELEASE(Unk) \
  37. ((Unk) != NULL ? ((Unk)->Release(), (Unk) = NULL) : NULL)
  38. // Global variables initialized by query.
  39. extern PDEBUG_ADVANCED g_ExtAdvanced;
  40. extern PDEBUG_CLIENT g_ExtClient;
  41. extern PDEBUG_CONTROL g_ExtControl;
  42. extern PDEBUG_DATA_SPACES g_ExtData;
  43. extern PDEBUG_REGISTERS g_ExtRegisters;
  44. extern PDEBUG_SYMBOLS2 g_ExtSymbols;
  45. extern PDEBUG_SYSTEM_OBJECTS3 g_ExtSystem;
  46. HRESULT
  47. ExtQuery(PDEBUG_CLIENT Client);
  48. void
  49. ExtRelease(void);
  50. #define PAGE_ALIGN64(Va) ((ULONG64)((Va) & ~((ULONG64) ((LONG64) (LONG) PageSize - 1))))
  51. extern ULONG PageSize;
  52. //-----------------------------------------------------------------------------------------
  53. //
  54. // api declaration macros & api access macros
  55. //
  56. //-----------------------------------------------------------------------------------------
  57. extern WINDBG_EXTENSION_APIS ExtensionApis;
  58. extern ULONG TargetMachine;
  59. extern ULONG g_TargetClass;
  60. extern ULONG g_TargetBuild;
  61. extern ULONG g_Qualifier;
  62. extern ULONG64 g_SharedUserData;
  63. //-----------------------------------------------------------------------------------------
  64. //
  65. // prototypes for internal non-exported support functions
  66. //
  67. //-----------------------------------------------------------------------------------------
  68. HRESULT
  69. GetCurrentProcessor(
  70. IN PDEBUG_CLIENT Client,
  71. OPTIONAL OUT PULONG pProcessor,
  72. OPTIONAL OUT PHANDLE phCurrentThread
  73. );
  74. HRESULT
  75. GetCurrentProcessName(
  76. PSTR ProcessBuffer,
  77. ULONG BufferSIze
  78. );
  79. /////////////////////////////////////////////
  80. //
  81. // sddump.c
  82. //
  83. /////////////////////////////////////////////
  84. ULONG64
  85. GetSidAddr(ULONG64 BaseAddress);
  86. ULONG
  87. GetSidAttributes(ULONG64 BaseAddress);
  88. PCSTR ConvertSidToFriendlyName(IN SID* pSid, IN PCSTR pszFmt);
  89. void ShowSid(IN PCSTR pszPad, IN ULONG64 addrSid, IN ULONG fOptions);
  90. /////////////////////////////////////////////
  91. //
  92. // Util.c
  93. //
  94. /////////////////////////////////////////////
  95. typedef VOID
  96. (*PDUMP_SPLAY_NODE_FN)(
  97. ULONG64 RemoteAddress,
  98. ULONG Level
  99. );
  100. ULONG
  101. DumpSplayTree(
  102. IN ULONG64 pSplayLinks,
  103. IN PDUMP_SPLAY_NODE_FN DumpNodeFn
  104. );
  105. BOOLEAN
  106. DbgRtlIsRightChild(
  107. ULONG64 pLinks,
  108. ULONG64 Parent
  109. );
  110. BOOLEAN
  111. DbgRtlIsLeftChild(
  112. ULONG64 pLinks,
  113. ULONG64 Parent
  114. );
  115. ULONG
  116. GetBitFieldOffset (
  117. IN LPSTR Type,
  118. IN LPSTR Field,
  119. OUT PULONG pOffset,
  120. OUT PULONG pSize
  121. );
  122. ULONG64
  123. GetPointerFromAddress (
  124. ULONG64 Location
  125. );
  126. VOID
  127. DumpUnicode(
  128. UNICODE_STRING u
  129. );
  130. VOID
  131. DumpUnicode64(
  132. UNICODE_STRING64 u
  133. );
  134. ULONG64
  135. GetPointerValue (
  136. PCHAR String
  137. );
  138. BOOLEAN
  139. IsHexNumber(
  140. const char *szExpression
  141. );
  142. BOOLEAN
  143. IsDecNumber(
  144. const char *szExpression
  145. );
  146. VOID DumpImage(
  147. ULONG64 xBase,
  148. BOOL DoHeaders,
  149. BOOL DoSections
  150. );
  151. #ifdef __cplusplus
  152. }
  153. #endif