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.

207 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1993-2000 Microsoft Corporation
  3. Module Name:
  4. precomp.hxx
  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. Author:
  9. Environment:
  10. User Mode
  11. --*/
  12. // This is a 64 bit aware debugger extension
  13. #define KDEXT_64BIT
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #include <windows.h>
  18. #include <wdbgexts.h>
  19. // When using the structures in wdbgexts.h UCHARs are
  20. // used. For C++ we need to get the type right.
  21. #define DbgStr(s) (PUCHAR)s
  22. #include <dbgeng.h>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26. #include <guiddef.h>
  27. #include <winddi.h>
  28. #include <wingdi.h>
  29. #include <ddraw.h>
  30. #include <ddrawint.h>
  31. #include "oscompat.hxx"
  32. #define lengthof(a) (sizeof(a)/sizeof(a[0]))
  33. #define GDIModule() "win32k.sys"
  34. #define GDISymbol(sym) "win32k!"#sym
  35. #define GDIType(type) "win32k!"#type
  36. #include "output.hxx"
  37. #include "input.hxx"
  38. #include "extapi.hxx"
  39. #include "array.hxx"
  40. #include "basictypes.hxx"
  41. #include "callback.hxx"
  42. #include "debug.hxx"
  43. #include "dumpers.hxx"
  44. #include "event.hxx"
  45. #include "extparse.hxx"
  46. #include "flags.hxx"
  47. #include "fontexts.hxx"
  48. #include "hmgr.hxx"
  49. #include "math.hxx"
  50. #include "objects.hxx"
  51. #include "process.hxx"
  52. #include "session.hxx"
  53. #include "typeout.hxx"
  54. #include "viewer.hxx"
  55. // DPRINTPP :: address, name, pointer-value, \n
  56. #define DPRINTPP(Pointer,FieldStr,Addr) \
  57. dprintf("[%p] %s %p\n", (Addr + offset) , (FieldStr), Pointer)
  58. // DPRINTPX :: address, name, hex-value, \n
  59. #define DPRINTPX(LongHex,FieldStr,Addr) \
  60. dprintf("[%p] %s 0x%lx\n", (Addr + offset) , (FieldStr), LongHex)
  61. // DPRINTFPD :: address, name dig-value, \n
  62. #define DPRINTPD(Integer,FieldStr,Addr) \
  63. dprintf("[%p] %s %d\n", (Addr + offset), (FieldStr), Integer)
  64. // DPRINTFPS :: address, name (no CR-LF)
  65. #define DPRINTPS(FieldStr,Addr) dprintf("[%p] %s", (Addr + offset), (FieldStr))
  66. typedef struct OPTDEF_ {
  67. char ch; // character in options string
  68. FLONG fl; // corresponding flag
  69. } OPTDEF;
  70. typedef struct ARGINFO_ {
  71. const char *psz; // pointer to original command string
  72. OPTDEF *aod; // pointer to array of option definitions
  73. FLONG fl; // option flags
  74. PVOID pv; // address of structure
  75. } ARGINFO;
  76. typedef struct {
  77. BOOL Valid;
  78. CHAR Type[MAX_PATH];
  79. ULONG64 Module;
  80. ULONG TypeId;
  81. ULONG Size;
  82. } CachedType;
  83. /////////////////////////////////////////////
  84. //
  85. // KdExts.cxx
  86. //
  87. /////////////////////////////////////////////
  88. extern HINSTANCE ghDllInst;
  89. extern BOOL gbVerbose;
  90. #ifdef PAGE_SIZE
  91. #undef PAGE_SIZE
  92. #endif
  93. extern ULONG PageSize;
  94. extern ULONG BuildNo;
  95. extern BOOL NewPool;
  96. extern ULONG PoolBlockShift;
  97. #define _KB (PageSize/1024)
  98. #define POOL_BLOCK_SHIFT_OLD ((PageSize == 0x4000) ? 6 : (((PageSize == 0x2000) || ((BuildNo < 2257) && (PageSize == 0x1000))) ? 5 : 4))
  99. #define POOL_BLOCK_SHIFT_LAB1_2402 ((PageSize == 0x4000) ? 5 : (((PageSize == 0x2000)) ? 4 : 3))
  100. #define POOL_BLOCK_SHIFT PoolBlockShift
  101. #define PAGE_ALIGN64(Va) ((ULONG64)((Va) & ~((ULONG64) (PageSize - 1))))
  102. #define GetBits(from, pos, num) ((from >> pos) & (((ULONG64) ~0) >> (sizeof(ULONG64)*8 - num)))
  103. extern ULONG PageShift;
  104. extern ULONG64 PaeEnabled;
  105. extern ULONG TargetMachine;
  106. extern ULONG TargetClass;
  107. typedef struct {
  108. ULONG64 Base;
  109. ULONG Index;
  110. CHAR Name[MAX_PATH];
  111. CHAR Ext[4];
  112. DEBUG_MODULE_PARAMETERS DbgModParams;
  113. } ModuleParameters;
  114. extern ModuleParameters GDIKM_Module;
  115. extern ModuleParameters GDIUM_Module;
  116. extern ModuleParameters Type_Module;
  117. HRESULT
  118. GetDebugClient(
  119. PDEBUG_CLIENT *pClient
  120. );
  121. void
  122. GetRemoteWindbgExtApis(
  123. PWINDBG_EXTENSION_APIS64 ExtensionApis
  124. );
  125. BOOLEAN
  126. IsCheckedBuild(
  127. PBOOLEAN Checked
  128. );
  129. //
  130. // undef the wdbgexts
  131. //
  132. #undef DECLARE_API
  133. #define DECLARE_API(extension) \
  134. CPPMOD HRESULT CALLBACK extension(PDEBUG_CLIENT Client, PCSTR args)
  135. #define BEGIN_API(extension) InitAPI(Client, #extension);
  136. HRESULT
  137. InitAPI(
  138. PDEBUG_CLIENT Client,
  139. PCSTR ExtName
  140. );
  141. HRESULT
  142. SymbolLoad(
  143. PDEBUG_CLIENT Client
  144. );