1
0

extsp.h 3.7 KB

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