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.

482 lines
13 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1999
  4. *
  5. * TITLE: WiaEnum.cpp
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ByronC
  10. *
  11. * DATE: 24 Aug, 1999
  12. *
  13. * DESCRIPTION:
  14. * Implements the [local]-to-[call_as] and [call_as]-to-[local] methods for
  15. * the WIA enumerators.
  16. *
  17. *******************************************************************************/
  18. #include <objbase.h>
  19. #include "wia.h"
  20. /**************************************************************************\
  21. * IEnumWiaItem_Next_Proxy
  22. *
  23. * [local]-to-[call_as] function for the Next method of IEnumWiaItem.
  24. * It ensures correct parameter semantics and always provides a
  25. * non-NULL last argument for it's sibling function, RemoteNext.
  26. *
  27. * Arguments:
  28. *
  29. * This - The this pointer of the calling object.
  30. * celt - Requested number of elements.
  31. * ppIWiaItem - Array of IWiaItem pointers.
  32. * pceltFetched - Address of ULONG to store the number of elements
  33. * actually returned.
  34. *
  35. * Return Value:
  36. *
  37. * Status
  38. *
  39. * History:
  40. *
  41. * 08/24/1999 Original Version
  42. *
  43. \**************************************************************************/
  44. HRESULT _stdcall IEnumWiaItem_Next_Proxy(
  45. IEnumWiaItem __RPC_FAR *This,
  46. ULONG celt,
  47. IWiaItem **ppIWiaItem,
  48. ULONG *pceltFetched)
  49. {
  50. //
  51. // Ensure that celt is 1 if pceltFetched = 0
  52. //
  53. if ((pceltFetched == NULL) && (celt != 1)) {
  54. #ifdef DEBUG
  55. OutputDebugString(TEXT("Error: IEnumWiaItem_Next_Proxy, celt must be 1 if pceltFetched is zero"));
  56. #endif
  57. return E_INVALIDARG;
  58. }
  59. //
  60. // Make sure last parameter to Next is not NULL by passing in our own local
  61. // variable if needed.
  62. //
  63. ULONG cFetched;
  64. if (pceltFetched == 0) {
  65. pceltFetched = &cFetched;
  66. }
  67. //
  68. // Call remote method with a non-null last parameter
  69. //
  70. return IEnumWiaItem_RemoteNext_Proxy(This,
  71. celt,
  72. ppIWiaItem,
  73. pceltFetched);
  74. }
  75. /**************************************************************************\
  76. * IEnumWiaItem_Next_Stub
  77. *
  78. * [call_as]-to-[local] function for the Next method of IEnumWiaItem.
  79. *
  80. * Arguments:
  81. *
  82. * This - The this pointer of the calling object.
  83. * celt - Requested number of elements.
  84. * ppIWiaItem - Array of IWiaItem pointers.
  85. * pceltFetched - Address of ULONG to store the number of elements
  86. * actually returned.
  87. *
  88. * Return Value:
  89. *
  90. * Status
  91. *
  92. * History:
  93. *
  94. * 08/24/1999 Original Version
  95. *
  96. \**************************************************************************/
  97. HRESULT _stdcall IEnumWiaItem_Next_Stub(
  98. IEnumWiaItem __RPC_FAR *This,
  99. ULONG celt,
  100. IWiaItem **ppIWiaItem,
  101. ULONG *pceltFetched)
  102. {
  103. HRESULT hr;
  104. //
  105. // Call the actual method off the object pointed to by This
  106. //
  107. hr = This->Next(celt,
  108. ppIWiaItem,
  109. pceltFetched);
  110. //
  111. // Make to set the value of pceltFetched if S_OK (used by Marshaller
  112. // for "length_is")
  113. //
  114. if (hr == S_OK) {
  115. *pceltFetched = celt;
  116. }
  117. return hr;
  118. }
  119. /**************************************************************************\
  120. * IEnumWIA_DEV_CAPS_Next_Proxy
  121. *
  122. * [local]-to-[call_as] function for the Next method of IEnumWIA_DEV_CAPS.
  123. * It ensures correct parameter semantics and always provides a
  124. * non-NULL last argument for it's sibling function, RemoteNext.
  125. *
  126. * Arguments:
  127. *
  128. * This - The this pointer of the calling object.
  129. * celt - Requested number of elements.
  130. * rgelt - Array of WIA_DEV_CAPs.
  131. * pceltFetched - Address of ULONG to store the number of elements
  132. * actually returned.
  133. *
  134. * Return Value:
  135. *
  136. * Status
  137. *
  138. * History:
  139. *
  140. * 08/24/1999 Original Version
  141. *
  142. \**************************************************************************/
  143. HRESULT _stdcall IEnumWIA_DEV_CAPS_Next_Proxy(
  144. IEnumWIA_DEV_CAPS __RPC_FAR *This,
  145. ULONG celt,
  146. WIA_DEV_CAP *rgelt,
  147. ULONG *pceltFetched)
  148. {
  149. //
  150. // Ensure that celt is 1 if pceltFetched = 0
  151. //
  152. if ((pceltFetched == NULL) && (celt != 1)) {
  153. #ifdef DEBUG
  154. OutputDebugString(TEXT("Error: IEnumWIA_DEV_CAPS_Next_Proxy, celt must be 1 if pceltFetched is zero"));
  155. #endif
  156. return E_INVALIDARG;
  157. }
  158. //
  159. // Make sure last parameter to Next is not NULL by passing in our own local
  160. // variable if needed.
  161. //
  162. ULONG cFetched;
  163. if (pceltFetched == 0) {
  164. pceltFetched = &cFetched;
  165. }
  166. //
  167. // Call remote method with a non-null last parameter
  168. //
  169. return IEnumWIA_DEV_CAPS_RemoteNext_Proxy(This,
  170. celt,
  171. rgelt,
  172. pceltFetched);
  173. }
  174. /**************************************************************************\
  175. * IEnumWIA_DEV_CAPS_Next_Stub
  176. *
  177. * [call_as]-to-[local] function for the Next method of IEnumWIA_DEV_CAPS.
  178. *
  179. * Arguments:
  180. *
  181. * This - The this pointer of the calling object.
  182. * celt - Requested number of elements.
  183. * rgelt - Array of WIA_DEV_CAPs.
  184. * pceltFetched - Address of ULONG to store the number of elements
  185. * actually returned.
  186. *
  187. * Return Value:
  188. *
  189. * Status
  190. *
  191. * History:
  192. *
  193. * 08/24/1999 Original Version
  194. *
  195. \**************************************************************************/
  196. HRESULT _stdcall IEnumWIA_DEV_CAPS_Next_Stub(
  197. IEnumWIA_DEV_CAPS __RPC_FAR *This,
  198. ULONG celt,
  199. WIA_DEV_CAP *rgelt,
  200. ULONG *pceltFetched)
  201. {
  202. HRESULT hr;
  203. //
  204. // Call the actual method off the object pointed to by This
  205. //
  206. hr = This->Next(celt,
  207. rgelt,
  208. pceltFetched);
  209. //
  210. // Make to set the value of pceltFetched if S_OK (used by Marshaller
  211. // for "length_is")
  212. //
  213. if (hr == S_OK) {
  214. *pceltFetched = celt;
  215. }
  216. return hr;
  217. }
  218. /**************************************************************************\
  219. * IEnumWIA_DEV_INFO_Next_Proxy
  220. *
  221. * [local]-to-[call_as] function for the Next method of IEnumWIA_DEV_INFO.
  222. * It ensures correct parameter semantics and always provides a
  223. * non-NULL last argument for it's sibling function, RemoteNext.
  224. *
  225. * Arguments:
  226. *
  227. * This - The this pointer of the calling object.
  228. * celt - Requested number of elements.
  229. * rgelt - Array of IWiaPropertyStorage pointers.
  230. * pceltFetched - Address of ULONG to store the number of elements
  231. * actually returned.
  232. *
  233. * Return Value:
  234. *
  235. * Status
  236. *
  237. * History:
  238. *
  239. * 08/24/1999 Original Version
  240. *
  241. \**************************************************************************/
  242. HRESULT _stdcall IEnumWIA_DEV_INFO_Next_Proxy(
  243. IEnumWIA_DEV_INFO __RPC_FAR *This,
  244. ULONG celt,
  245. IWiaPropertyStorage **rgelt,
  246. ULONG *pceltFetched)
  247. {
  248. //
  249. // Ensure that celt is 1 if pceltFetched = 0
  250. //
  251. if ((pceltFetched == NULL) && (celt != 1)) {
  252. #ifdef DEBUG
  253. OutputDebugString(TEXT("Error: IEnumWIA_DEV_INFO_Next_Proxy, celt must be 1 if pceltFetched is zero"));
  254. #endif
  255. return E_INVALIDARG;
  256. }
  257. //
  258. // Make sure last parameter to Next is not NULL by passing in our own local
  259. // variable if needed.
  260. //
  261. ULONG cFetched = 0;
  262. if (pceltFetched == NULL) {
  263. pceltFetched = &cFetched;
  264. }
  265. //
  266. // Call remote method with a non-null last parameter
  267. //
  268. return IEnumWIA_DEV_INFO_RemoteNext_Proxy(This,
  269. celt,
  270. rgelt,
  271. pceltFetched);
  272. }
  273. /**************************************************************************\
  274. * IEnumWIA_DEV_INFO_Next_Stub
  275. *
  276. * [call_as]-to-[local] function for the Next method of IEnumWIA_DEV_INFO.
  277. *
  278. * Arguments:
  279. *
  280. * This - The this pointer of the calling object.
  281. * celt - Requested number of elements.
  282. * rgelt - Array of IWiaPropertyStorage pointers.
  283. * pceltFetched - Address of ULONG to store the number of elements
  284. * actually returned.
  285. *
  286. * Return Value:
  287. *
  288. * Status
  289. *
  290. * History:
  291. *
  292. * 08/24/1999 Original Version
  293. *
  294. \**************************************************************************/
  295. HRESULT _stdcall IEnumWIA_DEV_INFO_Next_Stub(
  296. IEnumWIA_DEV_INFO __RPC_FAR *This,
  297. ULONG celt,
  298. IWiaPropertyStorage **rgelt,
  299. ULONG *pceltFetched)
  300. {
  301. HRESULT hr;
  302. //
  303. // Call the actual method off the object pointed to by This
  304. //
  305. ULONG cFetched = 0;
  306. if (pceltFetched == NULL) {
  307. pceltFetched = &cFetched;
  308. }
  309. hr = This->Next(celt,
  310. rgelt,
  311. pceltFetched);
  312. //
  313. // Make to set the value of pceltFetched if S_OK (used by Marshaller
  314. // for "length_is")
  315. //
  316. if (hr == S_OK) {
  317. *pceltFetched = celt;
  318. }
  319. return hr;
  320. }
  321. /**************************************************************************\
  322. * IEnumWIA_FORMAT_INFO_Next_Proxy
  323. *
  324. * [local]-to-[call_as] function for the Next method of IEnumWIA_FORMAT_INFO.
  325. * It ensures correct parameter semantics and always provides a
  326. * non-NULL last argument for it's sibling function, RemoteNext.
  327. *
  328. * Arguments:
  329. *
  330. * This - The this pointer of the calling object.
  331. * celt - Requested number of elements.
  332. * rgelt - Array of WIA_FORMAT_INFO.
  333. * pceltFetched - Address of ULONG to store the number of elements
  334. * actually returned.
  335. *
  336. * Return Value:
  337. *
  338. * Status
  339. *
  340. * History:
  341. *
  342. * 08/24/1999 Original Version
  343. *
  344. \**************************************************************************/
  345. HRESULT _stdcall IEnumWIA_FORMAT_INFO_Next_Proxy(
  346. IEnumWIA_FORMAT_INFO __RPC_FAR *This,
  347. ULONG celt,
  348. WIA_FORMAT_INFO *rgelt,
  349. ULONG *pceltFetched)
  350. {
  351. //
  352. // Ensure that celt is 1 if pceltFetched = 0
  353. //
  354. if ((pceltFetched == NULL) && (celt != 1)) {
  355. #ifdef DEBUG
  356. OutputDebugString(TEXT("Error: IEnumWIA_FORMAT_INFO_Next_Proxy, celt must be 1 if pceltFetched is zero"));
  357. #endif
  358. return E_INVALIDARG;
  359. }
  360. //
  361. // Make sure last parameter to Next is not NULL by passing in our own local
  362. // variable if needed.
  363. //
  364. ULONG cFetched;
  365. if (pceltFetched == 0) {
  366. pceltFetched = &cFetched;
  367. }
  368. //
  369. // Call remote method with a non-null last parameter
  370. //
  371. return IEnumWIA_FORMAT_INFO_RemoteNext_Proxy(This,
  372. celt,
  373. rgelt,
  374. pceltFetched);
  375. }
  376. /**************************************************************************\
  377. * IEnumWIA_FORMAT_INFO_Next_Stub
  378. *
  379. * [call_as]-to-[local] function for the Next method of IEnumWIA_FORMAT_INFO.
  380. *
  381. * Arguments:
  382. *
  383. * This - The this pointer of the calling object.
  384. * celt - Requested number of elements.
  385. * rgelt - Array of WIA_FORMAT_INFO.
  386. * pceltFetched - Address of ULONG to store the number of elements
  387. * actually returned.
  388. *
  389. * Return Value:
  390. *
  391. * Status
  392. *
  393. * History:
  394. *
  395. * 08/24/1999 Original Version
  396. *
  397. \**************************************************************************/
  398. HRESULT _stdcall IEnumWIA_FORMAT_INFO_Next_Stub(
  399. IEnumWIA_FORMAT_INFO __RPC_FAR *This,
  400. ULONG celt,
  401. WIA_FORMAT_INFO *rgelt,
  402. ULONG *pceltFetched)
  403. {
  404. HRESULT hr;
  405. //
  406. // Call the actual method off the object pointed to by This
  407. //
  408. hr = This->Next(celt,
  409. rgelt,
  410. pceltFetched);
  411. //
  412. // Make to set the value of pceltFetched if S_OK (used by Marshaller
  413. // for "length_is")
  414. //
  415. if (hr == S_OK) {
  416. *pceltFetched = celt;
  417. }
  418. return hr;
  419. }