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.

132 lines
2.7 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1993 - 1999
  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 = {
  21. (VER_PRODUCTVERSION_W >> 8),
  22. (VER_PRODUCTVERSION_W & 0xff),
  23. EXT_API_VERSION_NUMBER,
  24. 0
  25. };
  26. WINDBG_EXTENSION_APIS ExtensionApis;
  27. ULONG STeip;
  28. ULONG STebp;
  29. ULONG STesp;
  30. USHORT SavedMajorVersion;
  31. USHORT SavedMinorVersion;
  32. BOOLEAN VersionWarningAlreadyPrinted = FALSE;
  33. DllInit(
  34. HANDLE hModule,
  35. DWORD dwReason,
  36. DWORD dwReserved
  37. )
  38. {
  39. switch (dwReason) {
  40. case DLL_THREAD_ATTACH:
  41. break;
  42. case DLL_THREAD_DETACH:
  43. break;
  44. case DLL_PROCESS_DETACH:
  45. break;
  46. case DLL_PROCESS_ATTACH:
  47. break;
  48. }
  49. return TRUE;
  50. }
  51. VOID
  52. WinDbgExtensionDllInit(
  53. PWINDBG_EXTENSION_APIS lpExtensionApis,
  54. USHORT MajorVersion,
  55. USHORT MinorVersion
  56. )
  57. {
  58. ExtensionApis = *lpExtensionApis;
  59. SavedMajorVersion = MajorVersion;
  60. SavedMinorVersion = MinorVersion;
  61. return;
  62. }
  63. DECLARE_API( version )
  64. {
  65. #if DBG
  66. PCHAR DebuggerType = "Checked";
  67. #else
  68. PCHAR DebuggerType = "Free";
  69. #endif
  70. dprintf( "%s Extension dll for Build %d debugging %s kernel for Build %d\n",
  71. DebuggerType,
  72. VER_PRODUCTBUILD,
  73. SavedMajorVersion == 0x0c ? "Checked" : "Free",
  74. SavedMinorVersion
  75. );
  76. }
  77. VOID
  78. CheckVersion(
  79. VOID
  80. )
  81. {
  82. if (VersionWarningAlreadyPrinted) {
  83. return;
  84. }
  85. VersionWarningAlreadyPrinted = TRUE;
  86. #if DBG
  87. if ((SavedMajorVersion != 0x0c) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  88. dprintf("\r\n*** RedBook Extension DLL(%d Checked) does not match target system(%d %s)\r\n\r\n",
  89. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  90. }
  91. #else
  92. if ((SavedMajorVersion != 0x0f) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  93. dprintf("\r\n*** RedBook Extension DLL(%d Free) does not match target system(%d %s)\r\n\r\n",
  94. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  95. }
  96. #endif
  97. }
  98. LPEXT_API_VERSION
  99. ExtensionApiVersion(
  100. VOID
  101. )
  102. {
  103. return &ApiVersion;
  104. }