Source code of Windows XP (NT5)
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.

212 lines
7.4 KiB

  1. //
  2. // MODULE: TSLaunchDLL.cpp
  3. //
  4. // PURPOSE: The functions that are exported by TSLauncher.dll.
  5. //
  6. // PROJECT: Local Troubleshooter Launcher for the Device Manager
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  9. //
  10. // AUTHOR: Joe Mabel
  11. //
  12. // ORIGINAL DATE: 2-26-98
  13. //
  14. //
  15. // Version Date By Comments
  16. //--------------------------------------------------------------------
  17. // V0.1 - RM Original
  18. ///////////////////////
  19. #ifndef _TSLAUNCH_
  20. #define _TSLAUNCH_ 1
  21. #ifdef __TSLAUNCHER
  22. #define DLLEXPORT_IMPORT __declspec(dllexport)
  23. #else
  24. #define DLLEXPORT_IMPORT __declspec(dllimport)
  25. #endif
  26. DLLEXPORT_IMPORT BOOL APIENTRY DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
  27. /* TSLOpen
  28. Returns a handle that should be passed into subsequent Troubleshooter Launcher calls
  29. as hTSL. Returns NULL handle on failure. (Should only fail on out of memory,
  30. probably will never arise.)
  31. */
  32. DLLEXPORT_IMPORT HANDLE WINAPI TSLOpen(void);
  33. /* TSLClose
  34. Closes handle. Returns TSL_OK (== 0) if handle was open, otherwise TSL_ERROR_BAD_HANDLE.
  35. */
  36. DLLEXPORT_IMPORT DWORD WINAPI TSLClose (HANDLE hTSL);
  37. /* TSLReInit
  38. Reinitializes handle. Functionally the same as a TSLClose followed by TSLOpen, but more
  39. efficient. Returns same handle as passed in, if handle was OK, otherwise NULL.
  40. */
  41. DLLEXPORT_IMPORT HANDLE WINAPI TSLReInit (HANDLE hTSL);
  42. /* TSLLaunchKnownTS
  43. Launches to a known troubleshooting belief network and (optionally) problem node.
  44. If you know the particular troubleshooting network and problem, use this call.
  45. If setting network but not problem, pass in a NULL for szProblemNode.
  46. Also allows setting arbitrary nodes.
  47. nNode gives the number of nodes to set. pszNode, pVal are
  48. arrays (dimension nNode) of symbolic node names and corresponding values.
  49. Returns one of:
  50. TSL_OK
  51. TSL_ERROR_BAD_HANDLE
  52. TSL_ERROR_OUT_OF_MEMORY
  53. TSL_ERROR_GENERAL launch failed, call TSLStatus
  54. TSL_WARNING_GENERAL launch succeded, call TSLStatus for warnings
  55. */
  56. DLLEXPORT_IMPORT DWORD WINAPI TSLLaunchKnownTSA(HANDLE hTSL, const char * szNet,
  57. const char * szProblemNode, DWORD nNode, const char ** pszNode, DWORD* pVal);
  58. DLLEXPORT_IMPORT DWORD WINAPI TSLLaunchKnownTSW(HANDLE hTSL, const wchar_t * szNet,
  59. const wchar_t * szProblemNode, DWORD nNode, const wchar_t ** pszNode, DWORD* pVal);
  60. #ifdef UNICODE
  61. #define TSLLaunchKnownTS TSLLaunchKnownTSW
  62. #else
  63. #define TSLLaunchKnownTS TSLLaunchKnownTSA
  64. #endif
  65. /* TSLLaunch
  66. Launches to a troubleshooting belief network and (optionally) problem node based
  67. on application, version, and problem.
  68. If bLaunch is true, this just queries the mapping, but does not launch.
  69. Returns one of:
  70. TSL_OK
  71. TSL_ERROR_BAD_HANDLE
  72. TSL_ERROR_OUT_OF_MEMORY
  73. TSL_ERROR_GENERAL launch/query failed, call TSLStatus
  74. TSL_WARNING_GENERAL launch/query succeded, call TSLStatus for warnings
  75. */
  76. DLLEXPORT_IMPORT DWORD WINAPI TSLLaunchA(HANDLE hTSL, const char * szCallerName,
  77. const char * szCallerVersion, const char * szAppProblem, bool bLaunch);
  78. DLLEXPORT_IMPORT DWORD WINAPI TSLLaunchW(HANDLE hTSL, const wchar_t * szCallerName,
  79. const wchar_t * szCallerVersion, const wchar_t * szAppProblem, bool bLaunch);
  80. #ifdef UNICODE
  81. #define TSLLaunch TSLLaunchW
  82. #else
  83. #define TSLLaunch TSLLaunchA
  84. #endif
  85. /* TSLLaunchDevice
  86. Launches to a troubleshooting belief network and (optionally) problem node based
  87. on application, version, Plug & Play Device ID, Device Class GUID, and problem.
  88. If bLaunch is true, this just queries the mapping, but does not launch.
  89. Returns one of:
  90. TSL_OK
  91. TSL_ERROR_BAD_HANDLE
  92. TSL_ERROR_OUT_OF_MEMORY
  93. TSL_ERROR_GENERAL launch/query failed, call TSLStatus
  94. TSL_WARNING_GENERAL launch/query succeded, call TSLStatus for warnings
  95. */
  96. DLLEXPORT_IMPORT DWORD WINAPI TSLLaunchDeviceA(HANDLE hTSL, const char * szCallerName,
  97. const char * szCallerVersion, const char * szPNPDeviceID,
  98. const char * szDeviceClassGUID, const char * szAppProblem, bool bLaunch);
  99. DLLEXPORT_IMPORT DWORD WINAPI TSLLaunchDeviceW(HANDLE hTSL, const wchar_t * szCallerName,
  100. const wchar_t * szCallerVersion, const wchar_t * szPNPDeviceID,
  101. const wchar_t * szDeviceClassGUID, const wchar_t * szAppProblem, bool bLaunch);
  102. #ifdef UNICODE
  103. #define TSLLaunchDevice TSLLaunchDeviceW
  104. #else
  105. #define TSLLaunchDevice TSLLaunchDeviceA
  106. #endif
  107. /* Preferences ----------------------------------- */
  108. /* TSLPreferOnline
  109. Specify a preference for or against online debugger.
  110. Returns one of:
  111. TSL_OK
  112. TSL_ERROR_BAD_HANDLE
  113. TSL_ERROR_OUT_OF_MEMORY
  114. */
  115. DLLEXPORT_IMPORT DWORD WINAPI TSLPreferOnline(HANDLE hTSL, BOOL bPreferOnline);
  116. /* TSLLanguage
  117. Specify language, using Unicode-style 3-letter language ID. This overrides the system
  118. default.
  119. Returns one of:
  120. TSL_OK
  121. TSL_ERROR_BAD_HANDLE
  122. TSL_ERROR_OUT_OF_MEMORY
  123. Cannot return TSL_WARNING_LANGUAGE, because we will not know this till we try combining
  124. language and troubleshooting network.
  125. */
  126. DLLEXPORT_IMPORT DWORD WINAPI TSLLanguageA(HANDLE hTSL, const char * szLanguage);
  127. DLLEXPORT_IMPORT DWORD WINAPI TSLLanguageW(HANDLE hTSL, const wchar_t * szLanguage);
  128. #ifdef UNICODE
  129. #define TSLLanguage TSLLanguageW
  130. #else
  131. #define TSLLanguage TSLLanguageA
  132. #endif
  133. /* Sniffing ---------------------------- */
  134. /* TSLMachineID
  135. Necessary to support sniffing on a remote machine.
  136. Returns one of:
  137. TSL_OK
  138. TSL_ERROR_BAD_HANDLE
  139. TSL_ERROR_OUT_OF_MEMORY
  140. TSL_ERROR_ILLFORMED_MACHINE_ID
  141. TSL_ERROR_BAD_MACHINE_ID
  142. */
  143. DLLEXPORT_IMPORT DWORD WINAPI TSLMachineIDA(HANDLE hTSL, const char* szMachineID);
  144. DLLEXPORT_IMPORT DWORD WINAPI TSLMachineIDW(HANDLE hTSL, const wchar_t* szMachineID);
  145. #ifdef UNICODE
  146. #define TSLMachineID TSLMachineIDW
  147. #else
  148. #define TSLMachineID TSLMachineIDA
  149. #endif
  150. /* TSLDeviceInstanceIDA
  151. Necessary to support sniffing. For example, if there are two of the same card on a
  152. machine, the Plug & Play ID is of limited use for sniffing.
  153. Returns one of:
  154. TSL_OK
  155. TSL_ERROR_BAD_HANDLE
  156. TSL_ERROR_OUT_OF_MEMORY
  157. TSL_ERROR_ILLFORMED_DEVINST_ID
  158. TSL_ERROR_BAD_DEVINST_ID
  159. */
  160. DLLEXPORT_IMPORT DWORD WINAPI TSLDeviceInstanceIDA(HANDLE hTSL,
  161. const char* szDeviceInstanceID);
  162. DLLEXPORT_IMPORT DWORD WINAPI TSLDeviceInstanceIDW(HANDLE hTSL,
  163. const wchar_t* szDeviceInstanceID);
  164. #ifdef UNICODE
  165. #define TSLDeviceInstanceID TSLDeviceInstanceIDW
  166. #else
  167. #define TSLDeviceInstanceID TSLDeviceInstanceIDA
  168. #endif
  169. /* Status (after launch) ----------------------- */
  170. /* TSLStatus
  171. After any of the TSLLaunch... functions return TSL_ERROR_GENERAL or TSL_WARNING_GENERAL,
  172. this function can return one status.
  173. Repeated calls to this function allow any number of problems to be reported.
  174. Should be called in a loop until it returns 0.
  175. Returns TSL_OK if all OK or if all problems are already reported. nChar indicates size of
  176. buffer szBuf in characters. 255 is recommended. If present, szBuf is used to return
  177. a detailed error message. The buffer will always return appropriate text. Typically,
  178. it is just a text appropriate to the error/warning return. In the case of
  179. TSL_WARNING_NO_NODE or TSL_WARNING_NO_STATE, this text identifies what node has the
  180. problem. However, that is relevant only if there has been a call to TSLSetNodes.
  181. */
  182. DLLEXPORT_IMPORT DWORD WINAPI TSLStatusA (HANDLE hTSL, DWORD nChar, char * szBuf);
  183. DLLEXPORT_IMPORT DWORD WINAPI TSLStatusW (HANDLE hTSL, DWORD nChar, wchar_t * szBuf);
  184. #ifdef UNICODE
  185. #define TSLStatus TSLStatusW
  186. #else
  187. #define TSLStatus TSLStatusA
  188. #endif
  189. #endif _TSLAUNCH_