Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1883 lines
57 KiB

  1. /*******************************************************************************
  2. *
  3. * apisub.c
  4. *
  5. * RegApi helpers and convertion routines
  6. *
  7. * Copyright Microsoft Corporation, 1998
  8. *
  9. *
  10. *******************************************************************************/
  11. /*
  12. * Includes
  13. */
  14. #include <windows.h>
  15. #include <stdio.h>
  16. #include <winstaw.h>
  17. #include <regapi.h>
  18. /*
  19. * General purpose UNICODE <==> ANSI functions
  20. */
  21. VOID UnicodeToAnsi( CHAR *, ULONG, WCHAR * );
  22. VOID AnsiToUnicode( WCHAR *, ULONG, CHAR * );
  23. /*
  24. * Reg Create helpers
  25. */
  26. LONG SetNumValue( BOOLEAN, HKEY, LPWSTR, DWORD );
  27. LONG SetNumValueEx( BOOLEAN, HKEY, LPWSTR, DWORD, DWORD );
  28. LONG SetStringValue( BOOLEAN, HKEY, LPWSTR, LPWSTR );
  29. LONG SetStringValueEx( BOOLEAN, HKEY, LPWSTR, DWORD, LPWSTR );
  30. /*
  31. * Reg Query helpers
  32. */
  33. DWORD GetNumValue( HKEY, LPWSTR, DWORD );
  34. DWORD GetNumValueEx( HKEY, LPWSTR, DWORD, DWORD );
  35. LONG GetStringValue( HKEY, LPWSTR, LPWSTR, LPWSTR, DWORD );
  36. LONG GetStringValueEx( HKEY, LPWSTR, DWORD, LPWSTR, LPWSTR, DWORD );
  37. /*
  38. * Pd conversion helpers.
  39. */
  40. VOID PdConfigU2A( PPDCONFIGA, PPDCONFIGW );
  41. VOID PdConfigA2U( PPDCONFIGW, PPDCONFIGA );
  42. VOID PdConfig2U2A( PPDCONFIG2A, PPDCONFIG2W );
  43. VOID PdConfig2A2U( PPDCONFIG2W, PPDCONFIG2A );
  44. VOID PdConfig3U2A( PPDCONFIG3A, PPDCONFIG3W );
  45. VOID PdConfig3A2U( PPDCONFIG3W, PPDCONFIG3A );
  46. VOID PdParamsU2A( PPDPARAMSA, PPDPARAMSW );
  47. VOID PdParamsA2U( PPDPARAMSW, PPDPARAMSA );
  48. VOID AsyncConfigU2A ( PASYNCCONFIGA, PASYNCCONFIGW );
  49. VOID AsyncConfigA2U ( PASYNCCONFIGW, PASYNCCONFIGA );
  50. VOID NetworkConfigU2A ( PNETWORKCONFIGA, PNETWORKCONFIGW );
  51. VOID NetworkConfigA2U ( PNETWORKCONFIGW, PNETWORKCONFIGA );
  52. VOID NasiConfigU2A ( PNASICONFIGA, PNASICONFIGW );
  53. VOID NasiConfigA2U ( PNASICONFIGW, PNASICONFIGA );
  54. VOID OemTdConfigU2A ( POEMTDCONFIGA, POEMTDCONFIGW );
  55. VOID OemTdConfigA2U ( POEMTDCONFIGW, POEMTDCONFIGA );
  56. /*
  57. * WinStation conversion helpers (regapi).
  58. */
  59. VOID WinStationCreateU2A( PWINSTATIONCREATEA, PWINSTATIONCREATEW );
  60. VOID WinStationCreateA2U( PWINSTATIONCREATEW, PWINSTATIONCREATEA );
  61. VOID WinStationConfigU2A( PWINSTATIONCONFIGA, PWINSTATIONCONFIGW );
  62. VOID WinStationConfigA2U( PWINSTATIONCONFIGW, PWINSTATIONCONFIGA );
  63. VOID UserConfigU2A( PUSERCONFIGA, PUSERCONFIGW );
  64. VOID UserConfigA2U( PUSERCONFIGW, PUSERCONFIGA );
  65. /*
  66. * WinStation conversion helpers (winstapi).
  67. */
  68. VOID WinStationPrinterU2A( PWINSTATIONPRINTERA, PWINSTATIONPRINTERW );
  69. VOID WinStationPrinterA2U( PWINSTATIONPRINTERW, PWINSTATIONPRINTERA );
  70. VOID WinStationInformationU2A( PWINSTATIONINFORMATIONA,
  71. PWINSTATIONINFORMATIONW );
  72. VOID WinStationInformationA2U( PWINSTATIONINFORMATIONW,
  73. PWINSTATIONINFORMATIONA );
  74. VOID WinStationClientU2A( PWINSTATIONCLIENTA, PWINSTATIONCLIENTW );
  75. VOID WinStationProductIdU2A( PWINSTATIONPRODIDA, PWINSTATIONPRODIDW );
  76. /*
  77. * Wd conversion helpers.
  78. */
  79. VOID WdConfigU2A( PWDCONFIGA, PWDCONFIGW );
  80. VOID WdConfigA2U( PWDCONFIGW, PWDCONFIGA );
  81. /*
  82. * Cd conversion helpers.
  83. */
  84. VOID CdConfigU2A( PCDCONFIGA, PCDCONFIGW );
  85. VOID CdConfigA2U( PCDCONFIGW, PCDCONFIGA );
  86. /*
  87. * procedures used (not defined here)
  88. */
  89. VOID RtlUnicodeToMultiByteN( LPSTR, ULONG, PULONG, LPWSTR, ULONG );
  90. VOID RtlMultiByteToUnicodeN( LPWSTR, ULONG, PULONG, LPSTR, ULONG );
  91. /*******************************************************************************
  92. *
  93. * UnicodeToAnsi
  94. *
  95. * convert a UNICODE (WCHAR) string into an ANSI (CHAR) string
  96. *
  97. * ENTRY:
  98. *
  99. * pAnsiString (output)
  100. * buffer to place ANSI string into
  101. * lAnsiMax (input)
  102. * maximum number of BYTES to write into pAnsiString (sizeof the
  103. * pAnsiString buffer)
  104. * pUnicodeString (input)
  105. * UNICODE string to convert
  106. *
  107. * EXIT:
  108. * nothing (VOID)
  109. *
  110. ******************************************************************************/
  111. VOID
  112. UnicodeToAnsi( CHAR * pAnsiString,
  113. ULONG lAnsiMax,
  114. WCHAR * pUnicodeString )
  115. {
  116. ULONG ByteCount;
  117. RtlUnicodeToMultiByteN( pAnsiString, lAnsiMax, &ByteCount,
  118. pUnicodeString,
  119. ((wcslen(pUnicodeString) + 1) << 1) );
  120. }
  121. /*******************************************************************************
  122. *
  123. * AnsiToUnicode
  124. *
  125. * convert an ANSI (CHAR) string into a UNICODE (WCHAR) string
  126. *
  127. * ENTRY:
  128. *
  129. * pUnicodeString (output)
  130. * buffer to place UNICODE string into
  131. * lUnicodeMax (input)
  132. * maximum number of BYTES to write into pUnicodeString (sizeof the
  133. * pUnicodeString buffer).
  134. * pAnsiString (input)
  135. * ANSI string to convert
  136. *
  137. * EXIT:
  138. * nothing (VOID)
  139. *
  140. ******************************************************************************/
  141. VOID
  142. AnsiToUnicode( WCHAR * pUnicodeString,
  143. ULONG lUnicodeMax,
  144. CHAR * pAnsiString )
  145. {
  146. ULONG ByteCount;
  147. RtlMultiByteToUnicodeN( pUnicodeString, lUnicodeMax, &ByteCount,
  148. pAnsiString, (strlen(pAnsiString) + 1) );
  149. }
  150. /*******************************************************************************
  151. *
  152. * SetNumValue
  153. *
  154. * Set numeric (DWORD) value in registry
  155. *
  156. * ENTRY:
  157. *
  158. * bSetValue (input)
  159. * TRUE to set value; FALSE to delete from registry
  160. * Handle (input)
  161. * registry handle
  162. * ValueName (input)
  163. * name of registry value to set
  164. * ValueData (input)
  165. * data (DWORD) for registry value to set
  166. *
  167. * EXIT:
  168. * status from RegDeleteValue or RegSetValueEx
  169. *
  170. ******************************************************************************/
  171. LONG
  172. SetNumValue( BOOLEAN bSetValue,
  173. HKEY Handle,
  174. LPWSTR ValueName,
  175. DWORD ValueData )
  176. {
  177. if ( bSetValue )
  178. return( RegSetValueEx( Handle, ValueName, 0, REG_DWORD,
  179. (BYTE *)&ValueData, sizeof(DWORD) ) );
  180. else
  181. return( RegDeleteValue( Handle, ValueName ) );
  182. }
  183. /*******************************************************************************
  184. *
  185. * SetNumValueEx
  186. *
  187. * Set numeric (DWORD) value in registry (for use with arrays)
  188. *
  189. * ENTRY:
  190. *
  191. * bSetValue (input)
  192. * TRUE to set value; FALSE to delete from registry
  193. * Handle (input)
  194. * registry handle
  195. * ValueName (input)
  196. * name of registry value to set
  197. * Index (input)
  198. * Index of value (array index)
  199. * ValueData (input)
  200. * data (DWORD) for registry value to set
  201. *
  202. * EXIT:
  203. * status from SetNumValue
  204. *
  205. ******************************************************************************/
  206. LONG
  207. SetNumValueEx( BOOLEAN bSetValue,
  208. HKEY Handle,
  209. LPWSTR ValueName,
  210. DWORD Index,
  211. DWORD ValueData )
  212. {
  213. WCHAR Name[MAX_REGKEYWORD];
  214. if ( Index > 0 )
  215. swprintf( Name, L"%s%u", ValueName, Index );
  216. else
  217. wcscpy( Name, ValueName );
  218. return( SetNumValue( bSetValue, Handle, Name, ValueData ) );
  219. }
  220. /*******************************************************************************
  221. *
  222. * SetStringValue
  223. *
  224. * Set string value in registry
  225. *
  226. * ENTRY:
  227. *
  228. * bSetValue (input)
  229. * TRUE to set value; FALSE to delete from registry
  230. * Handle (input)
  231. * registry handle
  232. * ValueName (input)
  233. * name of registry value to set
  234. * pValueData (input)
  235. * data (string) for registry value to set
  236. *
  237. * EXIT:
  238. * status from RegDeleteValue or RegSetValueEx
  239. *
  240. ******************************************************************************/
  241. LONG
  242. SetStringValue( BOOLEAN bSetValue,
  243. HKEY Handle,
  244. LPWSTR ValueName,
  245. LPWSTR pValueData )
  246. {
  247. if ( bSetValue )
  248. return( RegSetValueEx( Handle, ValueName, 0, REG_SZ,
  249. (BYTE *)pValueData, (wcslen(pValueData)+1)<<1 ) );
  250. else
  251. return( RegDeleteValue( Handle, ValueName ) );
  252. }
  253. /*******************************************************************************
  254. *
  255. * SetStringValueEx
  256. *
  257. * Set string value in registry (for use with arrays)
  258. *
  259. * ENTRY:
  260. *
  261. * bSetValue (input)
  262. * TRUE to set value; FALSE to delete from registry
  263. * Handle (input)
  264. * registry handle
  265. * ValueName (input)
  266. * name of registry value to set
  267. * Index (input)
  268. * Index of value (array index)
  269. * pValueData (input)
  270. * data (string) for registry value to set
  271. *
  272. * EXIT:
  273. * status from SetStringValue
  274. *
  275. ******************************************************************************/
  276. LONG
  277. SetStringValueEx( BOOLEAN bSetValue,
  278. HKEY Handle,
  279. LPWSTR ValueName,
  280. DWORD Index,
  281. LPWSTR pValueData )
  282. {
  283. WCHAR Name[MAX_REGKEYWORD];
  284. if ( Index > 0 )
  285. swprintf( Name, L"%s%u", ValueName, Index );
  286. else
  287. wcscpy( Name, ValueName );
  288. return( SetStringValue( bSetValue, Handle, Name, pValueData ) );
  289. }
  290. /*******************************************************************************
  291. *
  292. * GetNumValue
  293. *
  294. * get numeric (DWORD) value from registry
  295. *
  296. * ENTRY:
  297. *
  298. * Handle (input)
  299. * registry handle
  300. * ValueName (input)
  301. * name of registry value to query
  302. * DefaultData (input)
  303. * default value to return if registry value name does not exist
  304. *
  305. * EXIT:
  306. * registry value (DWORD)
  307. *
  308. ******************************************************************************/
  309. DWORD
  310. GetNumValue( HKEY Handle,
  311. LPWSTR ValueName,
  312. DWORD DefaultData )
  313. {
  314. LONG Status;
  315. DWORD ValueType;
  316. DWORD ValueData;
  317. DWORD ValueSize = sizeof(DWORD);
  318. Status = RegQueryValueEx( Handle, ValueName, NULL, &ValueType,
  319. (LPBYTE) &ValueData, &ValueSize );
  320. if ( Status != ERROR_SUCCESS )
  321. ValueData = DefaultData;
  322. return( ValueData );
  323. }
  324. /*******************************************************************************
  325. *
  326. * GetNumValueEx
  327. *
  328. * get numeric (DWORD) value from registry (for use with arrays)
  329. *
  330. * ENTRY:
  331. *
  332. * Handle (input)
  333. * registry handle
  334. * ValueName (input)
  335. * name of registry value to query
  336. * Index (input)
  337. * Index of value (array index)
  338. * DefaultData (input)
  339. * default value to return if registry value name does not exist
  340. *
  341. * EXIT:
  342. * registry value (DWORD)
  343. *
  344. ******************************************************************************/
  345. DWORD
  346. GetNumValueEx( HKEY Handle,
  347. LPWSTR ValueName,
  348. DWORD Index,
  349. DWORD DefaultData )
  350. {
  351. WCHAR Name[MAX_REGKEYWORD];
  352. if ( Index > 0 )
  353. swprintf( Name, L"%s%u", ValueName, Index );
  354. else
  355. wcscpy( Name, ValueName );
  356. return( GetNumValue( Handle, Name, DefaultData ) );
  357. }
  358. /*******************************************************************************
  359. *
  360. * GetStringValue
  361. *
  362. * get string value from registry
  363. *
  364. * ENTRY:
  365. *
  366. * Handle (input)
  367. * registry handle
  368. * ValueName (input)
  369. * name of registry value to query
  370. * DefaultData (input)
  371. * default value to return if registry value name does not exist
  372. * pValueData (output)
  373. * pointer to buffer to store returned string
  374. * MaxValueSize (input)
  375. * max length of pValueData buffer
  376. *
  377. * EXIT:
  378. * nothing
  379. *
  380. ******************************************************************************/
  381. LONG
  382. GetStringValue( HKEY Handle,
  383. LPWSTR ValueName,
  384. LPWSTR DefaultData,
  385. LPWSTR pValueData,
  386. DWORD MaxValueSize )
  387. {
  388. LONG Status;
  389. DWORD ValueType;
  390. DWORD ValueSize = MaxValueSize << 1;
  391. Status = RegQueryValueEx( Handle, ValueName, NULL, &ValueType,
  392. (LPBYTE) pValueData, &ValueSize );
  393. if ( Status != ERROR_SUCCESS || ValueSize == sizeof(UNICODE_NULL) ) {
  394. if ( DefaultData )
  395. wcscpy( pValueData, DefaultData );
  396. else
  397. pValueData[0] = 0;
  398. } else {
  399. if ( ValueType != REG_SZ ) {
  400. pValueData[0] = 0;
  401. return( ERROR_INVALID_DATATYPE );
  402. }
  403. }
  404. return( ERROR_SUCCESS );
  405. }
  406. /*******************************************************************************
  407. *
  408. * GetStringValueEx
  409. *
  410. * get string value from registry (for use with arrays)
  411. *
  412. * ENTRY:
  413. *
  414. * Handle (input)
  415. * registry handle
  416. * ValueName (input)
  417. * name of registry value to query
  418. * Index (input)
  419. * Index of value (array index)
  420. * DefaultData (input)
  421. * default value to return if registry value name does not exist
  422. * pValueData (output)
  423. * pointer to buffer to store returned string
  424. * MaxValueSize (input)
  425. * max length of pValueData buffer
  426. *
  427. * EXIT:
  428. * nothing
  429. *
  430. ******************************************************************************/
  431. LONG
  432. GetStringValueEx( HKEY Handle,
  433. LPWSTR ValueName,
  434. DWORD Index,
  435. LPWSTR DefaultData,
  436. LPWSTR pValueData,
  437. DWORD MaxValueSize )
  438. {
  439. WCHAR Name[MAX_REGKEYWORD];
  440. if ( Index > 0 )
  441. swprintf( Name, L"%s%u", ValueName, Index );
  442. else
  443. wcscpy( Name, ValueName );
  444. return( GetStringValue( Handle, Name, DefaultData, pValueData, MaxValueSize ) );
  445. }
  446. /*******************************************************************************
  447. *
  448. * PdConfigU2A (UNICODE to ANSI)
  449. *
  450. * copies PDCONFIGW elements to PDCONFIGA elements
  451. *
  452. * ENTRY:
  453. * pPdConfigA (output)
  454. * points to PDCONFIGA structure to copy to
  455. *
  456. * pPdConfigW (input)
  457. * points to PDCONFIGW structure to copy from
  458. *
  459. * EXIT:
  460. * nothing (VOID)
  461. *
  462. ******************************************************************************/
  463. VOID
  464. PdConfigU2A( PPDCONFIGA pPdConfigA,
  465. PPDCONFIGW pPdConfigW )
  466. {
  467. PdConfig2U2A( &(pPdConfigA->Create), &(pPdConfigW->Create) );
  468. PdParamsU2A( &(pPdConfigA->Params), &(pPdConfigW->Params) );
  469. }
  470. /*******************************************************************************
  471. *
  472. * PdConfigA2U (ANSI to UNICODE)
  473. *
  474. * copies PDCONFIGA elements to PDCONFIGW elements
  475. *
  476. * ENTRY:
  477. * pPdConfigW (output)
  478. * points to PDCONFIGW structure to copy to
  479. *
  480. * pPdConfigA (input)
  481. * points to PDCONFIGA structure to copy from
  482. *
  483. * EXIT:
  484. * nothing (VOID)
  485. *
  486. ******************************************************************************/
  487. VOID
  488. PdConfigA2U( PPDCONFIGW pPdConfigW,
  489. PPDCONFIGA pPdConfigA )
  490. {
  491. PdConfig2A2U( &(pPdConfigW->Create), &(pPdConfigA->Create) );
  492. PdParamsA2U( &(pPdConfigW->Params), &(pPdConfigA->Params) );
  493. }
  494. /*******************************************************************************
  495. *
  496. * PdConfig2U2A (UNICODE to ANSI)
  497. *
  498. * copies PDCONFIG2W elements to PDCONFIG2A elements
  499. *
  500. * ENTRY:
  501. * pPdConfig2A (output)
  502. * points to PDCONFIG2A structure to copy to
  503. *
  504. * pPdConfig2W (input)
  505. * points to PDCONFIG2W structure to copy from
  506. *
  507. * EXIT:
  508. * nothing (VOID)
  509. *
  510. ******************************************************************************/
  511. VOID
  512. PdConfig2U2A( PPDCONFIG2A pPdConfig2A,
  513. PPDCONFIG2W pPdConfig2W )
  514. {
  515. UnicodeToAnsi( pPdConfig2A->PdName,
  516. sizeof(pPdConfig2A->PdName),
  517. pPdConfig2W->PdName );
  518. pPdConfig2A->SdClass = pPdConfig2W->SdClass;
  519. UnicodeToAnsi( pPdConfig2A->PdDLL,
  520. sizeof(pPdConfig2A->PdDLL),
  521. pPdConfig2W->PdDLL );
  522. pPdConfig2A->PdFlag = pPdConfig2W->PdFlag;
  523. pPdConfig2A->OutBufLength = pPdConfig2W->OutBufLength;
  524. pPdConfig2A->OutBufCount = pPdConfig2W->OutBufCount;
  525. pPdConfig2A->OutBufDelay = pPdConfig2W->OutBufDelay;
  526. pPdConfig2A->InteractiveDelay = pPdConfig2W->InteractiveDelay;
  527. pPdConfig2A->PortNumber = pPdConfig2W->PortNumber;
  528. pPdConfig2A->KeepAliveTimeout = pPdConfig2W->KeepAliveTimeout;
  529. }
  530. /*******************************************************************************
  531. *
  532. * PdConfig2A2U (ANSI to UNICODE)
  533. *
  534. * copies PDCONFIG2A elements to PDCONFIG2W elements
  535. *
  536. * ENTRY:
  537. * pPdConfig2W (output)
  538. * points to PDCONFIG2W structure to copy to
  539. *
  540. * pPdConfig2A (input)
  541. * points to PDCONFIG2A structure to copy from
  542. *
  543. * EXIT:
  544. * nothing (VOID)
  545. *
  546. ******************************************************************************/
  547. VOID
  548. PdConfig2A2U( PPDCONFIG2W pPdConfig2W,
  549. PPDCONFIG2A pPdConfig2A )
  550. {
  551. AnsiToUnicode( pPdConfig2W->PdName,
  552. sizeof(pPdConfig2W->PdName),
  553. pPdConfig2A->PdName );
  554. pPdConfig2W->SdClass = pPdConfig2A->SdClass;
  555. AnsiToUnicode( pPdConfig2W->PdDLL,
  556. sizeof(pPdConfig2W->PdDLL),
  557. pPdConfig2A->PdDLL );
  558. pPdConfig2W->PdFlag = pPdConfig2A->PdFlag;
  559. pPdConfig2W->OutBufLength = pPdConfig2A->OutBufLength;
  560. pPdConfig2W->OutBufCount = pPdConfig2A->OutBufCount;
  561. pPdConfig2W->OutBufDelay = pPdConfig2A->OutBufDelay;
  562. pPdConfig2W->InteractiveDelay = pPdConfig2A->InteractiveDelay;
  563. pPdConfig2W->PortNumber = pPdConfig2A->PortNumber;
  564. pPdConfig2W->KeepAliveTimeout = pPdConfig2A->KeepAliveTimeout;
  565. }
  566. /*******************************************************************************
  567. *
  568. * PdConfig3U2A (UNICODE to ANSI)
  569. *
  570. * copies PDCONFIG3W elements to PDCONFIG3A elements
  571. *
  572. * ENTRY:
  573. * pPdConfig3A (output)
  574. * points to PDCONFIG3A structure to copy to
  575. *
  576. * pPdConfig3W (input)
  577. * points to PDCONFIG3W structure to copy from
  578. *
  579. * EXIT:
  580. * nothing (VOID)
  581. *
  582. ******************************************************************************/
  583. VOID
  584. PdConfig3U2A( PPDCONFIG3A pPdConfig3A,
  585. PPDCONFIG3W pPdConfig3W )
  586. {
  587. PdConfig2U2A( &(pPdConfig3A->Data), &(pPdConfig3W->Data) );
  588. UnicodeToAnsi( pPdConfig3A->ServiceName,
  589. sizeof(pPdConfig3A->ServiceName),
  590. pPdConfig3W->ServiceName );
  591. UnicodeToAnsi( pPdConfig3A->ConfigDLL,
  592. sizeof(pPdConfig3A->ConfigDLL),
  593. pPdConfig3W->ConfigDLL );
  594. }
  595. /*******************************************************************************
  596. *
  597. * PdConfig3A2U (ANSI to UNICODE)
  598. *
  599. * copies PDCONFIG3A elements to PDCONFIG3W elements
  600. *
  601. * ENTRY:
  602. * pPdConfig3W (output)
  603. * points to PDCONFIG3W structure to copy to
  604. *
  605. * pPdConfig3A (input)
  606. * points to PDCONFIG3A structure to copy from
  607. *
  608. * EXIT:
  609. * nothing (VOID)
  610. *
  611. ******************************************************************************/
  612. VOID
  613. PdConfig3A2U( PPDCONFIG3W pPdConfig3W,
  614. PPDCONFIG3A pPdConfig3A )
  615. {
  616. PdConfig2A2U( &(pPdConfig3W->Data), &(pPdConfig3A->Data) );
  617. AnsiToUnicode( pPdConfig3W->ServiceName,
  618. sizeof(pPdConfig3W->ServiceName),
  619. pPdConfig3A->ServiceName );
  620. AnsiToUnicode( pPdConfig3W->ConfigDLL,
  621. sizeof(pPdConfig3W->ConfigDLL),
  622. pPdConfig3A->ConfigDLL );
  623. }
  624. /*******************************************************************************
  625. *
  626. * PdParamsU2A (UNICODE to ANSI)
  627. *
  628. * copies PDPARAMSW elements to PDPARAMSA elements
  629. *
  630. * ENTRY:
  631. * pPdParamsA (output)
  632. * points to PDPARAMSA structure to copy to
  633. *
  634. * pPdParamsW (input)
  635. * points to PDPARAMSW structure to copy from
  636. *
  637. * EXIT:
  638. * nothing (VOID)
  639. *
  640. ******************************************************************************/
  641. VOID
  642. PdParamsU2A( PPDPARAMSA pPdParamsA,
  643. PPDPARAMSW pPdParamsW )
  644. {
  645. pPdParamsA->SdClass = pPdParamsW->SdClass;
  646. switch ( pPdParamsW->SdClass ) {
  647. case SdNetwork:
  648. NetworkConfigU2A( &(pPdParamsA->Network), &(pPdParamsW->Network) );
  649. break;
  650. case SdNasi:
  651. NasiConfigU2A( &(pPdParamsA->Nasi), &(pPdParamsW->Nasi) );
  652. break;
  653. case SdAsync:
  654. AsyncConfigU2A( &(pPdParamsA->Async), &(pPdParamsW->Async) );
  655. break;
  656. case SdOemTransport:
  657. OemTdConfigU2A( &(pPdParamsA->OemTd), &(pPdParamsW->OemTd) );
  658. break;
  659. }
  660. }
  661. /*******************************************************************************
  662. *
  663. * PdParamsA2U (ANSI to UNICODE)
  664. *
  665. * copies PDPARAMSA elements to PDPARAMSW elements
  666. *
  667. * ENTRY:
  668. * pPdParamsW (output)
  669. * points to PDPARAMSW structure to copy to
  670. *
  671. * pPdParamsA (input)
  672. * points to PDPARAMSA structure to copy from
  673. *
  674. * EXIT:
  675. * nothing (VOID)
  676. *
  677. ******************************************************************************/
  678. VOID
  679. PdParamsA2U( PPDPARAMSW pPdParamsW,
  680. PPDPARAMSA pPdParamsA )
  681. {
  682. pPdParamsW->SdClass = pPdParamsA->SdClass;
  683. switch ( pPdParamsA->SdClass ) {
  684. case SdNetwork:
  685. NetworkConfigA2U( &(pPdParamsW->Network), &(pPdParamsA->Network) );
  686. break;
  687. case SdNasi:
  688. NasiConfigA2U( &(pPdParamsW->Nasi), &(pPdParamsA->Nasi) );
  689. break;
  690. case SdAsync:
  691. AsyncConfigA2U( &(pPdParamsW->Async), &(pPdParamsA->Async) );
  692. break;
  693. case SdOemTransport:
  694. OemTdConfigA2U( &(pPdParamsW->OemTd), &(pPdParamsA->OemTd) );
  695. break;
  696. }
  697. }
  698. /*******************************************************************************
  699. *
  700. * NetworkConfigU2A (UNICODE to ANSI)
  701. *
  702. * copies NETWORKCONFIGW elements to NETWORKCONFIGA elements
  703. *
  704. * ENTRY:
  705. * pNetworkConfigA (output)
  706. * points to NETWORKCONFIGA structure to copy to
  707. *
  708. * pNetworkConfigW (input)
  709. * points to NETWORKCONFIGW structure to copy from
  710. *
  711. * EXIT:
  712. * nothing (VOID)
  713. *
  714. ******************************************************************************/
  715. VOID
  716. NetworkConfigU2A( PNETWORKCONFIGA pNetworkConfigA,
  717. PNETWORKCONFIGW pNetworkConfigW )
  718. {
  719. pNetworkConfigA->LanAdapter = pNetworkConfigW->LanAdapter;
  720. UnicodeToAnsi( pNetworkConfigA->NetworkName,
  721. sizeof(pNetworkConfigA->NetworkName),
  722. pNetworkConfigW->NetworkName );
  723. pNetworkConfigA->Flags = pNetworkConfigW->Flags;
  724. }
  725. /*******************************************************************************
  726. *
  727. * NetworkConfigA2U (ANSI to UNICODE)
  728. *
  729. * copies NETWORKCONFIGA elements to NETWORKCONFIGW elements
  730. *
  731. * ENTRY:
  732. * pNetworkConfigW (output)
  733. * points to NETWORKCONFIGW structure to copy to
  734. *
  735. * pNetworkConfigW (input)
  736. * points to NETWORKCONFIGA structure to copy from
  737. *
  738. * EXIT:
  739. * nothing (VOID)
  740. *
  741. ******************************************************************************/
  742. VOID
  743. NetworkConfigA2U( PNETWORKCONFIGW pNetworkConfigW,
  744. PNETWORKCONFIGA pNetworkConfigA )
  745. {
  746. pNetworkConfigW->LanAdapter = pNetworkConfigA->LanAdapter;
  747. AnsiToUnicode( pNetworkConfigW->NetworkName,
  748. sizeof(pNetworkConfigW->NetworkName),
  749. pNetworkConfigA->NetworkName );
  750. pNetworkConfigW->Flags = pNetworkConfigA->Flags;
  751. }
  752. /*******************************************************************************
  753. *
  754. * AsyncConfigU2A (UNICODE to ANSI)
  755. *
  756. * copies ASYNCCONFIGW elements to ASYNCCONFIGA elements
  757. *
  758. * ENTRY:
  759. * pAsyncConfigA (output)
  760. * points to ASYNCCONFIGA structure to copy to
  761. *
  762. * pAsyncConfigW (input)
  763. * points to ASYNCCONFIGW structure to copy from
  764. *
  765. * EXIT:
  766. * nothing (VOID)
  767. *
  768. ******************************************************************************/
  769. VOID
  770. AsyncConfigU2A( PASYNCCONFIGA pAsyncConfigA,
  771. PASYNCCONFIGW pAsyncConfigW )
  772. {
  773. UnicodeToAnsi( pAsyncConfigA->DeviceName,
  774. sizeof(pAsyncConfigA->DeviceName),
  775. pAsyncConfigW->DeviceName );
  776. UnicodeToAnsi( pAsyncConfigA->ModemName,
  777. sizeof(pAsyncConfigA->ModemName),
  778. pAsyncConfigW->ModemName );
  779. pAsyncConfigA->BaudRate = pAsyncConfigW->BaudRate;
  780. pAsyncConfigA->Parity = pAsyncConfigW->Parity;
  781. pAsyncConfigA->StopBits = pAsyncConfigW->StopBits;
  782. pAsyncConfigA->ByteSize = pAsyncConfigW->ByteSize;
  783. pAsyncConfigA->fEnableDsrSensitivity = pAsyncConfigW->fEnableDsrSensitivity;
  784. pAsyncConfigA->fConnectionDriver = pAsyncConfigW->fConnectionDriver;
  785. pAsyncConfigA->FlowControl = pAsyncConfigW->FlowControl;
  786. pAsyncConfigA->Connect = pAsyncConfigW->Connect;
  787. }
  788. /*******************************************************************************
  789. *
  790. * AsyncConfigA2U (ANSI to UNICODE)
  791. *
  792. * copies ASYNCCONFIGA elements to ASYNCCONFIGW elements
  793. *
  794. * ENTRY:
  795. * pAsyncConfigW (output)
  796. * points to ASYNCCONFIGW structure to copy to
  797. *
  798. * pAsyncConfigA (input)
  799. * points to ASYNCCONFIGA structure to copy from
  800. *
  801. * EXIT:
  802. * nothing (VOID)
  803. *
  804. ******************************************************************************/
  805. VOID
  806. AsyncConfigA2U( PASYNCCONFIGW pAsyncConfigW,
  807. PASYNCCONFIGA pAsyncConfigA )
  808. {
  809. AnsiToUnicode( pAsyncConfigW->DeviceName,
  810. sizeof(pAsyncConfigW->DeviceName),
  811. pAsyncConfigA->DeviceName );
  812. AnsiToUnicode( pAsyncConfigW->ModemName,
  813. sizeof(pAsyncConfigW->ModemName),
  814. pAsyncConfigA->ModemName );
  815. pAsyncConfigW->BaudRate = pAsyncConfigA->BaudRate;
  816. pAsyncConfigW->Parity = pAsyncConfigA->Parity;
  817. pAsyncConfigW->StopBits = pAsyncConfigA->StopBits;
  818. pAsyncConfigW->ByteSize = pAsyncConfigA->ByteSize;
  819. pAsyncConfigW->fEnableDsrSensitivity = pAsyncConfigA->fEnableDsrSensitivity;
  820. pAsyncConfigW->FlowControl = pAsyncConfigA->FlowControl;
  821. pAsyncConfigW->Connect = pAsyncConfigA->Connect;
  822. }
  823. /*******************************************************************************
  824. *
  825. * NasiConfigU2A (UNICODE to ANSI)
  826. *
  827. * copies NASICONFIGW elements to NASICONFIGA elements
  828. *
  829. * ENTRY:
  830. * pNasiConfigA (output)
  831. * points to NASICONFIGA structure to copy to
  832. *
  833. * pNasiConfigW (input)
  834. * points to NASICONFIGW structure to copy from
  835. *
  836. * EXIT:
  837. * nothing (VOID)
  838. *
  839. ******************************************************************************/
  840. VOID
  841. NasiConfigU2A( PNASICONFIGA pNasiConfigA,
  842. PNASICONFIGW pNasiConfigW )
  843. {
  844. UnicodeToAnsi( pNasiConfigA->SpecificName,
  845. sizeof(pNasiConfigA->SpecificName),
  846. pNasiConfigW->SpecificName );
  847. UnicodeToAnsi( pNasiConfigA->UserName,
  848. sizeof(pNasiConfigA->UserName),
  849. pNasiConfigW->UserName );
  850. UnicodeToAnsi( pNasiConfigA->PassWord,
  851. sizeof(pNasiConfigA->PassWord),
  852. pNasiConfigW->PassWord );
  853. UnicodeToAnsi( pNasiConfigA->SessionName,
  854. sizeof(pNasiConfigA->SessionName),
  855. pNasiConfigW->SessionName );
  856. UnicodeToAnsi( pNasiConfigA->FileServer,
  857. sizeof(pNasiConfigA->FileServer),
  858. pNasiConfigW->FileServer );
  859. pNasiConfigA->GlobalSession = pNasiConfigW->GlobalSession;
  860. }
  861. /*******************************************************************************
  862. *
  863. * NasiConfigA2U (ANSI to UNICODE)
  864. *
  865. * copies NASICONFIGA elements to NASICONFIGW elements
  866. *
  867. * ENTRY:
  868. * pNasiConfigW (output)
  869. * points to NASICONFIGW structure to copy to
  870. *
  871. * pNasiConfigA (input)
  872. * points to NASICONFIGA structure to copy from
  873. *
  874. * EXIT:
  875. * nothing (VOID)
  876. *
  877. ******************************************************************************/
  878. VOID
  879. NasiConfigA2U( PNASICONFIGW pNasiConfigW,
  880. PNASICONFIGA pNasiConfigA )
  881. {
  882. AnsiToUnicode( pNasiConfigW->SpecificName,
  883. sizeof(pNasiConfigW->SpecificName),
  884. pNasiConfigA->SpecificName );
  885. AnsiToUnicode( pNasiConfigW->UserName,
  886. sizeof(pNasiConfigW->UserName),
  887. pNasiConfigA->UserName );
  888. AnsiToUnicode( pNasiConfigW->PassWord,
  889. sizeof(pNasiConfigW->PassWord),
  890. pNasiConfigA->PassWord );
  891. AnsiToUnicode( pNasiConfigW->SessionName,
  892. sizeof(pNasiConfigW->SessionName),
  893. pNasiConfigA->SessionName );
  894. AnsiToUnicode( pNasiConfigW->FileServer,
  895. sizeof(pNasiConfigW->FileServer),
  896. pNasiConfigA->FileServer );
  897. pNasiConfigW->GlobalSession = pNasiConfigA->GlobalSession;
  898. }
  899. /*******************************************************************************
  900. *
  901. * OemTdConfigU2A (UNICODE to ANSI)
  902. *
  903. * copies OEMTDCONFIGW elements to OEMTDCONFIGA elements
  904. *
  905. * ENTRY:
  906. * pOemTdConfigA (output)
  907. * points to OEMTDCONFIGA structure to copy to
  908. *
  909. * pOemTdConfigW (input)
  910. * points to OEMTDCONFIGW structure to copy from
  911. *
  912. * EXIT:
  913. * nothing (VOID)
  914. *
  915. ******************************************************************************/
  916. VOID
  917. OemTdConfigU2A( POEMTDCONFIGA pOemTdConfigA,
  918. POEMTDCONFIGW pOemTdConfigW )
  919. {
  920. pOemTdConfigA->Adapter = pOemTdConfigW->Adapter;
  921. UnicodeToAnsi( pOemTdConfigA->DeviceName,
  922. sizeof(pOemTdConfigA->DeviceName),
  923. pOemTdConfigW->DeviceName );
  924. pOemTdConfigA->Flags = pOemTdConfigW->Flags;
  925. }
  926. /*******************************************************************************
  927. *
  928. * OemTdConfigA2U (ANSI to Unicode)
  929. *
  930. * copies OEMTDCONFIGA elements to OEMTDCONFIGW elements
  931. *
  932. * ENTRY:
  933. * pOemTdConfigW (output)
  934. * points to OEMTDCONFIGW structure to copy to
  935. *
  936. * pOemTdConfigA (input)
  937. * points to OEMTDCONFIGA structure to copy from
  938. *
  939. * EXIT:
  940. * nothing (VOID)
  941. *
  942. ******************************************************************************/
  943. VOID
  944. OemTdConfigA2U( POEMTDCONFIGW pOemTdConfigW,
  945. POEMTDCONFIGA pOemTdConfigA )
  946. {
  947. pOemTdConfigW->Adapter = pOemTdConfigA->Adapter;
  948. AnsiToUnicode( pOemTdConfigW->DeviceName,
  949. sizeof(pOemTdConfigW->DeviceName),
  950. pOemTdConfigA->DeviceName );
  951. pOemTdConfigW->Flags = pOemTdConfigA->Flags;
  952. }
  953. /*******************************************************************************
  954. *
  955. * WdConfigU2A (UNICODE to ANSI)
  956. *
  957. * copies WDCONFIGW elements to WDCONFIGA elements
  958. *
  959. * ENTRY:
  960. * pWdConfigA (output)
  961. * points to WDCONFIGA structure to copy to
  962. *
  963. * pWdConfigW (input)
  964. * points to WDCONFIGW structure to copy from
  965. *
  966. * EXIT:
  967. * nothing (VOID)
  968. *
  969. ******************************************************************************/
  970. VOID
  971. WdConfigU2A( PWDCONFIGA pWdConfigA,
  972. PWDCONFIGW pWdConfigW )
  973. {
  974. UnicodeToAnsi( pWdConfigA->WdName,
  975. sizeof(pWdConfigA->WdName),
  976. pWdConfigW->WdName );
  977. UnicodeToAnsi( pWdConfigA->WdDLL,
  978. sizeof(pWdConfigA->WdDLL),
  979. pWdConfigW->WdDLL );
  980. UnicodeToAnsi( pWdConfigA->WsxDLL,
  981. sizeof(pWdConfigA->WsxDLL),
  982. pWdConfigW->WsxDLL );
  983. pWdConfigA->WdFlag = pWdConfigW->WdFlag;
  984. pWdConfigA->WdInputBufferLength = pWdConfigW->WdInputBufferLength;
  985. UnicodeToAnsi( pWdConfigA->CfgDLL,
  986. sizeof(pWdConfigA->CfgDLL),
  987. pWdConfigW->CfgDLL );
  988. UnicodeToAnsi( pWdConfigA->WdPrefix,
  989. sizeof(pWdConfigA->WdPrefix),
  990. pWdConfigW->WdPrefix );
  991. }
  992. /*******************************************************************************
  993. *
  994. * WdConfigA2U (ANSI to UNICODE)
  995. *
  996. * copies WDCONFIGA elements to WDCONFIGW elements
  997. *
  998. * ENTRY:
  999. * pWdConfigW (output)
  1000. * points to WDCONFIGW structure to copy to
  1001. *
  1002. * pWdConfigA (input)
  1003. * points to WDCONFIGA structure to copy from
  1004. *
  1005. * EXIT:
  1006. * nothing (VOID)
  1007. *
  1008. ******************************************************************************/
  1009. VOID
  1010. WdConfigA2U( PWDCONFIGW pWdConfigW,
  1011. PWDCONFIGA pWdConfigA )
  1012. {
  1013. AnsiToUnicode( pWdConfigW->WdName,
  1014. sizeof(pWdConfigW->WdName),
  1015. pWdConfigA->WdName );
  1016. AnsiToUnicode( pWdConfigW->WdDLL,
  1017. sizeof(pWdConfigW->WdDLL),
  1018. pWdConfigA->WdDLL );
  1019. AnsiToUnicode( pWdConfigW->WsxDLL,
  1020. sizeof(pWdConfigW->WsxDLL),
  1021. pWdConfigA->WsxDLL );
  1022. pWdConfigW->WdFlag = pWdConfigA->WdFlag;
  1023. pWdConfigW->WdInputBufferLength = pWdConfigA->WdInputBufferLength;
  1024. AnsiToUnicode( pWdConfigW->CfgDLL,
  1025. sizeof(pWdConfigW->CfgDLL),
  1026. pWdConfigA->CfgDLL );
  1027. AnsiToUnicode( pWdConfigW->WdPrefix,
  1028. sizeof(pWdConfigW->WdPrefix),
  1029. pWdConfigA->WdPrefix );
  1030. }
  1031. /*******************************************************************************
  1032. *
  1033. * CdConfigU2A (UNICODE to ANSI)
  1034. *
  1035. * copies CDCONFIGW elements to CDCONFIGA elements
  1036. *
  1037. * ENTRY:
  1038. * pCdConfigA (output)
  1039. * points to CDCONFIGA structure to copy to
  1040. *
  1041. * pCdConfigW (input)
  1042. * points to CDCONFIGW structure to copy from
  1043. *
  1044. * EXIT:
  1045. * nothing (VOID)
  1046. *
  1047. ******************************************************************************/
  1048. VOID
  1049. CdConfigU2A( PCDCONFIGA pCdConfigA,
  1050. PCDCONFIGW pCdConfigW )
  1051. {
  1052. pCdConfigA->CdClass = pCdConfigW->CdClass;
  1053. UnicodeToAnsi( pCdConfigA->CdName,
  1054. sizeof(pCdConfigA->CdName),
  1055. pCdConfigW->CdName );
  1056. UnicodeToAnsi( pCdConfigA->CdDLL,
  1057. sizeof(pCdConfigA->CdDLL),
  1058. pCdConfigW->CdDLL );
  1059. pCdConfigA->CdFlag = pCdConfigW->CdFlag;
  1060. }
  1061. /*******************************************************************************
  1062. *
  1063. * CdConfigA2U (ANSI to UNICODE)
  1064. *
  1065. * copies CDCONFIGA elements to CDCONFIGW elements
  1066. *
  1067. * ENTRY:
  1068. * pCdConfigW (output)
  1069. * points to CDCONFIGW structure to copy to
  1070. *
  1071. * pCdConfigA (input)
  1072. * points to CDCONFIGA structure to copy from
  1073. *
  1074. * EXIT:
  1075. * nothing (VOID)
  1076. *
  1077. ******************************************************************************/
  1078. VOID
  1079. CdConfigA2U( PCDCONFIGW pCdConfigW,
  1080. PCDCONFIGA pCdConfigA )
  1081. {
  1082. pCdConfigW->CdClass = pCdConfigA->CdClass;
  1083. AnsiToUnicode( pCdConfigW->CdName,
  1084. sizeof(pCdConfigW->CdName),
  1085. pCdConfigA->CdName );
  1086. AnsiToUnicode( pCdConfigW->CdDLL,
  1087. sizeof(pCdConfigW->CdDLL),
  1088. pCdConfigA->CdDLL );
  1089. pCdConfigW->CdFlag = pCdConfigA->CdFlag;
  1090. }
  1091. /*******************************************************************************
  1092. *
  1093. * WinStationCreateU2A (UNICODE to ANSI)
  1094. *
  1095. * copies WINSTATIONCREATEW elements to WINSTATIONCREATEA elements
  1096. *
  1097. * ENTRY:
  1098. * pWinStationCreateA (output)
  1099. * points to WINSTATIONCREATEA structure to copy to
  1100. *
  1101. * pWinStationCreateW (input)
  1102. * points to WINSTATIONCREATEW structure to copy from
  1103. *
  1104. * EXIT:
  1105. * nothing (VOID)
  1106. *
  1107. ******************************************************************************/
  1108. VOID
  1109. WinStationCreateU2A( PWINSTATIONCREATEA pWinStationCreateA,
  1110. PWINSTATIONCREATEW pWinStationCreateW )
  1111. {
  1112. pWinStationCreateA->fEnableWinStation = pWinStationCreateW->fEnableWinStation;
  1113. pWinStationCreateA->MaxInstanceCount = pWinStationCreateW->MaxInstanceCount;
  1114. }
  1115. /*******************************************************************************
  1116. *
  1117. * WinStationCreateA2U (ANSI to UNICODE)
  1118. *
  1119. * copies WINSTATIONCREATEA elements to WINSTATIONCREATEW elements
  1120. *
  1121. * ENTRY:
  1122. * pWinStationCreateW (output)
  1123. * points to WINSTATIONCREATEW structure to copy to
  1124. *
  1125. * pWinStationCreateA (input)
  1126. * points to WINSTATIONCREATEA structure to copy from
  1127. *
  1128. * EXIT:
  1129. * nothing (VOID)
  1130. *
  1131. ******************************************************************************/
  1132. VOID
  1133. WinStationCreateA2U( PWINSTATIONCREATEW pWinStationCreateW,
  1134. PWINSTATIONCREATEA pWinStationCreateA )
  1135. {
  1136. pWinStationCreateW->fEnableWinStation = pWinStationCreateA->fEnableWinStation;
  1137. pWinStationCreateW->MaxInstanceCount = pWinStationCreateA->MaxInstanceCount;
  1138. }
  1139. /*******************************************************************************
  1140. *
  1141. * WinStationConfigU2A (UNICODE to ANSI)
  1142. *
  1143. * copies WINSTATIONCONFIGW elements to WINSTATIONCONFIGA elements
  1144. *
  1145. * ENTRY:
  1146. * pWinStationConfigA (output)
  1147. * points to WINSTATIONCONFIGA structure to copy to
  1148. *
  1149. * pWinStationConfigW (input)
  1150. * points to WINSTATIONCONFIGW structure to copy from
  1151. *
  1152. * EXIT:
  1153. * nothing (VOID)
  1154. *
  1155. ******************************************************************************/
  1156. VOID
  1157. WinStationConfigU2A( PWINSTATIONCONFIGA pWinStationConfigA,
  1158. PWINSTATIONCONFIGW pWinStationConfigW )
  1159. {
  1160. UnicodeToAnsi( pWinStationConfigA->Comment,
  1161. sizeof(pWinStationConfigA->Comment),
  1162. pWinStationConfigW->Comment );
  1163. UserConfigU2A( &(pWinStationConfigA->User),
  1164. &(pWinStationConfigW->User) );
  1165. RtlCopyMemory( pWinStationConfigA->OEMId,
  1166. pWinStationConfigW->OEMId,
  1167. sizeof(pWinStationConfigW->OEMId) );
  1168. }
  1169. /*******************************************************************************
  1170. *
  1171. * WinStationConfigA2U (ANSI to UNICODE)
  1172. *
  1173. * copies WINSTATIONCONFIGA elements to WINSTATIONCONFIGW elements
  1174. *
  1175. * ENTRY:
  1176. * pWinStationConfigW (output)
  1177. * points to WINSTATIONCONFIGW structure to copy to
  1178. *
  1179. * pWinStationConfigA (input)
  1180. * points to WINSTATIONCONFIGA structure to copy from
  1181. *
  1182. * EXIT:
  1183. * nothing (VOID)
  1184. *
  1185. ******************************************************************************/
  1186. VOID
  1187. WinStationConfigA2U( PWINSTATIONCONFIGW pWinStationConfigW,
  1188. PWINSTATIONCONFIGA pWinStationConfigA )
  1189. {
  1190. AnsiToUnicode( pWinStationConfigW->Comment,
  1191. sizeof(pWinStationConfigW->Comment),
  1192. pWinStationConfigA->Comment );
  1193. UserConfigA2U( &(pWinStationConfigW->User),
  1194. &(pWinStationConfigA->User) );
  1195. RtlCopyMemory( pWinStationConfigW->OEMId,
  1196. pWinStationConfigA->OEMId,
  1197. sizeof(pWinStationConfigA->OEMId) );
  1198. }
  1199. /*******************************************************************************
  1200. *
  1201. * UserConfigU2A (UNICODE to ANSI)
  1202. *
  1203. * copies USERCONFIGW elements to USERCONFIGA elements
  1204. *
  1205. * ENTRY:
  1206. * pUserConfigA (output)
  1207. * points to USERCONFIGA structure to copy to
  1208. *
  1209. * pUserConfigW (input)
  1210. * points to USERCONFIGW structure to copy from
  1211. *
  1212. * EXIT:
  1213. * nothing (VOID)
  1214. *
  1215. ******************************************************************************/
  1216. VOID
  1217. UserConfigU2A( PUSERCONFIGA pUserConfigA,
  1218. PUSERCONFIGW pUserConfigW )
  1219. {
  1220. pUserConfigA->fInheritAutoLogon = pUserConfigW->fInheritAutoLogon;
  1221. pUserConfigA->fInheritResetBroken = pUserConfigW->fInheritResetBroken;
  1222. pUserConfigA->fInheritReconnectSame = pUserConfigW->fInheritReconnectSame;
  1223. pUserConfigA->fInheritInitialProgram = pUserConfigW->fInheritInitialProgram;
  1224. pUserConfigA->fInheritCallback = pUserConfigW->fInheritCallback;
  1225. pUserConfigA->fInheritCallbackNumber = pUserConfigW->fInheritCallbackNumber;
  1226. pUserConfigA->fInheritShadow = pUserConfigW->fInheritShadow;
  1227. pUserConfigA->fInheritMaxSessionTime = pUserConfigW->fInheritMaxSessionTime;
  1228. pUserConfigA->fInheritMaxDisconnectionTime = pUserConfigW->fInheritMaxDisconnectionTime;
  1229. pUserConfigA->fInheritMaxIdleTime = pUserConfigW->fInheritMaxIdleTime;
  1230. pUserConfigA->fInheritAutoClient = pUserConfigW->fInheritAutoClient;
  1231. pUserConfigA->fInheritSecurity = pUserConfigW->fInheritSecurity;
  1232. pUserConfigA->fPromptForPassword = pUserConfigW->fPromptForPassword;
  1233. pUserConfigA->fResetBroken = pUserConfigW->fResetBroken;
  1234. pUserConfigA->fReconnectSame = pUserConfigW->fReconnectSame;
  1235. pUserConfigA->fLogonDisabled = pUserConfigW->fLogonDisabled;
  1236. pUserConfigA->fWallPaperDisabled = pUserConfigW->fWallPaperDisabled;
  1237. pUserConfigA->fAutoClientDrives = pUserConfigW->fAutoClientDrives;
  1238. pUserConfigA->fAutoClientLpts = pUserConfigW->fAutoClientLpts;
  1239. pUserConfigA->fForceClientLptDef = pUserConfigW->fForceClientLptDef;
  1240. pUserConfigA->fDisableEncryption = pUserConfigW->fDisableEncryption;
  1241. pUserConfigA->fHomeDirectoryMapRoot = pUserConfigW->fHomeDirectoryMapRoot;
  1242. pUserConfigA->fUseDefaultGina = pUserConfigW->fUseDefaultGina;
  1243. pUserConfigA->fDisableCpm = pUserConfigW->fDisableCpm;
  1244. pUserConfigA->fDisableCdm = pUserConfigW->fDisableCdm;
  1245. pUserConfigA->fDisableCcm = pUserConfigW->fDisableCcm;
  1246. pUserConfigA->fDisableLPT = pUserConfigW->fDisableLPT;
  1247. pUserConfigA->fDisableClip = pUserConfigW->fDisableClip;
  1248. pUserConfigA->fDisableExe = pUserConfigW->fDisableExe;
  1249. pUserConfigA->fDisableCam = pUserConfigW->fDisableCam;
  1250. UnicodeToAnsi( pUserConfigA->UserName,
  1251. sizeof(pUserConfigA->UserName),
  1252. pUserConfigW->UserName );
  1253. UnicodeToAnsi( pUserConfigA->Domain,
  1254. sizeof(pUserConfigA->Domain),
  1255. pUserConfigW->Domain );
  1256. UnicodeToAnsi( pUserConfigA->Password,
  1257. sizeof(pUserConfigA->Password),
  1258. pUserConfigW->Password );
  1259. UnicodeToAnsi( pUserConfigA->WorkDirectory,
  1260. sizeof(pUserConfigA->WorkDirectory),
  1261. pUserConfigW->WorkDirectory );
  1262. UnicodeToAnsi( pUserConfigA->InitialProgram,
  1263. sizeof(pUserConfigA->InitialProgram),
  1264. pUserConfigW->InitialProgram );
  1265. UnicodeToAnsi( pUserConfigA->CallbackNumber,
  1266. sizeof(pUserConfigA->CallbackNumber),
  1267. pUserConfigW->CallbackNumber );
  1268. pUserConfigA->Callback = pUserConfigW->Callback;
  1269. pUserConfigA->Shadow = pUserConfigW->Shadow;
  1270. pUserConfigA->MaxConnectionTime = pUserConfigW->MaxConnectionTime;
  1271. pUserConfigA->MaxDisconnectionTime = pUserConfigW->MaxDisconnectionTime;
  1272. pUserConfigA->MaxIdleTime = pUserConfigW->MaxIdleTime;
  1273. pUserConfigA->KeyboardLayout = pUserConfigW->KeyboardLayout;
  1274. pUserConfigA->MinEncryptionLevel = pUserConfigW->MinEncryptionLevel;
  1275. UnicodeToAnsi( pUserConfigA->WFProfilePath,
  1276. sizeof(pUserConfigA->WFProfilePath),
  1277. pUserConfigW->WFProfilePath );
  1278. UnicodeToAnsi( pUserConfigA->WFHomeDir,
  1279. sizeof(pUserConfigA->WFHomeDir),
  1280. pUserConfigW->WFHomeDir );
  1281. UnicodeToAnsi( pUserConfigA->WFHomeDirDrive,
  1282. sizeof(pUserConfigA->WFHomeDirDrive),
  1283. pUserConfigW->WFHomeDirDrive );
  1284. }
  1285. /*******************************************************************************
  1286. *
  1287. * UserConfigA2U (ANSI to UNICODE)
  1288. *
  1289. * copies USERCONFIGA elements to USERCONFIGW elements
  1290. *
  1291. * ENTRY:
  1292. * pUserConfigW (output)
  1293. * points to USERCONFIGW structure to copy to
  1294. *
  1295. * pUserConfigA (input)
  1296. * points to USERCONFIGA structure to copy from
  1297. *
  1298. * EXIT:
  1299. * nothing (VOID)
  1300. *
  1301. ******************************************************************************/
  1302. VOID
  1303. UserConfigA2U( PUSERCONFIGW pUserConfigW,
  1304. PUSERCONFIGA pUserConfigA )
  1305. {
  1306. pUserConfigW->fInheritAutoLogon = pUserConfigA->fInheritAutoLogon;
  1307. pUserConfigW->fInheritResetBroken = pUserConfigA->fInheritResetBroken;
  1308. pUserConfigW->fInheritReconnectSame = pUserConfigA->fInheritReconnectSame;
  1309. pUserConfigW->fInheritInitialProgram = pUserConfigA->fInheritInitialProgram;
  1310. pUserConfigW->fInheritCallback = pUserConfigA->fInheritCallback;
  1311. pUserConfigW->fInheritCallbackNumber = pUserConfigA->fInheritCallbackNumber;
  1312. pUserConfigW->fInheritShadow = pUserConfigA->fInheritShadow;
  1313. pUserConfigW->fInheritMaxSessionTime = pUserConfigA->fInheritMaxSessionTime;
  1314. pUserConfigW->fInheritMaxDisconnectionTime = pUserConfigA->fInheritMaxDisconnectionTime;
  1315. pUserConfigW->fInheritMaxIdleTime = pUserConfigA->fInheritMaxIdleTime;
  1316. pUserConfigW->fInheritAutoClient = pUserConfigA->fInheritAutoClient;
  1317. pUserConfigW->fInheritSecurity = pUserConfigA->fInheritSecurity;
  1318. pUserConfigW->fPromptForPassword = pUserConfigA->fPromptForPassword;
  1319. pUserConfigW->fResetBroken = pUserConfigA->fResetBroken;
  1320. pUserConfigW->fReconnectSame = pUserConfigA->fReconnectSame;
  1321. pUserConfigW->fLogonDisabled = pUserConfigA->fLogonDisabled;
  1322. pUserConfigW->fWallPaperDisabled = pUserConfigA->fWallPaperDisabled;
  1323. pUserConfigW->fAutoClientDrives = pUserConfigA->fAutoClientDrives;
  1324. pUserConfigW->fAutoClientLpts = pUserConfigA->fAutoClientLpts;
  1325. pUserConfigW->fForceClientLptDef = pUserConfigA->fForceClientLptDef;
  1326. pUserConfigW->fDisableEncryption = pUserConfigA->fDisableEncryption;
  1327. pUserConfigW->fHomeDirectoryMapRoot = pUserConfigA->fHomeDirectoryMapRoot;
  1328. pUserConfigW->fUseDefaultGina = pUserConfigA->fUseDefaultGina;
  1329. pUserConfigW->fDisableCpm = pUserConfigA->fDisableCpm;
  1330. pUserConfigW->fDisableCdm = pUserConfigA->fDisableCdm;
  1331. pUserConfigW->fDisableCcm = pUserConfigA->fDisableCcm;
  1332. pUserConfigW->fDisableLPT = pUserConfigA->fDisableLPT;
  1333. pUserConfigW->fDisableClip = pUserConfigA->fDisableClip;
  1334. pUserConfigW->fDisableExe = pUserConfigA->fDisableExe;
  1335. pUserConfigW->fDisableCam = pUserConfigA->fDisableCam;
  1336. AnsiToUnicode( pUserConfigW->UserName,
  1337. sizeof(pUserConfigW->UserName),
  1338. pUserConfigA->UserName );
  1339. AnsiToUnicode( pUserConfigW->Domain,
  1340. sizeof(pUserConfigW->Domain),
  1341. pUserConfigA->Domain );
  1342. AnsiToUnicode( pUserConfigW->Password,
  1343. sizeof(pUserConfigW->Password),
  1344. pUserConfigA->Password );
  1345. AnsiToUnicode( pUserConfigW->WorkDirectory,
  1346. sizeof(pUserConfigW->WorkDirectory),
  1347. pUserConfigA->WorkDirectory );
  1348. AnsiToUnicode( pUserConfigW->InitialProgram,
  1349. sizeof(pUserConfigW->InitialProgram),
  1350. pUserConfigA->InitialProgram );
  1351. AnsiToUnicode( pUserConfigW->CallbackNumber,
  1352. sizeof(pUserConfigW->CallbackNumber),
  1353. pUserConfigA->CallbackNumber );
  1354. pUserConfigW->Callback = pUserConfigA->Callback;
  1355. pUserConfigW->Shadow = pUserConfigA->Shadow;
  1356. pUserConfigW->MaxConnectionTime = pUserConfigA->MaxConnectionTime;
  1357. pUserConfigW->MaxDisconnectionTime = pUserConfigA->MaxDisconnectionTime;
  1358. pUserConfigW->MaxIdleTime = pUserConfigA->MaxIdleTime;
  1359. pUserConfigW->KeyboardLayout = pUserConfigA->KeyboardLayout;
  1360. pUserConfigW->MinEncryptionLevel = pUserConfigA->MinEncryptionLevel;
  1361. AnsiToUnicode( pUserConfigW->WFProfilePath,
  1362. sizeof(pUserConfigW->WFProfilePath),
  1363. pUserConfigA->WFProfilePath );
  1364. AnsiToUnicode( pUserConfigW->WFHomeDir,
  1365. sizeof(pUserConfigW->WFHomeDir),
  1366. pUserConfigA->WFHomeDir );
  1367. AnsiToUnicode( pUserConfigW->WFHomeDirDrive,
  1368. sizeof(pUserConfigW->WFHomeDirDrive),
  1369. pUserConfigA->WFHomeDirDrive );
  1370. }
  1371. /*******************************************************************************
  1372. *
  1373. * WinStationPrinterU2A (UNICODE to ANSI)
  1374. *
  1375. * copies WINSTATIONPRINTERW elements to WINSTATIONPRINTERA elements
  1376. *
  1377. * ENTRY:
  1378. * pWinStationPrinterA (output)
  1379. * points to WINSTATIONPRINTERA structure to copy to
  1380. *
  1381. * pWinStationPrinterW (input)
  1382. * points to WINSTATIONPRINTERW structure to copy from
  1383. *
  1384. * EXIT:
  1385. * nothing (VOID)
  1386. *
  1387. ******************************************************************************/
  1388. VOID
  1389. WinStationPrinterU2A( PWINSTATIONPRINTERA pWinStationPrinterA,
  1390. PWINSTATIONPRINTERW pWinStationPrinterW )
  1391. {
  1392. UnicodeToAnsi( pWinStationPrinterA->Lpt1,
  1393. sizeof(pWinStationPrinterA->Lpt1),
  1394. pWinStationPrinterW->Lpt1 );
  1395. UnicodeToAnsi( pWinStationPrinterA->Lpt2,
  1396. sizeof(pWinStationPrinterA->Lpt2),
  1397. pWinStationPrinterW->Lpt2 );
  1398. UnicodeToAnsi( pWinStationPrinterA->Lpt3,
  1399. sizeof(pWinStationPrinterA->Lpt3),
  1400. pWinStationPrinterW->Lpt3 );
  1401. UnicodeToAnsi( pWinStationPrinterA->Lpt4,
  1402. sizeof(pWinStationPrinterA->Lpt4),
  1403. pWinStationPrinterW->Lpt4 );
  1404. }
  1405. /*******************************************************************************
  1406. *
  1407. * WinStationPrinterA2U (ANSI to UNICODE)
  1408. *
  1409. * copies WINSTATIONPRINTERA elements to WINSTATIONPRINTERW elements
  1410. *
  1411. * ENTRY:
  1412. * pWinStationPrinterW (output)
  1413. * points to WINSTATIONPRINTERW structure to copy to
  1414. *
  1415. * pWinStationPrinterA (input)
  1416. * points to WINSTATIONPRINTERA structure to copy from
  1417. *
  1418. * EXIT:
  1419. * nothing (VOID)
  1420. *
  1421. ******************************************************************************/
  1422. VOID
  1423. WinStationPrinterA2U( PWINSTATIONPRINTERW pWinStationPrinterW,
  1424. PWINSTATIONPRINTERA pWinStationPrinterA )
  1425. {
  1426. AnsiToUnicode( pWinStationPrinterW->Lpt1,
  1427. sizeof(pWinStationPrinterW->Lpt1),
  1428. pWinStationPrinterA->Lpt1 );
  1429. AnsiToUnicode( pWinStationPrinterW->Lpt2,
  1430. sizeof(pWinStationPrinterW->Lpt2),
  1431. pWinStationPrinterA->Lpt2 );
  1432. AnsiToUnicode( pWinStationPrinterW->Lpt3,
  1433. sizeof(pWinStationPrinterW->Lpt3),
  1434. pWinStationPrinterA->Lpt3 );
  1435. AnsiToUnicode( pWinStationPrinterW->Lpt4,
  1436. sizeof(pWinStationPrinterW->Lpt4),
  1437. pWinStationPrinterA->Lpt4 );
  1438. }
  1439. /*******************************************************************************
  1440. *
  1441. * WinStationInformationU2A (UNICODE to ANSI)
  1442. *
  1443. * copies WINSTATIONINFORMATIONW elements to WINSTATIONINFORMATIONA elements
  1444. *
  1445. * ENTRY:
  1446. * pWinStationInformationA (output)
  1447. * points to WINSTATIONINFORMATIONA structure to copy to
  1448. *
  1449. * pWinStationInformationW (input)
  1450. * points to WINSTATIONINFORMATIONW structure to copy from
  1451. *
  1452. * EXIT:
  1453. * nothing (VOID)
  1454. *
  1455. ******************************************************************************/
  1456. VOID
  1457. WinStationInformationU2A( PWINSTATIONINFORMATIONA pWinStationInformationA,
  1458. PWINSTATIONINFORMATIONW pWinStationInformationW )
  1459. {
  1460. pWinStationInformationA->ConnectState = pWinStationInformationW->ConnectState;
  1461. UnicodeToAnsi( pWinStationInformationA->WinStationName,
  1462. sizeof(pWinStationInformationA->WinStationName),
  1463. pWinStationInformationW->WinStationName );
  1464. pWinStationInformationA->LogonId = pWinStationInformationW->LogonId;
  1465. pWinStationInformationA->ConnectTime = pWinStationInformationW->ConnectTime;
  1466. pWinStationInformationA->DisconnectTime = pWinStationInformationW->DisconnectTime;
  1467. pWinStationInformationA->LastInputTime = pWinStationInformationW->LastInputTime;
  1468. pWinStationInformationA->LogonTime = pWinStationInformationW->LogonTime;
  1469. pWinStationInformationA->Status = pWinStationInformationW->Status;
  1470. UnicodeToAnsi( pWinStationInformationA->Domain,
  1471. sizeof(pWinStationInformationA->Domain),
  1472. pWinStationInformationW->Domain );
  1473. UnicodeToAnsi( pWinStationInformationA->UserName,
  1474. sizeof(pWinStationInformationA->UserName),
  1475. pWinStationInformationW->UserName );
  1476. }
  1477. /*******************************************************************************
  1478. *
  1479. * WinStationInformationA2U (ANSI to UNICODE)
  1480. *
  1481. * copies WINSTATIONINFORMATIONA elements to WINSTATIONINFORMATIONW elements
  1482. *
  1483. * ENTRY:
  1484. * pWinStationInformationW (output)
  1485. * points to WINSTATIONINFORMATIONW structure to copy to
  1486. *
  1487. * pWinStationInformationA (input)
  1488. * points to WINSTATIONINFORMATIONA structure to copy from
  1489. *
  1490. * EXIT:
  1491. * nothing (VOID)
  1492. *
  1493. ******************************************************************************/
  1494. VOID
  1495. WinStationInformationA2U( PWINSTATIONINFORMATIONW pWinStationInformationW,
  1496. PWINSTATIONINFORMATIONA pWinStationInformationA )
  1497. {
  1498. pWinStationInformationW->ConnectState = pWinStationInformationA->ConnectState;
  1499. AnsiToUnicode( pWinStationInformationW->WinStationName,
  1500. sizeof(pWinStationInformationW->WinStationName),
  1501. pWinStationInformationA->WinStationName );
  1502. pWinStationInformationW->LogonId = pWinStationInformationA->LogonId;
  1503. pWinStationInformationW->ConnectTime = pWinStationInformationA->ConnectTime;
  1504. pWinStationInformationW->DisconnectTime = pWinStationInformationA->DisconnectTime;
  1505. pWinStationInformationW->LastInputTime = pWinStationInformationA->LastInputTime;
  1506. pWinStationInformationW->LogonTime = pWinStationInformationA->LogonTime;
  1507. pWinStationInformationW->Status = pWinStationInformationA->Status;
  1508. AnsiToUnicode( pWinStationInformationW->Domain,
  1509. sizeof(pWinStationInformationW->Domain),
  1510. pWinStationInformationA->Domain );
  1511. AnsiToUnicode( pWinStationInformationW->UserName,
  1512. sizeof(pWinStationInformationW->UserName),
  1513. pWinStationInformationA->UserName );
  1514. }
  1515. /*******************************************************************************
  1516. *
  1517. * WinStationClientU2A (UNICODE to ANSI)
  1518. *
  1519. * copies WINSTATIONCLIENTW elements to WINSTATIONCLIENTA elements
  1520. *
  1521. * ENTRY:
  1522. * pWinStationClientA (output)
  1523. * points to WINSTATIONCLIENTA structure to copy to
  1524. *
  1525. * pWinStationClientW (input)
  1526. * points to WINSTATIONCLIENTW structure to copy from
  1527. *
  1528. * EXIT:
  1529. * nothing (VOID)
  1530. *
  1531. ******************************************************************************/
  1532. VOID
  1533. WinStationClientU2A( PWINSTATIONCLIENTA pWinStationClientA,
  1534. PWINSTATIONCLIENTW pWinStationClientW )
  1535. {
  1536. pWinStationClientA->fTextOnly = pWinStationClientW->fTextOnly;
  1537. pWinStationClientA->fDisableCtrlAltDel = pWinStationClientW->fDisableCtrlAltDel;
  1538. UnicodeToAnsi( pWinStationClientA->ClientName,
  1539. sizeof(pWinStationClientA->ClientName),
  1540. pWinStationClientW->ClientName );
  1541. UnicodeToAnsi( pWinStationClientA->Domain,
  1542. sizeof(pWinStationClientA->Domain),
  1543. pWinStationClientW->Domain );
  1544. UnicodeToAnsi( pWinStationClientA->UserName,
  1545. sizeof(pWinStationClientA->UserName),
  1546. pWinStationClientW->UserName );
  1547. UnicodeToAnsi( pWinStationClientA->Password,
  1548. sizeof(pWinStationClientA->Password),
  1549. pWinStationClientW->Password );
  1550. UnicodeToAnsi( pWinStationClientA->WorkDirectory,
  1551. sizeof(pWinStationClientA->WorkDirectory),
  1552. pWinStationClientW->WorkDirectory );
  1553. UnicodeToAnsi( pWinStationClientA->InitialProgram,
  1554. sizeof(pWinStationClientA->InitialProgram),
  1555. pWinStationClientW->InitialProgram );
  1556. UnicodeToAnsi( pWinStationClientA->clientDigProductId,
  1557. sizeof( pWinStationClientA->clientDigProductId),
  1558. pWinStationClientW->clientDigProductId );
  1559. pWinStationClientA->SerialNumber = pWinStationClientW->SerialNumber;
  1560. pWinStationClientA->EncryptionLevel = pWinStationClientW->EncryptionLevel;
  1561. UnicodeToAnsi( pWinStationClientA->ClientAddress,
  1562. sizeof(pWinStationClientA->ClientAddress),
  1563. pWinStationClientW->ClientAddress);
  1564. pWinStationClientA->HRes = pWinStationClientW->HRes;
  1565. pWinStationClientA->VRes = pWinStationClientW->VRes;
  1566. pWinStationClientA->ColorDepth = pWinStationClientW->ColorDepth;
  1567. pWinStationClientA->ProtocolType = pWinStationClientW->ProtocolType;
  1568. pWinStationClientA->KeyboardLayout = pWinStationClientW->KeyboardLayout;
  1569. UnicodeToAnsi( pWinStationClientA->ClientDirectory,
  1570. sizeof(pWinStationClientA->ClientDirectory),
  1571. pWinStationClientW->ClientDirectory);
  1572. UnicodeToAnsi( pWinStationClientA->ClientLicense,
  1573. sizeof(pWinStationClientA->ClientLicense),
  1574. pWinStationClientW->ClientLicense);
  1575. UnicodeToAnsi( pWinStationClientA->ClientModem,
  1576. sizeof(pWinStationClientA->ClientModem),
  1577. pWinStationClientW->ClientModem);
  1578. pWinStationClientA->ClientBuildNumber = pWinStationClientW->ClientBuildNumber;
  1579. pWinStationClientA->ClientHardwareId = pWinStationClientW->ClientHardwareId;
  1580. pWinStationClientA->ClientProductId = pWinStationClientW->ClientProductId;
  1581. pWinStationClientA->OutBufCountHost = pWinStationClientW->OutBufCountHost;
  1582. pWinStationClientA->OutBufCountClient = pWinStationClientW->OutBufCountClient;
  1583. pWinStationClientA->OutBufLength = pWinStationClientW->OutBufLength;
  1584. }
  1585. VOID WinStationProductIdU2A( PWINSTATIONPRODIDA pWinStationProdIdA, PWINSTATIONPRODIDW pWinStationProdIdW)
  1586. {
  1587. UnicodeToAnsi( pWinStationProdIdA->DigProductId,
  1588. sizeof(pWinStationProdIdA->DigProductId),
  1589. pWinStationProdIdW->DigProductId);
  1590. UnicodeToAnsi( pWinStationProdIdA->ClientDigProductId,
  1591. sizeof(pWinStationProdIdA->ClientDigProductId),
  1592. pWinStationProdIdW->ClientDigProductId);
  1593. UnicodeToAnsi( pWinStationProdIdA->OuterMostDigProductId,
  1594. sizeof(pWinStationProdIdA->OuterMostDigProductId),
  1595. pWinStationProdIdW->OuterMostDigProductId);
  1596. pWinStationProdIdA->curentSessionId = pWinStationProdIdW->curentSessionId;
  1597. pWinStationProdIdA->ClientSessionId = pWinStationProdIdW->ClientSessionId;
  1598. pWinStationProdIdA->OuterMostSessionId = pWinStationProdIdW->OuterMostSessionId;
  1599. }