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.

77 lines
2.1 KiB

  1. README file for sample WINDBG (old stlye) extension simple.dll
  2. This extsnsion dll shows how to write a simple extension and demostrates use of APIs in wdbgexts.h
  3. Mandatory routines which must be implemented and exported for windbg style extensions:
  4. VOID
  5. WinDbgExtensionDllInit(
  6. PWINDBG_EXTENSION_APIS lpExtensionApis,
  7. USHORT MajorVersion,
  8. USHORT MinorVersion
  9. )
  10. This is called on loading extension dll. Global variables and flags for extension should be initialized in this routine. One
  11. of the useful things to initialize is WINDBG_WNTENSION_APIS which has some commonly used APIS for memory reads and I/O.
  12. LPEXT_API_VERSION
  13. ExtensionApiVersion(
  14. VOID
  15. )
  16. This tells debugger about version of the extension dll. The values returned by this will determine how extension of this
  17. dll will be called. A common error while writing extensions is mismatched values of version returned be this routine as
  18. compared to what version dll was built with.
  19. This has ApiVersion = { (VER_PRODUCTVERSION_W >> 8),
  20. (VER_PRODUCTVERSION_W & 0xff),
  21. EXT_API_VERSION_NUMBER64,
  22. 0 };
  23. VOID
  24. CheckVersion(
  25. VOID
  26. )
  27. This is called after the dll is loaded by the debugger. The extension dll can verify here if it was loaded for correct target.
  28. Extension Calls
  29. ---------------
  30. EXT_API_VERSION_NUMBER64 is needed for making 64-bit aware extensions, all addresses for these will then be ULONG64s, for this
  31. an extension is defined as:
  32. CPPMOD VOID
  33. extension(
  34. HANDLE hCurrentProcess,
  35. HANDLE hCurrentThread,
  36. ULONG64 dwCurrentPc,
  37. ULONG dwProcessor,
  38. PCSTR args
  39. )
  40. Extensions
  41. ----------
  42. read
  43. This shows how to read data from the target.
  44. edit
  45. This shows how to edit data on the target.
  46. stack
  47. This retrieves and prints current stack trace
  48. help
  49. Every extension dll should have one extension called 'help' which shows descriptions for extensions that are present in the dll.