Source code of Windows XP (NT5)
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.

126 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. kdexts.c
  5. Abstract:
  6. This file contains the generic routines and initialization code
  7. for the kernel debugger extensions dll.
  8. Author:
  9. Keith Moore (keithmo) 17-Jun-1998.
  10. --*/
  11. #include "precomp.h"
  12. // #include <ntverp.h>
  13. // #include <imagehlp.h>
  14. //
  15. // globals
  16. //
  17. EXT_API_VERSION ApiVersion =
  18. {
  19. (VER_PRODUCTVERSION_W >> 8),
  20. (VER_PRODUCTVERSION_W & 0xFF),
  21. EXT_API_VERSION_NUMBER,
  22. 0
  23. };
  24. WINDBG_EXTENSION_APIS ExtensionApis;
  25. USHORT SavedMajorVersion;
  26. USHORT SavedMinorVersion;
  27. //
  28. // Snapshot from the extension routines.
  29. //
  30. HANDLE g_hCurrentProcess;
  31. HANDLE g_hCurrentThread;
  32. ULONG_PTR g_dwCurrentPc;
  33. ULONG g_dwProcessor;
  34. VOID
  35. WinDbgExtensionDllInit(
  36. PWINDBG_EXTENSION_APIS lpExtensionApis,
  37. USHORT MajorVersion,
  38. USHORT MinorVersion
  39. )
  40. {
  41. ExtensionApis = *lpExtensionApis;
  42. SavedMajorVersion = MajorVersion;
  43. SavedMinorVersion = MinorVersion;
  44. }
  45. DECLARE_API( version )
  46. {
  47. #if DBG
  48. PCHAR DebuggerType = "Checked";
  49. #else
  50. PCHAR DebuggerType = "Free";
  51. #endif
  52. SNAPSHOT_EXTENSION_DATA();
  53. dprintf(
  54. "%s Extension dll for Build %s debugging %s kernel for Build %d\n",
  55. DebuggerType,
  56. VER_PRODUCTVERSION_STR,
  57. SavedMajorVersion == 0x0c
  58. ? "Checked"
  59. : "Free",
  60. SavedMinorVersion
  61. );
  62. }
  63. VOID
  64. CheckVersion(
  65. VOID
  66. )
  67. {
  68. #if 0
  69. #if DBG
  70. if ((SavedMajorVersion != 0x0c) || (SavedMinorVersion != VER_PRODUCTBUILD))
  71. {
  72. dprintf(
  73. "\r\n*** Extension DLL(%d Checked) does not match target system(%d %s)\r\n\r\n",
  74. VER_PRODUCTBUILD,
  75. SavedMinorVersion,
  76. (SavedMajorVersion==0x0f)
  77. ? "Free"
  78. : "Checked"
  79. );
  80. }
  81. #else
  82. if ((SavedMajorVersion != 0x0f) || (SavedMinorVersion != VER_PRODUCTBUILD))
  83. {
  84. dprintf(
  85. "\r\n*** Extension DLL(%d Free) does not match target system(%d %s)\r\n\r\n",
  86. VER_PRODUCTBUILD,
  87. SavedMinorVersion,
  88. (SavedMajorVersion==0x0f)
  89. ? "Free"
  90. : "Checked"
  91. );
  92. }
  93. #endif
  94. #endif
  95. }
  96. LPEXT_API_VERSION
  97. ExtensionApiVersion(
  98. VOID
  99. )
  100. {
  101. return &ApiVersion;
  102. }