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.

4895 lines
135 KiB

  1. /*++
  2. Copyright (C) 1992-98 Microsft Corporation. All rights reserved.
  3. Module Name:
  4. dlparams.c
  5. Abstract:
  6. Contains the code for submitting rpc request to the
  7. rasman service
  8. Author:
  9. Gurdeep Singh Pall (gurdeep) 06-Jun-1997
  10. Revision History:
  11. Miscellaneous Modifications - raos 31-Dec-1997
  12. --*/
  13. #include <nt.h>
  14. #include <ntrtl.h>
  15. #include <nturtl.h>
  16. #include <rasman.h>
  17. #include <wanpub.h>
  18. #include <ntlsa.h>
  19. #include <ntmsv1_0.h>
  20. #include <raserror.h>
  21. #include <rasppp.h>
  22. #include <media.h>
  23. #include <devioctl.h>
  24. #include <stdio.h>
  25. #include <stdarg.h>
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include "defs.h"
  29. #include "structs.h"
  30. #include "protos.h"
  31. #include "globals.h"
  32. #include "ras.h" // for RAS_STATS structure
  33. #include "rasapip.h"
  34. #include "strsafe.h"
  35. DWORD
  36. AllocateBuffer(DWORD dwSize,
  37. PBYTE *ppbuf,
  38. PDWORD pdwSizeofBuffer)
  39. {
  40. DWORD retcode = SUCCESS;
  41. DWORD dwSizeRequired;
  42. *ppbuf = NULL;
  43. dwSizeRequired = dwSize +
  44. sizeof( RequestBuffer ) +
  45. sizeof (REQTYPECAST);
  46. if ( dwSizeRequired <= *pdwSizeofBuffer )
  47. {
  48. goto done;
  49. }
  50. *ppbuf = LocalAlloc(LPTR, dwSizeRequired);
  51. if ( NULL == *ppbuf )
  52. {
  53. retcode = GetLastError();
  54. goto done;
  55. }
  56. ((RequestBuffer *) *ppbuf)->RB_Dummy = sizeof(ULONG_PTR);
  57. *pdwSizeofBuffer = dwSizeRequired;
  58. done:
  59. return retcode;
  60. }
  61. /* SubmitRequest ()
  62. Function: This function submits the different types
  63. of requests and waits for their completion.
  64. Since the different requests require different
  65. number of arguments and require different
  66. information to be passed to and from the
  67. Requestor thread - case statements are
  68. used to send and retrieve information in
  69. the request buffer.
  70. Returns: Error codes returned by the request.
  71. */
  72. DWORD _cdecl
  73. SubmitRequest (HANDLE hConnection, WORD reqtype, ...)
  74. {
  75. RequestBuffer *preqbuf ;
  76. DWORD retcode ;
  77. DWORD i ;
  78. va_list ap ;
  79. RequestBuffer *pBuffer = NULL;
  80. DWORD *pdwSize;
  81. DWORD *pdwEntries;
  82. DWORD dwSizeofBuffer = sizeof ( RequestBuffer )
  83. + REQUEST_BUFFER_SIZE;
  84. RequestBuffer *pbTemp;
  85. PBYTE pUserBuffer;
  86. PDWORD pdwVersion;
  87. PDWORD pdwMaskDialParams;
  88. PDWORD pdwFlags = 0;
  89. DWORD dwVersion;
  90. preqbuf = GetRequestBuffer();
  91. if (NULL == preqbuf)
  92. {
  93. //
  94. // couldn't get a req. buffer. can't do
  95. // much in this case. this can happen
  96. // if we are not able to initialize the
  97. // shared memory.
  98. //
  99. return E_OUTOFMEMORY;
  100. }
  101. va_start (ap, reqtype) ;
  102. preqbuf->RB_Reqtype = reqtype;
  103. preqbuf->RB_Dummy = sizeof(ULONG_PTR);
  104. pbTemp = preqbuf;
  105. switch (reqtype)
  106. {
  107. case REQTYPE_DEVICEENUM:
  108. {
  109. PCHAR devicetype = va_arg( ap, PCHAR ) ;
  110. pdwSize = va_arg(ap, PDWORD );
  111. pUserBuffer = va_arg( ap, PBYTE );
  112. if ( NULL == pUserBuffer )
  113. {
  114. *pdwSize = 0;
  115. }
  116. if ( *pdwSize )
  117. {
  118. retcode = AllocateBuffer(*pdwSize,
  119. (PBYTE *) &pBuffer,
  120. &dwSizeofBuffer);
  121. if(retcode)
  122. { //
  123. // failed to allocate
  124. //
  125. goto done;
  126. }
  127. if (pBuffer)
  128. {
  129. pBuffer->RB_Reqtype = reqtype;
  130. pbTemp = pBuffer;
  131. }
  132. }
  133. else
  134. {
  135. pbTemp = preqbuf;
  136. }
  137. ((REQTYPECAST *) pbTemp->RB_Buffer )->DeviceEnum.dwsize
  138. = *pdwSize;
  139. memcpy (((REQTYPECAST *)
  140. pbTemp->RB_Buffer)->DeviceEnum.devicetype,
  141. devicetype,
  142. MAX_DEVICETYPE_NAME) ;
  143. }
  144. break ;
  145. case REQTYPE_DEVICECONNECT:
  146. {
  147. HPORT porthandle = va_arg(ap, HPORT);
  148. PCHAR devicetype = va_arg(ap, PCHAR);
  149. PCHAR devicename = va_arg(ap, PCHAR);
  150. DWORD timeout = va_arg(ap, DWORD);
  151. HANDLE handle = va_arg(ap, HANDLE);
  152. DWORD pid = va_arg(ap, DWORD);
  153. preqbuf->RB_PCBIndex = PtrToUlong( porthandle) ;
  154. (VOID) StringCchCopyA(((REQTYPECAST *)
  155. preqbuf->RB_Buffer)->DeviceConnect.devicetype,
  156. MAX_DEVICETYPE_NAME,
  157. devicetype) ;
  158. (VOID) StringCchCopyA(((REQTYPECAST *)
  159. preqbuf->RB_Buffer)->DeviceConnect.devicename,
  160. MAX_DEVICE_NAME + 1,
  161. devicename) ;
  162. ((REQTYPECAST *)
  163. preqbuf->RB_Buffer)->DeviceConnect.timeout = timeout;
  164. ((REQTYPECAST *)
  165. preqbuf->RB_Buffer)->DeviceConnect.handle = handle;
  166. ((REQTYPECAST *)
  167. preqbuf->RB_Buffer)->DeviceConnect.pid = pid;
  168. }
  169. break ;
  170. case REQTYPE_DEVICEGETINFO:
  171. {
  172. HPORT porthandle = va_arg(ap, HPORT) ;
  173. PCHAR devicetype = va_arg(ap, PCHAR) ;
  174. PCHAR devicename = va_arg(ap, PCHAR) ;
  175. pUserBuffer = va_arg( ap, PBYTE );
  176. pdwSize = va_arg( ap, PDWORD );
  177. if ( NULL == pUserBuffer )
  178. {
  179. *pdwSize = 0;
  180. }
  181. if ( *pdwSize )
  182. {
  183. retcode = AllocateBuffer(*pdwSize,
  184. (PBYTE *) &pBuffer,
  185. &dwSizeofBuffer);
  186. if(retcode)
  187. {
  188. goto done;
  189. }
  190. if(pBuffer)
  191. {
  192. pBuffer->RB_Reqtype = reqtype;
  193. pbTemp = pBuffer;
  194. }
  195. }
  196. else
  197. {
  198. pbTemp = preqbuf;
  199. }
  200. pbTemp->RB_PCBIndex = PtrToUlong( porthandle) ;
  201. ((REQTYPECAST *)
  202. pbTemp->RB_Buffer)->DeviceGetInfo.dwSize = (DWORD) *pdwSize;
  203. (VOID) StringCchCopyA(((REQTYPECAST *)
  204. pbTemp->RB_Buffer)->DeviceGetInfo.devicetype,
  205. MAX_DEVICETYPE_NAME,
  206. devicetype) ;
  207. (VOID) StringCchCopyA(((REQTYPECAST *)
  208. pbTemp->RB_Buffer)->DeviceGetInfo.devicename,
  209. MAX_DEVICE_NAME + 1,
  210. devicename) ;
  211. }
  212. break ;
  213. case REQTYPE_GETINFOEX:
  214. {
  215. ((REQTYPECAST *)
  216. preqbuf->RB_Buffer)->InfoEx.pid = GetCurrentProcessId();
  217. }
  218. break;
  219. case REQTYPE_PORTENUM:
  220. {
  221. pdwSize = va_arg ( ap, DWORD * );
  222. pUserBuffer = (PBYTE ) va_arg ( ap, PBYTE ) ;
  223. if ( NULL == pUserBuffer )
  224. {
  225. *pdwSize = 0;
  226. }
  227. if ( *pdwSize )
  228. {
  229. retcode = AllocateBuffer(*pdwSize,
  230. (PBYTE *) &pBuffer,
  231. &dwSizeofBuffer);
  232. if ( retcode )
  233. {
  234. goto done;
  235. }
  236. if ( pBuffer )
  237. {
  238. pBuffer->RB_Reqtype = reqtype;
  239. pbTemp = pBuffer;
  240. }
  241. }
  242. else
  243. {
  244. //
  245. // Use default buffer
  246. //
  247. pbTemp = preqbuf;
  248. }
  249. ((REQTYPECAST *)
  250. pbTemp->RB_Buffer)->Enum.size = *pdwSize;
  251. }
  252. break;
  253. case REQTYPE_ENUMCONNECTION:
  254. {
  255. pdwSize = va_arg ( ap, DWORD * );
  256. pUserBuffer = (PBYTE ) va_arg ( ap, HCONN * ) ;
  257. if ( NULL == pUserBuffer )
  258. {
  259. *pdwSize = 0;
  260. }
  261. if ( *pdwSize )
  262. {
  263. retcode = AllocateBuffer(*pdwSize,
  264. (PBYTE *) &pBuffer,
  265. &dwSizeofBuffer);
  266. if (retcode)
  267. {
  268. goto done;
  269. }
  270. if(pBuffer)
  271. {
  272. pBuffer->RB_Reqtype = reqtype;
  273. pbTemp = pBuffer;
  274. }
  275. }
  276. else
  277. {
  278. //
  279. // Use default buffer
  280. //
  281. pbTemp = preqbuf;
  282. }
  283. ((REQTYPECAST *)
  284. pbTemp->RB_Buffer)->Enum.size = *pdwSize;
  285. }
  286. break;
  287. case REQTYPE_PROTOCOLENUM:
  288. {
  289. pdwSize = va_arg ( ap, DWORD * );
  290. pUserBuffer = (PBYTE ) va_arg ( ap, PBYTE ) ;
  291. if ( NULL == pUserBuffer )
  292. {
  293. *pdwSize = 0;
  294. }
  295. if ( *pdwSize )
  296. {
  297. retcode = AllocateBuffer(*pdwSize,
  298. (PBYTE *) &pBuffer,
  299. &dwSizeofBuffer);
  300. if(retcode)
  301. {
  302. goto done;
  303. }
  304. if(pBuffer)
  305. {
  306. pBuffer->RB_Reqtype = reqtype;
  307. pbTemp = pBuffer;
  308. }
  309. }
  310. else
  311. {
  312. //
  313. // Use default buffer
  314. //
  315. pbTemp = preqbuf;
  316. }
  317. ((REQTYPECAST *)
  318. pbTemp->RB_Buffer)->Enum.size = *pdwSize;
  319. }
  320. break;
  321. case REQTYPE_ENUMLANNETS:
  322. case REQTYPE_GETATTACHEDCOUNT:
  323. break ;
  324. case REQTYPE_RETRIEVEUSERDATA:
  325. {
  326. HPORT porthandle = va_arg ( ap, HPORT );
  327. pUserBuffer = va_arg ( ap, PBYTE );
  328. pdwSize = va_arg ( ap, DWORD * );
  329. if ( NULL == pUserBuffer )
  330. {
  331. *pdwSize = 0;
  332. }
  333. if ( *pdwSize )
  334. {
  335. retcode = AllocateBuffer(*pdwSize,
  336. (PBYTE *) &pBuffer,
  337. &dwSizeofBuffer);
  338. if(retcode)
  339. {
  340. goto done;
  341. }
  342. if(pBuffer)
  343. {
  344. pBuffer->RB_Reqtype = reqtype;
  345. pbTemp = pBuffer;
  346. }
  347. }
  348. else
  349. {
  350. pbTemp = preqbuf;
  351. }
  352. ((REQTYPECAST *)
  353. pbTemp->RB_Buffer)->OldUserData.size = *pdwSize;
  354. pbTemp->RB_PCBIndex = PtrToUlong( porthandle);
  355. }
  356. break;
  357. case REQTYPE_PORTGETINFO:
  358. {
  359. HPORT porthandle = va_arg ( ap, HPORT );
  360. pUserBuffer = va_arg ( ap, PBYTE );
  361. pdwSize = va_arg( ap, PDWORD );
  362. if ( NULL == pUserBuffer )
  363. {
  364. *pdwSize = 0;
  365. }
  366. if ( *pdwSize )
  367. {
  368. retcode = AllocateBuffer(*pdwSize,
  369. (PBYTE *) &pBuffer,
  370. &dwSizeofBuffer);
  371. if(retcode)
  372. {
  373. goto done;
  374. }
  375. if(pBuffer)
  376. {
  377. pBuffer->RB_Reqtype = reqtype;
  378. pbTemp = pBuffer;
  379. }
  380. }
  381. else
  382. {
  383. pbTemp = preqbuf;
  384. }
  385. pbTemp->RB_PCBIndex = PtrToUlong( porthandle );
  386. ((REQTYPECAST *)
  387. pbTemp->RB_Buffer)->GetInfo.size = *pdwSize;
  388. }
  389. break;
  390. case REQTYPE_GETINFO:
  391. case REQTYPE_CANCELRECEIVE:
  392. case REQTYPE_PORTCLEARSTATISTICS:
  393. case REQTYPE_PORTGETSTATISTICS:
  394. case REQTYPE_BUNDLECLEARSTATISTICS:
  395. case REQTYPE_BUNDLEGETSTATISTICS:
  396. case REQTYPE_PORTGETSTATISTICSEX:
  397. case REQTYPE_BUNDLEGETSTATISTICSEX:
  398. case REQTYPE_COMPRESSIONGETINFO:
  399. case REQTYPE_PORTCONNECTCOMPLETE:
  400. case REQTYPE_PORTENUMPROTOCOLS:
  401. case REQTYPE_GETFRAMINGCAPABILITIES:
  402. case REQTYPE_GETFRAMINGEX:
  403. case REQTYPE_GETBUNDLEDPORT:
  404. case REQTYPE_PORTGETBUNDLE:
  405. case REQTYPE_PORTRECEIVEEX:
  406. case REQTYPE_PPPSTARTED:
  407. {
  408. HPORT porthandle = va_arg(ap, HPORT) ;
  409. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  410. }
  411. break ;
  412. case REQTYPE_BUNDLEGETPORT:
  413. {
  414. HBUNDLE bundlehandle = va_arg(ap, HBUNDLE) ;
  415. ((REQTYPECAST *)
  416. preqbuf->RB_Buffer)->BundleGetPort.bundle = bundlehandle;
  417. }
  418. break ;
  419. case REQTYPE_PORTCLOSE:
  420. case REQTYPE_SERVERPORTCLOSE:
  421. {
  422. HPORT porthandle = va_arg(ap, HPORT) ;
  423. DWORD pid = va_arg(ap, DWORD) ;
  424. DWORD close = va_arg(ap, DWORD) ;
  425. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  426. ((REQTYPECAST *)
  427. preqbuf->RB_Buffer)->PortClose.pid = pid;
  428. ((REQTYPECAST *)
  429. preqbuf->RB_Buffer)->PortClose.close = close ;
  430. }
  431. break ;
  432. case REQTYPE_REQUESTNOTIFICATION:
  433. {
  434. HPORT porthandle = va_arg(ap, HPORT) ;
  435. HANDLE handle = va_arg(ap, HANDLE) ;
  436. DWORD pid = va_arg(ap, DWORD) ;
  437. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  438. ((REQTYPECAST *)
  439. preqbuf->RB_Buffer)->ReqNotification.handle = handle;
  440. ((REQTYPECAST *)
  441. preqbuf->RB_Buffer)->ReqNotification.pid = pid;
  442. }
  443. break ;
  444. case REQTYPE_PORTLISTEN:
  445. {
  446. HPORT porthandle = va_arg(ap, HPORT) ;
  447. DWORD timeout = va_arg(ap, DWORD) ;
  448. HANDLE handle = va_arg(ap, HANDLE) ;
  449. DWORD pid = va_arg(ap, DWORD) ;
  450. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  451. ((REQTYPECAST *)
  452. preqbuf->RB_Buffer)->PortListen.timeout = timeout;
  453. ((REQTYPECAST *)
  454. preqbuf->RB_Buffer)->PortListen.handle = handle;
  455. ((REQTYPECAST *)
  456. preqbuf->RB_Buffer)->PortListen.pid = pid ;
  457. }
  458. break ;
  459. case REQTYPE_PORTSETINFO:
  460. {
  461. HPORT porthandle = va_arg(ap, HPORT) ;
  462. RASMAN_PORTINFO *info = va_arg(ap, RASMAN_PORTINFO *) ;
  463. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  464. ((REQTYPECAST*)
  465. preqbuf->RB_Buffer)->PortSetInfo.info.PI_NumOfParams =
  466. info->PI_NumOfParams ;
  467. CopyParams (
  468. info->PI_Params,
  469. ((REQTYPECAST*)
  470. preqbuf->RB_Buffer)->PortSetInfo.info.PI_Params,
  471. info->PI_NumOfParams) ;
  472. }
  473. ConvParamPointerToOffset(
  474. ((REQTYPECAST*)
  475. preqbuf->RB_Buffer)->PortSetInfo.info.PI_Params,
  476. ((REQTYPECAST*)
  477. preqbuf->RB_Buffer)->PortSetInfo.info.PI_NumOfParams);
  478. break ;
  479. case REQTYPE_DEVICESETINFO:
  480. {
  481. HPORT porthandle = va_arg(ap, HPORT) ;
  482. PCHAR devicetype = va_arg(ap, PCHAR) ;
  483. PCHAR devicename = va_arg(ap, PCHAR) ;
  484. RASMAN_DEVICEINFO* info = va_arg(ap, RASMAN_DEVICEINFO*) ;
  485. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  486. (VOID) StringCchCopyA(((REQTYPECAST *)
  487. preqbuf->RB_Buffer)->DeviceSetInfo.devicetype,
  488. MAX_DEVICETYPE_NAME,
  489. devicetype) ;
  490. (VOID) StringCchCopyA(((REQTYPECAST *)
  491. preqbuf->RB_Buffer)->DeviceSetInfo.devicename,
  492. MAX_DEVICE_NAME,
  493. devicename) ;
  494. ((REQTYPECAST *)
  495. preqbuf->RB_Buffer)->DeviceSetInfo.pid = GetCurrentProcessId();
  496. ((REQTYPECAST*)
  497. preqbuf->RB_Buffer)->DeviceSetInfo.info.DI_NumOfParams =
  498. info->DI_NumOfParams ;
  499. CopyParams (
  500. info->DI_Params,
  501. ((REQTYPECAST*)
  502. preqbuf->RB_Buffer)->DeviceSetInfo.info.DI_Params,
  503. info->DI_NumOfParams) ;
  504. }
  505. //
  506. // So that we don't get hit by the shared memory being mapped to
  507. // different addresses we convert pointers to offsets:
  508. //
  509. ConvParamPointerToOffset(
  510. ((REQTYPECAST*)
  511. preqbuf->RB_Buffer)->DeviceSetInfo.info.DI_Params,
  512. ((REQTYPECAST*)
  513. preqbuf->RB_Buffer)->DeviceSetInfo.info.DI_NumOfParams) ;
  514. break ;
  515. case REQTYPE_PORTOPEN:
  516. {
  517. PCHAR portname = va_arg(ap, PCHAR) ;
  518. HANDLE notifier= va_arg(ap, HANDLE) ;
  519. DWORD pid = va_arg(ap, DWORD) ;
  520. DWORD open = va_arg(ap, DWORD) ;
  521. (VOID) StringCchCopyA(
  522. ((REQTYPECAST *)
  523. preqbuf->RB_Buffer)->PortOpen.portname,
  524. MAX_PORT_NAME,
  525. portname);
  526. ((REQTYPECAST *)
  527. preqbuf->RB_Buffer)->PortOpen.notifier = notifier ;
  528. ((REQTYPECAST *)
  529. preqbuf->RB_Buffer)->PortOpen.PID = pid ;
  530. ((REQTYPECAST *)
  531. preqbuf->RB_Buffer)->PortOpen.open = open ;
  532. }
  533. break ;
  534. case REQTYPE_PORTOPENEX:
  535. {
  536. PCHAR pszDeviceName = va_arg(ap, PCHAR);
  537. DWORD dwCounter = va_arg(ap, DWORD);
  538. HANDLE hnotifier = va_arg(ap, HANDLE);
  539. DWORD pid = GetCurrentProcessId();
  540. DWORD dwOpen = va_arg(ap, DWORD);
  541. pdwFlags = va_arg(ap, DWORD *);
  542. (VOID) StringCchCopyA(
  543. ((REQTYPECAST *)
  544. preqbuf->RB_Buffer)->PortOpenEx.szDeviceName,
  545. MAX_DEVICE_NAME + 1,
  546. pszDeviceName);
  547. ((REQTYPECAST *)
  548. preqbuf->RB_Buffer)->PortOpenEx.dwDeviceLineCounter
  549. = dwCounter;
  550. ((REQTYPECAST *)
  551. preqbuf->RB_Buffer)->PortOpenEx.hnotifier = hnotifier;
  552. ((REQTYPECAST *)
  553. preqbuf->RB_Buffer)->PortOpenEx.pid = pid;
  554. ((REQTYPECAST *)
  555. preqbuf->RB_Buffer)->PortOpenEx.dwFlags = *pdwFlags;
  556. ((REQTYPECAST *)
  557. preqbuf->RB_Buffer)->PortOpenEx.dwOpen = dwOpen;
  558. ((REQTYPECAST *)
  559. preqbuf->RB_Buffer)->PortOpenEx.hnotifier = hnotifier;
  560. }
  561. break;
  562. case REQTYPE_PORTDISCONNECT:
  563. {
  564. HPORT porthandle = va_arg(ap, HPORT) ;
  565. HANDLE handle = va_arg(ap, HANDLE) ;
  566. DWORD pid = va_arg(ap, DWORD) ;
  567. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  568. ((REQTYPECAST *)
  569. preqbuf->RB_Buffer)->PortDisconnect.handle = handle;
  570. ((REQTYPECAST *)
  571. preqbuf->RB_Buffer)->PortDisconnect.pid = pid;
  572. }
  573. break ;
  574. case REQTYPE_PORTSEND:
  575. {
  576. HPORT porthandle = va_arg(ap, HPORT) ;
  577. SendRcvBuffer *pbuffer = va_arg(ap, SendRcvBuffer *) ;
  578. DWORD size = va_arg(ap, DWORD) ;
  579. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  580. ((REQTYPECAST *)
  581. preqbuf->RB_Buffer)->PortSend.size = size;
  582. memcpy (&(( (REQTYPECAST *)
  583. preqbuf->RB_Buffer)->PortSend.buffer),
  584. pbuffer,
  585. sizeof ( SendRcvBuffer ) );
  586. }
  587. break ;
  588. case REQTYPE_PORTRECEIVE:
  589. {
  590. HPORT porthandle = va_arg(ap, HPORT) ;
  591. SendRcvBuffer *pSendRcvBuffer = va_arg(ap, SendRcvBuffer *) ;
  592. PDWORD size = va_arg(ap, PDWORD) ;
  593. DWORD timeout = va_arg(ap, DWORD) ;
  594. HANDLE handle = va_arg(ap, HANDLE) ;
  595. DWORD pid = va_arg(ap, DWORD) ;
  596. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  597. ((REQTYPECAST *)
  598. preqbuf->RB_Buffer)->PortReceive.size = *size;
  599. ((REQTYPECAST *)
  600. preqbuf->RB_Buffer)->PortReceive.handle = handle;
  601. ((REQTYPECAST *)
  602. preqbuf->RB_Buffer)->PortReceive.pid = pid;
  603. ((REQTYPECAST *)
  604. preqbuf->RB_Buffer)->PortReceive.timeout = timeout;
  605. ((REQTYPECAST *)
  606. preqbuf->RB_Buffer)->PortReceive.buffer = pSendRcvBuffer;
  607. }
  608. break ;
  609. case REQTYPE_ALLOCATEROUTE:
  610. {
  611. HPORT porthandle = va_arg(ap, HPORT) ;
  612. RAS_PROTOCOLTYPE type = va_arg(ap, RAS_PROTOCOLTYPE) ;
  613. BOOL wrknet = va_arg(ap, BOOL) ;
  614. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  615. ((REQTYPECAST *)
  616. preqbuf->RB_Buffer)->AllocateRoute.type = type ;
  617. ((REQTYPECAST *)
  618. preqbuf->RB_Buffer)->AllocateRoute.wrknet = wrknet ;
  619. }
  620. break ;
  621. case REQTYPE_DEALLOCATEROUTE:
  622. {
  623. HBUNDLE hbundle = va_arg(ap, HBUNDLE) ;
  624. RAS_PROTOCOLTYPE type = va_arg(ap, RAS_PROTOCOLTYPE) ;
  625. ((REQTYPECAST *)
  626. preqbuf->RB_Buffer)->DeAllocateRoute.hbundle =
  627. hbundle;
  628. ((REQTYPECAST *)
  629. preqbuf->RB_Buffer)->DeAllocateRoute.type = type ;
  630. }
  631. break ;
  632. case REQTYPE_ACTIVATEROUTE:
  633. {
  634. HPORT porthandle = va_arg(ap, HPORT) ;
  635. RAS_PROTOCOLTYPE type = va_arg(ap, RAS_PROTOCOLTYPE) ;
  636. PROTOCOL_CONFIG_INFO *config = va_arg(ap,
  637. PROTOCOL_CONFIG_INFO*) ;
  638. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  639. ((REQTYPECAST *)
  640. preqbuf->RB_Buffer)->ActivateRoute.type = type ;
  641. memcpy (
  642. &((REQTYPECAST *)
  643. preqbuf->RB_Buffer)->ActivateRoute.config.P_Info,
  644. config->P_Info,
  645. config->P_Length) ;
  646. ((REQTYPECAST *)
  647. preqbuf->RB_Buffer)->ActivateRoute.config.P_Length =
  648. config->P_Length ;
  649. }
  650. break ;
  651. case REQTYPE_ACTIVATEROUTEEX:
  652. {
  653. HPORT porthandle = va_arg(ap, HPORT) ;
  654. RAS_PROTOCOLTYPE type = va_arg(ap, RAS_PROTOCOLTYPE) ;
  655. DWORD framesize = va_arg(ap, DWORD) ;
  656. PROTOCOL_CONFIG_INFO *config = va_arg(ap,
  657. PROTOCOL_CONFIG_INFO*) ;
  658. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  659. ((REQTYPECAST *)
  660. preqbuf->RB_Buffer)->ActivateRouteEx.type = type ;
  661. ((REQTYPECAST *)
  662. preqbuf->RB_Buffer)->ActivateRouteEx.framesize = framesize ;
  663. memcpy (
  664. &((REQTYPECAST *)
  665. preqbuf->RB_Buffer)->ActivateRouteEx.config.P_Info,
  666. config->P_Info,
  667. config->P_Length) ;
  668. ((REQTYPECAST *)
  669. preqbuf->RB_Buffer)->ActivateRouteEx.config.P_Length =
  670. config->P_Length ;
  671. }
  672. break ;
  673. case REQTYPE_COMPRESSIONSETINFO:
  674. {
  675. HPORT porthandle = va_arg(ap, HPORT) ;
  676. RAS_COMPRESSION_INFO *send = va_arg(ap, RAS_COMPRESSION_INFO *) ;
  677. RAS_COMPRESSION_INFO *recv = va_arg(ap, RAS_COMPRESSION_INFO *) ;
  678. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  679. memcpy (&((REQTYPECAST *)
  680. preqbuf->RB_Buffer)->CompressionSetInfo.send,
  681. send,
  682. sizeof (RAS_COMPRESSION_INFO)) ;
  683. memcpy (&((REQTYPECAST *)
  684. preqbuf->RB_Buffer)->CompressionSetInfo.recv,
  685. recv,
  686. sizeof (RAS_COMPRESSION_INFO)) ;
  687. }
  688. break ;
  689. case REQTYPE_GETUSERCREDENTIALS:
  690. {
  691. PBYTE pChallenge = va_arg(ap, PBYTE) ;
  692. PLUID LogonId = va_arg(ap, PLUID) ;
  693. memcpy (((REQTYPECAST*)
  694. preqbuf->RB_Buffer)->GetCredentials.Challenge,
  695. pChallenge,
  696. MAX_CHALLENGE_SIZE) ;
  697. ((REQTYPECAST *)
  698. preqbuf->RB_Buffer)->GetCredentials.LogonId = *LogonId;
  699. }
  700. break ;
  701. case REQTYPE_SETCACHEDCREDENTIALS:
  702. {
  703. PCHAR Account = va_arg( ap, PCHAR );
  704. PCHAR Domain = va_arg( ap, PCHAR );
  705. PCHAR NewPassword = va_arg( ap, PCHAR );
  706. (VOID) StringCchCopyA(
  707. ((REQTYPECAST* )
  708. preqbuf->RB_Buffer)->SetCachedCredentials.Account,
  709. MAX_USERNAME_SIZE + 1,
  710. Account );
  711. (VOID) StringCchCopyA(
  712. ((REQTYPECAST* )
  713. preqbuf->RB_Buffer)->SetCachedCredentials.Domain,
  714. MAX_DOMAIN_SIZE + 1,
  715. Domain );
  716. (VOID) StringCchCopyA(
  717. ((REQTYPECAST* )
  718. preqbuf->RB_Buffer)->SetCachedCredentials.NewPassword,
  719. MAX_PASSWORD_SIZE + 1,
  720. NewPassword );
  721. }
  722. break;
  723. case REQTYPE_SETFRAMING:
  724. {
  725. HPORT porthandle = va_arg(ap, HPORT) ;
  726. DWORD SendFeatureBits = va_arg(ap, DWORD) ;
  727. DWORD RecvFeatureBits = va_arg(ap, DWORD) ;
  728. DWORD SendBitMask = va_arg(ap, DWORD) ;
  729. DWORD RecvBitMask = va_arg(ap, DWORD) ;
  730. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  731. ((REQTYPECAST *)
  732. preqbuf->RB_Buffer)->SetFraming.Sendbits = SendFeatureBits ;
  733. ((REQTYPECAST *)
  734. preqbuf->RB_Buffer)->SetFraming.Recvbits = RecvFeatureBits ;
  735. ((REQTYPECAST *)
  736. preqbuf->RB_Buffer)->SetFraming.SendbitMask = SendBitMask ;
  737. ((REQTYPECAST *)
  738. preqbuf->RB_Buffer)->SetFraming.RecvbitMask = RecvBitMask ;
  739. }
  740. break ;
  741. case REQTYPE_SETFRAMINGEX:
  742. {
  743. HPORT porthandle = va_arg(ap, HPORT) ;
  744. RAS_FRAMING_INFO *info = va_arg(ap, RAS_FRAMING_INFO *) ;
  745. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  746. memcpy (&((REQTYPECAST *)
  747. preqbuf->RB_Buffer)->FramingInfo.info,
  748. info,
  749. sizeof (RAS_FRAMING_INFO)) ;
  750. }
  751. break ;
  752. case REQTYPE_REGISTERSLIP:
  753. {
  754. HPORT porthandle = va_arg(ap, HPORT) ;
  755. DWORD ipaddr = va_arg(ap, DWORD) ;
  756. DWORD dwFrameSize = va_arg ( ap, DWORD ) ;
  757. BOOL priority = va_arg(ap, BOOL) ;
  758. WCHAR *pszDNSAddress = va_arg(ap, WCHAR*);
  759. WCHAR *pszDNS2Address = va_arg(ap, WCHAR*);
  760. WCHAR *pszWINSAddress = va_arg(ap, WCHAR*);
  761. WCHAR *pszWINS2Address = va_arg(ap, WCHAR*);
  762. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  763. ((REQTYPECAST*)
  764. preqbuf->RB_Buffer)->RegisterSlip.dwFrameSize = dwFrameSize;
  765. ((REQTYPECAST *)
  766. preqbuf->RB_Buffer)->RegisterSlip.ipaddr = ipaddr ;
  767. ((REQTYPECAST *)
  768. preqbuf->RB_Buffer)->RegisterSlip.priority = priority ;
  769. if (pszDNSAddress != NULL)
  770. {
  771. memcpy (
  772. ((REQTYPECAST *)
  773. preqbuf->RB_Buffer)->RegisterSlip.szDNSAddress,
  774. pszDNSAddress,
  775. ( wcslen(pszDNSAddress) + 1 ) * sizeof (WCHAR)) ;
  776. }
  777. else
  778. {
  779. memset(
  780. ((REQTYPECAST *)
  781. preqbuf->RB_Buffer)->RegisterSlip.szDNSAddress,
  782. 0,
  783. 17 * sizeof (WCHAR));
  784. }
  785. if (pszDNS2Address != NULL)
  786. {
  787. memcpy (
  788. ((REQTYPECAST *)
  789. preqbuf->RB_Buffer)->RegisterSlip.szDNS2Address,
  790. pszDNS2Address,
  791. ( wcslen(pszDNS2Address) + 1 ) * sizeof (WCHAR)) ;
  792. }
  793. else
  794. {
  795. memset(
  796. ((REQTYPECAST *)
  797. preqbuf->RB_Buffer)->RegisterSlip.szDNS2Address,
  798. 0,
  799. 17 * sizeof (WCHAR));
  800. }
  801. if (pszWINSAddress != NULL)
  802. {
  803. memcpy (
  804. ((REQTYPECAST *)
  805. preqbuf->RB_Buffer)->RegisterSlip.szWINSAddress,
  806. pszWINSAddress,
  807. ( wcslen(pszWINSAddress) + 1 ) * sizeof (WCHAR)) ;
  808. }
  809. else
  810. {
  811. memset(
  812. ((REQTYPECAST *)
  813. preqbuf->RB_Buffer)->RegisterSlip.szWINSAddress,
  814. 0,
  815. 17 * sizeof (WCHAR));
  816. }
  817. if (pszWINS2Address != NULL)
  818. {
  819. memcpy (
  820. ((REQTYPECAST *)
  821. preqbuf->RB_Buffer)->RegisterSlip.szWINS2Address,
  822. pszWINS2Address,
  823. ( wcslen(pszWINS2Address) + 1 ) * sizeof (WCHAR)) ;
  824. }
  825. else
  826. {
  827. memset(
  828. ((REQTYPECAST *)
  829. preqbuf->RB_Buffer)->RegisterSlip.szWINS2Address,
  830. 0,
  831. 17 * sizeof (WCHAR));
  832. }
  833. }
  834. break ;
  835. case REQTYPE_GETPROTOCOLCOMPRESSION:
  836. {
  837. HPORT porthandle = va_arg(ap, HPORT) ;
  838. RAS_PROTOCOLTYPE type = va_arg(ap, RAS_PROTOCOLTYPE) ;
  839. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  840. ((REQTYPECAST *)
  841. preqbuf->RB_Buffer)->ProtocolComp.type = type ;
  842. }
  843. break ;
  844. case REQTYPE_PORTBUNDLE:
  845. {
  846. HPORT porthandle = va_arg(ap, HPORT) ;
  847. HPORT porttobundle = va_arg(ap, HPORT) ;
  848. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  849. ((REQTYPECAST *)
  850. preqbuf->RB_Buffer)->PortBundle.porttobundle = porttobundle ;
  851. }
  852. break ;
  853. case REQTYPE_SETPROTOCOLCOMPRESSION:
  854. {
  855. HPORT porthandle = va_arg(ap, HPORT) ;
  856. RAS_PROTOCOLTYPE type = va_arg(ap, RAS_PROTOCOLTYPE) ;
  857. RAS_PROTOCOLCOMPRESSION *send = va_arg(ap, RAS_PROTOCOLCOMPRESSION *) ;
  858. RAS_PROTOCOLCOMPRESSION *recv = va_arg(ap, RAS_PROTOCOLCOMPRESSION *) ;
  859. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  860. ((REQTYPECAST *)
  861. preqbuf->RB_Buffer)->ProtocolComp.type = type ;
  862. memcpy (&((REQTYPECAST *)
  863. preqbuf->RB_Buffer)->ProtocolComp.send,
  864. send,
  865. sizeof (RAS_PROTOCOLCOMPRESSION)) ;
  866. memcpy (&((REQTYPECAST *)
  867. preqbuf->RB_Buffer)->ProtocolComp.recv,
  868. recv,
  869. sizeof (RAS_PROTOCOLCOMPRESSION)) ;
  870. }
  871. break ;
  872. case REQTYPE_STOREUSERDATA:
  873. {
  874. HPORT porthandle = va_arg(ap, HPORT) ;
  875. PBYTE data = va_arg(ap, PBYTE) ;
  876. DWORD size = va_arg(ap, DWORD) ;
  877. retcode = AllocateBuffer(size,
  878. (PBYTE *) &pBuffer,
  879. &dwSizeofBuffer);
  880. if (retcode)
  881. {
  882. goto done;
  883. }
  884. if(pBuffer)
  885. {
  886. pBuffer->RB_Reqtype = reqtype;
  887. pBuffer->RB_PCBIndex = PtrToUlong( porthandle );
  888. pbTemp = pBuffer;
  889. }
  890. ((REQTYPECAST *)
  891. pbTemp->RB_Buffer)->OldUserData.size = (size < 5000 ?
  892. size : 5000) ;
  893. memcpy (((REQTYPECAST *)
  894. pbTemp->RB_Buffer)->OldUserData.data,
  895. data,
  896. (size < 5000 ? size : 5000)) ; // max 5000 bytes copied
  897. }
  898. break ;
  899. case REQTYPE_SETATTACHCOUNT:
  900. {
  901. BOOL fAttach = va_arg(ap, BOOL);
  902. ((REQTYPECAST *)
  903. preqbuf->RB_Buffer)->AttachInfo.dwPid = GetCurrentProcessId();
  904. ((REQTYPECAST *)
  905. preqbuf->RB_Buffer)->AttachInfo.fAttach = fAttach;
  906. }
  907. break;
  908. case REQTYPE_GETDIALPARAMS:
  909. {
  910. DWORD dwUID = va_arg(ap, DWORD);
  911. pdwMaskDialParams = va_arg(ap, LPDWORD);
  912. dwSizeofBuffer = sizeof ( RequestBuffer )
  913. + sizeof( REQTYPECAST )
  914. + 5000 * sizeof( WCHAR );
  915. pBuffer = LocalAlloc( LPTR, dwSizeofBuffer );
  916. if ( NULL == pBuffer )
  917. {
  918. retcode = GetLastError();
  919. goto done;
  920. }
  921. pBuffer->RB_Reqtype = reqtype;
  922. pBuffer->RB_PCBIndex = 0;
  923. ((REQTYPECAST *)
  924. pBuffer->RB_Buffer)->DialParams.dwUID = dwUID;
  925. ((REQTYPECAST *)
  926. pBuffer->RB_Buffer)->DialParams.dwMask = *pdwMaskDialParams;
  927. ((REQTYPECAST *)
  928. pBuffer->RB_Buffer)->DialParams.dwPid = GetCurrentProcessId();
  929. GetUserSid(((REQTYPECAST *)
  930. pBuffer->RB_Buffer)->DialParams.sid,
  931. 5000);
  932. pbTemp = pBuffer;
  933. }
  934. break;
  935. case REQTYPE_SETDIALPARAMS:
  936. {
  937. DWORD dwUID = va_arg(ap, DWORD);
  938. DWORD dwMask = va_arg(ap, DWORD);
  939. PRAS_DIALPARAMS pDialParams = va_arg(ap, PRAS_DIALPARAMS);
  940. BOOL fDelete = va_arg(ap, BOOL);
  941. dwSizeofBuffer = sizeof ( RequestBuffer )
  942. + sizeof ( REQTYPECAST )
  943. + 5000 * sizeof ( WCHAR );
  944. pBuffer = LocalAlloc( LPTR, dwSizeofBuffer );
  945. if ( NULL == pBuffer )
  946. {
  947. retcode = GetLastError();
  948. goto done;
  949. }
  950. pBuffer->RB_PCBIndex = 0;
  951. pBuffer->RB_Reqtype = reqtype;
  952. ((REQTYPECAST *)
  953. pBuffer->RB_Buffer)->DialParams.dwUID = dwUID;
  954. ((REQTYPECAST *)
  955. pBuffer->RB_Buffer)->DialParams.dwMask = dwMask;
  956. ((REQTYPECAST *)
  957. pBuffer->RB_Buffer)->DialParams.dwPid = GetCurrentProcessId();
  958. if(NULL != pDialParams)
  959. {
  960. RtlCopyMemory(
  961. &(((REQTYPECAST *)
  962. pBuffer->RB_Buffer)->DialParams.params),
  963. pDialParams,
  964. sizeof (RAS_DIALPARAMS));
  965. }
  966. ((REQTYPECAST *)
  967. pBuffer->RB_Buffer)->DialParams.fDelete = fDelete;
  968. GetUserSid(((REQTYPECAST *)
  969. pBuffer->RB_Buffer)->DialParams.sid,
  970. 5000);
  971. pbTemp = pBuffer;
  972. }
  973. break;
  974. case REQTYPE_CREATECONNECTION:
  975. {
  976. DWORD pid = va_arg (ap, DWORD);
  977. DWORD dwSubEntries = va_arg (ap, DWORD );
  978. DWORD dwDialMode = va_arg (ap, DWORD );
  979. GUID *pGuidEntry = va_arg (ap, GUID *);
  980. CHAR *pszPhonebookPath = va_arg (ap, CHAR *);
  981. CHAR *pszEntryName = va_arg (ap, CHAR *);
  982. CHAR *pszRefPbkPath = va_arg (ap, CHAR *);
  983. CHAR *pszRefEntryName = va_arg (ap, CHAR *);
  984. retcode = AllocateBuffer(dwSubEntries * sizeof(DWORD),
  985. (PBYTE *) &pBuffer,
  986. &dwSizeofBuffer);
  987. if(retcode)
  988. {
  989. goto done;
  990. }
  991. if(pBuffer)
  992. {
  993. pBuffer->RB_Reqtype = reqtype;
  994. pBuffer->RB_PCBIndex = 0;
  995. pbTemp = pBuffer;
  996. }
  997. (VOID) StringCchCopyA (((REQTYPECAST *)
  998. pbTemp->RB_Buffer)->Connection.szPhonebookPath,
  999. MAX_PATH,
  1000. pszPhonebookPath);
  1001. (VOID) StringCchCopyA (((REQTYPECAST *)
  1002. pbTemp->RB_Buffer)->Connection.szEntryName,
  1003. MAX_ENTRYNAME_SIZE,
  1004. pszEntryName);
  1005. (VOID) StringCchCopyA (((REQTYPECAST *)
  1006. pbTemp->RB_Buffer)->Connection.szRefPbkPath,
  1007. MAX_PATH,
  1008. pszRefPbkPath);
  1009. (VOID) StringCchCopyA (((REQTYPECAST *)
  1010. pbTemp->RB_Buffer)->Connection.szRefEntryName,
  1011. MAX_ENTRYNAME_SIZE,
  1012. pszRefEntryName);
  1013. if(NULL != pGuidEntry)
  1014. {
  1015. memcpy(&((REQTYPECAST *)
  1016. pbTemp->RB_Buffer)->Connection.guidEntry,
  1017. pGuidEntry,
  1018. sizeof(GUID));
  1019. }
  1020. ((REQTYPECAST *)
  1021. pbTemp->RB_Buffer)->Connection.dwSubEntries = dwSubEntries;
  1022. ((REQTYPECAST *)
  1023. pbTemp->RB_Buffer)->Connection.dwDialMode = dwDialMode;
  1024. ((REQTYPECAST *)pbTemp->RB_Buffer)->Connection.pid = pid;
  1025. }
  1026. break;
  1027. case REQTYPE_DESTROYCONNECTION:
  1028. {
  1029. HCONN conn = va_arg(ap, HCONN);
  1030. DWORD pid = va_arg(ap, DWORD);
  1031. ((REQTYPECAST *)preqbuf->RB_Buffer)->Connection.conn = conn;
  1032. ((REQTYPECAST *)preqbuf->RB_Buffer)->Connection.pid = pid;
  1033. }
  1034. break;
  1035. case REQTYPE_ENUMCONNECTIONPORTS:
  1036. {
  1037. HCONN conn = va_arg ( ap, HCONN );
  1038. pdwSize = va_arg ( ap, DWORD *);
  1039. pUserBuffer = (PBYTE ) va_arg ( ap, RASMAN_PORT *);
  1040. if ( NULL == pUserBuffer )
  1041. {
  1042. *pdwSize = 0;
  1043. }
  1044. if ( *pdwSize )
  1045. {
  1046. retcode = AllocateBuffer(*pdwSize,
  1047. (PBYTE *) &pBuffer,
  1048. &dwSizeofBuffer);
  1049. if(retcode)
  1050. {
  1051. goto done;
  1052. }
  1053. if(pBuffer)
  1054. {
  1055. pBuffer->RB_Reqtype = reqtype;
  1056. pbTemp = pBuffer;
  1057. }
  1058. }
  1059. else
  1060. {
  1061. pbTemp = preqbuf;
  1062. }
  1063. ((REQTYPECAST *)
  1064. pbTemp->RB_Buffer)->EnumConnectionPorts.conn = conn;
  1065. ((REQTYPECAST *)
  1066. pbTemp->RB_Buffer)->EnumConnectionPorts.size = *pdwSize;
  1067. }
  1068. break;
  1069. case REQTYPE_GETCONNECTIONPARAMS:
  1070. {
  1071. HCONN conn = va_arg(ap, HCONN);
  1072. ((REQTYPECAST *)preqbuf->RB_Buffer)->Connection.conn = conn;
  1073. }
  1074. break;
  1075. case REQTYPE_ADDCONNECTIONPORT:
  1076. {
  1077. HCONN conn = va_arg(ap, HCONN);
  1078. HPORT porthandle = va_arg(ap, HPORT);
  1079. DWORD dwSubEntry = va_arg(ap, DWORD);
  1080. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1081. ((REQTYPECAST *)
  1082. preqbuf->RB_Buffer)->AddConnectionPort.conn = conn;
  1083. ((REQTYPECAST *)
  1084. preqbuf->RB_Buffer)->AddConnectionPort.dwSubEntry = dwSubEntry;
  1085. }
  1086. break;
  1087. case REQTYPE_SETCONNECTIONPARAMS:
  1088. {
  1089. HCONN conn = va_arg(ap, HCONN) ;
  1090. PRAS_CONNECTIONPARAMS pParams = va_arg(ap, PRAS_CONNECTIONPARAMS);
  1091. ((REQTYPECAST *)
  1092. preqbuf->RB_Buffer)->ConnectionParams.conn = conn;
  1093. RtlCopyMemory(
  1094. &(((REQTYPECAST *)
  1095. preqbuf->RB_Buffer)->ConnectionParams.params),
  1096. pParams,
  1097. sizeof (RAS_CONNECTIONPARAMS));
  1098. }
  1099. break;
  1100. case REQTYPE_GETCONNECTIONUSERDATA:
  1101. {
  1102. HCONN conn = va_arg(ap, HCONN);
  1103. DWORD dwTag = va_arg(ap, DWORD);
  1104. pUserBuffer = va_arg ( ap, PBYTE );
  1105. pdwSize = va_arg ( ap, DWORD *);
  1106. if ( NULL == pUserBuffer )
  1107. {
  1108. *pdwSize = 0;
  1109. }
  1110. if ( *pdwSize )
  1111. {
  1112. retcode = AllocateBuffer(*pdwSize,
  1113. (PBYTE *) &pBuffer,
  1114. &dwSizeofBuffer);
  1115. if(retcode)
  1116. {
  1117. goto done;
  1118. }
  1119. if(pBuffer)
  1120. {
  1121. pBuffer->RB_Reqtype = reqtype;
  1122. pbTemp = pBuffer;
  1123. }
  1124. }
  1125. else
  1126. {
  1127. pbTemp = preqbuf;
  1128. }
  1129. ((REQTYPECAST *)
  1130. pbTemp->RB_Buffer)->ConnectionUserData.dwcb = *pdwSize;
  1131. ((REQTYPECAST *)
  1132. pbTemp->RB_Buffer)->ConnectionUserData.conn = conn;
  1133. ((REQTYPECAST *)
  1134. pbTemp->RB_Buffer)->ConnectionUserData.dwTag = dwTag;
  1135. }
  1136. break;
  1137. case REQTYPE_SETCONNECTIONUSERDATA:
  1138. {
  1139. HCONN conn = va_arg(ap, HCONN) ;
  1140. DWORD dwTag = va_arg(ap, DWORD);
  1141. PBYTE pBuf = va_arg(ap, PBYTE);
  1142. DWORD dwcb = va_arg(ap, DWORD);
  1143. ((REQTYPECAST *)
  1144. preqbuf->RB_Buffer)->ConnectionUserData.conn = conn;
  1145. ((REQTYPECAST *)
  1146. preqbuf->RB_Buffer)->ConnectionUserData.dwTag = dwTag;
  1147. dwcb = (dwcb < 5000 ? dwcb : 5000);
  1148. ((REQTYPECAST *)
  1149. preqbuf->RB_Buffer)->ConnectionUserData.dwcb = dwcb;
  1150. memcpy (
  1151. ((REQTYPECAST *)
  1152. preqbuf->RB_Buffer)->ConnectionUserData.data,
  1153. pBuf,
  1154. dwcb);
  1155. }
  1156. break;
  1157. case REQTYPE_GETPORTUSERDATA:
  1158. {
  1159. HPORT port = va_arg(ap, HPORT);
  1160. DWORD dwTag = va_arg(ap, DWORD);
  1161. pUserBuffer = va_arg ( ap, PBYTE );
  1162. pdwSize = va_arg ( ap, DWORD *);
  1163. if ( NULL == pUserBuffer )
  1164. {
  1165. *pdwSize = 0;
  1166. }
  1167. if ( *pdwSize )
  1168. {
  1169. retcode = AllocateBuffer(*pdwSize,
  1170. (PBYTE *) &pBuffer,
  1171. &dwSizeofBuffer);
  1172. if(retcode)
  1173. {
  1174. goto done;
  1175. }
  1176. if(pBuffer)
  1177. {
  1178. pBuffer->RB_Reqtype = reqtype;
  1179. pbTemp = pBuffer;
  1180. }
  1181. }
  1182. else
  1183. {
  1184. pbTemp = preqbuf;
  1185. }
  1186. pbTemp->RB_PCBIndex = PtrToUlong( port);
  1187. ((REQTYPECAST *)
  1188. pbTemp->RB_Buffer)->PortUserData.dwTag = dwTag;
  1189. ((REQTYPECAST *)
  1190. pbTemp->RB_Buffer)->PortUserData.dwcb = *pdwSize;
  1191. }
  1192. break;
  1193. case REQTYPE_SETPORTUSERDATA:
  1194. {
  1195. HPORT port = va_arg(ap, HPORT);
  1196. DWORD dwTag = va_arg(ap, DWORD);
  1197. PBYTE pBuf = va_arg(ap, PBYTE);
  1198. DWORD dwcb = va_arg(ap, DWORD);
  1199. if ( dwcb )
  1200. {
  1201. retcode = AllocateBuffer(dwcb,
  1202. (PBYTE *) &pBuffer,
  1203. &dwSizeofBuffer);
  1204. if(retcode)
  1205. {
  1206. goto done;
  1207. }
  1208. if(pBuffer)
  1209. {
  1210. pBuffer->RB_Reqtype = reqtype;
  1211. pbTemp = pBuffer;
  1212. }
  1213. }
  1214. else
  1215. {
  1216. pbTemp = preqbuf;
  1217. }
  1218. pbTemp->RB_PCBIndex = PtrToUlong( port);
  1219. ((REQTYPECAST *)
  1220. pbTemp->RB_Buffer)->PortUserData.dwTag = dwTag;
  1221. dwcb = (dwcb < 5000 ? dwcb : 5000);
  1222. ((REQTYPECAST *)
  1223. pbTemp->RB_Buffer)->PortUserData.dwcb = dwcb;
  1224. memcpy (
  1225. ((REQTYPECAST *)pbTemp->RB_Buffer)->PortUserData.data,
  1226. pBuf,
  1227. dwcb);
  1228. }
  1229. break;
  1230. case REQTYPE_PPPCALLBACK:
  1231. {
  1232. HPORT porthandle = va_arg(ap, HPORT) ;
  1233. CHAR * pszCallbackNumber = va_arg(ap, CHAR *) ;
  1234. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1235. ((REQTYPECAST *)preqbuf->RB_Buffer)->PppEMsg.dwMsgId =
  1236. PPPEMSG_Callback;
  1237. ((REQTYPECAST *)preqbuf->RB_Buffer)->PppEMsg.hPort =
  1238. porthandle;
  1239. (VOID) StringCchCopyA(((REQTYPECAST *)
  1240. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Callback.
  1241. szCallbackNumber,
  1242. RAS_MaxCallbackNumber + 1,
  1243. pszCallbackNumber );
  1244. }
  1245. break;
  1246. case REQTYPE_PPPSTOP:
  1247. {
  1248. HPORT porthandle = va_arg(ap, HPORT) ;
  1249. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1250. ((REQTYPECAST *)
  1251. preqbuf->RB_Buffer)->PppEMsg.dwMsgId = PPPEMSG_Stop;
  1252. ((REQTYPECAST *)
  1253. preqbuf->RB_Buffer)->PppEMsg.hPort = porthandle;
  1254. }
  1255. break;
  1256. case REQTYPE_PPPSTART:
  1257. {
  1258. HPORT porthandle = va_arg(ap, HPORT) ;
  1259. CHAR * pszPortName = va_arg(ap, CHAR *) ;
  1260. CHAR * pszUserName = va_arg(ap, CHAR *) ;
  1261. CHAR * pszPassword = va_arg(ap, CHAR *) ;
  1262. CHAR * pszDomain = va_arg(ap, CHAR *) ;
  1263. LUID * pLuid = va_arg(ap, LUID *) ;
  1264. PPP_CONFIG_INFO* pConfigInfo = va_arg(ap, PPP_CONFIG_INFO *) ;
  1265. PPP_INTERFACE_INFO* pPppInterfaceInfo = va_arg(ap,
  1266. PPP_INTERFACE_INFO*);
  1267. CHAR * pszzParameters = va_arg(ap, CHAR *) ;
  1268. BOOL fThisIsACallback = va_arg(ap, BOOL) ;
  1269. HANDLE hEvent = va_arg(ap, HANDLE) ;
  1270. DWORD dwPid = va_arg(ap, DWORD) ;
  1271. DWORD dwAutoDisconnectTime = va_arg(ap, DWORD) ;
  1272. BOOL fRedialOnLinkFailure = va_arg(ap, BOOL);
  1273. PPP_BAPPARAMS *pBapParams = va_arg(ap, PPP_BAPPARAMS *);
  1274. BOOL fNonInteractive = va_arg(ap, BOOL);
  1275. DWORD dwEapTypeId = va_arg(ap, DWORD);
  1276. DWORD dwFlags = va_arg(ap, DWORD);
  1277. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1278. ((REQTYPECAST *)preqbuf->RB_Buffer)->PppEMsg.dwMsgId =
  1279. PPPEMSG_Start;
  1280. ((REQTYPECAST *)preqbuf->RB_Buffer)->PppEMsg.hPort = porthandle;
  1281. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1282. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.szPortName,
  1283. MAX_PORT_NAME + 1,
  1284. pszPortName );
  1285. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1286. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.szUserName,
  1287. UNLEN + 1,
  1288. pszUserName );
  1289. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1290. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.szPassword,
  1291. PWLEN + 1,
  1292. pszPassword );
  1293. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1294. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.szDomain,
  1295. DNLEN + 1,
  1296. pszDomain );
  1297. ((REQTYPECAST *)
  1298. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.Luid = *pLuid;
  1299. ((REQTYPECAST *)
  1300. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.ConfigInfo =
  1301. *pConfigInfo;
  1302. if ( pPppInterfaceInfo != NULL )
  1303. {
  1304. ((REQTYPECAST *)
  1305. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.PppInterfaceInfo
  1306. = *pPppInterfaceInfo;
  1307. }
  1308. else
  1309. {
  1310. ((REQTYPECAST *)
  1311. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.
  1312. PppInterfaceInfo.IfType = (DWORD)-1;
  1313. }
  1314. memcpy( ((REQTYPECAST *)
  1315. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.szzParameters,
  1316. pszzParameters, PARAMETERBUFLEN );
  1317. ((REQTYPECAST *)
  1318. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.fThisIsACallback =
  1319. fThisIsACallback;
  1320. ((REQTYPECAST *)
  1321. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.hEvent = hEvent;
  1322. ((REQTYPECAST *)
  1323. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.dwPid = dwPid;
  1324. ((REQTYPECAST *)
  1325. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.dwAutoDisconnectTime
  1326. = dwAutoDisconnectTime;
  1327. ((REQTYPECAST *)
  1328. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.fRedialOnLinkFailure
  1329. = fRedialOnLinkFailure;
  1330. memcpy( &(((REQTYPECAST *)
  1331. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.BapParams),
  1332. pBapParams, sizeof (PPP_BAPPARAMS));
  1333. ((REQTYPECAST *)
  1334. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.fNonInteractive
  1335. = fNonInteractive;
  1336. ((REQTYPECAST *)
  1337. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.dwEapTypeId =
  1338. dwEapTypeId;
  1339. ((REQTYPECAST *)
  1340. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Start.dwFlags =
  1341. dwFlags;
  1342. }
  1343. break;
  1344. case REQTYPE_PPPRETRY:
  1345. {
  1346. HPORT porthandle = va_arg(ap, HPORT) ;
  1347. CHAR * pszUserName = va_arg(ap, CHAR *) ;
  1348. CHAR * pszPassword = va_arg(ap, CHAR *) ;
  1349. CHAR * pszDomain = va_arg(ap, CHAR *) ;
  1350. preqbuf->RB_PCBIndex = PtrToUlong( porthandle);
  1351. ((REQTYPECAST *)preqbuf->RB_Buffer)->PppEMsg.dwMsgId =
  1352. PPPEMSG_Retry;
  1353. ((REQTYPECAST *)preqbuf->RB_Buffer)->PppEMsg.hPort = porthandle;
  1354. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1355. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Retry.szUserName,
  1356. UNLEN + 1,
  1357. pszUserName );
  1358. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1359. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Retry.szPassword,
  1360. PWLEN + 1,
  1361. pszPassword );
  1362. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1363. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.Retry.szDomain,
  1364. DNLEN + 1,
  1365. pszDomain );
  1366. }
  1367. break;
  1368. case REQTYPE_PPPGETINFO:
  1369. {
  1370. HPORT porthandle = va_arg(ap, HPORT) ;
  1371. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1372. }
  1373. break;
  1374. case REQTYPE_GETTIMESINCELASTACTIVITY:
  1375. {
  1376. HPORT porthandle = va_arg(ap, HPORT) ;
  1377. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1378. }
  1379. break;
  1380. case REQTYPE_PPPCHANGEPWD:
  1381. {
  1382. HPORT porthandle = va_arg(ap, HPORT) ;
  1383. CHAR * pszUserName = va_arg(ap, CHAR *) ;
  1384. CHAR * pszOldPassword = va_arg(ap, CHAR *) ;
  1385. CHAR * pszNewPassword = va_arg(ap, CHAR *) ;
  1386. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1387. ((REQTYPECAST *)
  1388. preqbuf->RB_Buffer)->PppEMsg.dwMsgId = PPPEMSG_ChangePw;
  1389. ((REQTYPECAST *)
  1390. preqbuf->RB_Buffer)->PppEMsg.hPort = porthandle;
  1391. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1392. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.ChangePw.szUserName,
  1393. UNLEN + 1,
  1394. pszUserName );
  1395. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1396. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.ChangePw.szOldPassword,
  1397. PWLEN + 1,
  1398. pszOldPassword );
  1399. (VOID) StringCchCopyA( ((REQTYPECAST *)
  1400. preqbuf->RB_Buffer)->PppEMsg.ExtraInfo.ChangePw.szNewPassword,
  1401. PWLEN + 1,
  1402. pszNewPassword );
  1403. }
  1404. break;
  1405. case REQTYPE_ADDNOTIFICATION:
  1406. {
  1407. DWORD pid = va_arg(ap, DWORD);
  1408. HCONN hconn = va_arg(ap, HCONN);
  1409. HANDLE hevent = va_arg(ap, HANDLE);
  1410. DWORD dwfFlags = va_arg(ap, DWORD);
  1411. //
  1412. // Either a HPORT or a HCONN can be passed
  1413. // in as the HCONN argument.
  1414. //
  1415. ((REQTYPECAST *)
  1416. preqbuf->RB_Buffer)->AddNotification.pid = pid;
  1417. ((REQTYPECAST *)
  1418. preqbuf->RB_Buffer)->AddNotification.fAny =
  1419. (hconn == INVALID_HPORT);
  1420. if ( hconn == INVALID_HPORT
  1421. || (HandleToUlong(hconn) & 0xffff0000))
  1422. {
  1423. ((REQTYPECAST *)
  1424. preqbuf->RB_Buffer)->AddNotification.hconn = hconn;
  1425. }
  1426. else
  1427. {
  1428. preqbuf->RB_PCBIndex = PtrToUlong( hconn );
  1429. ((REQTYPECAST *)
  1430. preqbuf->RB_Buffer)->AddNotification.hconn = 0;//(HCONN)NULL;
  1431. }
  1432. ((REQTYPECAST *)
  1433. preqbuf->RB_Buffer)->AddNotification.hevent = hevent;
  1434. ((REQTYPECAST *)
  1435. preqbuf->RB_Buffer)->AddNotification.dwfFlags = dwfFlags;
  1436. }
  1437. break;
  1438. case REQTYPE_SIGNALCONNECTION:
  1439. {
  1440. HCONN hconn = va_arg(ap, HCONN);
  1441. ((REQTYPECAST *)
  1442. preqbuf->RB_Buffer)->SignalConnection.hconn = hconn;
  1443. }
  1444. break;
  1445. case REQTYPE_SETDEVCONFIG:
  1446. {
  1447. HPORT porthandle = va_arg(ap, HPORT) ;
  1448. PCHAR devicetype = va_arg(ap, PCHAR) ;
  1449. PBYTE config = va_arg(ap, PBYTE) ;
  1450. DWORD size = va_arg(ap, DWORD) ;
  1451. preqbuf->RB_PCBIndex = PtrToUlong( porthandle );
  1452. ((REQTYPECAST *)
  1453. preqbuf->RB_Buffer)->SetDevConfig.size = size ;
  1454. (VOID) StringCchCopyA(((REQTYPECAST *)
  1455. preqbuf->RB_Buffer)->SetDevConfig.devicetype,
  1456. MAX_DEVICETYPE_NAME,
  1457. devicetype) ;
  1458. memcpy (((REQTYPECAST *)
  1459. preqbuf->RB_Buffer)->SetDevConfig.config,
  1460. config,
  1461. size) ;
  1462. }
  1463. break;
  1464. case REQTYPE_GETDEVCONFIG:
  1465. {
  1466. HPORT porthandle = va_arg(ap, HPORT) ;
  1467. PCHAR devicetype = va_arg(ap, PCHAR) ;
  1468. pUserBuffer = va_arg ( ap, PBYTE );
  1469. pdwSize = va_arg ( ap, DWORD *);
  1470. if (NULL == pUserBuffer)
  1471. {
  1472. *pdwSize = 0;
  1473. }
  1474. if (*pdwSize)
  1475. {
  1476. retcode = AllocateBuffer(*pdwSize,
  1477. (PBYTE *) &pBuffer,
  1478. &dwSizeofBuffer);
  1479. if(retcode)
  1480. {
  1481. goto done;
  1482. }
  1483. if(pBuffer)
  1484. {
  1485. pBuffer->RB_Reqtype = reqtype;
  1486. pbTemp = pBuffer;
  1487. }
  1488. }
  1489. else
  1490. {
  1491. pbTemp = preqbuf;
  1492. }
  1493. pbTemp->RB_PCBIndex = PtrToUlong( porthandle );
  1494. (VOID) StringCchCopyA(((REQTYPECAST *)
  1495. pbTemp->RB_Buffer)->GetDevConfig.devicetype,
  1496. MAX_DEVICETYPE_NAME,
  1497. devicetype) ;
  1498. ((REQTYPECAST *)
  1499. pbTemp->RB_Buffer)->GetDevConfig.size = *pdwSize;
  1500. }
  1501. break;
  1502. case REQTYPE_GETDEVCONFIGEX:
  1503. {
  1504. HPORT porthandle = va_arg(ap, HPORT) ;
  1505. PCHAR devicetype = va_arg(ap, PCHAR) ;
  1506. pUserBuffer = va_arg ( ap, PBYTE );
  1507. pdwSize = va_arg ( ap, DWORD *);
  1508. if (NULL == pUserBuffer)
  1509. {
  1510. *pdwSize = 0;
  1511. }
  1512. if (*pdwSize)
  1513. {
  1514. retcode = AllocateBuffer(*pdwSize,
  1515. (PBYTE *) &pBuffer,
  1516. &dwSizeofBuffer);
  1517. if(retcode)
  1518. {
  1519. goto done;
  1520. }
  1521. if(pBuffer)
  1522. {
  1523. pBuffer->RB_Reqtype = reqtype;
  1524. pbTemp = pBuffer;
  1525. }
  1526. }
  1527. else
  1528. {
  1529. pbTemp = preqbuf;
  1530. }
  1531. pbTemp->RB_PCBIndex = PtrToUlong( porthandle );
  1532. (VOID) StringCchCopyA(((REQTYPECAST *)
  1533. pbTemp->RB_Buffer)->GetDevConfigEx.devicetype,
  1534. MAX_DEVICETYPE_NAME,
  1535. devicetype) ;
  1536. ((REQTYPECAST *)
  1537. pbTemp->RB_Buffer)->GetDevConfigEx.size = *pdwSize;
  1538. break;
  1539. }
  1540. case REQTYPE_CLOSEPROCESSPORTS:
  1541. {
  1542. ((REQTYPECAST *)
  1543. preqbuf->RB_Buffer)->CloseProcessPortsInfo.pid =
  1544. GetCurrentProcessId();
  1545. }
  1546. break;
  1547. case REQTYPE_PNPCONTROL:
  1548. {
  1549. DWORD dwOp = va_arg(ap, DWORD);
  1550. HPORT porthandle = va_arg(ap, HPORT);
  1551. preqbuf->RB_PCBIndex = PtrToUlong( porthandle);
  1552. ((REQTYPECAST *)preqbuf->RB_Buffer)->PnPControlInfo.dwOp = dwOp;
  1553. }
  1554. break;
  1555. case REQTYPE_SETIOCOMPLETIONPORT:
  1556. {
  1557. HPORT porthandle = va_arg(ap, HPORT);
  1558. HANDLE hIoCompletionPort = va_arg(ap, HANDLE);
  1559. LPOVERLAPPED lpOvDrop = va_arg(ap, LPOVERLAPPED);
  1560. LPOVERLAPPED lpOvStateChange = va_arg(ap, LPOVERLAPPED);
  1561. LPOVERLAPPED lpOvPpp = va_arg(ap, LPOVERLAPPED);
  1562. LPOVERLAPPED lpOvLast = va_arg(ap, LPOVERLAPPED);
  1563. HCONN hConn = va_arg(ap, HCONN);
  1564. preqbuf->RB_PCBIndex = PtrToUlong( porthandle);
  1565. ((REQTYPECAST *)
  1566. preqbuf->RB_Buffer)->SetIoCompletionPortInfo.hIoCompletionPort =
  1567. hIoCompletionPort;
  1568. ((REQTYPECAST *)
  1569. preqbuf->RB_Buffer)->SetIoCompletionPortInfo.pid =
  1570. GetCurrentProcessId();
  1571. ((REQTYPECAST *)
  1572. preqbuf->RB_Buffer)->SetIoCompletionPortInfo.lpOvDrop =
  1573. lpOvDrop;
  1574. ((REQTYPECAST *)
  1575. preqbuf->RB_Buffer)->SetIoCompletionPortInfo.lpOvStateChange =
  1576. lpOvStateChange;
  1577. ((REQTYPECAST *)
  1578. preqbuf->RB_Buffer)->SetIoCompletionPortInfo.lpOvPpp = lpOvPpp;
  1579. ((REQTYPECAST *)
  1580. preqbuf->RB_Buffer)->SetIoCompletionPortInfo.lpOvLast = lpOvLast;
  1581. ((REQTYPECAST *)
  1582. preqbuf->RB_Buffer)->SetIoCompletionPortInfo.hConn = hConn;
  1583. }
  1584. break;
  1585. case REQTYPE_SETROUTERUSAGE:
  1586. {
  1587. HPORT porthandle = va_arg(ap, HPORT);
  1588. BOOL fRouter = va_arg(ap, BOOL);
  1589. preqbuf->RB_PCBIndex = PtrToUlong( porthandle);
  1590. ((REQTYPECAST *)
  1591. preqbuf->RB_Buffer)->SetRouterUsageInfo.fRouter = fRouter;
  1592. }
  1593. break;
  1594. case REQTYPE_SENDPPPMESSAGETORASMAN:
  1595. {
  1596. HPORT hPort = va_arg(ap, HPORT);
  1597. PPP_MESSAGE *pppMsg = (PPP_MESSAGE *) va_arg(ap, PPP_MESSAGE *);
  1598. memcpy( &(((REQTYPECAST *)preqbuf->RB_Buffer)->PppMsg),
  1599. pppMsg,
  1600. sizeof( PPP_MESSAGE ) );
  1601. }
  1602. break;
  1603. case REQTYPE_SETRASDIALINFO:
  1604. {
  1605. HPORT hPort = va_arg (ap, HPORT);
  1606. CHAR *pszPhonebookPath = va_arg (ap, CHAR *);
  1607. CHAR *pszEntryName = va_arg (ap, CHAR *);
  1608. CHAR *pszPhoneNumber = va_arg(ap, CHAR *);
  1609. DWORD cbCustomAuthData = va_arg(ap, DWORD);
  1610. PBYTE pbCustomAuthData = va_arg(ap, PBYTE);
  1611. DWORD dwRequiredSize;
  1612. dwRequiredSize = strlen(pszPhonebookPath) + 1
  1613. + strlen(pszEntryName) + 1
  1614. + strlen(pszPhoneNumber)
  1615. + sizeof(RAS_CUSTOM_AUTH_DATA)
  1616. + cbCustomAuthData;
  1617. retcode = AllocateBuffer(dwRequiredSize,
  1618. (PBYTE *) &pBuffer,
  1619. &dwSizeofBuffer);
  1620. if(retcode)
  1621. {
  1622. goto done;
  1623. }
  1624. if(pBuffer)
  1625. {
  1626. pBuffer->RB_Reqtype = reqtype;
  1627. pbTemp = pBuffer;
  1628. }
  1629. pbTemp->RB_PCBIndex = PtrToUlong( hPort);
  1630. (VOID) StringCchCopyA (((REQTYPECAST *)
  1631. pbTemp->RB_Buffer)->SetRasdialInfo.szPhonebookPath,
  1632. MAX_PATH,
  1633. pszPhonebookPath);
  1634. (VOID) StringCchCopyA (((REQTYPECAST *)
  1635. pbTemp->RB_Buffer)->SetRasdialInfo.szEntryName,
  1636. MAX_ENTRYNAME_SIZE,
  1637. pszEntryName);
  1638. (VOID) StringCchCopyA (((REQTYPECAST *)
  1639. pbTemp->RB_Buffer)->SetRasdialInfo.szPhoneNumber,
  1640. RAS_MaxPhoneNumber,
  1641. pszPhoneNumber);
  1642. ((REQTYPECAST *)
  1643. pbTemp->RB_Buffer)->SetRasdialInfo.rcad.cbCustomAuthData
  1644. = cbCustomAuthData;
  1645. if(cbCustomAuthData > 0)
  1646. {
  1647. memcpy(
  1648. ((REQTYPECAST *)
  1649. pbTemp->RB_Buffer)->SetRasdialInfo.rcad.abCustomAuthData,
  1650. pbCustomAuthData,
  1651. cbCustomAuthData);
  1652. }
  1653. break;
  1654. }
  1655. case REQTYPE_REGISTERPNPNOTIF:
  1656. {
  1657. PVOID pvNotifier = va_arg ( ap, PVOID );
  1658. DWORD dwFlags = va_arg ( ap, DWORD );
  1659. DWORD pid = va_arg ( ap, DWORD );
  1660. HANDLE hThreadHandle = va_arg ( ap, HANDLE );
  1661. BOOL fRegister = va_arg( ap, BOOL );
  1662. (( REQTYPECAST *)
  1663. preqbuf->RB_Buffer )->PnPNotif.pvNotifier = pvNotifier;
  1664. (( REQTYPECAST *)
  1665. preqbuf->RB_Buffer )->PnPNotif.dwFlags = dwFlags;
  1666. (( REQTYPECAST *)
  1667. preqbuf->RB_Buffer )->PnPNotif.pid = pid;
  1668. (( REQTYPECAST *)
  1669. preqbuf->RB_Buffer )->PnPNotif.hThreadHandle = hThreadHandle;
  1670. ((REQTYPECAST *)
  1671. preqbuf->RB_Buffer)->PnPNotif.fRegister = fRegister;
  1672. preqbuf->RB_PCBIndex = 0;
  1673. }
  1674. break;
  1675. case REQTYPE_SETBAPPOLICY:
  1676. {
  1677. HCONN hConn = va_arg ( ap, HCONN );
  1678. DWORD dwLowThreshold = va_arg ( ap, DWORD );
  1679. DWORD dwLowSamplePeriod = va_arg ( ap, DWORD );
  1680. DWORD dwHighThreshold = va_arg ( ap, DWORD );
  1681. DWORD dwHighSamplePeriod = va_arg ( ap, DWORD );
  1682. ((REQTYPECAST *)
  1683. preqbuf->RB_Buffer)->SetBapPolicy.hConn = hConn;
  1684. ((REQTYPECAST *)
  1685. preqbuf->RB_Buffer)->SetBapPolicy.dwLowThreshold =
  1686. dwLowThreshold;
  1687. ((REQTYPECAST *)
  1688. preqbuf->RB_Buffer)->SetBapPolicy.dwLowSamplePeriod =
  1689. dwLowSamplePeriod;
  1690. ((REQTYPECAST *)
  1691. preqbuf->RB_Buffer)->SetBapPolicy.dwHighThreshold =
  1692. dwHighThreshold;
  1693. ((REQTYPECAST *)
  1694. preqbuf->RB_Buffer)->SetBapPolicy.dwHighSamplePeriod =
  1695. dwHighSamplePeriod;
  1696. }
  1697. break;
  1698. case REQTYPE_REFCONNECTION:
  1699. {
  1700. HCONN hConn = va_arg ( ap, HCONN );
  1701. BOOL fAddref = va_arg ( ap, BOOL );
  1702. preqbuf->RB_PCBIndex = 0;
  1703. ((REQTYPECAST * )
  1704. preqbuf->RB_Buffer)->RefConnection.hConn = hConn;
  1705. ((REQTYPECAST * )
  1706. preqbuf->RB_Buffer)->RefConnection.fAddref = fAddref;
  1707. }
  1708. break;
  1709. case REQTYPE_GETEAPINFO:
  1710. {
  1711. HCONN hConn = va_arg( ap, HCONN);
  1712. DWORD dwSubEntry = va_arg( ap, DWORD);
  1713. pdwSize = va_arg(ap, DWORD *);
  1714. pUserBuffer = va_arg(ap, PBYTE);
  1715. if ( NULL == pUserBuffer )
  1716. {
  1717. *pdwSize = 0;
  1718. }
  1719. if ( *pdwSize )
  1720. {
  1721. retcode = AllocateBuffer(*pdwSize,
  1722. (PBYTE *) &pBuffer,
  1723. &dwSizeofBuffer);
  1724. if(retcode)
  1725. {
  1726. goto done;
  1727. }
  1728. if(pBuffer)
  1729. {
  1730. pBuffer->RB_Reqtype = reqtype;
  1731. pbTemp = pBuffer;
  1732. }
  1733. }
  1734. else
  1735. {
  1736. pbTemp = preqbuf;
  1737. }
  1738. pbTemp->RB_PCBIndex = 0;
  1739. ((REQTYPECAST *)
  1740. pbTemp->RB_Buffer)->GetEapInfo.hConn = hConn;
  1741. ((REQTYPECAST *)
  1742. pbTemp->RB_Buffer)->GetEapInfo.dwSubEntry = dwSubEntry;
  1743. ((REQTYPECAST *)
  1744. pbTemp->RB_Buffer)->GetEapInfo.dwSizeofEapUIData = *pdwSize;
  1745. }
  1746. break;
  1747. case REQTYPE_SETEAPINFO:
  1748. {
  1749. HPORT port = va_arg(ap, HPORT);
  1750. DWORD dwContextId = va_arg(ap, DWORD);
  1751. DWORD dwcb = va_arg(ap, DWORD);
  1752. PBYTE pbdata = va_arg(ap, PBYTE);
  1753. if ( dwcb )
  1754. {
  1755. retcode = AllocateBuffer(dwcb,
  1756. (PBYTE *) &pBuffer,
  1757. &dwSizeofBuffer);
  1758. if(retcode)
  1759. {
  1760. goto done;
  1761. }
  1762. if (pBuffer)
  1763. {
  1764. pBuffer->RB_Reqtype = reqtype;
  1765. pbTemp = pBuffer;
  1766. }
  1767. }
  1768. else
  1769. {
  1770. pbTemp = preqbuf;
  1771. }
  1772. pbTemp->RB_PCBIndex = PtrToUlong( port);
  1773. ((REQTYPECAST *)
  1774. pbTemp->RB_Buffer)->SetEapInfo.dwContextId = dwContextId;
  1775. ((REQTYPECAST *)
  1776. pbTemp->RB_Buffer)->SetEapInfo.dwSizeofEapUIData = dwcb;
  1777. memcpy (
  1778. ((REQTYPECAST *)pbTemp->RB_Buffer)->SetEapInfo.data,
  1779. pbdata,
  1780. dwcb);
  1781. }
  1782. break;
  1783. case REQTYPE_SETDEVICECONFIGINFO:
  1784. {
  1785. DWORD cEntries = va_arg(ap, DWORD);
  1786. DWORD cbData = va_arg(ap, DWORD);
  1787. pUserBuffer = va_arg(ap, BYTE *);
  1788. retcode = AllocateBuffer(cbData,
  1789. (PBYTE *) &pBuffer,
  1790. &dwSizeofBuffer);
  1791. if(retcode)
  1792. {
  1793. goto done;
  1794. }
  1795. if(pBuffer)
  1796. {
  1797. pBuffer->RB_Reqtype = reqtype;
  1798. pbTemp = pBuffer;
  1799. }
  1800. ((REQTYPECAST *)
  1801. pbTemp->RB_Buffer)->DeviceConfigInfo.cEntries = cEntries;
  1802. ((REQTYPECAST *)
  1803. pbTemp->RB_Buffer)->DeviceConfigInfo.cbBuffer = cbData;
  1804. memcpy(
  1805. ((REQTYPECAST *)
  1806. pbTemp->RB_Buffer)->DeviceConfigInfo.abdata,
  1807. pUserBuffer,
  1808. cbData);
  1809. }
  1810. break;
  1811. case REQTYPE_GETDEVICECONFIGINFO:
  1812. {
  1813. pdwVersion = va_arg(ap, DWORD *);
  1814. pdwSize = va_arg(ap, DWORD *);
  1815. pUserBuffer = (PBYTE) va_arg(ap, PBYTE);
  1816. if(NULL == pUserBuffer)
  1817. {
  1818. *pdwSize = 0;
  1819. }
  1820. if(*pdwSize)
  1821. {
  1822. retcode = AllocateBuffer(*pdwSize,
  1823. (PBYTE *) &pBuffer,
  1824. &dwSizeofBuffer);
  1825. if(retcode)
  1826. {
  1827. goto done;
  1828. }
  1829. if(pBuffer)
  1830. {
  1831. pBuffer->RB_Reqtype = reqtype;
  1832. pbTemp = pBuffer;
  1833. }
  1834. }
  1835. else
  1836. {
  1837. pbTemp = preqbuf;
  1838. }
  1839. ((REQTYPECAST *)
  1840. pbTemp->RB_Buffer)->DeviceConfigInfo.dwVersion = *pdwVersion;
  1841. ((REQTYPECAST *)
  1842. pbTemp->RB_Buffer)->DeviceConfigInfo.cbBuffer = *pdwSize;
  1843. }
  1844. break;
  1845. case REQTYPE_FINDPREREQUISITEENTRY:
  1846. {
  1847. HCONN hConn = va_arg(ap, HCONN);
  1848. ((REQTYPECAST *)
  1849. preqbuf->RB_Buffer)->FindRefConnection.hConn = hConn;
  1850. break;
  1851. }
  1852. case REQTYPE_GETLINKSTATS:
  1853. {
  1854. HCONN hConn = va_arg(ap, HCONN);
  1855. DWORD dwSubEntry = va_arg(ap, DWORD);
  1856. ((REQTYPECAST *)
  1857. preqbuf->RB_Buffer)->GetStats.hConn = hConn;
  1858. ((REQTYPECAST *)
  1859. preqbuf->RB_Buffer)->GetStats.dwSubEntry = dwSubEntry;
  1860. break;
  1861. }
  1862. case REQTYPE_GETCONNECTIONSTATS:
  1863. {
  1864. HCONN hConn = va_arg(ap, HCONN);
  1865. ((REQTYPECAST *)
  1866. preqbuf->RB_Buffer)->GetStats.hConn = hConn;
  1867. break;
  1868. }
  1869. case REQTYPE_GETHPORTFROMCONNECTION:
  1870. {
  1871. HCONN hConn = va_arg(ap, HCONN);
  1872. ((REQTYPECAST *)
  1873. preqbuf->RB_Buffer)->GetHportFromConnection.hConn = hConn;
  1874. break;
  1875. }
  1876. case REQTYPE_REFERENCECUSTOMCOUNT:
  1877. {
  1878. HCONN hConn = va_arg(ap, HCONN);
  1879. BOOL fAddref = va_arg(ap, BOOL);
  1880. CHAR *pszPhonebook = NULL;
  1881. CHAR *pszEntry = NULL;
  1882. if(fAddref)
  1883. {
  1884. pszPhonebook = va_arg(ap, CHAR *);
  1885. pszEntry = va_arg(ap, CHAR *);
  1886. }
  1887. if( pszPhonebook
  1888. && pszEntry)
  1889. {
  1890. (VOID) StringCchCopyA(
  1891. ((REQTYPECAST *)
  1892. preqbuf->RB_Buffer)->ReferenceCustomCount.szPhonebookPath,
  1893. MAX_PATH + 1,
  1894. pszPhonebook);
  1895. (VOID) StringCchCopyA(
  1896. ((REQTYPECAST *)
  1897. preqbuf->RB_Buffer)->ReferenceCustomCount.szEntryName,
  1898. MAX_ENTRYNAME_SIZE + 1,
  1899. pszEntry);
  1900. }
  1901. ((REQTYPECAST *)
  1902. preqbuf->RB_Buffer)->ReferenceCustomCount.fAddRef = fAddref;
  1903. ((REQTYPECAST *)
  1904. preqbuf->RB_Buffer)->ReferenceCustomCount.hConn = hConn;
  1905. break;
  1906. }
  1907. case REQTYPE_GETHCONNFROMENTRY:
  1908. {
  1909. CHAR *pszPhonebookPath = va_arg(ap, CHAR *);
  1910. CHAR *pszEntryName = va_arg(ap, CHAR *);
  1911. (VOID) StringCchCopyA(
  1912. ((REQTYPECAST *)
  1913. preqbuf->RB_Buffer)->HconnFromEntry.szPhonebookPath,
  1914. MAX_PATH + 1,
  1915. pszPhonebookPath);
  1916. (VOID) StringCchCopyA(
  1917. ((REQTYPECAST *)
  1918. preqbuf->RB_Buffer)->HconnFromEntry.szEntryName,
  1919. MAX_ENTRYNAME_SIZE + 1,
  1920. pszEntryName);
  1921. break;
  1922. }
  1923. case REQTYPE_GETCONNECTINFO:
  1924. {
  1925. HPORT hPort = va_arg(ap, HPORT);
  1926. pdwSize = va_arg(ap, DWORD *);
  1927. pUserBuffer = (PBYTE) va_arg(ap, RAS_CONNECT_INFO *);
  1928. if(NULL == pUserBuffer)
  1929. {
  1930. *pdwSize = 0;
  1931. }
  1932. if(*pdwSize)
  1933. {
  1934. retcode = AllocateBuffer(*pdwSize,
  1935. (PBYTE *) &pBuffer,
  1936. &dwSizeofBuffer);
  1937. if(retcode)
  1938. {
  1939. goto done;
  1940. }
  1941. if(pBuffer)
  1942. {
  1943. pBuffer->RB_Reqtype = reqtype;
  1944. pbTemp = pBuffer;
  1945. }
  1946. }
  1947. else
  1948. {
  1949. pbTemp = preqbuf;
  1950. }
  1951. pbTemp->RB_PCBIndex = PtrToUlong( hPort);
  1952. ((REQTYPECAST *)
  1953. pbTemp->RB_Buffer)->GetConnectInfo.dwSize = *pdwSize;
  1954. break;
  1955. }
  1956. case REQTYPE_GETDEVICENAME:
  1957. {
  1958. RASDEVICETYPE eDeviceType = va_arg(ap, RASDEVICETYPE);
  1959. //
  1960. // dummy - this won't be looked at
  1961. //
  1962. pbTemp->RB_PCBIndex = 0;
  1963. ((REQTYPECAST *)
  1964. pbTemp->RB_Buffer)->GetDeviceName.eDeviceType = eDeviceType;
  1965. break;
  1966. }
  1967. case REQTYPE_GETDEVICENAMEW:
  1968. {
  1969. RASDEVICETYPE eDeviceType = va_arg(ap, RASDEVICETYPE);
  1970. //
  1971. // dummy - this won't be looked at
  1972. //
  1973. pbTemp->RB_PCBIndex = 0;
  1974. ((REQTYPECAST *)
  1975. pbTemp->RB_Buffer)->GetDeviceNameW.eDeviceType = eDeviceType;
  1976. break;
  1977. }
  1978. case REQTYPE_GETCALLEDID:
  1979. {
  1980. RAS_DEVICE_INFO *pDeviceInfo = va_arg(ap, RAS_DEVICE_INFO *);
  1981. pdwSize = va_arg(ap, DWORD *);
  1982. pUserBuffer = (PBYTE) va_arg(ap, RAS_CALLEDID_INFO *);
  1983. if(NULL == pUserBuffer)
  1984. {
  1985. *pdwSize = 0;
  1986. }
  1987. if(*pdwSize)
  1988. {
  1989. retcode = AllocateBuffer(*pdwSize,
  1990. (PBYTE *) &pBuffer,
  1991. &dwSizeofBuffer);
  1992. if(retcode)
  1993. {
  1994. goto done;
  1995. }
  1996. if(pBuffer)
  1997. {
  1998. pBuffer->RB_Reqtype = reqtype;
  1999. pbTemp = pBuffer;
  2000. }
  2001. }
  2002. else
  2003. {
  2004. pbTemp = preqbuf;
  2005. }
  2006. pbTemp->RB_PCBIndex = 0;
  2007. dwVersion = RasGetServerVersion(hConnection);
  2008. ((REQTYPECAST *)
  2009. pbTemp->RB_Buffer)->GetSetCalledId.dwSize = *pdwSize;
  2010. if(dwVersion == VERSION_501)
  2011. {
  2012. memcpy(
  2013. (PBYTE) &((REQTYPECAST *)
  2014. pbTemp->RB_Buffer)->GetSetCalledId.rdi,
  2015. pDeviceInfo,
  2016. sizeof(RAS_DEVICE_INFO));
  2017. }
  2018. else
  2019. {
  2020. memcpy(
  2021. (PBYTE) &((REQTYPECAST *)
  2022. pbTemp->RB_Buffer)->GetSetCalledId_500.rdi,
  2023. pDeviceInfo,
  2024. sizeof(RAS_DEVICE_INFO_V500));
  2025. }
  2026. break;
  2027. }
  2028. case REQTYPE_SETCALLEDID:
  2029. {
  2030. RAS_DEVICE_INFO *pDeviceInfo = va_arg(ap, RAS_DEVICE_INFO *);
  2031. RAS_CALLEDID_INFO *pCalledId = va_arg(ap, RAS_CALLEDID_INFO *);
  2032. BOOL fWrite = va_arg(ap, BOOL);
  2033. retcode = AllocateBuffer(pCalledId->dwSize,
  2034. (PBYTE *) &pBuffer,
  2035. &dwSizeofBuffer);
  2036. if(retcode)
  2037. {
  2038. goto done;
  2039. }
  2040. if(pBuffer)
  2041. {
  2042. pBuffer->RB_Reqtype = reqtype;
  2043. pbTemp = pBuffer;
  2044. }
  2045. pbTemp->RB_PCBIndex = 0;
  2046. ((REQTYPECAST *)
  2047. pbTemp->RB_Buffer)->GetSetCalledId.fWrite = fWrite;
  2048. dwVersion = RasGetServerVersion(hConnection);
  2049. if(dwVersion == VERSION_501)
  2050. {
  2051. memcpy(
  2052. (LPBYTE) &((REQTYPECAST *)
  2053. pbTemp->RB_Buffer)->GetSetCalledId.rdi,
  2054. (LPBYTE) pDeviceInfo,
  2055. sizeof(RAS_DEVICE_INFO));
  2056. memcpy(
  2057. (LPBYTE) ((REQTYPECAST *)
  2058. pbTemp->RB_Buffer)->GetSetCalledId.rciInfo.bCalledId,
  2059. pCalledId->bCalledId,
  2060. pCalledId->dwSize);
  2061. ((REQTYPECAST *)
  2062. pbTemp->RB_Buffer)->GetSetCalledId.rciInfo.dwSize =
  2063. pCalledId->dwSize;
  2064. }
  2065. else
  2066. {
  2067. memcpy(
  2068. (LPBYTE) &((REQTYPECAST *)
  2069. pbTemp->RB_Buffer)->GetSetCalledId_500.rdi,
  2070. (LPBYTE) pDeviceInfo,
  2071. sizeof(RAS_DEVICE_INFO_V500));
  2072. memcpy(
  2073. (LPBYTE) ((REQTYPECAST *)
  2074. pbTemp->RB_Buffer)->GetSetCalledId_500.rciInfo.bCalledId,
  2075. pCalledId->bCalledId,
  2076. pCalledId->dwSize);
  2077. ((REQTYPECAST *)
  2078. pbTemp->RB_Buffer)->GetSetCalledId_500.rciInfo.dwSize =
  2079. pCalledId->dwSize;
  2080. }
  2081. break;
  2082. }
  2083. case REQTYPE_ENABLEIPSEC:
  2084. {
  2085. HPORT hPort = va_arg(ap, HPORT);
  2086. BOOL fEnable = va_arg(ap, BOOL);
  2087. BOOL fServer = va_arg(ap, BOOL);
  2088. RAS_L2TP_ENCRYPTION eEncryption =
  2089. va_arg(ap, RAS_L2TP_ENCRYPTION);
  2090. preqbuf->RB_PCBIndex = PtrToUlong( hPort);
  2091. ((REQTYPECAST *)
  2092. preqbuf->RB_Buffer)->EnableIpSec.fEnable = fEnable;
  2093. ((REQTYPECAST *)
  2094. preqbuf->RB_Buffer)->EnableIpSec.fServer = fServer;
  2095. ((REQTYPECAST *)
  2096. preqbuf->RB_Buffer)->EnableIpSec.eEncryption = eEncryption;
  2097. break;
  2098. }
  2099. case REQTYPE_ISIPSECENABLED:
  2100. {
  2101. HPORT hPort = va_arg(ap, HPORT);
  2102. preqbuf->RB_PCBIndex = PtrToUlong( hPort);
  2103. break;
  2104. }
  2105. case REQTYPE_SETEAPLOGONINFO:
  2106. {
  2107. HPORT hPort = va_arg(ap, HPORT);
  2108. BOOL fLogon = va_arg(ap, BOOL);
  2109. RASEAPINFO * pEapInfo = va_arg(ap, RASEAPINFO *);
  2110. retcode = AllocateBuffer(pEapInfo->dwSizeofEapInfo,
  2111. (PBYTE *) &pBuffer,
  2112. &dwSizeofBuffer);
  2113. if(retcode)
  2114. {
  2115. goto done;
  2116. }
  2117. if(pBuffer)
  2118. {
  2119. pBuffer->RB_Reqtype = reqtype;
  2120. pbTemp = pBuffer;
  2121. }
  2122. pbTemp->RB_PCBIndex = PtrToUlong( hPort);
  2123. ((REQTYPECAST *)
  2124. pbTemp->RB_Buffer)->SetEapLogonInfo.dwSizeofEapData =
  2125. pEapInfo->dwSizeofEapInfo;
  2126. ((REQTYPECAST *)
  2127. pbTemp->RB_Buffer)->SetEapLogonInfo.fLogon = fLogon;
  2128. memcpy(((REQTYPECAST *)
  2129. pbTemp->RB_Buffer)->SetEapLogonInfo.abEapData,
  2130. pEapInfo->pbEapInfo,
  2131. pEapInfo->dwSizeofEapInfo);
  2132. break;
  2133. }
  2134. case REQTYPE_SENDNOTIFICATION:
  2135. {
  2136. RASEVENT *pRasEvent = va_arg(ap, RASEVENT *);
  2137. //
  2138. // dummy - this won't be looked at
  2139. //
  2140. pbTemp->RB_PCBIndex = 0;
  2141. memcpy(
  2142. (PBYTE) &((REQTYPECAST *)
  2143. pbTemp->RB_Buffer)->SendNotification.RasEvent,
  2144. (PBYTE) pRasEvent,
  2145. sizeof(RASEVENT));
  2146. break;
  2147. }
  2148. case REQTYPE_GETNDISWANDRIVERCAPS:
  2149. {
  2150. pbTemp->RB_PCBIndex = 0;
  2151. break;
  2152. }
  2153. case REQTYPE_GETBANDWIDTHUTILIZATION:
  2154. {
  2155. HPORT hPort = va_arg(ap, HPORT);
  2156. pbTemp->RB_PCBIndex = PtrToUlong( hPort);
  2157. break;
  2158. }
  2159. case REQTYPE_REGISTERREDIALCALLBACK:
  2160. {
  2161. PVOID pvfn = va_arg(ap, PVOID);
  2162. pbTemp->RB_PCBIndex = 0;
  2163. ((REQTYPECAST *)
  2164. pbTemp->RB_Buffer)->RegisterRedialCallback.pvCallback
  2165. = pvfn;
  2166. break;
  2167. }
  2168. case REQTYPE_GETPROTOCOLINFO:
  2169. {
  2170. pbTemp->RB_PCBIndex = 0;
  2171. break;
  2172. }
  2173. case REQTYPE_GETCUSTOMSCRIPTDLL:
  2174. {
  2175. pbTemp->RB_PCBIndex = 0;
  2176. break;
  2177. }
  2178. case REQTYPE_ISTRUSTEDCUSTOMDLL:
  2179. {
  2180. WCHAR *pwszCustomDll = va_arg( ap, WCHAR * );
  2181. pbTemp->RB_PCBIndex = 0;
  2182. (VOID) StringCchCopyW(
  2183. ((REQTYPECAST *)
  2184. pbTemp->RB_Buffer)->IsTrusted.wszCustomDll,
  2185. MAX_PATH + 1,
  2186. pwszCustomDll);
  2187. break;
  2188. }
  2189. case REQTYPE_DOIKE:
  2190. {
  2191. HPORT hPort = va_arg(ap, HPORT);
  2192. HANDLE hEvent = va_arg(ap, HANDLE);
  2193. pbTemp->RB_PCBIndex = PtrToUlong( hPort);
  2194. ((REQTYPECAST *) pbTemp->RB_Buffer)->DoIke.hEvent = hEvent;
  2195. ((REQTYPECAST *) pbTemp->RB_Buffer)->DoIke.pid =
  2196. GetCurrentProcessId();
  2197. break;
  2198. }
  2199. case REQTYPE_QUERYIKESTATUS:
  2200. {
  2201. HPORT hPort = va_arg(ap, HPORT);
  2202. pbTemp->RB_PCBIndex = PtrToUlong(hPort);
  2203. break;
  2204. }
  2205. case REQTYPE_SETRASCOMMSETTINGS:
  2206. {
  2207. HPORT hPort = va_arg(ap, HPORT);
  2208. RASCOMMSETTINGS *rs = va_arg(ap, RASCOMMSETTINGS *);
  2209. pbTemp->RB_PCBIndex = PtrToUlong(hPort);
  2210. ((REQTYPECAST *)
  2211. pbTemp->RB_Buffer)->SetRasCommSettings.Settings.bParity
  2212. = rs->bParity;
  2213. ((REQTYPECAST *)
  2214. pbTemp->RB_Buffer)->SetRasCommSettings.Settings.bStop
  2215. = rs->bStop;
  2216. ((REQTYPECAST *)
  2217. pbTemp->RB_Buffer)->SetRasCommSettings.Settings.bByteSize
  2218. = rs->bByteSize;
  2219. break;
  2220. }
  2221. case REQTYPE_SETKEY:
  2222. {
  2223. GUID *pGuid = va_arg(ap, GUID *);
  2224. DWORD dwMask = va_arg(ap, DWORD);
  2225. DWORD cbkey = va_arg(ap, DWORD);
  2226. PBYTE pbkey = va_arg(ap, PBYTE);
  2227. retcode = AllocateBuffer(cbkey,
  2228. (PBYTE *) &pBuffer,
  2229. &dwSizeofBuffer);
  2230. if(retcode)
  2231. {
  2232. goto done;
  2233. }
  2234. pbTemp->RB_PCBIndex = 0;
  2235. if(pBuffer)
  2236. {
  2237. pBuffer->RB_Reqtype = reqtype;
  2238. pbTemp = pBuffer;
  2239. }
  2240. if(NULL != pGuid)
  2241. {
  2242. memcpy(
  2243. &((REQTYPECAST *)
  2244. pbTemp->RB_Buffer)->GetSetKey.guid,
  2245. pGuid,
  2246. sizeof(GUID));
  2247. }
  2248. else
  2249. {
  2250. memset(
  2251. &((REQTYPECAST *)
  2252. pbTemp->RB_Buffer)->GetSetKey.guid,
  2253. 0, sizeof(GUID));
  2254. }
  2255. ((REQTYPECAST *)
  2256. pbTemp->RB_Buffer)->GetSetKey.dwMask = dwMask;
  2257. ((REQTYPECAST *)
  2258. pbTemp->RB_Buffer)->GetSetKey.cbkey = cbkey;
  2259. if(cbkey > 0)
  2260. {
  2261. memcpy(
  2262. ((REQTYPECAST *)
  2263. pbTemp->RB_Buffer)->GetSetKey.data,
  2264. pbkey,
  2265. cbkey);
  2266. }
  2267. break;
  2268. }
  2269. case REQTYPE_GETKEY:
  2270. {
  2271. GUID *pGuid = va_arg(ap, GUID *);
  2272. DWORD dwMask = va_arg(ap, DWORD);
  2273. pdwSize = va_arg(ap, DWORD *);
  2274. retcode = AllocateBuffer(*pdwSize,
  2275. (PBYTE *) &pBuffer,
  2276. &dwSizeofBuffer);
  2277. if(retcode)
  2278. {
  2279. goto done;
  2280. }
  2281. pbTemp->RB_PCBIndex = 0;
  2282. if(pBuffer)
  2283. {
  2284. pBuffer->RB_Reqtype = reqtype;
  2285. pbTemp = pBuffer;
  2286. }
  2287. if(NULL != pGuid)
  2288. {
  2289. memcpy(
  2290. &((REQTYPECAST *)
  2291. pbTemp->RB_Buffer)->GetSetKey.guid,
  2292. pGuid,
  2293. sizeof(GUID));
  2294. }
  2295. ((REQTYPECAST *)
  2296. pbTemp->RB_Buffer)->GetSetKey.dwMask = dwMask;
  2297. ((REQTYPECAST *)
  2298. pbTemp->RB_Buffer)->GetSetKey.cbkey = *pdwSize;
  2299. break;
  2300. }
  2301. case REQTYPE_ADDRESSDISABLE:
  2302. {
  2303. WCHAR *pszAddress = va_arg( ap, WCHAR * );
  2304. BOOL fDisable = va_arg(ap, BOOL);
  2305. pbTemp->RB_PCBIndex = 0;
  2306. (VOID) StringCchCopyW(((REQTYPECAST *)
  2307. pbTemp->RB_Buffer)->AddressDisable.szAddress,
  2308. 1024 + 1,
  2309. pszAddress);
  2310. ((REQTYPECAST *)
  2311. pbTemp->RB_Buffer)->AddressDisable.fDisable = fDisable;
  2312. break;
  2313. }
  2314. case REQTYPE_SENDCREDS:
  2315. {
  2316. HPORT hport = va_arg(ap, HPORT);
  2317. CHAR controlchar = va_arg(ap, CHAR);
  2318. pbTemp->RB_PCBIndex = PtrToUlong(hport);
  2319. ((REQTYPECAST *)
  2320. pbTemp->RB_Buffer)->SendCreds.pid =
  2321. GetCurrentProcessId();
  2322. ((REQTYPECAST *)
  2323. pbTemp->RB_Buffer)->SendCreds.controlchar =
  2324. controlchar;
  2325. break;
  2326. }
  2327. case REQTYPE_GETUNICODEDEVICENAME:
  2328. {
  2329. HPORT hport = va_arg(ap, HPORT);
  2330. //
  2331. // dummy - this won't be looked at
  2332. //
  2333. pbTemp->RB_PCBIndex = HandleToUlong(hport);
  2334. break;
  2335. }
  2336. case REQTYPE_GETBESTINTERFACE:
  2337. {
  2338. //
  2339. // This is a dummy
  2340. //
  2341. pbTemp->RB_PCBIndex = 0;
  2342. ((REQTYPECAST *)
  2343. pbTemp->RB_Buffer)->GetBestInterface.DestAddr =
  2344. va_arg(ap, DWORD);
  2345. break;
  2346. }
  2347. case REQTYPE_ISPULSEDIAL:
  2348. {
  2349. pbTemp->RB_PCBIndex = HandleToUlong(va_arg(ap, HPORT));
  2350. break;
  2351. }
  2352. } // switch(reqtype)
  2353. //
  2354. // The request packet is now ready. Pass it on to
  2355. // the request thread:
  2356. //
  2357. retcode = PutRequestInQueue (hConnection, pbTemp, dwSizeofBuffer) ;
  2358. if(ERROR_SUCCESS != retcode)
  2359. {
  2360. goto done;
  2361. }
  2362. #if DBG
  2363. ASSERT(reqtype == pbTemp->RB_Reqtype);
  2364. #endif
  2365. //
  2366. // The request has been completed by the requestor thread:
  2367. // copy the results into the user supplied arguments:
  2368. //
  2369. switch (reqtype) {
  2370. case REQTYPE_PORTENUM:
  2371. case REQTYPE_DEVICEENUM:
  2372. {
  2373. PDWORD entries = va_arg(ap, PDWORD) ;
  2374. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2375. if (*pdwSize >= ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.size)
  2376. {
  2377. retcode = ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.retcode ;
  2378. }
  2379. else
  2380. {
  2381. retcode = ERROR_BUFFER_TOO_SMALL ;
  2382. }
  2383. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2384. *pdwSize = ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.size ;
  2385. *entries = ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.entries ;
  2386. if (retcode == SUCCESS)
  2387. {
  2388. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2389. memcpy (pUserBuffer,
  2390. ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.buffer,
  2391. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2392. *pdwSize);
  2393. }
  2394. }
  2395. break ;
  2396. case REQTYPE_PROTOCOLENUM:
  2397. {
  2398. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2399. PBYTE buffer = pUserBuffer ;
  2400. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2401. PDWORD size = pdwSize ;
  2402. PDWORD entries = va_arg(ap, PDWORD) ;
  2403. if (*size >= ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.size)
  2404. {
  2405. retcode = ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.retcode ;
  2406. }
  2407. else
  2408. {
  2409. retcode = ERROR_BUFFER_TOO_SMALL ;
  2410. }
  2411. *size = ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.size ;
  2412. *entries = ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.entries ;
  2413. if (retcode == SUCCESS)
  2414. {
  2415. memcpy (buffer,
  2416. ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.buffer,
  2417. *size);
  2418. }
  2419. }
  2420. break;
  2421. case REQTYPE_PORTGETINFO:
  2422. case REQTYPE_DEVICEGETINFO:
  2423. {
  2424. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2425. PBYTE buffer = pUserBuffer ;
  2426. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2427. PDWORD size = pdwSize ;
  2428. if (*size >= ((REQTYPECAST *)
  2429. pbTemp->RB_Buffer)->GetInfo.size)
  2430. {
  2431. retcode = ((REQTYPECAST *)
  2432. pbTemp->RB_Buffer)->GetInfo.retcode ;
  2433. }
  2434. else
  2435. {
  2436. retcode = ERROR_BUFFER_TOO_SMALL ;
  2437. }
  2438. *size = ((REQTYPECAST *)pbTemp->RB_Buffer)->GetInfo.size ;
  2439. if (retcode == SUCCESS)
  2440. {
  2441. RASMAN_DEVICEINFO *devinfo =
  2442. (RASMAN_DEVICEINFO *)
  2443. ((REQTYPECAST*)pbTemp->RB_Buffer)->GetInfo.buffer ;
  2444. //
  2445. // Convert the offset based param structure into
  2446. // pointer based.
  2447. //
  2448. ConvParamOffsetToPointer (devinfo->DI_Params,
  2449. devinfo->DI_NumOfParams);
  2450. CopyParams (
  2451. devinfo->DI_Params,
  2452. ((RASMAN_DEVICEINFO *) buffer)->DI_Params,
  2453. devinfo->DI_NumOfParams);
  2454. ((RASMAN_DEVICEINFO*)buffer)->DI_NumOfParams =
  2455. devinfo->DI_NumOfParams;
  2456. }
  2457. }
  2458. break ;
  2459. case REQTYPE_PORTOPEN:
  2460. {
  2461. HPORT *handle = va_arg(ap, HPORT*) ;
  2462. if ((retcode = ((REQTYPECAST *)
  2463. preqbuf->RB_Buffer)->PortOpen.retcode)
  2464. == SUCCESS)
  2465. {
  2466. *handle = ((REQTYPECAST*)
  2467. preqbuf->RB_Buffer)->PortOpen.porthandle;
  2468. }
  2469. }
  2470. break ;
  2471. case REQTYPE_PORTOPENEX:
  2472. {
  2473. HPORT *phport = va_arg(ap, HPORT *);
  2474. if(SUCCESS == (retcode = ((REQTYPECAST *)
  2475. preqbuf->RB_Buffer)->PortOpenEx.retcode))
  2476. {
  2477. *phport = ((REQTYPECAST *)
  2478. preqbuf->RB_Buffer)->PortOpenEx.hport;
  2479. }
  2480. #pragma prefast(suppress:11, "pdwFlags initialized in prev. switch statement (PREfast bug 634)")
  2481. *pdwFlags = ((REQTYPECAST *)
  2482. preqbuf->RB_Buffer)->PortOpenEx.dwFlags;
  2483. }
  2484. break;
  2485. case REQTYPE_PORTGETSTATISTICS:
  2486. case REQTYPE_BUNDLEGETSTATISTICS:
  2487. case REQTYPE_PORTGETSTATISTICSEX:
  2488. case REQTYPE_BUNDLEGETSTATISTICSEX:
  2489. {
  2490. RAS_STATISTICS *statbuffer = va_arg(ap, RAS_STATISTICS*) ;
  2491. PDWORD size = va_arg(ap, PDWORD) ;
  2492. //
  2493. // some local variables...
  2494. //
  2495. DWORD returnedsize ;
  2496. RAS_STATISTICS *temp = &((REQTYPECAST*)
  2497. preqbuf->RB_Buffer)->PortGetStatistics.statbuffer;
  2498. retcode = ((REQTYPECAST *)
  2499. preqbuf->RB_Buffer)->PortGetStatistics.retcode;
  2500. returnedsize = ((temp->S_NumOfStatistics - 1) * sizeof(ULONG))
  2501. + sizeof(RAS_STATISTICS);
  2502. if ( (SUCCESS == retcode)
  2503. && (*size < returnedsize))
  2504. {
  2505. retcode = ERROR_BUFFER_TOO_SMALL ;
  2506. }
  2507. /*
  2508. else
  2509. {
  2510. retcode = ((REQTYPECAST*)
  2511. preqbuf->RB_Buffer)->PortGetStatistics.retcode;
  2512. } */
  2513. if ( (retcode == SUCCESS)
  2514. || (retcode == ERROR_BUFFER_TOO_SMALL))
  2515. {
  2516. memcpy (statbuffer, temp, *size) ;
  2517. }
  2518. *size = returnedsize ;
  2519. }
  2520. break ;
  2521. case REQTYPE_GETINFO:
  2522. {
  2523. RASMAN_INFO *info = va_arg(ap, RASMAN_INFO*) ;
  2524. retcode = ((REQTYPECAST*)preqbuf->RB_Buffer)->Info.retcode ;
  2525. memcpy (info,
  2526. &((REQTYPECAST *)preqbuf->RB_Buffer)->Info.info,
  2527. sizeof (RASMAN_INFO));
  2528. //
  2529. // Now we set the OwnershipFlag in the GetInfo
  2530. // structure to tell us whether the caller owns
  2531. // the port or not.
  2532. //
  2533. if (info->RI_OwnershipFlag == GetCurrentProcessId())
  2534. {
  2535. info->RI_OwnershipFlag = TRUE ;
  2536. }
  2537. else
  2538. {
  2539. info->RI_OwnershipFlag = FALSE ;
  2540. }
  2541. }
  2542. break ;
  2543. case REQTYPE_GETINFOEX:
  2544. {
  2545. RASMAN_INFO *info = va_arg(ap, RASMAN_INFO*) ;
  2546. retcode = ((REQTYPECAST*)preqbuf->RB_Buffer)->InfoEx.retcode;
  2547. memcpy (info,
  2548. &((REQTYPECAST *)preqbuf->RB_Buffer)->InfoEx.info,
  2549. sizeof (RASMAN_INFO)
  2550. * ((REQTYPECAST *)preqbuf->RB_Buffer)->InfoEx.count);
  2551. }
  2552. break ;
  2553. case REQTYPE_ACTIVATEROUTEEX:
  2554. case REQTYPE_ACTIVATEROUTE:
  2555. case REQTYPE_ALLOCATEROUTE:
  2556. {
  2557. RASMAN_ROUTEINFO *info = va_arg(ap,RASMAN_ROUTEINFO*) ;
  2558. retcode= ((REQTYPECAST*)preqbuf->RB_Buffer)->Route.retcode ;
  2559. if ((retcode == SUCCESS) && info)
  2560. {
  2561. memcpy(info,
  2562. &((REQTYPECAST*)preqbuf->RB_Buffer)->Route.info,
  2563. sizeof(RASMAN_ROUTEINFO));
  2564. }
  2565. }
  2566. break ;
  2567. case REQTYPE_GETUSERCREDENTIALS:
  2568. {
  2569. PWCHAR UserName = va_arg(ap, PWCHAR);
  2570. PBYTE CSCResponse = va_arg(ap, PBYTE);
  2571. PBYTE CICResponse = va_arg(ap, PBYTE);
  2572. PBYTE LMSessionKey= va_arg(ap, PBYTE);
  2573. PBYTE UserSessionKey = va_arg(ap, PBYTE);
  2574. memcpy (UserName,
  2575. ((REQTYPECAST*)
  2576. preqbuf->RB_Buffer)->GetCredentials.UserName,
  2577. sizeof(WCHAR) * MAX_USERNAME_SIZE) ;
  2578. memcpy(CSCResponse,
  2579. ((REQTYPECAST*)
  2580. preqbuf->RB_Buffer)->GetCredentials.CSCResponse,
  2581. MAX_RESPONSE_SIZE);
  2582. memcpy(CICResponse,
  2583. ((REQTYPECAST*)
  2584. preqbuf->RB_Buffer)->GetCredentials.CICResponse,
  2585. MAX_RESPONSE_SIZE);
  2586. memcpy(LMSessionKey,
  2587. ((REQTYPECAST*)
  2588. preqbuf->RB_Buffer)->GetCredentials.LMSessionKey,
  2589. MAX_SESSIONKEY_SIZE);
  2590. memcpy(UserSessionKey,
  2591. ((REQTYPECAST*)
  2592. preqbuf->RB_Buffer)->GetCredentials.UserSessionKey,
  2593. MAX_USERSESSIONKEY_SIZE);
  2594. retcode = ((REQTYPECAST *)
  2595. preqbuf->RB_Buffer)->GetCredentials.retcode ;
  2596. }
  2597. break ;
  2598. case REQTYPE_SETCACHEDCREDENTIALS:
  2599. {
  2600. retcode = ((REQTYPECAST *)
  2601. preqbuf->RB_Buffer)->SetCachedCredentials.retcode;
  2602. }
  2603. break;
  2604. case REQTYPE_COMPRESSIONGETINFO:
  2605. {
  2606. RAS_COMPRESSION_INFO *send = va_arg(ap, RAS_COMPRESSION_INFO *) ;
  2607. RAS_COMPRESSION_INFO *recv = va_arg(ap, RAS_COMPRESSION_INFO *) ;
  2608. memcpy (send,
  2609. &((REQTYPECAST *)preqbuf->RB_Buffer)->CompressionGetInfo.
  2610. send,
  2611. sizeof (RAS_COMPRESSION_INFO)) ;
  2612. memcpy (recv,
  2613. &((REQTYPECAST *)preqbuf->RB_Buffer)->CompressionGetInfo.
  2614. recv,
  2615. sizeof (RAS_COMPRESSION_INFO)) ;
  2616. retcode = ((REQTYPECAST*)
  2617. preqbuf->RB_Buffer)->CompressionGetInfo.retcode;
  2618. }
  2619. break ;
  2620. case REQTYPE_ENUMLANNETS:
  2621. {
  2622. DWORD *count = va_arg (ap, DWORD*) ;
  2623. UCHAR *lanas = va_arg (ap, UCHAR*) ;
  2624. *count =
  2625. (((REQTYPECAST*)preqbuf->RB_Buffer)->EnumLanNets.count <
  2626. MAX_LAN_NETS) ?
  2627. ((REQTYPECAST*)preqbuf->RB_Buffer)->EnumLanNets.count :
  2628. MAX_LAN_NETS ;
  2629. memcpy (lanas,
  2630. ((REQTYPECAST *)preqbuf->RB_Buffer)->EnumLanNets.lanas,
  2631. (*count) * sizeof (UCHAR)) ;
  2632. retcode = SUCCESS ;
  2633. }
  2634. break ;
  2635. case REQTYPE_RETRIEVEUSERDATA:
  2636. {
  2637. if ((retcode =
  2638. ((REQTYPECAST *)pbTemp->RB_Buffer)->OldUserData.retcode)
  2639. != SUCCESS)
  2640. {
  2641. break ;
  2642. }
  2643. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2644. if (*pdwSize < ((REQTYPECAST *)pbTemp->RB_Buffer)->OldUserData.size)
  2645. {
  2646. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2647. *pdwSize = ((REQTYPECAST *)pbTemp->RB_Buffer)->OldUserData.
  2648. size ;
  2649. retcode = ERROR_BUFFER_TOO_SMALL ;
  2650. break ;
  2651. }
  2652. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2653. *pdwSize = ((REQTYPECAST *)pbTemp->RB_Buffer)->OldUserData.size ;
  2654. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2655. memcpy (pUserBuffer,
  2656. ((REQTYPECAST *)pbTemp->RB_Buffer)->OldUserData.data,
  2657. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2658. *pdwSize) ;
  2659. retcode = SUCCESS ;
  2660. }
  2661. break ;
  2662. case REQTYPE_GETFRAMINGEX:
  2663. {
  2664. RAS_FRAMING_INFO *info = va_arg(ap, RAS_FRAMING_INFO *) ;
  2665. if ((retcode =
  2666. ((REQTYPECAST *)preqbuf->RB_Buffer)->FramingInfo.retcode)
  2667. != SUCCESS)
  2668. {
  2669. break ;
  2670. }
  2671. memcpy (info,
  2672. &((REQTYPECAST *)preqbuf->RB_Buffer)->FramingInfo.info,
  2673. sizeof (RAS_FRAMING_INFO)) ;
  2674. retcode = SUCCESS ;
  2675. }
  2676. break ;
  2677. case REQTYPE_GETPROTOCOLCOMPRESSION:
  2678. {
  2679. RAS_PROTOCOLCOMPRESSION *send = va_arg(ap,
  2680. RAS_PROTOCOLCOMPRESSION *) ;
  2681. RAS_PROTOCOLCOMPRESSION *recv = va_arg(ap,
  2682. RAS_PROTOCOLCOMPRESSION *) ;
  2683. if ((retcode =
  2684. ((REQTYPECAST *)preqbuf->RB_Buffer)->ProtocolComp.retcode)
  2685. != SUCCESS)
  2686. {
  2687. break ;
  2688. }
  2689. memcpy (send,
  2690. &((REQTYPECAST *)
  2691. preqbuf->RB_Buffer)->ProtocolComp.send,
  2692. sizeof (RAS_PROTOCOLCOMPRESSION)) ;
  2693. memcpy (recv,
  2694. &((REQTYPECAST *)preqbuf->RB_Buffer)->ProtocolComp.recv,
  2695. sizeof (RAS_PROTOCOLCOMPRESSION)) ;
  2696. }
  2697. break ;
  2698. case REQTYPE_PORTENUMPROTOCOLS:
  2699. {
  2700. RAS_PROTOCOLS *protocols = va_arg (ap, RAS_PROTOCOLS*) ;
  2701. PDWORD count = va_arg (ap, PDWORD) ;
  2702. memcpy (protocols,
  2703. &((REQTYPECAST *)
  2704. preqbuf->RB_Buffer)->EnumProtocols.protocols,
  2705. sizeof (RAS_PROTOCOLS)) ;
  2706. *count = ((REQTYPECAST *)
  2707. preqbuf->RB_Buffer)->EnumProtocols.count ;
  2708. retcode = ((REQTYPECAST *)
  2709. preqbuf->RB_Buffer)->EnumProtocols.retcode ;
  2710. }
  2711. break ;
  2712. case REQTYPE_GETFRAMINGCAPABILITIES:
  2713. {
  2714. RAS_FRAMING_CAPABILITIES* caps = va_arg (ap,
  2715. RAS_FRAMING_CAPABILITIES*) ;
  2716. memcpy (caps,
  2717. &((REQTYPECAST *)
  2718. preqbuf->RB_Buffer)->FramingCapabilities.caps,
  2719. sizeof (RAS_FRAMING_CAPABILITIES)) ;
  2720. retcode = ((REQTYPECAST *)
  2721. preqbuf->RB_Buffer)->FramingCapabilities.retcode ;
  2722. }
  2723. break ;
  2724. case REQTYPE_GETBUNDLEDPORT:
  2725. {
  2726. HPORT *phport = va_arg (ap, HPORT*) ;
  2727. *phport = ((REQTYPECAST *)
  2728. preqbuf->RB_Buffer)->GetBundledPort.port ;
  2729. retcode = ((REQTYPECAST *)
  2730. preqbuf->RB_Buffer)->GetBundledPort.retcode ;
  2731. }
  2732. break ;
  2733. case REQTYPE_PORTGETBUNDLE:
  2734. {
  2735. HBUNDLE *phbundle = va_arg(ap, HBUNDLE *) ;
  2736. *phbundle = ((REQTYPECAST *)
  2737. preqbuf->RB_Buffer)->PortGetBundle.bundle;
  2738. retcode = ((REQTYPECAST *)
  2739. preqbuf->RB_Buffer)->PortGetBundle.retcode ;
  2740. }
  2741. break ;
  2742. case REQTYPE_BUNDLEGETPORT:
  2743. {
  2744. HPORT *phport = va_arg (ap, HPORT*) ;
  2745. *phport = ((REQTYPECAST *)
  2746. preqbuf->RB_Buffer)->BundleGetPort.port ;
  2747. retcode = ((REQTYPECAST *)
  2748. preqbuf->RB_Buffer)->BundleGetPort.retcode ;
  2749. }
  2750. break ;
  2751. case REQTYPE_GETDIALPARAMS:
  2752. {
  2753. PRAS_DIALPARAMS pDialParams = va_arg(ap, PRAS_DIALPARAMS);
  2754. retcode = ((REQTYPECAST *)
  2755. pbTemp->RB_Buffer)->DialParams.retcode;
  2756. if(retcode == SUCCESS)
  2757. {
  2758. #pragma prefast(suppress:1, "pdwMaskDialParams initialized in prev. switch statement (PREfast bug 634)")
  2759. *pdwMaskDialParams = ((REQTYPECAST *)
  2760. pbTemp->RB_Buffer)->DialParams.dwMask;
  2761. RtlCopyMemory(
  2762. pDialParams,
  2763. &(((REQTYPECAST *)
  2764. pbTemp->RB_Buffer)->DialParams.params),
  2765. sizeof (RAS_DIALPARAMS));
  2766. }
  2767. }
  2768. break;
  2769. case REQTYPE_SETDIALPARAMS:
  2770. {
  2771. retcode = ((REQTYPECAST *)
  2772. pbTemp->RB_Buffer)->DialParams.retcode;
  2773. }
  2774. break;
  2775. case REQTYPE_CREATECONNECTION:
  2776. {
  2777. HCONN *lphconn = va_arg(ap, HCONN *);
  2778. DWORD *pdwAlreadyConnected = va_arg(ap, DWORD *);
  2779. DWORD *pdwSubEntryInfo = va_arg(ap, DWORD * );
  2780. retcode = ((REQTYPECAST *)
  2781. pbTemp->RB_Buffer)->Connection.retcode;
  2782. if (retcode == SUCCESS)
  2783. {
  2784. DWORD dwSubEntries = ((REQTYPECAST *)
  2785. pbTemp->RB_Buffer)->Connection.dwSubEntries;
  2786. *lphconn = ((REQTYPECAST *)
  2787. pbTemp->RB_Buffer)->Connection.conn;
  2788. *pdwAlreadyConnected = ((REQTYPECAST *)
  2789. pbTemp->RB_Buffer)->Connection.
  2790. dwEntryAlreadyConnected;
  2791. if ( *pdwAlreadyConnected )
  2792. {
  2793. memcpy ( pdwSubEntryInfo,
  2794. ((REQTYPECAST *)
  2795. pbTemp->RB_Buffer)->Connection.data,
  2796. dwSubEntries * sizeof ( DWORD ) );
  2797. }
  2798. }
  2799. }
  2800. break;
  2801. case REQTYPE_DESTROYCONNECTION:
  2802. {
  2803. retcode = ((REQTYPECAST *)
  2804. preqbuf->RB_Buffer)->Connection.retcode;
  2805. }
  2806. break;
  2807. case REQTYPE_ENUMCONNECTION:
  2808. {
  2809. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2810. HCONN *lphconn = (HCONN *) pUserBuffer;
  2811. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2812. LPDWORD lpdwcbConnections = pdwSize;
  2813. LPDWORD lpdwcConnections = va_arg(ap, LPDWORD);
  2814. retcode = ((REQTYPECAST *)
  2815. pbTemp->RB_Buffer)->Enum.retcode;
  2816. if (lphconn != NULL)
  2817. {
  2818. if (*lpdwcbConnections >=
  2819. ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.size)
  2820. {
  2821. memcpy(
  2822. lphconn,
  2823. &((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.buffer,
  2824. ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.size);
  2825. }
  2826. else
  2827. retcode = ERROR_BUFFER_TOO_SMALL;
  2828. }
  2829. *lpdwcbConnections =
  2830. ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.size;
  2831. *lpdwcConnections =
  2832. ((REQTYPECAST *)pbTemp->RB_Buffer)->Enum.entries;
  2833. }
  2834. break;
  2835. case REQTYPE_ADDCONNECTIONPORT:
  2836. {
  2837. retcode = ((REQTYPECAST *)
  2838. preqbuf->RB_Buffer)->AddConnectionPort.retcode;
  2839. }
  2840. break;
  2841. case REQTYPE_ENUMCONNECTIONPORTS:
  2842. {
  2843. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2844. RASMAN_PORT *lpPorts = ( RASMAN_PORT *) pUserBuffer;
  2845. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2846. LPDWORD lpdwcbPorts = pdwSize;
  2847. LPDWORD lpdwcPorts = va_arg(ap, LPDWORD);
  2848. if (*lpdwcbPorts >= ((REQTYPECAST *)
  2849. pbTemp->RB_Buffer)->EnumConnectionPorts.size)
  2850. {
  2851. retcode = ((REQTYPECAST *)
  2852. pbTemp->RB_Buffer)->EnumConnectionPorts.retcode;
  2853. }
  2854. else
  2855. {
  2856. retcode = ERROR_BUFFER_TOO_SMALL;
  2857. }
  2858. *lpdwcbPorts = ((REQTYPECAST *)
  2859. pbTemp->RB_Buffer)->EnumConnectionPorts.size;
  2860. *lpdwcPorts = ((REQTYPECAST *)
  2861. pbTemp->RB_Buffer)->EnumConnectionPorts.entries;
  2862. if ( retcode == SUCCESS
  2863. && lpPorts != NULL)
  2864. {
  2865. memcpy(
  2866. lpPorts,
  2867. ((REQTYPECAST *)
  2868. pbTemp->RB_Buffer)->EnumConnectionPorts.buffer,
  2869. ((REQTYPECAST *)
  2870. pbTemp->RB_Buffer)->EnumConnectionPorts.size);
  2871. }
  2872. }
  2873. break;
  2874. case REQTYPE_GETCONNECTIONPARAMS:
  2875. {
  2876. PRAS_CONNECTIONPARAMS pParams = va_arg(ap, PRAS_CONNECTIONPARAMS);
  2877. memcpy(
  2878. pParams,
  2879. &(((REQTYPECAST *)
  2880. preqbuf->RB_Buffer)->ConnectionParams.params),
  2881. sizeof (RAS_CONNECTIONPARAMS));
  2882. retcode = ((REQTYPECAST *)
  2883. preqbuf->RB_Buffer)->ConnectionParams.retcode;
  2884. }
  2885. break;
  2886. case REQTYPE_SETCONNECTIONPARAMS:
  2887. {
  2888. retcode = ((REQTYPECAST *)
  2889. preqbuf->RB_Buffer)->ConnectionParams.retcode;
  2890. }
  2891. break;
  2892. case REQTYPE_GETCONNECTIONUSERDATA:
  2893. {
  2894. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2895. PBYTE pBuf = pUserBuffer ;
  2896. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2897. LPDWORD lpdwcb = pdwSize;
  2898. if ((retcode =
  2899. ((REQTYPECAST *)
  2900. pbTemp->RB_Buffer)->ConnectionUserData.retcode)
  2901. != SUCCESS)
  2902. {
  2903. break ;
  2904. }
  2905. if (lpdwcb != NULL)
  2906. {
  2907. if (*lpdwcb <
  2908. ((REQTYPECAST *)
  2909. pbTemp->RB_Buffer)->ConnectionUserData.dwcb)
  2910. {
  2911. *lpdwcb = ((REQTYPECAST *)
  2912. pbTemp->RB_Buffer)->ConnectionUserData.dwcb;
  2913. retcode = ERROR_BUFFER_TOO_SMALL ;
  2914. break ;
  2915. }
  2916. *lpdwcb = ((REQTYPECAST *)
  2917. pbTemp->RB_Buffer)->ConnectionUserData.dwcb;
  2918. }
  2919. if (pBuf != NULL)
  2920. {
  2921. memcpy(
  2922. pBuf,
  2923. ((REQTYPECAST *)
  2924. pbTemp->RB_Buffer)->ConnectionUserData.data,
  2925. ((REQTYPECAST *)
  2926. pbTemp->RB_Buffer)->ConnectionUserData.dwcb);
  2927. }
  2928. retcode = SUCCESS ;
  2929. }
  2930. break;
  2931. case REQTYPE_SETCONNECTIONUSERDATA:
  2932. {
  2933. retcode = ((REQTYPECAST *)
  2934. preqbuf->RB_Buffer)->ConnectionUserData.retcode;
  2935. }
  2936. break;
  2937. case REQTYPE_GETPORTUSERDATA:
  2938. {
  2939. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  2940. PBYTE pBuf = pUserBuffer;
  2941. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  2942. LPDWORD lpdwcb = pdwSize;
  2943. if ((retcode =
  2944. ((REQTYPECAST *)
  2945. pbTemp->RB_Buffer)->PortUserData.retcode)
  2946. != SUCCESS)
  2947. {
  2948. break ;
  2949. }
  2950. if (lpdwcb != NULL)
  2951. {
  2952. if (*lpdwcb < ((REQTYPECAST *)
  2953. pbTemp->RB_Buffer)->PortUserData.dwcb)
  2954. {
  2955. *lpdwcb = ((REQTYPECAST *)
  2956. pbTemp->RB_Buffer)->PortUserData.dwcb;
  2957. retcode = ERROR_BUFFER_TOO_SMALL ;
  2958. break ;
  2959. }
  2960. *lpdwcb = ((REQTYPECAST *)
  2961. pbTemp->RB_Buffer)->PortUserData.dwcb;
  2962. }
  2963. if (pBuf != NULL)
  2964. {
  2965. memcpy(
  2966. pBuf,
  2967. ((REQTYPECAST *)
  2968. pbTemp->RB_Buffer)->PortUserData.data,
  2969. ((REQTYPECAST *)
  2970. pbTemp->RB_Buffer)->PortUserData.dwcb);
  2971. }
  2972. retcode = SUCCESS ;
  2973. }
  2974. break;
  2975. case REQTYPE_SETPORTUSERDATA:
  2976. {
  2977. retcode = ((REQTYPECAST *)
  2978. pbTemp->RB_Buffer)->PortUserData.retcode;
  2979. }
  2980. break;
  2981. case REQTYPE_PPPGETINFO:
  2982. {
  2983. PPP_MESSAGE * pPppMsg = va_arg(ap, PPP_MESSAGE*);
  2984. memcpy( pPppMsg,
  2985. &(((REQTYPECAST *)
  2986. preqbuf->RB_Buffer)->PppMsg),
  2987. sizeof( PPP_MESSAGE ) );
  2988. retcode = pPppMsg->dwError;
  2989. }
  2990. break;
  2991. case REQTYPE_GETTIMESINCELASTACTIVITY:
  2992. {
  2993. LPDWORD lpdwTimeSinceLastActivity = va_arg(ap, LPDWORD);
  2994. *lpdwTimeSinceLastActivity =
  2995. ((REQTYPECAST *)
  2996. preqbuf->RB_Buffer)->GetTimeSinceLastActivity.dwTimeSinceLastActivity;
  2997. retcode =
  2998. ((REQTYPECAST *)
  2999. preqbuf->RB_Buffer)->GetTimeSinceLastActivity.dwRetCode;
  3000. }
  3001. break;
  3002. case REQTYPE_ADDNOTIFICATION:
  3003. {
  3004. retcode = ((REQTYPECAST *)
  3005. preqbuf->RB_Buffer)->AddNotification.retcode;
  3006. }
  3007. break;
  3008. case REQTYPE_SIGNALCONNECTION:
  3009. {
  3010. retcode = ((REQTYPECAST *)
  3011. preqbuf->RB_Buffer)->SignalConnection.retcode;
  3012. }
  3013. break;
  3014. case REQTYPE_GETDEVCONFIG:
  3015. {
  3016. if ((retcode =
  3017. ((REQTYPECAST *)
  3018. pbTemp->RB_Buffer)->GetDevConfig.retcode)
  3019. != SUCCESS)
  3020. {
  3021. ;
  3022. }
  3023. else if (((REQTYPECAST *)
  3024. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3025. pbTemp->RB_Buffer)->GetDevConfig.size > *pdwSize)
  3026. {
  3027. retcode = ERROR_BUFFER_TOO_SMALL ;
  3028. }
  3029. else
  3030. {
  3031. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  3032. memcpy (pUserBuffer,
  3033. ((REQTYPECAST *)
  3034. pbTemp->RB_Buffer)->GetDevConfig.config,
  3035. ((REQTYPECAST *)
  3036. pbTemp->RB_Buffer)->GetDevConfig.size) ;
  3037. }
  3038. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3039. *pdwSize = ((REQTYPECAST *)
  3040. pbTemp->RB_Buffer)->GetDevConfig.size ;
  3041. }
  3042. break ;
  3043. case REQTYPE_GETDEVCONFIGEX:
  3044. {
  3045. if ((retcode =
  3046. ((REQTYPECAST *)
  3047. pbTemp->RB_Buffer)->GetDevConfigEx.retcode)
  3048. != SUCCESS)
  3049. {
  3050. ;
  3051. }
  3052. else if (((REQTYPECAST *)
  3053. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3054. pbTemp->RB_Buffer)->GetDevConfigEx.size > *pdwSize)
  3055. {
  3056. retcode = ERROR_BUFFER_TOO_SMALL ;
  3057. }
  3058. else
  3059. {
  3060. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  3061. memcpy (pUserBuffer,
  3062. ((REQTYPECAST *)
  3063. pbTemp->RB_Buffer)->GetDevConfigEx.config,
  3064. ((REQTYPECAST *)
  3065. pbTemp->RB_Buffer)->GetDevConfigEx.size) ;
  3066. }
  3067. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3068. *pdwSize = ((REQTYPECAST *)
  3069. pbTemp->RB_Buffer)->GetDevConfigEx.size ;
  3070. break;
  3071. }
  3072. case REQTYPE_PORTRECEIVEEX:
  3073. {
  3074. PBYTE pReceiveBuffer = va_arg ( ap, PBYTE );
  3075. PDWORD size = va_arg (ap, DWORD * );
  3076. DWORD dwSize;
  3077. if ((retcode =
  3078. ((REQTYPECAST *)
  3079. preqbuf->RB_Buffer)->PortReceiveEx.retcode )
  3080. == SUCCESS )
  3081. {
  3082. memcpy (pReceiveBuffer,
  3083. &((REQTYPECAST *)
  3084. preqbuf->RB_Buffer)->PortReceiveEx.
  3085. buffer.SRB_Packet.PacketData,
  3086. MAX_SENDRCVBUFFER_SIZE);
  3087. dwSize = ((REQTYPECAST *)
  3088. preqbuf->RB_Buffer)->PortReceiveEx.size;
  3089. *size = ((dwSize > MAX_SENDRCVBUFFER_SIZE)
  3090. ? MAX_SENDRCVBUFFER_SIZE : dwSize );
  3091. }
  3092. break;
  3093. }
  3094. case REQTYPE_GETATTACHEDCOUNT:
  3095. {
  3096. DWORD *pdwAttachedCount = va_arg ( ap, DWORD * );
  3097. if ((retcode =
  3098. ((REQTYPECAST *)
  3099. preqbuf->RB_Buffer)->GetAttachedCount.retcode )
  3100. == SUCCESS )
  3101. {
  3102. *pdwAttachedCount = ((REQTYPECAST *)
  3103. preqbuf->RB_Buffer)->GetAttachedCount.
  3104. dwAttachedCount;
  3105. }
  3106. break;
  3107. }
  3108. case REQTYPE_REFCONNECTION:
  3109. {
  3110. PDWORD pdwRefCount = va_arg ( ap, DWORD * );
  3111. retcode = ((REQTYPECAST*)
  3112. preqbuf->RB_Buffer)->RefConnection.retcode;
  3113. if ( SUCCESS == retcode
  3114. && pdwRefCount )
  3115. {
  3116. *pdwRefCount = ((REQTYPECAST *)
  3117. preqbuf->RB_Buffer )->RefConnection.dwRef;
  3118. }
  3119. }
  3120. break;
  3121. case REQTYPE_GETEAPINFO:
  3122. {
  3123. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  3124. PBYTE pBuf = pUserBuffer;
  3125. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3126. LPDWORD lpdwcb = pdwSize;
  3127. DWORD *pdwContextId = va_arg(ap, DWORD *);
  3128. DWORD *pdwEapTypeId = va_arg(ap, DWORD *);
  3129. if ((retcode =
  3130. ((REQTYPECAST *)pbTemp->RB_Buffer)->GetEapInfo.retcode)
  3131. != SUCCESS)
  3132. {
  3133. break ;
  3134. }
  3135. if ( pdwContextId )
  3136. {
  3137. *pdwContextId = ((REQTYPECAST *)
  3138. pbTemp->RB_Buffer)->GetEapInfo.dwContextId;
  3139. }
  3140. if ( pdwEapTypeId )
  3141. {
  3142. *pdwEapTypeId = ((REQTYPECAST *)
  3143. pbTemp->RB_Buffer)->GetEapInfo.dwEapTypeId;
  3144. }
  3145. if (lpdwcb != NULL)
  3146. {
  3147. if (*lpdwcb <
  3148. ((REQTYPECAST *)
  3149. pbTemp->RB_Buffer)->GetEapInfo.dwSizeofEapUIData)
  3150. {
  3151. *lpdwcb = ((REQTYPECAST *)
  3152. pbTemp->RB_Buffer)->GetEapInfo.dwSizeofEapUIData;
  3153. retcode = ERROR_BUFFER_TOO_SMALL ;
  3154. break ;
  3155. }
  3156. *lpdwcb = ((REQTYPECAST *)
  3157. pbTemp->RB_Buffer)->GetEapInfo.dwSizeofEapUIData;
  3158. }
  3159. if (pBuf != NULL)
  3160. {
  3161. memcpy(
  3162. pBuf,
  3163. ((REQTYPECAST *)pbTemp->RB_Buffer)->GetEapInfo.data,
  3164. ((REQTYPECAST *)
  3165. pbTemp->RB_Buffer)->GetEapInfo.dwSizeofEapUIData);
  3166. }
  3167. retcode = SUCCESS ;
  3168. }
  3169. break;
  3170. case REQTYPE_SETEAPINFO:
  3171. {
  3172. retcode = ((REQTYPECAST *)
  3173. pbTemp->RB_Buffer)->SetEapInfo.retcode;
  3174. }
  3175. break;
  3176. case REQTYPE_GETDEVICECONFIGINFO:
  3177. {
  3178. DWORD *pcEntries = va_arg(ap, DWORD *);
  3179. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3180. if(*pdwSize >= ((REQTYPECAST *)
  3181. pbTemp->RB_Buffer)->DeviceConfigInfo.cbBuffer)
  3182. {
  3183. retcode = ((REQTYPECAST *)
  3184. pbTemp->RB_Buffer)->DeviceConfigInfo.retcode;
  3185. }
  3186. else
  3187. {
  3188. retcode = ERROR_BUFFER_TOO_SMALL;
  3189. }
  3190. *pcEntries = ((REQTYPECAST *)
  3191. pbTemp->RB_Buffer)->DeviceConfigInfo.cEntries;
  3192. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3193. *pdwSize = ((REQTYPECAST *)
  3194. pbTemp->RB_Buffer)->DeviceConfigInfo.cbBuffer;
  3195. #pragma prefast(suppress:1, "pdwVersion initialized in prev. switch statement (PREfast bug 634)")
  3196. *pdwVersion = ((REQTYPECAST *)
  3197. pbTemp->RB_Buffer)->DeviceConfigInfo.dwVersion;
  3198. if(SUCCESS == retcode)
  3199. {
  3200. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  3201. memcpy(pUserBuffer,
  3202. ((REQTYPECAST *)
  3203. pbTemp->RB_Buffer)->DeviceConfigInfo.abdata,
  3204. *pdwSize);
  3205. }
  3206. break;
  3207. }
  3208. case REQTYPE_SETDEVICECONFIGINFO:
  3209. {
  3210. retcode = ((REQTYPECAST *)
  3211. pbTemp->RB_Buffer)->DeviceConfigInfo.retcode;
  3212. if(retcode)
  3213. {
  3214. //
  3215. // Copy the buffer to users buffer.
  3216. // the Buffer may have error information
  3217. //
  3218. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  3219. memcpy(pUserBuffer,
  3220. ((REQTYPECAST *)
  3221. pbTemp->RB_Buffer)->DeviceConfigInfo.abdata,
  3222. ((REQTYPECAST *)
  3223. pbTemp->RB_Buffer)->DeviceConfigInfo.cbBuffer);
  3224. }
  3225. break;
  3226. }
  3227. case REQTYPE_FINDPREREQUISITEENTRY:
  3228. {
  3229. HCONN *phRefConn = va_arg(ap, HCONN *);
  3230. retcode = ((REQTYPECAST *)
  3231. pbTemp->RB_Buffer)->FindRefConnection.retcode;
  3232. if(SUCCESS == retcode)
  3233. {
  3234. *phRefConn =
  3235. ((REQTYPECAST *)
  3236. pbTemp->RB_Buffer)->FindRefConnection.hRefConn;
  3237. }
  3238. break;
  3239. }
  3240. case REQTYPE_GETLINKSTATS:
  3241. case REQTYPE_GETCONNECTIONSTATS:
  3242. {
  3243. PBYTE pStats = va_arg(ap, PBYTE);
  3244. retcode = ((REQTYPECAST *)
  3245. pbTemp->RB_Buffer)->GetStats.retcode;
  3246. if(SUCCESS == retcode)
  3247. {
  3248. //
  3249. // Copy everything except the dwVersion parameter
  3250. // of the RAS_STATS structure. This is what is
  3251. // returned by the rasman server
  3252. //
  3253. memcpy(pStats,
  3254. ((REQTYPECAST *)
  3255. pbTemp->RB_Buffer)->GetStats.abStats,
  3256. (sizeof(RAS_STATS) - sizeof(DWORD)));
  3257. }
  3258. break;
  3259. }
  3260. case REQTYPE_GETHPORTFROMCONNECTION:
  3261. {
  3262. HPORT *phport = va_arg(ap, HPORT *);
  3263. retcode = ((REQTYPECAST *)
  3264. pbTemp->RB_Buffer)->GetHportFromConnection.retcode;
  3265. if(SUCCESS == retcode)
  3266. {
  3267. *phport = ((REQTYPECAST *)
  3268. pbTemp->RB_Buffer)->GetHportFromConnection.hPort;
  3269. }
  3270. break;
  3271. }
  3272. case REQTYPE_REFERENCECUSTOMCOUNT:
  3273. {
  3274. retcode = ((REQTYPECAST *)
  3275. pbTemp->RB_Buffer)->ReferenceCustomCount.retcode;
  3276. if(SUCCESS == retcode)
  3277. {
  3278. BOOL fAddref;
  3279. fAddref = ((REQTYPECAST *)
  3280. pbTemp->RB_Buffer)->ReferenceCustomCount.fAddRef;
  3281. if(!fAddref)
  3282. {
  3283. CHAR *pszPhonebook = va_arg(ap, CHAR *);
  3284. CHAR *pszEntry = va_arg(ap, CHAR *);
  3285. DWORD *pdwCount = va_arg(ap, DWORD *);
  3286. *pdwCount =
  3287. ((REQTYPECAST *)
  3288. pbTemp->RB_Buffer)->ReferenceCustomCount.dwCount;
  3289. if( NULL == pszPhonebook
  3290. || NULL == pszEntry)
  3291. {
  3292. break;
  3293. }
  3294. (VOID) StringCchCopyA(
  3295. pszPhonebook,
  3296. MAX_PATH + 1,
  3297. ((REQTYPECAST *)
  3298. pbTemp->RB_Buffer)->ReferenceCustomCount.szPhonebookPath);
  3299. (VOID) StringCchCopyA(
  3300. pszEntry,
  3301. MAX_ENTRYNAME_SIZE + 1,
  3302. ((REQTYPECAST *)
  3303. pbTemp->RB_Buffer)->ReferenceCustomCount.szEntryName);
  3304. }
  3305. else
  3306. {
  3307. DWORD *pdwCount = va_arg(ap, DWORD *);
  3308. if(NULL != pdwCount)
  3309. {
  3310. *pdwCount =
  3311. ((REQTYPECAST *)
  3312. pbTemp->RB_Buffer)->ReferenceCustomCount.dwCount;
  3313. }
  3314. }
  3315. }
  3316. break;
  3317. }
  3318. case REQTYPE_GETHCONNFROMENTRY:
  3319. {
  3320. HCONN *phConn = va_arg(ap, HCONN *);
  3321. retcode = ((REQTYPECAST *)
  3322. preqbuf->RB_Buffer)->HconnFromEntry.retcode;
  3323. if(ERROR_SUCCESS == retcode)
  3324. {
  3325. *phConn = ((REQTYPECAST *)
  3326. preqbuf->RB_Buffer)->HconnFromEntry.hConn;
  3327. }
  3328. break;
  3329. }
  3330. case REQTYPE_GETCONNECTINFO:
  3331. {
  3332. DWORD dwRequiredSize;
  3333. dwRequiredSize = ((REQTYPECAST *)
  3334. pbTemp->RB_Buffer)->GetConnectInfo.dwSize
  3335. + sizeof(RAS_CONNECT_INFO)
  3336. - sizeof(RASTAPI_CONNECT_INFO);
  3337. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3338. if(*pdwSize < dwRequiredSize)
  3339. {
  3340. retcode = ERROR_BUFFER_TOO_SMALL;
  3341. }
  3342. else
  3343. {
  3344. retcode = ((REQTYPECAST *)
  3345. pbTemp->RB_Buffer)->GetConnectInfo.retcode;
  3346. }
  3347. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3348. *pdwSize = dwRequiredSize;
  3349. if(ERROR_SUCCESS == retcode)
  3350. {
  3351. RAS_CONNECT_INFO *pConnectInfo;
  3352. RASTAPI_CONNECT_INFO *pRasTapiConnectInfo;
  3353. //
  3354. // Fixup users buffer to change
  3355. // offsets to pointers.
  3356. //
  3357. #pragma prefast(suppress:1, "pUserBuffer initialized in prev. switch statement (PREfast bug 634)")
  3358. pConnectInfo = (RAS_CONNECT_INFO *) pUserBuffer;
  3359. pRasTapiConnectInfo = (RASTAPI_CONNECT_INFO *)
  3360. &((REQTYPECAST *)
  3361. pbTemp->RB_Buffer)->GetConnectInfo.rci;
  3362. // DebugBreak();
  3363. pConnectInfo->dwCallerIdSize =
  3364. pRasTapiConnectInfo->dwCallerIdSize;
  3365. pConnectInfo->dwCalledIdSize =
  3366. pRasTapiConnectInfo->dwCalledIdSize;
  3367. pConnectInfo->dwConnectResponseSize =
  3368. pRasTapiConnectInfo->dwConnectResponseSize;
  3369. pConnectInfo->dwAltCalledIdSize =
  3370. pRasTapiConnectInfo->dwAltCalledIdSize;
  3371. if(pConnectInfo->dwCallerIdSize > 0)
  3372. {
  3373. //
  3374. // Note abdata is already aligned at 8-byte boundary
  3375. //
  3376. pConnectInfo->pszCallerId =
  3377. (CHAR *) pConnectInfo->abdata;
  3378. memcpy(
  3379. pConnectInfo->pszCallerId,
  3380. ((PBYTE) pRasTapiConnectInfo)
  3381. + pRasTapiConnectInfo->dwCallerIdOffset,
  3382. pRasTapiConnectInfo->dwCallerIdSize);
  3383. }
  3384. else
  3385. {
  3386. pConnectInfo->pszCallerId = NULL;
  3387. }
  3388. if(pConnectInfo->dwCalledIdSize > 0)
  3389. {
  3390. pConnectInfo->pszCalledId =
  3391. (CHAR *) pConnectInfo->abdata
  3392. + RASMAN_ALIGN8(pConnectInfo->dwCallerIdSize);
  3393. memcpy(pConnectInfo->pszCalledId,
  3394. ((PBYTE) pRasTapiConnectInfo)
  3395. + pRasTapiConnectInfo->dwCalledIdOffset,
  3396. pRasTapiConnectInfo->dwCalledIdSize);
  3397. }
  3398. else
  3399. {
  3400. pConnectInfo->pszCalledId = NULL;
  3401. }
  3402. if(pConnectInfo->dwConnectResponseSize > 0)
  3403. {
  3404. pConnectInfo->pszConnectResponse =
  3405. (CHAR *) pConnectInfo->abdata
  3406. + RASMAN_ALIGN8(pConnectInfo->dwCallerIdSize)
  3407. + RASMAN_ALIGN8(pConnectInfo->dwCalledIdSize);
  3408. memcpy(pConnectInfo->pszConnectResponse,
  3409. ((PBYTE) pRasTapiConnectInfo)
  3410. + pRasTapiConnectInfo->dwConnectResponseOffset,
  3411. pRasTapiConnectInfo->dwConnectResponseSize);
  3412. }
  3413. else
  3414. {
  3415. pConnectInfo->pszConnectResponse = NULL;
  3416. }
  3417. if(pConnectInfo->dwAltCalledIdSize > 0)
  3418. {
  3419. pConnectInfo->pszAltCalledId =
  3420. (CHAR *) pConnectInfo->abdata
  3421. + RASMAN_ALIGN8(pConnectInfo->dwCallerIdSize)
  3422. + RASMAN_ALIGN8(pConnectInfo->dwCalledIdSize)
  3423. + RASMAN_ALIGN8(pConnectInfo->dwConnectResponseSize);
  3424. memcpy(pConnectInfo->pszAltCalledId,
  3425. ((PBYTE) pRasTapiConnectInfo)
  3426. + pRasTapiConnectInfo->dwAltCalledIdOffset,
  3427. pRasTapiConnectInfo->dwAltCalledIdSize);
  3428. }
  3429. else
  3430. {
  3431. pConnectInfo->pszAltCalledId = NULL;
  3432. }
  3433. // DebugBreak();
  3434. }
  3435. break;
  3436. }
  3437. case REQTYPE_GETDEVICENAME:
  3438. {
  3439. CHAR *pszDeviceName = va_arg(ap, CHAR *);
  3440. retcode = ((REQTYPECAST *)
  3441. pbTemp->RB_Buffer)->GetDeviceName.retcode;
  3442. if(ERROR_SUCCESS == retcode)
  3443. {
  3444. (VOID) StringCchCopyA(pszDeviceName,
  3445. MAX_DEVICE_NAME + 1,
  3446. ((REQTYPECAST *)
  3447. pbTemp->RB_Buffer)->GetDeviceName.szDeviceName);
  3448. }
  3449. break;
  3450. }
  3451. case REQTYPE_GETDEVICENAMEW:
  3452. {
  3453. WCHAR *pszDeviceName = va_arg(ap, WCHAR *);
  3454. retcode = ((REQTYPECAST *)
  3455. pbTemp->RB_Buffer)->GetDeviceNameW.retcode;
  3456. if(ERROR_SUCCESS == retcode)
  3457. {
  3458. (VOID) StringCchCopyW(pszDeviceName,
  3459. MAX_DEVICE_NAME + 1,
  3460. ((REQTYPECAST *)
  3461. pbTemp->RB_Buffer)->GetDeviceNameW.szDeviceName);
  3462. }
  3463. break;
  3464. }
  3465. case REQTYPE_GETCALLEDID:
  3466. {
  3467. DWORD ServerVersion = RasGetServerVersion(hConnection);
  3468. RAS_CALLEDID_INFO *pCalledId =
  3469. (VERSION_501 == ServerVersion)
  3470. ? &((REQTYPECAST *)
  3471. pbTemp->RB_Buffer)->GetSetCalledId.rciInfo
  3472. : &((REQTYPECAST *)
  3473. pbTemp->RB_Buffer)->GetSetCalledId_500.rciInfo;
  3474. retcode = ((REQTYPECAST *)
  3475. pbTemp->RB_Buffer)->GetSetCalledId.retcode;
  3476. if( (ERROR_SUCCESS == retcode)
  3477. && (*pdwSize < ((REQTYPECAST *)
  3478. pbTemp->RB_Buffer)->GetSetCalledId.dwSize))
  3479. {
  3480. retcode = ERROR_BUFFER_TOO_SMALL;
  3481. }
  3482. *pdwSize = ((REQTYPECAST *)
  3483. pbTemp->RB_Buffer)->GetSetCalledId.dwSize;
  3484. if(ERROR_SUCCESS == retcode)
  3485. {
  3486. memcpy(((RAS_CALLEDID_INFO *)pUserBuffer)->bCalledId,
  3487. pCalledId->bCalledId,
  3488. pCalledId->dwSize);
  3489. ((RAS_CALLEDID_INFO *)pUserBuffer)->dwSize =
  3490. pCalledId->dwSize;
  3491. }
  3492. break;
  3493. }
  3494. case REQTYPE_SETCALLEDID:
  3495. {
  3496. retcode = ((REQTYPECAST *)
  3497. pbTemp->RB_Buffer)->GetSetCalledId.retcode;
  3498. break;
  3499. }
  3500. case REQTYPE_ENABLEIPSEC:
  3501. {
  3502. retcode = ((REQTYPECAST *)
  3503. pbTemp->RB_Buffer)->EnableIpSec.retcode;
  3504. break;
  3505. }
  3506. case REQTYPE_ISIPSECENABLED:
  3507. {
  3508. BOOL *pfIsIpSecEnabled = va_arg(ap, BOOL *);
  3509. retcode = ((REQTYPECAST *)
  3510. pbTemp->RB_Buffer)->IsIpSecEnabled.retcode;
  3511. if(ERROR_SUCCESS == retcode)
  3512. {
  3513. *pfIsIpSecEnabled =
  3514. ((REQTYPECAST *)
  3515. pbTemp->RB_Buffer)->IsIpSecEnabled.fIsIpSecEnabled;
  3516. }
  3517. break;
  3518. }
  3519. case REQTYPE_SETEAPLOGONINFO:
  3520. {
  3521. retcode = ((REQTYPECAST *)
  3522. pbTemp->RB_Buffer)->SetEapLogonInfo.retcode;
  3523. break;
  3524. }
  3525. case REQTYPE_SENDNOTIFICATION:
  3526. {
  3527. retcode = ((REQTYPECAST *)
  3528. pbTemp->RB_Buffer)->SendNotification.retcode;
  3529. break;
  3530. }
  3531. case REQTYPE_GETNDISWANDRIVERCAPS:
  3532. {
  3533. RAS_NDISWAN_DRIVER_INFO *pInfo =
  3534. va_arg(ap, RAS_NDISWAN_DRIVER_INFO *);
  3535. retcode = ((REQTYPECAST *)
  3536. pbTemp->RB_Buffer)->GetNdiswanDriverCaps.retcode;
  3537. if(SUCCESS == retcode)
  3538. {
  3539. memcpy(
  3540. (PBYTE) pInfo,
  3541. (PBYTE) &((REQTYPECAST *)
  3542. pbTemp->RB_Buffer)->GetNdiswanDriverCaps.NdiswanDriverInfo,
  3543. sizeof(RAS_NDISWAN_DRIVER_INFO));
  3544. }
  3545. break;
  3546. }
  3547. case REQTYPE_GETBANDWIDTHUTILIZATION:
  3548. {
  3549. RAS_GET_BANDWIDTH_UTILIZATION *pUtilization =
  3550. va_arg(ap, RAS_GET_BANDWIDTH_UTILIZATION *);
  3551. retcode = ((REQTYPECAST *)
  3552. pbTemp->RB_Buffer)->GetBandwidthUtilization.retcode;
  3553. if(SUCCESS == retcode)
  3554. {
  3555. memcpy(
  3556. (PBYTE) pUtilization,
  3557. (PBYTE) &((REQTYPECAST *)
  3558. pbTemp->RB_Buffer)->GetBandwidthUtilization.BandwidthUtilization,
  3559. sizeof(RAS_GET_BANDWIDTH_UTILIZATION));
  3560. }
  3561. break;
  3562. }
  3563. case REQTYPE_REGISTERREDIALCALLBACK:
  3564. {
  3565. retcode = ((REQTYPECAST *)
  3566. pbTemp->RB_Buffer)->RegisterRedialCallback.retcode;
  3567. break;
  3568. }
  3569. case REQTYPE_GETPROTOCOLINFO:
  3570. {
  3571. RASMAN_GET_PROTOCOL_INFO *pInfo =
  3572. va_arg(ap, RASMAN_GET_PROTOCOL_INFO *);
  3573. retcode = ((REQTYPECAST *)
  3574. pbTemp->RB_Buffer)->GetProtocolInfo.retcode;
  3575. if(SUCCESS != retcode)
  3576. {
  3577. break;
  3578. }
  3579. memcpy(pInfo,
  3580. (PBYTE) &((REQTYPECAST *)
  3581. pbTemp->RB_Buffer)->GetProtocolInfo.Info,
  3582. sizeof(RASMAN_GET_PROTOCOL_INFO));
  3583. break;
  3584. }
  3585. case REQTYPE_GETCUSTOMSCRIPTDLL:
  3586. {
  3587. CHAR *pszCustomScriptDll =
  3588. va_arg(ap, CHAR *);
  3589. retcode = ((REQTYPECAST *)
  3590. pbTemp->RB_Buffer)->GetCustomScriptDll.retcode;
  3591. if(ERROR_SUCCESS == retcode)
  3592. {
  3593. (VOID) StringCchCopyA(pszCustomScriptDll,
  3594. MAX_PATH + 1,
  3595. ((REQTYPECAST *)
  3596. pbTemp->RB_Buffer)->GetCustomScriptDll.szCustomScript);
  3597. }
  3598. break;
  3599. }
  3600. case REQTYPE_ISTRUSTEDCUSTOMDLL:
  3601. {
  3602. BOOL *pfTrusted = va_arg( ap, BOOL * );
  3603. retcode = ((REQTYPECAST *)
  3604. pbTemp->RB_Buffer)->IsTrusted.retcode;
  3605. if(SUCCESS == retcode)
  3606. {
  3607. *pfTrusted = ((REQTYPECAST *)
  3608. pbTemp->RB_Buffer)->IsTrusted.fTrusted;
  3609. }
  3610. break;
  3611. }
  3612. case REQTYPE_DOIKE:
  3613. {
  3614. retcode = ((REQTYPECAST *)
  3615. pbTemp->RB_Buffer)->DoIke.retcode;
  3616. break;
  3617. }
  3618. case REQTYPE_QUERYIKESTATUS:
  3619. {
  3620. DWORD * pdwStatus = va_arg(ap, DWORD *);
  3621. retcode = ((REQTYPECAST *)
  3622. pbTemp->RB_Buffer)->QueryIkeStatus.retcode;
  3623. if(SUCCESS == retcode)
  3624. {
  3625. *pdwStatus = ((REQTYPECAST *)
  3626. pbTemp->RB_Buffer)->QueryIkeStatus.dwStatus;
  3627. }
  3628. break;
  3629. }
  3630. case REQTYPE_SETRASCOMMSETTINGS:
  3631. {
  3632. retcode = ((REQTYPECAST *)
  3633. pbTemp->RB_Buffer)->SetRasCommSettings.retcode;
  3634. break;
  3635. }
  3636. case REQTYPE_SETKEY:
  3637. {
  3638. retcode = ((REQTYPECAST *)
  3639. pbTemp->RB_Buffer)->GetSetKey.retcode;
  3640. break;
  3641. }
  3642. case REQTYPE_GETKEY:
  3643. {
  3644. PBYTE pbkey = va_arg(ap, PBYTE);
  3645. retcode = ((REQTYPECAST *)
  3646. pbTemp->RB_Buffer)->GetSetKey.retcode;
  3647. #pragma prefast(suppress:1, "pdwSize initialized in prev. switch statement (PREfast bug 634)")
  3648. *pdwSize = ((REQTYPECAST *)
  3649. pbTemp->RB_Buffer)->GetSetKey.cbkey;
  3650. if(ERROR_SUCCESS == retcode)
  3651. {
  3652. memcpy(pbkey,
  3653. ((REQTYPECAST *)
  3654. pbTemp->RB_Buffer)->GetSetKey.data,
  3655. ((REQTYPECAST *)
  3656. pbTemp->RB_Buffer)->GetSetKey.cbkey);
  3657. }
  3658. break;
  3659. }
  3660. case REQTYPE_ADDRESSDISABLE:
  3661. {
  3662. retcode = ((REQTYPECAST *)
  3663. pbTemp->RB_Buffer)->AddressDisable.retcode;
  3664. break;
  3665. }
  3666. case REQTYPE_SENDCREDS:
  3667. {
  3668. retcode = ((REQTYPECAST *)
  3669. pbTemp->RB_Buffer)->SendCreds.retcode;
  3670. break;
  3671. }
  3672. case REQTYPE_GETUNICODEDEVICENAME:
  3673. {
  3674. WCHAR *pwszDeviceName = va_arg(ap, WCHAR *);
  3675. retcode = ((REQTYPECAST *)
  3676. pbTemp->RB_Buffer)->GetUDeviceName.retcode;
  3677. if(ERROR_SUCCESS == retcode)
  3678. {
  3679. (VOID) StringCchCopyW(pwszDeviceName,
  3680. MAX_DEVICE_NAME + 1,
  3681. ((REQTYPECAST *)
  3682. pbTemp->RB_Buffer)->GetUDeviceName.wszDeviceName);
  3683. }
  3684. break;
  3685. }
  3686. case REQTYPE_GETBESTINTERFACE:
  3687. {
  3688. DWORD *pdwBestIf = va_arg(ap, DWORD *);
  3689. DWORD *pdwMask = va_arg(ap, DWORD *);
  3690. retcode = ((REQTYPECAST *)
  3691. pbTemp->RB_Buffer)->GetBestInterface.retcode;
  3692. if(ERROR_SUCCESS == retcode)
  3693. {
  3694. *pdwBestIf = ((REQTYPECAST *)
  3695. pbTemp->RB_Buffer)->GetBestInterface.BestIf;
  3696. *pdwMask = ((REQTYPECAST *)
  3697. pbTemp->RB_Buffer)->GetBestInterface.Mask;
  3698. }
  3699. break;
  3700. }
  3701. case REQTYPE_ISPULSEDIAL:
  3702. {
  3703. BOOL *pfPulse = va_arg(ap, BOOL *);
  3704. if(NO_ERROR == retcode)
  3705. {
  3706. *pfPulse = ((REQTYPECAST *)
  3707. pbTemp->RB_Buffer)->IsPulseDial.fPulse;
  3708. }
  3709. break;
  3710. }
  3711. case REQTYPE_REQUESTNOTIFICATION:
  3712. case REQTYPE_COMPRESSIONSETINFO:
  3713. case REQTYPE_DEALLOCATEROUTE:
  3714. case REQTYPE_PORTCLEARSTATISTICS:
  3715. case REQTYPE_BUNDLECLEARSTATISTICS:
  3716. case REQTYPE_PORTDISCONNECT:
  3717. case REQTYPE_PORTCLOSE:
  3718. case REQTYPE_SERVERPORTCLOSE:
  3719. case REQTYPE_PORTSETINFO:
  3720. case REQTYPE_PORTSEND:
  3721. case REQTYPE_PORTRECEIVE:
  3722. case REQTYPE_PORTCONNECTCOMPLETE:
  3723. case REQTYPE_DEVICESETINFO:
  3724. case REQTYPE_DEVICECONNECT:
  3725. case REQTYPE_PORTLISTEN:
  3726. case REQTYPE_CANCELRECEIVE:
  3727. case REQTYPE_STOREUSERDATA:
  3728. case REQTYPE_REGISTERSLIP:
  3729. case REQTYPE_SETFRAMING:
  3730. case REQTYPE_SETFRAMINGEX:
  3731. case REQTYPE_SETPROTOCOLCOMPRESSION:
  3732. case REQTYPE_PORTBUNDLE:
  3733. case REQTYPE_SETATTACHCOUNT:
  3734. case REQTYPE_PPPCHANGEPWD:
  3735. case REQTYPE_PPPSTOP:
  3736. case REQTYPE_PPPSTART:
  3737. case REQTYPE_PPPRETRY:
  3738. case REQTYPE_PPPCALLBACK:
  3739. case REQTYPE_SETDEVCONFIG:
  3740. case REQTYPE_CLOSEPROCESSPORTS:
  3741. case REQTYPE_PNPCONTROL:
  3742. case REQTYPE_SETIOCOMPLETIONPORT:
  3743. case REQTYPE_SETROUTERUSAGE:
  3744. case REQTYPE_SENDPPPMESSAGETORASMAN:
  3745. case REQTYPE_SETRASDIALINFO:
  3746. case REQTYPE_REGISTERPNPNOTIF:
  3747. case REQTYPE_SETBAPPOLICY:
  3748. case REQTYPE_PPPSTARTED:
  3749. default:
  3750. {
  3751. retcode = ((REQTYPECAST *)
  3752. pbTemp->RB_Buffer)->Generic.retcode ;
  3753. }
  3754. break ;
  3755. }
  3756. done:
  3757. if ( pBuffer )
  3758. {
  3759. LocalFree ( pBuffer );
  3760. }
  3761. va_end (ap) ;
  3762. FreeRequestBuffer(preqbuf) ;
  3763. return retcode ;
  3764. }