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.

124 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1993 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. Wesley Witt (wesw) 26-Aug-1993
  10. Environment:
  11. User Mode
  12. --*/
  13. #include "pch.h"
  14. #pragma hdrstop
  15. #include <ntverp.h>
  16. #include <imagehlp.h>
  17. //
  18. // globals
  19. //
  20. EXT_API_VERSION ApiVersion = { (VER_PRODUCTVERSION_W >> 8), (VER_PRODUCTVERSION_W & 0xff), EXT_API_VERSION_NUMBER64, 0 };
  21. WINDBG_EXTENSION_APIS ExtensionApis;
  22. USHORT SavedMajorVersion;
  23. USHORT SavedMinorVersion;
  24. ULONG STeip;
  25. ULONG STebp;
  26. ULONG STesp;
  27. DllInit(
  28. HANDLE hModule,
  29. DWORD dwReason,
  30. DWORD dwReserved
  31. )
  32. {
  33. switch (dwReason) {
  34. case DLL_THREAD_ATTACH:
  35. break;
  36. case DLL_THREAD_DETACH:
  37. break;
  38. case DLL_PROCESS_DETACH:
  39. break;
  40. case DLL_PROCESS_ATTACH:
  41. break;
  42. }
  43. return TRUE;
  44. }
  45. VOID
  46. WinDbgExtensionDllInit(
  47. PWINDBG_EXTENSION_APIS64 lpExtensionApis,
  48. USHORT MajorVersion,
  49. USHORT MinorVersion
  50. )
  51. {
  52. ExtensionApis = *lpExtensionApis;
  53. SavedMajorVersion = MajorVersion;
  54. SavedMinorVersion = MinorVersion;
  55. return;
  56. }
  57. DECLARE_API( version )
  58. {
  59. #if DBG
  60. PCHAR DebuggerType = "Checked";
  61. #else
  62. PCHAR DebuggerType = "Free";
  63. #endif
  64. dprintf( "%s Extension dll for Build %d debugging %s kernel for Build %d\n",
  65. DebuggerType,
  66. VER_PRODUCTBUILD,
  67. SavedMajorVersion == 0x0c ? "Checked" : "Free",
  68. SavedMinorVersion
  69. );
  70. }
  71. VOID
  72. CheckVersion(
  73. VOID
  74. )
  75. {
  76. #if DBG
  77. if ((SavedMajorVersion != 0x0c) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  78. dprintf("\r\n*** Extension DLL(%d Checked) does not match target system(%d %s)\r\n\r\n",
  79. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  80. }
  81. #else
  82. if ((SavedMajorVersion != 0x0f) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  83. dprintf("\r\n*** Extension DLL(%d Free) does not match target system(%d %s)\r\n\r\n",
  84. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  85. }
  86. #endif
  87. }
  88. LPEXT_API_VERSION
  89. ExtensionApiVersion(
  90. VOID
  91. )
  92. {
  93. return &ApiVersion;
  94. }