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.

114 lines
2.5 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 <ntsdexts.h>
  15. //#define NOEXTAPI
  16. #include <wdbgexts.h>
  17. #include <ntverp.h>
  18. //#include <stdexts.h>
  19. //
  20. // globals
  21. //
  22. EXT_API_VERSION ApiVersion = { 3, 5, EXT_API_VERSION_NUMBER, 0 };
  23. WINDBG_EXTENSION_APIS ExtensionApis;
  24. ULONG STeip;
  25. ULONG STebp;
  26. ULONG STesp;
  27. USHORT SavedMajorVersion;
  28. USHORT SavedMinorVersion;
  29. USHORT usProcessorArchitecture;
  30. BOOL bDebuggingChecked;
  31. PSZ szProcessorArchitecture[] = {
  32. "Intel",
  33. "MIPS",
  34. "Alpha",
  35. "PPC"
  36. };
  37. #define cArchitecture (sizeof(szProcessorArchitecture) / sizeof(PSZ))
  38. VOID
  39. WinDbgExtensionDllInit(
  40. PWINDBG_EXTENSION_APIS lpExtensionApis,
  41. USHORT MajorVersion,
  42. USHORT MinorVersion
  43. )
  44. {
  45. ULONG offKeProcessorArchitecture;
  46. ULONG Result;
  47. ExtensionApis = *lpExtensionApis;
  48. SavedMajorVersion = MajorVersion;
  49. SavedMinorVersion = MinorVersion;
  50. bDebuggingChecked = (SavedMajorVersion == 0x0c);
  51. usProcessorArchitecture = (USHORT)-1;
  52. return;
  53. }
  54. DECLARE_API( version )
  55. {
  56. #if DBG
  57. PCHAR DebuggerType = "Checked";
  58. #else
  59. PCHAR DebuggerType = "Free";
  60. #endif
  61. dprintf( "%s Extension dll for Build %d debugging %s kernel for Build %d\n",
  62. DebuggerType,
  63. VER_PRODUCTBUILD,
  64. SavedMajorVersion == 0x0c ? "Checked" : "Free",
  65. SavedMinorVersion
  66. );
  67. }
  68. VOID
  69. CheckVersion(
  70. VOID
  71. )
  72. {
  73. #if DBG
  74. if ((SavedMajorVersion != 0x0c) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  75. dprintf("\r\n*** Extension DLL(%d Checked) does not match target system(%d %s)\r\n\r\n",
  76. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  77. }
  78. #else
  79. if ((SavedMajorVersion != 0x0f) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  80. dprintf("\r\n*** Extension DLL(%d Free) does not match target system(%d %s)\r\n\r\n",
  81. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  82. }
  83. #endif
  84. }
  85. LPEXT_API_VERSION
  86. ExtensionApiVersion(
  87. VOID
  88. )
  89. {
  90. return &ApiVersion;
  91. }