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.

120 lines
2.3 KiB

  1. /*++
  2. Module Name:
  3. elfmain.cpp
  4. Abstract:
  5. This module contains the default ntsd debugger extensions for
  6. Author:
  7. Ivan Brugiolo 21-06-2001 adapted from wmiexts.cpp
  8. Revision History:
  9. --*/
  10. #include "elfmain.h"
  11. #undef DBG_ASSERT
  12. /************************************************************
  13. * Debugger Utility Functions
  14. ************************************************************/
  15. WINDBG_EXTENSION_APIS ExtensionApis;
  16. HANDLE ExtensionCurrentProcess;
  17. USHORT g_MajorVersion;
  18. USHORT g_MinorVersion;
  19. /************************************************************
  20. * The WinDBG required Export
  21. ************************************************************/
  22. LPEXT_API_VERSION
  23. ExtensionApiVersion(
  24. void
  25. )
  26. /*++
  27. Function Description:
  28. Windbg calls this function to match between the version of windbg and the
  29. extension. If the versions doesn't match, windbg will not load the
  30. extension.
  31. --*/
  32. {
  33. static EXT_API_VERSION ApiVersion =
  34. #ifdef KDEXT_64BIT
  35. { 5, 0, EXT_API_VERSION_NUMBER64, 0 };
  36. #else
  37. { 5, 0, EXT_API_VERSION_NUMBER, 0 };
  38. #endif
  39. return &ApiVersion;
  40. }
  41. void
  42. WinDbgExtensionDllInit(
  43. PWINDBG_EXTENSION_APIS lpExtensionApis,
  44. USHORT MajorVersion,
  45. USHORT MinorVersion
  46. )
  47. /*++
  48. Function Description:
  49. When windbg loads the extension, it first call this function. You can
  50. perform various intialization here.
  51. Arguments:
  52. lpExtensionApis - A structure that contains the callbacks to functions that
  53. I can use to do standard operation. I must store this in a global
  54. variable called 'ExtensionApis'.
  55. MajorVersion - Indicates if target machine is running checked build or
  56. free.
  57. 0x0C - Checked build.
  58. 0x0F - Free build.
  59. MinorVersion - The Windows NT build number (for example, 1381 for NT4).
  60. --*/
  61. {
  62. ExtensionApis = *lpExtensionApis;
  63. g_MajorVersion = MajorVersion;
  64. g_MinorVersion = MinorVersion;
  65. }
  66. void
  67. CheckVersion( void )
  68. /*++
  69. Function Description:
  70. This function is called before every command. It gives the extension
  71. a chance to compare between the versions of the target and the extension.
  72. In this demo, I don't do much with that.
  73. --*/
  74. {
  75. return;
  76. }