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.

350 lines
7.0 KiB

  1. /* comdef.c -- Default com driver routines.
  2. * These routines are pointed to by various com function pointers
  3. * before a valid device driver is loaded.
  4. *
  5. * Copyright 1994 by Hilgraeve Inc. -- Monroe, MI
  6. * All rights reserved
  7. *
  8. * $Revision: 3 $
  9. * $Date: 5/09/01 4:42p $
  10. */
  11. #include <windows.h>
  12. #pragma hdrstop
  13. #include "stdtyp.h"
  14. #include <tdll\assert.h>
  15. #include "sf.h"
  16. #include "com.h"
  17. #include "comdev.h"
  18. #include "com.hh"
  19. // since these are all dummy functions that serve as place-holders for
  20. // real functions during the time when no driver is loaded, they often
  21. // do not use the arguments passed to them. The following line will
  22. // suppress the warnings that lint issues
  23. /*lint -e715*/
  24. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  25. * FUNCTION: ComDefDoNothing
  26. *
  27. * DESCRIPTION:
  28. * A filler function that various com function pointers can be set to
  29. * until they receive actual values from a com driver. This prevents
  30. * the function pointers from pointing to invalid code.
  31. *
  32. * ARGUMENTS:
  33. * pvDriverData -- Data being passed to driver
  34. *
  35. * RETURNS:
  36. * always returns COM_PORT_NOT_OPEN;
  37. */
  38. int WINAPI ComDefDoNothing(void *pvDriverData)
  39. {
  40. pvDriverData = pvDriverData;
  41. return COM_PORT_NOT_OPEN;
  42. }
  43. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  44. * FUNCTION:
  45. *
  46. * DESCRIPTION:
  47. *
  48. *
  49. * ARGUMENTS:
  50. *
  51. *
  52. * RETURNS:
  53. *
  54. */
  55. int WINAPI ComDefPortPreconnect(void *pvDriverData,
  56. TCHAR *pszPortName,
  57. HWND hwndParent)
  58. {
  59. // Avoid lint complaints
  60. pvDriverData = pvDriverData;
  61. pszPortName = pszPortName;
  62. hwndParent = hwndParent;
  63. return COM_OK;
  64. }
  65. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  66. * FUNCTION: ComDefDeviceDialog
  67. *
  68. * DESCRIPTION:
  69. *
  70. *
  71. * ARGUMENTS:
  72. *
  73. *
  74. * RETURNS:
  75. *
  76. */
  77. int WINAPI ComDefDeviceDialog(void *pvDriverData, HWND hwndParent)
  78. {
  79. return COM_OK;
  80. }
  81. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82. * FUNCTION:
  83. *
  84. * DESCRIPTION:
  85. *
  86. *
  87. * ARGUMENTS:
  88. *
  89. *
  90. * RETURNS:
  91. *
  92. */
  93. int WINAPI ComDefPortActivate(void *pvDriverData,
  94. TCHAR *pszPortName,
  95. DWORD_PTR dwMediaHdl)
  96. {
  97. // Avoid lint complaints
  98. pvDriverData = pvDriverData;
  99. pszPortName = pszPortName;
  100. dwMediaHdl = dwMediaHdl;
  101. return COM_DEVICE_INVALID;
  102. }
  103. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104. * FUNCTION: ComDefBufrRefill
  105. *
  106. * DESCRIPTION:
  107. *
  108. *
  109. * ARGUMENTS:
  110. *
  111. *
  112. * RETURNS:
  113. *
  114. */
  115. int WINAPI ComDefBufrRefill(void *pvDriverData)
  116. {
  117. // Avoid lint complaints
  118. pvDriverData = pvDriverData;
  119. return FALSE;
  120. }
  121. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  122. * FUNCTION: ComDefSndBufrSend
  123. *
  124. * DESCRIPTION:
  125. * Starts background transmission of a buffer of characters. Optionally
  126. * waits for any prior buffer transmission to be completed.
  127. *
  128. * ARGUMENTS:
  129. * pvDriverData
  130. * pchBufr -- Pointer to buffer of characters to be transmitted
  131. * usCount -- Number of characters in buffer
  132. * usWait -- Time (in tenths of a second) to wait for any prior,
  133. * unfinished buffer to finish. If this value is zero, the call
  134. * will fail immediately if the transmitter is busy.
  135. *
  136. * RETURNS:
  137. * COM_OK if transmission is started. Note that this call returns as soon
  138. * as the transmission is started -- it does not wait for the entire
  139. * transmission to be completed.
  140. * COM_BUSY if transmitter is busy with a prior buffer and time limit is
  141. * exceeded
  142. * COM_PORT_NOT_OPEN if called when no port is active
  143. */
  144. int WINAPI ComDefSndBufrSend(void *pvDriverData, void *pvBufr, int nCount)
  145. {
  146. // Avoid lint complaints
  147. pvDriverData = pvDriverData;
  148. pvBufr = pvBufr;
  149. nCount = nCount;
  150. return COM_PORT_NOT_OPEN;
  151. }
  152. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  153. * FUNCTION: ComSndBufrBusy
  154. *
  155. * DESCRIPTION:
  156. *
  157. *
  158. * ARGUMENTS:
  159. *
  160. *
  161. * RETURNS:
  162. *
  163. */
  164. int WINAPI ComDefSndBufrBusy(void *pvDriverData)
  165. {
  166. // Avoid lint complaints
  167. pvDriverData = pvDriverData;
  168. // Act like we're never busy to keep program from hanging when
  169. // no com driver is active.
  170. return COM_OK;
  171. }
  172. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  173. * FUNCTION:
  174. *
  175. * DESCRIPTION:
  176. *
  177. *
  178. * ARGUMENTS:
  179. *
  180. *
  181. * RETURNS:
  182. *
  183. */
  184. int WINAPI ComDefSndBufrClear(void *pvDriverData)
  185. {
  186. // Avoid lint complaints
  187. pvDriverData = pvDriverData;
  188. return COM_OK;
  189. }
  190. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  191. * FUNCTION:
  192. *
  193. * DESCRIPTION:
  194. *
  195. *
  196. * ARGUMENTS:
  197. *
  198. *
  199. * RETURNS:
  200. *
  201. */
  202. int WINAPI ComDefSndBufrQuery(void *pvDriverData,
  203. unsigned *pafStatus,
  204. long *plHandshakeDelay)
  205. {
  206. // Avoid lint complaints
  207. pvDriverData = pvDriverData;
  208. if (pafStatus)
  209. *pafStatus = 0;
  210. if (plHandshakeDelay)
  211. *plHandshakeDelay = 0L;
  212. return COM_OK;
  213. }
  214. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  215. * FUNCTION:
  216. *
  217. * DESCRIPTION:
  218. *
  219. *
  220. * ARGUMENTS:
  221. *
  222. *
  223. * RETURNS:
  224. *
  225. */
  226. void WINAPI ComDefIdle(void)
  227. {
  228. // Do nothing. This fills in for real function that can be set by caller.
  229. }
  230. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  231. * FUNCTION: ComDefDeviceGetCommon
  232. *
  233. * DESCRIPTION:
  234. *
  235. *
  236. * ARGUMENTS:
  237. *
  238. *
  239. * RETURNS:
  240. *
  241. */
  242. int WINAPI ComDefDeviceGetCommon(void *pvPrivate, ST_COMMON *pstCommon)
  243. {
  244. // Keep lint from complaining
  245. pvPrivate = pvPrivate;
  246. // Indicate that we do not support any common items
  247. pstCommon->afItem = 0;
  248. return COM_OK;
  249. }
  250. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  251. * FUNCTION: ComDefDeviceSetCommon
  252. *
  253. * DESCRIPTION:
  254. *
  255. *
  256. * ARGUMENTS:
  257. *
  258. *
  259. * RETURNS:
  260. *
  261. */
  262. int WINAPI ComDefDeviceSetCommon(void *pvPrivate, struct s_common *pstCommon)
  263. {
  264. // Keep lint from complaining
  265. pvPrivate = pvPrivate;
  266. pstCommon = pstCommon;
  267. // Don't set anything, pretend that all is well
  268. return COM_OK;
  269. }
  270. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  271. * FUNCTION: ComDefDeviceSpecial
  272. *
  273. * DESCRIPTION:
  274. * The means for others to control any special features in this driver
  275. * that are not supported by all drivers.
  276. *
  277. * ARGUMENTS:
  278. *
  279. *
  280. * RETURNS:
  281. * COM_NOT_SUPPORTED if the instruction string was not recognized
  282. * otherwise depends on instruction string
  283. */
  284. int WINAPI ComDefDeviceSpecial(void *pvPrivate,
  285. const TCHAR *pszInstructions,
  286. TCHAR *pszResult,
  287. int nBufrSize)
  288. {
  289. return COM_NOT_SUPPORTED;
  290. }
  291. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  292. * FUNCTION:
  293. * ComDefDeviceLoadSaveHdl
  294. *
  295. * DESCRIPTION:
  296. * Dummy routine for pfDeviceLoadHdl and pfDeviceSaveHdl used when no
  297. * com driver is loaded
  298. *
  299. * ARGUMENTS:
  300. *
  301. *
  302. * RETURNS:
  303. * always returns TRUE
  304. */
  305. int WINAPI ComDefDeviceLoadSaveHdl(void *pvPrivate, SF_HANDLE sfHdl)
  306. {
  307. pvPrivate = pvPrivate;
  308. sfHdl = sfHdl;
  309. return TRUE;
  310. }