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.

135 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. kdext.c
  5. Abstract:
  6. This file contains the generic routines and initialization code
  7. for the kernel debugger extensions dll.
  8. // @@BEGIN_DDKSPLIT
  9. Author:
  10. Wesley Witt (wesw) 26-Aug-1993
  11. Ravisankar Pudipeddi [ravisp] 3-March-01 (moved to filespy)
  12. // @@END_DDKSPLIT
  13. Environment:
  14. User Mode
  15. --*/
  16. #include "pch.h"
  17. #pragma hdrstop
  18. #include <ntverp.h>
  19. //
  20. // globals
  21. //
  22. EXT_API_VERSION ApiVersion = { 6, 0, EXT_API_VERSION_NUMBER64, 0 };
  23. WINDBG_EXTENSION_APIS ExtensionApis;
  24. ULONG STeip;
  25. ULONG STebp;
  26. ULONG STesp;
  27. USHORT SavedMajorVersion;
  28. USHORT SavedMinorVersion;
  29. DllInit(
  30. HANDLE hModule,
  31. DWORD dwReason,
  32. DWORD dwReserved
  33. )
  34. {
  35. UNREFERENCED_PARAMETER( hModule );
  36. UNREFERENCED_PARAMETER( dwReserved );
  37. switch (dwReason) {
  38. case DLL_THREAD_ATTACH:
  39. break;
  40. case DLL_THREAD_DETACH:
  41. break;
  42. case DLL_PROCESS_DETACH:
  43. break;
  44. case DLL_PROCESS_ATTACH:
  45. break;
  46. }
  47. return TRUE;
  48. }
  49. VOID
  50. WinDbgExtensionDllInit(
  51. PWINDBG_EXTENSION_APIS lpExtensionApis,
  52. USHORT MajorVersion,
  53. USHORT MinorVersion
  54. )
  55. {
  56. ExtensionApis = *lpExtensionApis;
  57. SavedMajorVersion = MajorVersion;
  58. SavedMinorVersion = MinorVersion;
  59. return;
  60. }
  61. DECLARE_API( version )
  62. {
  63. #if DBG
  64. PCHAR DebuggerType = "Checked";
  65. #else
  66. PCHAR DebuggerType = "Free";
  67. #endif
  68. UNREFERENCED_PARAMETER( args );
  69. UNREFERENCED_PARAMETER( dwProcessor );
  70. UNREFERENCED_PARAMETER( dwCurrentPc );
  71. UNREFERENCED_PARAMETER( hCurrentThread );
  72. UNREFERENCED_PARAMETER( hCurrentProcess );
  73. dprintf( "%s Extension dll for Build %d debugging %s kernel for Build %d\n",
  74. DebuggerType,
  75. VER_PRODUCTBUILD,
  76. SavedMajorVersion == 0x0c ? "Checked" : "Free",
  77. SavedMinorVersion
  78. );
  79. }
  80. VOID
  81. CheckVersion(
  82. VOID
  83. )
  84. {
  85. #if DBG
  86. if ((SavedMajorVersion != 0x0c) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  87. dprintf("\r\n*** Extension DLL(%d Checked) does not match target system(%d %s)\r\n\r\n",
  88. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  89. }
  90. #else
  91. if ((SavedMajorVersion != 0x0f) || (SavedMinorVersion != VER_PRODUCTBUILD)) {
  92. dprintf("\r\n*** Extension DLL(%d Free) does not match target system(%d %s)\r\n\r\n",
  93. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  94. }
  95. #endif
  96. }
  97. LPEXT_API_VERSION
  98. ExtensionApiVersion(
  99. VOID
  100. )
  101. {
  102. return &ApiVersion;
  103. }