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.

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