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.

117 lines
2.6 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. Environment:
  10. User Mode
  11. --*/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. #include <imagehlp.h>
  15. #include <ntdbg.h>
  16. #include <ntsdexts.h>
  17. //#define NOEXTAPI
  18. #include <wdbgexts.h>
  19. #include <ntverp.h>
  20. //#include <stdexts.h>
  21. //
  22. // globals
  23. //
  24. //EXT_API_VERSION ApiVersion = { 3, 5, EXT_API_VERSION_NUMBER, 0 };
  25. EXT_API_VERSION ApiVersion = { 5, 0, EXT_API_VERSION_NUMBER, 0 };
  26. WINDBG_EXTENSION_APIS ExtensionApis;
  27. ULONG STeip;
  28. ULONG STebp;
  29. ULONG STesp;
  30. USHORT SavedMajorVersion;
  31. USHORT SavedMinorVersion;
  32. USHORT usProcessorArchitecture;
  33. BOOL bDebuggingChecked;
  34. PSZ szProcessorArchitecture[] = {
  35. "Intel",
  36. "MIPS",
  37. "Alpha",
  38. "PPC"
  39. };
  40. #define cArchitecture (sizeof(szProcessorArchitecture) / sizeof(PSZ))
  41. VOID
  42. WinDbgExtensionDllInit(
  43. PWINDBG_EXTENSION_APIS lpExtensionApis,
  44. USHORT MajorVersion,
  45. USHORT MinorVersion
  46. )
  47. {
  48. ULONG offKeProcessorArchitecture;
  49. ULONG Result;
  50. ExtensionApis = *lpExtensionApis;
  51. SavedMajorVersion = MajorVersion;
  52. SavedMinorVersion = MinorVersion;
  53. bDebuggingChecked = (SavedMajorVersion == 0x0c);
  54. usProcessorArchitecture = (USHORT)-1;
  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. }