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.

171 lines
3.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999
  5. //
  6. // File: PCH.cxx
  7. //
  8. // Contents: Pre-compiled header
  9. //
  10. // History: 21-Dec-92 BartoszM Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #include <nt.h>
  14. #include <ntrtl.h>
  15. #include <nturtl.h>
  16. #include <windows.h>
  17. #include <ntosp.h>
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <scsi.h>
  22. #include <srb.h>
  23. #define KDEXT_64BIT
  24. #include <wdbgexts.h>
  25. #include <dbgeng.h>
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. //
  30. // undef the wdbgexts
  31. //
  32. #undef DECLARE_API
  33. #define DECLARE_API(extension) \
  34. CPPMOD HRESULT CALLBACK extension(PDEBUG_CLIENT Client, PCSTR args)
  35. #define INIT_API() \
  36. HRESULT Status; \
  37. if ((Status = ExtQuery(Client)) != S_OK) return Status;
  38. // Safe release and NULL.
  39. #define EXT_RELEASE(Unk) \
  40. ((Unk) != NULL ? ((Unk)->Release(), (Unk) = NULL) : NULL)
  41. // Global variables initialized by query.
  42. extern PDEBUG_ADVANCED g_ExtAdvanced;
  43. extern PDEBUG_CLIENT g_ExtClient;
  44. extern PDEBUG_CONTROL g_ExtControl;
  45. extern PDEBUG_DATA_SPACES g_ExtData;
  46. extern PDEBUG_REGISTERS g_ExtRegisters;
  47. extern PDEBUG_SYMBOLS g_ExtSymbols;
  48. extern PDEBUG_SYSTEM_OBJECTS g_ExtSystem;
  49. HRESULT
  50. ExtQuery(PDEBUG_CLIENT Client);
  51. void
  52. ExtRelease(void);
  53. #define EXIT_API ExtRelease
  54. extern WINDBG_EXTENSION_APIS ExtensionApis;
  55. #define SCSIKD_PRINT_ERROR(r)\
  56. dprintf("scsikd error (%x): %s @ line %d\n", (r), __FILE__, __LINE__);
  57. #define RECUR DBG_DUMP_FIELD_RECUR_ON_THIS
  58. #define F_ADDR DBG_DUMP_FIELD_RETURN_ADDRESS
  59. #define COPY DBG_DUMP_FIELD_FULL_NAME | DBG_DUMP_FIELD_COPY_FIELD_DATA | DBG_DUMP_FIELD_RETURN_ADDRESS
  60. #define ADDROF DBG_DUMP_FIELD_RETURN_ADDRESS | DBG_DUMP_FIELD_FULL_NAME
  61. // Stolen from ntrtl.h to override RECOMASSERT
  62. #undef ASSERT
  63. #undef ASSERTMSG
  64. #if DBG
  65. #define ASSERT( exp ) \
  66. if (!(exp)) \
  67. RtlAssert( #exp, __FILE__, __LINE__, NULL )
  68. #define ASSERTMSG( msg, exp ) \
  69. if (!(exp)) \
  70. RtlAssert( #exp, __FILE__, __LINE__, msg )
  71. #else
  72. #define ASSERT( exp )
  73. #define ASSERTMSG( msg, exp )
  74. #endif // DBG
  75. #define OFFSET(struct, elem) ((char *) &(struct->elem) - (char *) struct)
  76. #define _DRIVER
  77. //#define KDBG_EXT
  78. #include "wmistr.h"
  79. #define PRINT_FLAGS(Flags,b) if (Flags & b) {dprintf(#b", ");}
  80. __inline
  81. VOID
  82. xdindent(
  83. ULONG Depth
  84. )
  85. {
  86. ULONG i;
  87. for (i=0; i<Depth; i++)
  88. dprintf(" ");
  89. }
  90. #define xdprintfEx(d, expr)\
  91. xdindent((d));\
  92. dprintf expr
  93. typedef struct {
  94. ULONG Flag;
  95. PUCHAR Name;
  96. } FLAG_NAME, *PFLAG_NAME;
  97. #define FLAG_NAME(flag) {flag, #flag}
  98. PUCHAR
  99. DevicePowerStateToString(
  100. IN DEVICE_POWER_STATE State
  101. );
  102. PUCHAR
  103. SystemPowerStateToString(
  104. IN DEVICE_POWER_STATE State
  105. );
  106. VOID
  107. xdprintf(
  108. ULONG Depth,
  109. PCCHAR S,
  110. ...
  111. );
  112. VOID
  113. DumpFlags(
  114. ULONG Depth,
  115. PUCHAR Name,
  116. ULONG Flags,
  117. PFLAG_NAME FlagTable
  118. );
  119. BOOLEAN
  120. GetAnsiString(
  121. IN ULONG64 Address,
  122. IN PUCHAR Buffer,
  123. IN OUT PULONG Length
  124. );
  125. PCHAR
  126. GuidToString(
  127. GUID* GUID
  128. );
  129. ULONG64
  130. GetDeviceExtension(
  131. ULONG64 address
  132. );
  133. #ifdef __cplusplus
  134. }
  135. #endif