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.

104 lines
2.8 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * *******************
  4. * * GDI SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: kdexts.cxx
  8. *
  9. * Contains all the kernel debugger extension necessary routines
  10. *
  11. * Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved.
  13. \*****************************************************************************/
  14. #include "dbgext.hxx"
  15. #include <ntverp.h>
  16. //
  17. // globals
  18. //
  19. EXT_API_VERSION ApiVersion = { 3, 5, EXT_API_VERSION_NUMBER, 0 };
  20. WINDBG_EXTENSION_APIS ExtensionApis;
  21. ULONG STeip;
  22. ULONG STebp;
  23. ULONG STesp;
  24. USHORT SavedMajorVersion;
  25. USHORT SavedMinorVersion;
  26. DllInit(HANDLE hModule,
  27. DWORD dwReason,
  28. DWORD dwReserved)
  29. {
  30. switch ( dwReason )
  31. {
  32. case DLL_THREAD_ATTACH:
  33. break;
  34. case DLL_THREAD_DETACH:
  35. break;
  36. case DLL_PROCESS_DETACH:
  37. break;
  38. case DLL_PROCESS_ATTACH:
  39. break;
  40. }
  41. return TRUE;
  42. }// DllInit()
  43. VOID
  44. WinDbgExtensionDllInit(PWINDBG_EXTENSION_APIS lpExtensionApis,
  45. USHORT MajorVersion,
  46. USHORT MinorVersion)
  47. {
  48. ExtensionApis = *lpExtensionApis;
  49. SavedMajorVersion = MajorVersion;
  50. SavedMinorVersion = MinorVersion;
  51. return;
  52. }// WinDbgExtensionDllInit()
  53. DECLARE_API(version)
  54. {
  55. #if DBG
  56. PCHAR DebuggerType = "Checked";
  57. #else
  58. PCHAR DebuggerType = "Free";
  59. #endif
  60. dprintf("%s Extension dll for Build %d debugging %s kernel for Build %d\n",
  61. DebuggerType,
  62. VER_PRODUCTBUILD,
  63. SavedMajorVersion == 0x0c ? "Checked" : "Free",
  64. SavedMinorVersion);
  65. }// version
  66. VOID
  67. CheckVersion(VOID)
  68. {
  69. #if DBG
  70. if ( (SavedMajorVersion != 0x0c)
  71. ||(SavedMinorVersion != VER_PRODUCTBUILD) )
  72. {
  73. dprintf("\r\n*** Extension DLL(%d Checked) does not match target system(%d %s)\r\n\r\n",
  74. VER_PRODUCTBUILD, SavedMinorVersion,
  75. (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  76. }
  77. #else
  78. if ( (SavedMajorVersion != 0x0f)
  79. ||(SavedMinorVersion != VER_PRODUCTBUILD) )
  80. {
  81. dprintf("\r\n*** Extension DLL(%d Free) does not match target system(%d %s)\r\n\r\n",
  82. VER_PRODUCTBUILD, SavedMinorVersion, (SavedMajorVersion==0x0f) ? "Free" : "Checked" );
  83. }
  84. #endif
  85. }// CheckVersion()
  86. LPEXT_API_VERSION
  87. ExtensionApiVersion(VOID)
  88. {
  89. return &ApiVersion;
  90. }// ExtensionApiVersion()