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.

848 lines
24 KiB

  1. #include <string.h>
  2. #include <limits.h>
  3. #include <rpc.h>
  4. #include "rawrpc.h"
  5. static handle_t AutoBindHandle;
  6. extern RPC_DISPATCH_TABLE IRawRpc_DispatchTable;
  7. static RPC_CLIENT_INTERFACE ___RpcClientInterface = {
  8. sizeof(RPC_CLIENT_INTERFACE),
  9. {{0x00000145,0x0001,0x0008,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}},
  10. {0,0}},
  11. {
  12. {0x8A885D04L,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},
  13. {2,0}
  14. }
  15. ,
  16. 0,0,0,
  17. 0
  18. }
  19. ;
  20. RPC_IF_HANDLE IRawRpc_ClientIfHandle = (RPC_IF_HANDLE) &___RpcClientInterface;
  21. SCODE Quit(
  22. handle_t hRpc)
  23. {
  24. SCODE _ret_value;
  25. unsigned char * _packet;
  26. unsigned char * _tempbuf;
  27. RPC_STATUS _status;
  28. RPC_MESSAGE _message;
  29. PRPC_MESSAGE _prpcmsg = & _message;
  30. ((void)( _packet ));
  31. ((void)( _tempbuf ));
  32. _message.Handle = hRpc;
  33. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  34. _prpcmsg->BufferLength = 0;
  35. _message.ProcNum = ( 0 );
  36. _message.RpcFlags = ( 0 );
  37. _status = I_RpcGetBuffer(&_message);
  38. if (_status) RpcRaiseException(_status);
  39. _packet = _message.Buffer;
  40. _prpcmsg->Buffer = _packet;
  41. _status = I_RpcSendReceive(&_message);
  42. if (_status) RpcRaiseException(_status);
  43. _packet = _message.Buffer;
  44. RpcTryFinally
  45. {
  46. /* receive data into &_ret_value */
  47. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  48. }
  49. RpcFinally
  50. {
  51. _message.Buffer = _packet;
  52. _status = I_RpcFreeBuffer(&_message);
  53. if (_status) RpcRaiseException(_status);
  54. }
  55. RpcEndFinally
  56. return (_ret_value);
  57. }
  58. void Void(
  59. handle_t hRpc)
  60. {
  61. unsigned char * _packet;
  62. RPC_STATUS _status;
  63. RPC_MESSAGE _message;
  64. PRPC_MESSAGE _prpcmsg = & _message;
  65. ((void)( _packet ));
  66. _message.Handle = hRpc;
  67. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  68. _prpcmsg->BufferLength = 0;
  69. _message.ProcNum = ( 1 );
  70. _message.RpcFlags = ( 0 );
  71. _status = I_RpcGetBuffer(&_message);
  72. if (_status) RpcRaiseException(_status);
  73. _packet = _message.Buffer;
  74. _prpcmsg->Buffer = _packet;
  75. _status = I_RpcSendReceive(&_message);
  76. if (_status) RpcRaiseException(_status);
  77. _status = I_RpcFreeBuffer(&_message);
  78. if (_status) RpcRaiseException(_status);
  79. }
  80. SCODE VoidRC(
  81. handle_t hRpc)
  82. {
  83. SCODE _ret_value;
  84. unsigned char * _packet;
  85. unsigned char * _tempbuf;
  86. RPC_STATUS _status;
  87. RPC_MESSAGE _message;
  88. PRPC_MESSAGE _prpcmsg = & _message;
  89. ((void)( _packet ));
  90. ((void)( _tempbuf ));
  91. _message.Handle = hRpc;
  92. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  93. _prpcmsg->BufferLength = 0;
  94. _message.ProcNum = ( 2 );
  95. _message.RpcFlags = ( 0 );
  96. _status = I_RpcGetBuffer(&_message);
  97. if (_status) RpcRaiseException(_status);
  98. _packet = _message.Buffer;
  99. _prpcmsg->Buffer = _packet;
  100. _status = I_RpcSendReceive(&_message);
  101. if (_status) RpcRaiseException(_status);
  102. _packet = _message.Buffer;
  103. RpcTryFinally
  104. {
  105. /* receive data into &_ret_value */
  106. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  107. }
  108. RpcFinally
  109. {
  110. _message.Buffer = _packet;
  111. _status = I_RpcFreeBuffer(&_message);
  112. if (_status) RpcRaiseException(_status);
  113. }
  114. RpcEndFinally
  115. return (_ret_value);
  116. }
  117. SCODE VoidPtrIn(
  118. handle_t hRpc,
  119. ULONG cb,
  120. void *pv)
  121. {
  122. SCODE _ret_value;
  123. unsigned char * _packet;
  124. unsigned int _length;
  125. unsigned char * _tempbuf;
  126. RPC_STATUS _status;
  127. RPC_MESSAGE _message;
  128. PRPC_MESSAGE _prpcmsg = & _message;
  129. ((void)( _packet ));
  130. ((void)( _tempbuf ));
  131. ((void)( _length ));
  132. _message.Handle = hRpc;
  133. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  134. _prpcmsg->BufferLength = 8;
  135. if (pv ==0)
  136. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  137. _prpcmsg->BufferLength += 4;
  138. _prpcmsg->BufferLength += (unsigned int)(cb);
  139. _message.ProcNum = ( 3 );
  140. _message.RpcFlags = ( 0 );
  141. _status = I_RpcGetBuffer(&_message);
  142. if (_status) RpcRaiseException(_status);
  143. _packet = _message.Buffer;
  144. _length = _prpcmsg->BufferLength;
  145. _prpcmsg->BufferLength = 0;
  146. /* send data from cb */
  147. *(*(long **)&_prpcmsg->Buffer)++ = (long)cb;
  148. // send total number of elements
  149. *(*(long **)&_prpcmsg->Buffer)++ = cb;
  150. /* send data from pv */
  151. NDRcopy (_prpcmsg->Buffer, (void __RPC_FAR *) ((unsigned char *)pv+0), (unsigned int)(cb));
  152. *(unsigned long *)&_prpcmsg->Buffer += cb;
  153. _prpcmsg->Buffer = _packet;
  154. _prpcmsg->BufferLength = _length;
  155. _status = I_RpcSendReceive(&_message);
  156. if (_status) RpcRaiseException(_status);
  157. _packet = _message.Buffer;
  158. RpcTryFinally
  159. {
  160. /* receive data into &_ret_value */
  161. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  162. }
  163. RpcFinally
  164. {
  165. _message.Buffer = _packet;
  166. _status = I_RpcFreeBuffer(&_message);
  167. if (_status) RpcRaiseException(_status);
  168. }
  169. RpcEndFinally
  170. return (_ret_value);
  171. }
  172. SCODE VoidPtrOut(
  173. handle_t hRpc,
  174. ULONG cb,
  175. ULONG *pcb,
  176. void *pv)
  177. {
  178. SCODE _ret_value;
  179. unsigned long _alloc_total;
  180. unsigned long _valid_lower;
  181. unsigned long _valid_total;
  182. unsigned char * _packet;
  183. unsigned char * _tempbuf;
  184. unsigned char * _savebuf;
  185. RPC_STATUS _status;
  186. RPC_MESSAGE _message;
  187. PRPC_MESSAGE _prpcmsg = & _message;
  188. ((void)( _alloc_total ));
  189. ((void)( _valid_total ));
  190. ((void)( _valid_lower ));
  191. ((void)( _packet ));
  192. ((void)( _tempbuf ));
  193. ((void)( _savebuf ));
  194. _message.Handle = hRpc;
  195. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  196. _prpcmsg->BufferLength = 4;
  197. _message.ProcNum = ( 4 );
  198. _message.RpcFlags = ( 0 );
  199. _status = I_RpcGetBuffer(&_message);
  200. if (_status) RpcRaiseException(_status);
  201. _packet = _message.Buffer;
  202. /* send data from cb */
  203. *(*(long **)&_prpcmsg->Buffer)++ = (long)cb;
  204. _prpcmsg->Buffer = _packet;
  205. _status = I_RpcSendReceive(&_message);
  206. if (_status) RpcRaiseException(_status);
  207. _packet = _message.Buffer;
  208. RpcTryFinally
  209. {
  210. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  211. if (pcb ==0)
  212. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  213. /* receive data into pcb */
  214. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)pcb);
  215. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  216. if (pv ==0)
  217. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  218. // recv total number of elements
  219. long_from_ndr((PRPC_MESSAGE)_prpcmsg, &_alloc_total);
  220. // recv valid range
  221. long_from_ndr((PRPC_MESSAGE)_prpcmsg, &_valid_lower);
  222. long_from_ndr((PRPC_MESSAGE)_prpcmsg, &_valid_total);
  223. byte_array_from_ndr ((PRPC_MESSAGE)_prpcmsg, _valid_lower, _valid_lower + _valid_total, pv);
  224. /* receive data into &_ret_value */
  225. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  226. }
  227. RpcFinally
  228. {
  229. _message.Buffer = _packet;
  230. _status = I_RpcFreeBuffer(&_message);
  231. if (_status) RpcRaiseException(_status);
  232. }
  233. RpcEndFinally
  234. return (_ret_value);
  235. }
  236. SCODE DwordIn(
  237. handle_t hRpc,
  238. DWORD dw)
  239. {
  240. SCODE _ret_value;
  241. unsigned char * _packet;
  242. unsigned char * _tempbuf;
  243. RPC_STATUS _status;
  244. RPC_MESSAGE _message;
  245. PRPC_MESSAGE _prpcmsg = & _message;
  246. ((void)( _packet ));
  247. ((void)( _tempbuf ));
  248. _message.Handle = hRpc;
  249. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  250. _prpcmsg->BufferLength = 4;
  251. _message.ProcNum = ( 5 );
  252. _message.RpcFlags = ( 0 );
  253. _status = I_RpcGetBuffer(&_message);
  254. if (_status) RpcRaiseException(_status);
  255. _packet = _message.Buffer;
  256. /* send data from dw */
  257. *(*(long **)&_prpcmsg->Buffer)++ = (long)dw;
  258. _prpcmsg->Buffer = _packet;
  259. _status = I_RpcSendReceive(&_message);
  260. if (_status) RpcRaiseException(_status);
  261. _packet = _message.Buffer;
  262. RpcTryFinally
  263. {
  264. /* receive data into &_ret_value */
  265. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  266. }
  267. RpcFinally
  268. {
  269. _message.Buffer = _packet;
  270. _status = I_RpcFreeBuffer(&_message);
  271. if (_status) RpcRaiseException(_status);
  272. }
  273. RpcEndFinally
  274. return (_ret_value);
  275. }
  276. SCODE DwordOut(
  277. handle_t hRpc,
  278. DWORD *pdw)
  279. {
  280. SCODE _ret_value;
  281. unsigned char * _packet;
  282. unsigned char * _tempbuf;
  283. RPC_STATUS _status;
  284. RPC_MESSAGE _message;
  285. PRPC_MESSAGE _prpcmsg = & _message;
  286. ((void)( _packet ));
  287. ((void)( _tempbuf ));
  288. _message.Handle = hRpc;
  289. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  290. _prpcmsg->BufferLength = 0;
  291. _message.ProcNum = ( 6 );
  292. _message.RpcFlags = ( 0 );
  293. _status = I_RpcGetBuffer(&_message);
  294. if (_status) RpcRaiseException(_status);
  295. _packet = _message.Buffer;
  296. _prpcmsg->Buffer = _packet;
  297. _status = I_RpcSendReceive(&_message);
  298. if (_status) RpcRaiseException(_status);
  299. _packet = _message.Buffer;
  300. RpcTryFinally
  301. {
  302. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  303. if (pdw ==0)
  304. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  305. /* receive data into pdw */
  306. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)pdw);
  307. /* receive data into &_ret_value */
  308. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  309. }
  310. RpcFinally
  311. {
  312. _message.Buffer = _packet;
  313. _status = I_RpcFreeBuffer(&_message);
  314. if (_status) RpcRaiseException(_status);
  315. }
  316. RpcEndFinally
  317. return (_ret_value);
  318. }
  319. SCODE DwordInOut(
  320. handle_t hRpc,
  321. DWORD *pdw)
  322. {
  323. SCODE _ret_value;
  324. unsigned char * _packet;
  325. unsigned int _length;
  326. unsigned char * _tempbuf;
  327. RPC_STATUS _status;
  328. RPC_MESSAGE _message;
  329. PRPC_MESSAGE _prpcmsg = & _message;
  330. ((void)( _packet ));
  331. ((void)( _tempbuf ));
  332. ((void)( _length ));
  333. _message.Handle = hRpc;
  334. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  335. _prpcmsg->BufferLength = 4;
  336. _message.ProcNum = ( 7 );
  337. _message.RpcFlags = ( 0 );
  338. _status = I_RpcGetBuffer(&_message);
  339. if (_status) RpcRaiseException(_status);
  340. _packet = _message.Buffer;
  341. _length = _prpcmsg->BufferLength;
  342. _prpcmsg->BufferLength = 0;
  343. /* send data from *pdw */
  344. *(*(long **)&_prpcmsg->Buffer)++ = (long)*pdw;
  345. _prpcmsg->Buffer = _packet;
  346. _prpcmsg->BufferLength = _length;
  347. _status = I_RpcSendReceive(&_message);
  348. if (_status) RpcRaiseException(_status);
  349. _packet = _message.Buffer;
  350. RpcTryFinally
  351. {
  352. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  353. if (pdw ==0)
  354. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  355. /* receive data into pdw */
  356. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)pdw);
  357. /* receive data into &_ret_value */
  358. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  359. }
  360. RpcFinally
  361. {
  362. _message.Buffer = _packet;
  363. _status = I_RpcFreeBuffer(&_message);
  364. if (_status) RpcRaiseException(_status);
  365. }
  366. RpcEndFinally
  367. return (_ret_value);
  368. }
  369. SCODE LiIn(
  370. handle_t hRpc,
  371. LARGE_INTEGER li)
  372. {
  373. SCODE _ret_value;
  374. unsigned char * _packet;
  375. unsigned char * _tempbuf;
  376. RPC_STATUS _status;
  377. RPC_MESSAGE _message;
  378. PRPC_MESSAGE _prpcmsg = & _message;
  379. ((void)( _packet ));
  380. ((void)( _tempbuf ));
  381. _message.Handle = hRpc;
  382. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  383. _prpcmsg->BufferLength = 8;
  384. _message.ProcNum = ( 8 );
  385. _message.RpcFlags = ( 0 );
  386. _status = I_RpcGetBuffer(&_message);
  387. if (_status) RpcRaiseException(_status);
  388. _packet = _message.Buffer;
  389. /* send data from &li */
  390. NDRcopy (_prpcmsg->Buffer, (void __RPC_FAR *) (&li), (unsigned int)(8));
  391. *(unsigned long *)&_prpcmsg->Buffer += 8;
  392. _prpcmsg->Buffer = _packet;
  393. _status = I_RpcSendReceive(&_message);
  394. if (_status) RpcRaiseException(_status);
  395. _packet = _message.Buffer;
  396. RpcTryFinally
  397. {
  398. /* receive data into &_ret_value */
  399. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  400. }
  401. RpcFinally
  402. {
  403. _message.Buffer = _packet;
  404. _status = I_RpcFreeBuffer(&_message);
  405. if (_status) RpcRaiseException(_status);
  406. }
  407. RpcEndFinally
  408. return (_ret_value);
  409. }
  410. SCODE LiOut(
  411. handle_t hRpc,
  412. LARGE_INTEGER *pli)
  413. {
  414. SCODE _ret_value;
  415. unsigned long _alloc_total;
  416. unsigned char * _packet;
  417. unsigned char * _tempbuf;
  418. RPC_STATUS _status;
  419. RPC_MESSAGE _message;
  420. PRPC_MESSAGE _prpcmsg = & _message;
  421. ((void)( _alloc_total ));
  422. ((void)( _packet ));
  423. ((void)( _tempbuf ));
  424. _message.Handle = hRpc;
  425. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  426. _prpcmsg->BufferLength = 0;
  427. _message.ProcNum = ( 9 );
  428. _message.RpcFlags = ( 0 );
  429. _status = I_RpcGetBuffer(&_message);
  430. if (_status) RpcRaiseException(_status);
  431. _packet = _message.Buffer;
  432. _prpcmsg->Buffer = _packet;
  433. _status = I_RpcSendReceive(&_message);
  434. if (_status) RpcRaiseException(_status);
  435. _packet = _message.Buffer;
  436. RpcTryFinally
  437. {
  438. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  439. if (pli ==0)
  440. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  441. data_from_ndr((PRPC_MESSAGE)_prpcmsg, (void __RPC_FAR *) (pli), "4ll", 8);
  442. /* receive data into &_ret_value */
  443. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  444. }
  445. RpcFinally
  446. {
  447. _message.Buffer = _packet;
  448. _status = I_RpcFreeBuffer(&_message);
  449. if (_status) RpcRaiseException(_status);
  450. }
  451. RpcEndFinally
  452. return (_ret_value);
  453. }
  454. SCODE ULiIn(
  455. handle_t hRpc,
  456. ULARGE_INTEGER uli)
  457. {
  458. SCODE _ret_value;
  459. unsigned char * _packet;
  460. unsigned char * _tempbuf;
  461. RPC_STATUS _status;
  462. RPC_MESSAGE _message;
  463. PRPC_MESSAGE _prpcmsg = & _message;
  464. ((void)( _packet ));
  465. ((void)( _tempbuf ));
  466. _message.Handle = hRpc;
  467. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  468. _prpcmsg->BufferLength = 8;
  469. _message.ProcNum = ( 10 );
  470. _message.RpcFlags = ( 0 );
  471. _status = I_RpcGetBuffer(&_message);
  472. if (_status) RpcRaiseException(_status);
  473. _packet = _message.Buffer;
  474. /* send data from &uli */
  475. NDRcopy (_prpcmsg->Buffer, (void __RPC_FAR *) (&uli), (unsigned int)(8));
  476. *(unsigned long *)&_prpcmsg->Buffer += 8;
  477. _prpcmsg->Buffer = _packet;
  478. _status = I_RpcSendReceive(&_message);
  479. if (_status) RpcRaiseException(_status);
  480. _packet = _message.Buffer;
  481. RpcTryFinally
  482. {
  483. /* receive data into &_ret_value */
  484. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  485. }
  486. RpcFinally
  487. {
  488. _message.Buffer = _packet;
  489. _status = I_RpcFreeBuffer(&_message);
  490. if (_status) RpcRaiseException(_status);
  491. }
  492. RpcEndFinally
  493. return (_ret_value);
  494. }
  495. SCODE ULiOut(
  496. handle_t hRpc,
  497. ULARGE_INTEGER *puli)
  498. {
  499. SCODE _ret_value;
  500. unsigned long _alloc_total;
  501. unsigned char * _packet;
  502. unsigned char * _tempbuf;
  503. RPC_STATUS _status;
  504. RPC_MESSAGE _message;
  505. PRPC_MESSAGE _prpcmsg = & _message;
  506. ((void)( _alloc_total ));
  507. ((void)( _packet ));
  508. ((void)( _tempbuf ));
  509. _message.Handle = hRpc;
  510. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  511. _prpcmsg->BufferLength = 0;
  512. _message.ProcNum = ( 11 );
  513. _message.RpcFlags = ( 0 );
  514. _status = I_RpcGetBuffer(&_message);
  515. if (_status) RpcRaiseException(_status);
  516. _packet = _message.Buffer;
  517. _prpcmsg->Buffer = _packet;
  518. _status = I_RpcSendReceive(&_message);
  519. if (_status) RpcRaiseException(_status);
  520. _packet = _message.Buffer;
  521. RpcTryFinally
  522. {
  523. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  524. if (puli ==0)
  525. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  526. data_from_ndr((PRPC_MESSAGE)_prpcmsg, (void __RPC_FAR *) (puli), "4ll", 8);
  527. /* receive data into &_ret_value */
  528. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  529. }
  530. RpcFinally
  531. {
  532. _message.Buffer = _packet;
  533. _status = I_RpcFreeBuffer(&_message);
  534. if (_status) RpcRaiseException(_status);
  535. }
  536. RpcEndFinally
  537. return (_ret_value);
  538. }
  539. SCODE StringIn(
  540. handle_t hRpc,
  541. LPWSTR pwsz)
  542. {
  543. SCODE _ret_value;
  544. unsigned char * _packet;
  545. unsigned int _length;
  546. unsigned char * _buffer;
  547. unsigned char * _treebuf;
  548. unsigned char * _tempbuf;
  549. RPC_STATUS _status;
  550. RPC_MESSAGE _message;
  551. PRPC_MESSAGE _prpcmsg = & _message;
  552. ((void)( _packet ));
  553. ((void)( _buffer ));
  554. ((void)( _treebuf ));
  555. ((void)( _tempbuf ));
  556. ((void)( _length ));
  557. _message.Handle = hRpc;
  558. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  559. _prpcmsg->BufferLength = 0;
  560. if (pwsz ==0)
  561. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  562. tree_size_ndr((void __RPC_FAR *)&(pwsz), (PRPC_MESSAGE)_prpcmsg, "s2", 1);
  563. _message.ProcNum = ( 12 );
  564. _message.RpcFlags = ( 0 );
  565. _status = I_RpcGetBuffer(&_message);
  566. if (_status) RpcRaiseException(_status);
  567. _packet = _message.Buffer;
  568. _length = _prpcmsg->BufferLength;
  569. _prpcmsg->BufferLength = 0;
  570. tree_into_ndr((void __RPC_FAR *)&(pwsz), (PRPC_MESSAGE)_prpcmsg, "s2", 1);
  571. _prpcmsg->Buffer = _packet;
  572. _prpcmsg->BufferLength = _length;
  573. _status = I_RpcSendReceive(&_message);
  574. if (_status) RpcRaiseException(_status);
  575. _packet = _message.Buffer;
  576. RpcTryFinally
  577. {
  578. /* receive data into &_ret_value */
  579. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  580. }
  581. RpcFinally
  582. {
  583. _message.Buffer = _packet;
  584. _status = I_RpcFreeBuffer(&_message);
  585. if (_status) RpcRaiseException(_status);
  586. }
  587. RpcEndFinally
  588. return (_ret_value);
  589. }
  590. SCODE StringOut(
  591. handle_t hRpc,
  592. LPWSTR *ppwsz)
  593. {
  594. SCODE _ret_value;
  595. unsigned long _alloc_total;
  596. unsigned long _valid_lower;
  597. unsigned long _valid_total;
  598. unsigned char * _packet;
  599. unsigned int _length;
  600. unsigned char * _buffer;
  601. unsigned char * _treebuf;
  602. unsigned char * _tempbuf;
  603. unsigned char * _savebuf;
  604. RPC_STATUS _status;
  605. RPC_MESSAGE _message;
  606. PRPC_MESSAGE _prpcmsg = & _message;
  607. ((void)( _alloc_total ));
  608. ((void)( _valid_total ));
  609. ((void)( _valid_lower ));
  610. ((void)( _packet ));
  611. ((void)( _buffer ));
  612. ((void)( _treebuf ));
  613. ((void)( _tempbuf ));
  614. ((void)( _savebuf ));
  615. ((void)( _length ));
  616. _message.Handle = hRpc;
  617. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  618. _prpcmsg->BufferLength = 0;
  619. _message.ProcNum = ( 13 );
  620. _message.RpcFlags = ( 0 );
  621. _status = I_RpcGetBuffer(&_message);
  622. if (_status) RpcRaiseException(_status);
  623. _packet = _message.Buffer;
  624. _prpcmsg->Buffer = _packet;
  625. _status = I_RpcSendReceive(&_message);
  626. if (_status) RpcRaiseException(_status);
  627. _packet = _message.Buffer;
  628. RpcTryFinally
  629. {
  630. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  631. _treebuf = 0;
  632. if (ppwsz ==0)
  633. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  634. *(unsigned long *)&_prpcmsg->Buffer += 3;
  635. *(unsigned long *)&_prpcmsg->Buffer &= 0xfffffffc;
  636. if (*(*(unsigned long **)&_prpcmsg->Buffer)++)
  637. {
  638. // recv total number of elements
  639. long_from_ndr((PRPC_MESSAGE)_prpcmsg, &_alloc_total);
  640. if ((*ppwsz) ==0)
  641. {
  642. (*ppwsz) = (WCHAR *)MIDL_user_allocate ((size_t)(_alloc_total * sizeof(WCHAR)));
  643. }
  644. data_from_ndr((PRPC_MESSAGE)_prpcmsg, (void __RPC_FAR *) ((*ppwsz)), "s2", 1);
  645. }
  646. else
  647. {
  648. (*ppwsz) = 0;
  649. }
  650. /* receive data into &_ret_value */
  651. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  652. }
  653. RpcFinally
  654. {
  655. _message.Buffer = _packet;
  656. _status = I_RpcFreeBuffer(&_message);
  657. if (_status) RpcRaiseException(_status);
  658. }
  659. RpcEndFinally
  660. return (_ret_value);
  661. }
  662. SCODE StringInOut(
  663. handle_t hRpc,
  664. LPWSTR pwsz)
  665. {
  666. SCODE _ret_value;
  667. unsigned long _alloc_total;
  668. unsigned long _valid_lower;
  669. unsigned long _valid_total;
  670. unsigned char * _packet;
  671. unsigned int _length;
  672. unsigned char * _buffer;
  673. unsigned char * _treebuf;
  674. unsigned char * _tempbuf;
  675. unsigned char * _savebuf;
  676. RPC_STATUS _status;
  677. RPC_MESSAGE _message;
  678. PRPC_MESSAGE _prpcmsg = & _message;
  679. ((void)( _alloc_total ));
  680. ((void)( _valid_total ));
  681. ((void)( _valid_lower ));
  682. ((void)( _packet ));
  683. ((void)( _buffer ));
  684. ((void)( _treebuf ));
  685. ((void)( _tempbuf ));
  686. ((void)( _savebuf ));
  687. ((void)( _length ));
  688. _message.Handle = hRpc;
  689. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  690. _prpcmsg->BufferLength = 0;
  691. if (pwsz ==0)
  692. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  693. tree_size_ndr((void __RPC_FAR *)&(pwsz), (PRPC_MESSAGE)_prpcmsg, "s2", 1);
  694. _message.ProcNum = ( 14 );
  695. _message.RpcFlags = ( 0 );
  696. _status = I_RpcGetBuffer(&_message);
  697. if (_status) RpcRaiseException(_status);
  698. _packet = _message.Buffer;
  699. _length = _prpcmsg->BufferLength;
  700. _prpcmsg->BufferLength = 0;
  701. tree_into_ndr((void __RPC_FAR *)&(pwsz), (PRPC_MESSAGE)_prpcmsg, "s2", 1);
  702. _prpcmsg->Buffer = _packet;
  703. _prpcmsg->BufferLength = _length;
  704. _status = I_RpcSendReceive(&_message);
  705. if (_status) RpcRaiseException(_status);
  706. _packet = _message.Buffer;
  707. RpcTryFinally
  708. {
  709. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  710. _treebuf = 0;
  711. if (pwsz ==0)
  712. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  713. // recv total number of elements
  714. long_from_ndr((PRPC_MESSAGE)_prpcmsg, &_alloc_total);
  715. data_from_ndr((PRPC_MESSAGE)_prpcmsg, (void __RPC_FAR *) (pwsz), "s2", 1);
  716. /* receive data into &_ret_value */
  717. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  718. }
  719. RpcFinally
  720. {
  721. _message.Buffer = _packet;
  722. _status = I_RpcFreeBuffer(&_message);
  723. if (_status) RpcRaiseException(_status);
  724. }
  725. RpcEndFinally
  726. return (_ret_value);
  727. }
  728. SCODE GuidIn(
  729. handle_t hRpc,
  730. GUID guid)
  731. {
  732. SCODE _ret_value;
  733. unsigned char * _packet;
  734. unsigned char * _tempbuf;
  735. RPC_STATUS _status;
  736. RPC_MESSAGE _message;
  737. PRPC_MESSAGE _prpcmsg = & _message;
  738. ((void)( _packet ));
  739. ((void)( _tempbuf ));
  740. _message.Handle = hRpc;
  741. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  742. _prpcmsg->BufferLength = 16;
  743. _message.ProcNum = ( 15 );
  744. _message.RpcFlags = ( 0 );
  745. _status = I_RpcGetBuffer(&_message);
  746. if (_status) RpcRaiseException(_status);
  747. _packet = _message.Buffer;
  748. /* send data from &guid */
  749. NDRcopy (_prpcmsg->Buffer, (void __RPC_FAR *) (&guid), (unsigned int)(16));
  750. *(unsigned long *)&_prpcmsg->Buffer += 16;
  751. _prpcmsg->Buffer = _packet;
  752. _status = I_RpcSendReceive(&_message);
  753. if (_status) RpcRaiseException(_status);
  754. _packet = _message.Buffer;
  755. RpcTryFinally
  756. {
  757. /* receive data into &_ret_value */
  758. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  759. }
  760. RpcFinally
  761. {
  762. _message.Buffer = _packet;
  763. _status = I_RpcFreeBuffer(&_message);
  764. if (_status) RpcRaiseException(_status);
  765. }
  766. RpcEndFinally
  767. return (_ret_value);
  768. }
  769. SCODE GuidOut(
  770. handle_t hRpc,
  771. GUID *pguid)
  772. {
  773. SCODE _ret_value;
  774. unsigned long _alloc_total;
  775. unsigned char * _packet;
  776. unsigned char * _tempbuf;
  777. RPC_STATUS _status;
  778. RPC_MESSAGE _message;
  779. PRPC_MESSAGE _prpcmsg = & _message;
  780. ((void)( _alloc_total ));
  781. ((void)( _packet ));
  782. ((void)( _tempbuf ));
  783. _message.Handle = hRpc;
  784. _message.RpcInterfaceInformation = (void __RPC_FAR *) &___RpcClientInterface;
  785. _prpcmsg->BufferLength = 0;
  786. _message.ProcNum = ( 16 );
  787. _message.RpcFlags = ( 0 );
  788. _status = I_RpcGetBuffer(&_message);
  789. if (_status) RpcRaiseException(_status);
  790. _packet = _message.Buffer;
  791. _prpcmsg->Buffer = _packet;
  792. _status = I_RpcSendReceive(&_message);
  793. if (_status) RpcRaiseException(_status);
  794. _packet = _message.Buffer;
  795. RpcTryFinally
  796. {
  797. _tempbuf = (unsigned char *)_prpcmsg->Buffer;
  798. if (pguid ==0)
  799. RpcRaiseException(RPC_X_NULL_REF_POINTER);
  800. _gns__GUID ((GUID *)pguid, (PRPC_MESSAGE)_prpcmsg);
  801. /* receive data into &_ret_value */
  802. long_from_ndr((PRPC_MESSAGE)_prpcmsg, (unsigned long *)&_ret_value);
  803. }
  804. RpcFinally
  805. {
  806. _message.Buffer = _packet;
  807. _status = I_RpcFreeBuffer(&_message);
  808. if (_status) RpcRaiseException(_status);
  809. }
  810. RpcEndFinally
  811. return (_ret_value);
  812. }