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.

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