extsp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*++
  2. Copyright (c) 2012 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. extsp.h
  5. Abstract:
  6. This header contains private definitions for debugger extension support.
  7. Author:
  8. Evan Green 10-Sep-2012
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. //
  14. // ---------------------------------------------------------------- Definitions
  15. //
  16. #define MALLOC(_x) malloc(_x)
  17. #define FREE(_x) free(_x)
  18. //
  19. // ------------------------------------------------------ Data Type Definitions
  20. //
  21. //
  22. // -------------------------------------------------------------------- Globals
  23. //
  24. //
  25. // -------------------------------------------------------- Function Prototypes
  26. //
  27. INT
  28. DbgInitializeExtensions (
  29. PDEBUGGER_CONTEXT Context
  30. );
  31. /*++
  32. Routine Description:
  33. This routine initializes support for debugger extensions and loads any
  34. extensions supplied on the command line.
  35. Arguments:
  36. Context - Supplies a pointer to the application context.
  37. Return Value:
  38. 0 on success.
  39. Returns an error code on failure.
  40. --*/
  41. INT
  42. DbgLoadExtension (
  43. PDEBUGGER_CONTEXT Context,
  44. PSTR BinaryName
  45. );
  46. /*++
  47. Routine Description:
  48. This routine loads a debugger extension library.
  49. Arguments:
  50. Context - Supplies a pointer to the application context.
  51. BinaryName - Supplies the path to the binary to load.
  52. Return Value:
  53. 0 on success.
  54. Returns an error code on failure.
  55. --*/
  56. VOID
  57. DbgUnloadExtension (
  58. PDEBUGGER_CONTEXT Context,
  59. PSTR BinaryName
  60. );
  61. /*++
  62. Routine Description:
  63. This routine unloads and frees a debugger extension library.
  64. Arguments:
  65. Context - Supplies a pointer to the application context.
  66. BinaryName - Supplies the path to the binary to unload.
  67. Return Value:
  68. None.
  69. --*/
  70. VOID
  71. DbgUnloadAllExtensions (
  72. PDEBUGGER_CONTEXT Context
  73. );
  74. /*++
  75. Routine Description:
  76. This routine unloads all debugger extensions.
  77. Arguments:
  78. Context - Supplies a pointer to the application context.
  79. Return Value:
  80. None.
  81. --*/
  82. INT
  83. DbgDispatchExtension (
  84. PDEBUGGER_CONTEXT Context,
  85. PSTR *Arguments,
  86. ULONG ArgumentCount
  87. );
  88. /*++
  89. Routine Description:
  90. This routine dispatches a debugger extension command.
  91. Arguments:
  92. Context - Supplies a pointer to the application context.
  93. Arguments - Supplies an array of strings containing the arguments. The
  94. first argument is the command itself.
  95. ArgumentCount - Supplies the count of arguments. This is always at least
  96. one.
  97. Return Value:
  98. 0 on success.
  99. Returns an error code on failure.
  100. --*/
  101. ULONG
  102. DbgLoadLibrary (
  103. PSTR BinaryName
  104. );
  105. /*++
  106. Routine Description:
  107. This routine loads a shared library.
  108. Arguments:
  109. BinaryName - Supplies the name of the binary to load.
  110. Return Value:
  111. Returns a non-zero handle on success.
  112. 0 on failure.
  113. --*/
  114. VOID
  115. DbgFreeLibrary (
  116. ULONG Handle
  117. );
  118. /*++
  119. Routine Description:
  120. This routine unloads a shared library.
  121. Arguments:
  122. Handle - Supplies the handle to to the loaded library.
  123. Return Value:
  124. None.
  125. --*/
  126. PVOID
  127. DbgGetProcedureAddress (
  128. ULONG Handle,
  129. PSTR ProcedureName
  130. );
  131. /*++
  132. Routine Description:
  133. This routine gets the address of a routine in a loaded shared library (DLL).
  134. Arguments:
  135. Handle - Supplies the handle to to the loaded library.
  136. ProcedureName - Supplies the name of the procedure to look up.
  137. Return Value:
  138. Returns a pointer to the procedure on success.
  139. NULL on failure.
  140. --*/