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.

665 lines
20 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: umi2nt.cxx
  7. //
  8. // Contents: Contains the routines to convert from UMI_PROPERTY structures to
  9. // NT objects that can be stored in the cache.
  10. //
  11. // History: 02-28-00 SivaramR Created.
  12. //
  13. //----------------------------------------------------------------------------
  14. #include "winnt.hxx"
  15. //----------------------------------------------------------------------------
  16. // Function: UmiToBooleans
  17. //
  18. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  19. // each containing a boolean.
  20. //
  21. // Arguments:
  22. //
  23. // pPropArray Pointer to UMI_PROPERTY structure
  24. // pNtObjects Array of NT objects that returns the values.
  25. // ulNumValues Number of values stored in pPropArray
  26. //
  27. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise (none now).
  28. //
  29. // Modifies: *pNtObject to return the converted value.
  30. //
  31. //----------------------------------------------------------------------------
  32. HRESULT UmiToBooleans(
  33. UMI_PROPERTY *pPropArray,
  34. LPNTOBJECT pNtObjects,
  35. ULONG ulNumValues
  36. )
  37. {
  38. ULONG ulIndex = 0;
  39. BOOL bVal;
  40. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  41. ADsAssert(pPropArray->pUmiValue != NULL);
  42. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  43. {
  44. bVal = pPropArray->pUmiValue->bValue[ulIndex];
  45. pNtObjects[ulIndex].NTType = NT_SYNTAX_ID_BOOL;
  46. if(bVal)
  47. pNtObjects[ulIndex].NTValue.fValue = TRUE;
  48. else
  49. pNtObjects[ulIndex].NTValue.fValue = FALSE;
  50. }
  51. RRETURN(UMI_S_NO_ERROR);
  52. }
  53. //----------------------------------------------------------------------------
  54. // Function: ConvertSystemTimeToUTCTime
  55. //
  56. // Synopsis: Converts a system time structure containing a local time to a
  57. // system time structure containing UTC time.
  58. //
  59. // Arguments:
  60. //
  61. // pLocalTime Pointer to local time
  62. // pUTCTime Returns UTC time
  63. //
  64. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  65. //
  66. // Modifies: *pUTCTime to contain the UTC time.
  67. //
  68. //----------------------------------------------------------------------------
  69. HRESULT ConvertSystemTimeToUTCTime(
  70. SYSTEMTIME *pLocalTime,
  71. SYSTEMTIME *pUTCTime
  72. )
  73. {
  74. HRESULT hr = UMI_S_NO_ERROR;
  75. FILETIME localft, ft;
  76. BOOL fRetVal;
  77. ADsAssert( (pLocalTime != NULL) && (pUTCTime != NULL) );
  78. fRetVal = SystemTimeToFileTime(pLocalTime, &localft);
  79. if(!fRetVal)
  80. BAIL_ON_FAILURE( hr = HRESULT_FROM_WIN32(GetLastError()) );
  81. fRetVal = LocalFileTimeToFileTime(&localft, &ft);
  82. if(!fRetVal)
  83. BAIL_ON_FAILURE( hr = HRESULT_FROM_WIN32(GetLastError()) );
  84. fRetVal = FileTimeToSystemTime(&ft, pUTCTime);
  85. if(!fRetVal)
  86. BAIL_ON_FAILURE( hr = HRESULT_FROM_WIN32(GetLastError()) );
  87. RRETURN(UMI_S_NO_ERROR);
  88. error:
  89. RRETURN(hr);
  90. }
  91. //----------------------------------------------------------------------------
  92. // Function: UmiToSystemTimes
  93. //
  94. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  95. // each containing a system time. The time sent in by the user
  96. // is local time, so we need to convert it to UTC.
  97. //
  98. // Arguments:
  99. //
  100. // pPropArray Pointer to UMI_PROPERTY structure
  101. // pNtObjects Array of NT objects that returns the values.
  102. // ulNumValues Number of values stored in pPropArray
  103. //
  104. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  105. //
  106. // Modifies: *pNtObject to return the converted value.
  107. //
  108. //----------------------------------------------------------------------------
  109. HRESULT UmiToSystemTimes(
  110. UMI_PROPERTY *pPropArray,
  111. LPNTOBJECT pNtObjects,
  112. ULONG ulNumValues
  113. )
  114. {
  115. ULONG ulIndex = 0;
  116. SYSTEMTIME *pSysTime, UTCTime;
  117. HRESULT hr = UMI_S_NO_ERROR;
  118. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  119. ADsAssert(pPropArray->pUmiValue != NULL);
  120. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  121. {
  122. pSysTime = &(pPropArray->pUmiValue->sysTimeValue[ulIndex]);
  123. hr = ConvertSystemTimeToUTCTime(pSysTime, &UTCTime);
  124. BAIL_ON_FAILURE(hr);
  125. pNtObjects[ulIndex].NTType = NT_SYNTAX_ID_SYSTEMTIME;
  126. pNtObjects[ulIndex].NTValue.stSystemTimeValue = UTCTime;
  127. }
  128. RRETURN(UMI_S_NO_ERROR);
  129. error:
  130. RRETURN(hr);
  131. }
  132. //----------------------------------------------------------------------------
  133. // Function: UmiToDwords
  134. //
  135. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  136. // each containing a DWORD.
  137. //
  138. // Arguments:
  139. //
  140. // pPropArray Pointer to UMI_PROPERTY structure
  141. // pNtObjects Array of NT objects that returns the values.
  142. // ulNumValues Number of values stored in pPropArray
  143. //
  144. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise (none now).
  145. //
  146. // Modifies: *pNtObject to return the converted value.
  147. //
  148. //----------------------------------------------------------------------------
  149. HRESULT UmiToDwords(
  150. UMI_PROPERTY *pPropArray,
  151. LPNTOBJECT pNtObjects,
  152. ULONG ulNumValues
  153. )
  154. {
  155. ULONG ulIndex = 0;
  156. DWORD dwVal;
  157. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  158. ADsAssert(pPropArray->pUmiValue != NULL);
  159. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  160. {
  161. dwVal = pPropArray->pUmiValue->uValue[ulIndex];
  162. pNtObjects[ulIndex].NTType = NT_SYNTAX_ID_DWORD;
  163. pNtObjects[ulIndex].NTValue.dwValue = dwVal;
  164. }
  165. RRETURN(UMI_S_NO_ERROR);
  166. }
  167. //----------------------------------------------------------------------------
  168. // Function: UmiToDates
  169. //
  170. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  171. // each containing a DATE. Only the hours and minutes in the
  172. // system time are stored in the NT object. Again, the input
  173. // is local time, so it needs to be converted to UTC.
  174. //
  175. // Arguments:
  176. //
  177. // pPropArray Pointer to UMI_PROPERTY structure
  178. // pNtObjects Array of NT objects that returns the values.
  179. // ulNumValues Number of values stored in pPropArray
  180. //
  181. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  182. //
  183. // Modifies: *pNtObject to return the converted value.
  184. //
  185. //----------------------------------------------------------------------------
  186. HRESULT UmiToDates(
  187. UMI_PROPERTY *pPropArray,
  188. LPNTOBJECT pNtObjects,
  189. ULONG ulNumValues
  190. )
  191. {
  192. ULONG ulIndex = 0;
  193. SYSTEMTIME *pSysTime, UTCTime;
  194. HRESULT hr = UMI_S_NO_ERROR;
  195. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  196. ADsAssert(pPropArray->pUmiValue != NULL);
  197. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  198. {
  199. pSysTime = &(pPropArray->pUmiValue->sysTimeValue[ulIndex]);
  200. hr = ConvertSystemTimeToUTCTime(pSysTime, &UTCTime);
  201. BAIL_ON_FAILURE(hr);
  202. pNtObjects[ulIndex].NTType = NT_SYNTAX_ID_DATE;
  203. pNtObjects[ulIndex].NTValue.dwValue =
  204. UTCTime.wHour*60 + UTCTime.wMinute;
  205. }
  206. RRETURN(UMI_S_NO_ERROR);
  207. error:
  208. RRETURN(hr);
  209. }
  210. //----------------------------------------------------------------------------
  211. // Function: ConvertSystemTimeToUTCFileTime
  212. //
  213. // Synopsis: Converts a system time structure containing a local time to a
  214. // file time structure containing UTC time.
  215. //
  216. // Arguments:
  217. //
  218. // pLocalTime Pointer to local time
  219. // pUTCTime Returns UTC file time
  220. //
  221. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  222. //
  223. // Modifies: *pUTCFileTime to contain the UTC file time.
  224. //
  225. //----------------------------------------------------------------------------
  226. HRESULT ConvertSystemTimeToUTCFileTime(
  227. SYSTEMTIME *pLocalTime,
  228. FILETIME *pUTCFileTime
  229. )
  230. {
  231. HRESULT hr = UMI_S_NO_ERROR;
  232. FILETIME localft;
  233. BOOL fRetVal;
  234. ADsAssert( (pLocalTime != NULL) && (pUTCFileTime != NULL) );
  235. fRetVal = SystemTimeToFileTime(pLocalTime, &localft);
  236. if(!fRetVal)
  237. BAIL_ON_FAILURE( hr = HRESULT_FROM_WIN32(GetLastError()) );
  238. fRetVal = LocalFileTimeToFileTime(&localft, pUTCFileTime);
  239. if(!fRetVal)
  240. BAIL_ON_FAILURE( hr = HRESULT_FROM_WIN32(GetLastError()) );
  241. RRETURN(UMI_S_NO_ERROR);
  242. error:
  243. RRETURN(hr);
  244. }
  245. //----------------------------------------------------------------------------
  246. // Function: UmiToDate70s
  247. //
  248. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  249. // each containing the number of seconds from 1970 to the date
  250. // in UMI_PROPERTY. Again the input is local time, so it needs
  251. // to be converted to UTC.
  252. //
  253. // Arguments:
  254. //
  255. // pPropArray Pointer to UMI_PROPERTY structure
  256. // pNtObjects Array of NT objects that returns the values.
  257. // ulNumValues Number of values stored in pPropArray
  258. //
  259. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  260. //
  261. // Modifies: *pNtObject to return the converted value.
  262. //
  263. //----------------------------------------------------------------------------
  264. HRESULT UmiToDate70s(
  265. UMI_PROPERTY *pPropArray,
  266. LPNTOBJECT pNtObjects,
  267. ULONG ulNumValues
  268. )
  269. {
  270. ULONG ulIndex = 0;
  271. SYSTEMTIME *pSysTime;
  272. FILETIME UTCFileTime;
  273. HRESULT hr = UMI_S_NO_ERROR;
  274. LARGE_INTEGER tmpTime;
  275. DWORD dwSeconds1970 = 0;
  276. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  277. ADsAssert(pPropArray->pUmiValue != NULL);
  278. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  279. {
  280. pSysTime = &(pPropArray->pUmiValue->sysTimeValue[ulIndex]);
  281. hr = ConvertSystemTimeToUTCFileTime(pSysTime, &UTCFileTime);
  282. BAIL_ON_FAILURE(hr);
  283. tmpTime.LowPart = UTCFileTime.dwLowDateTime;
  284. tmpTime.HighPart = UTCFileTime.dwHighDateTime;
  285. RtlTimeToSecondsSince1970(&tmpTime, (ULONG *) (&dwSeconds1970) );
  286. pNtObjects[ulIndex].NTType = NT_SYNTAX_ID_DATE_1970;
  287. pNtObjects[ulIndex].NTValue.dwSeconds1970 = dwSeconds1970;
  288. }
  289. RRETURN(UMI_S_NO_ERROR);
  290. error:
  291. RRETURN(hr);
  292. }
  293. //----------------------------------------------------------------------------
  294. // Function: UmiToLPWSTRs
  295. //
  296. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  297. // each containing a string.
  298. //
  299. // Arguments:
  300. //
  301. // pPropArray Pointer to UMI_PROPERTY structure
  302. // pNtObjects Array of NT objects that returns the values.
  303. // ulNumValues Number of values stored in pPropArray
  304. // dwSyntaxId Syntax of the property. There are different syntaxes for
  305. // strings - Delimited_Strings, Nulled_Strings etc.
  306. //
  307. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  308. //
  309. // Modifies: *pNtObject to return the converted value.
  310. //
  311. //----------------------------------------------------------------------------
  312. HRESULT UmiToLPWSTRs(
  313. UMI_PROPERTY *pPropArray,
  314. LPNTOBJECT pNtObjects,
  315. ULONG ulNumValues,
  316. DWORD dwSyntaxId
  317. )
  318. {
  319. ULONG ulIndex = 0, i = 0;
  320. LPWSTR pszStr = NULL;
  321. HRESULT hr = UMI_S_NO_ERROR;
  322. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  323. ADsAssert(pPropArray->pUmiValue != NULL);
  324. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  325. {
  326. pszStr = pPropArray->pUmiValue->pszStrValue[ulIndex];
  327. pNtObjects[ulIndex].NTType = dwSyntaxId;
  328. if(pszStr != NULL) {
  329. pNtObjects[ulIndex].NTValue.pszValue = AllocADsStr(pszStr);
  330. if(NULL == pNtObjects[ulIndex].NTValue.pszValue)
  331. BAIL_ON_FAILURE(hr = UMI_E_OUT_OF_MEMORY);
  332. }
  333. else
  334. pNtObjects[ulIndex].NTValue.pszValue = NULL;
  335. }
  336. RRETURN(UMI_S_NO_ERROR);
  337. error:
  338. for(i = 0; i < ulIndex; i++)
  339. if(pNtObjects[i].NTValue.pszValue != NULL)
  340. FreeADsStr(pNtObjects[i].NTValue.pszValue);
  341. RRETURN(hr);
  342. }
  343. //----------------------------------------------------------------------------
  344. // Function: UmiToOctetStrings
  345. //
  346. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  347. // each containing an octet string.
  348. //
  349. // Arguments:
  350. //
  351. // pPropArray Pointer to UMI_PROPERTY structure
  352. // pNtObjects Array of NT objects that returns the values.
  353. // ulNumValues Number of values stored in pPropArray
  354. //
  355. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  356. //
  357. // Modifies: *pNtObject to return the converted value.
  358. //
  359. //----------------------------------------------------------------------------
  360. HRESULT UmiToOctetStrings(
  361. UMI_PROPERTY *pPropArray,
  362. LPNTOBJECT pNtObjects,
  363. ULONG ulNumValues
  364. )
  365. {
  366. ULONG ulIndex = 0, i = 0;
  367. UMI_OCTET_STRING *pUmiOctetStr;
  368. HRESULT hr = UMI_S_NO_ERROR;
  369. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  370. ADsAssert(pPropArray->pUmiValue != NULL);
  371. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  372. {
  373. pUmiOctetStr = &(pPropArray->pUmiValue->octetStr[ulIndex]);
  374. pNtObjects[ulIndex].NTType = NT_SYNTAX_ID_OCTETSTRING;
  375. pNtObjects[ulIndex].NTValue.octetstring.pByte =
  376. (BYTE *) AllocADsMem(pUmiOctetStr->uLength);
  377. if(NULL == pNtObjects[ulIndex].NTValue.octetstring.pByte)
  378. BAIL_ON_FAILURE(hr = UMI_E_OUT_OF_MEMORY);
  379. memcpy(pNtObjects[ulIndex].NTValue.octetstring.pByte,
  380. pUmiOctetStr->lpValue, pUmiOctetStr->uLength);
  381. pNtObjects[ulIndex].NTValue.octetstring.dwSize = pUmiOctetStr->uLength;
  382. }
  383. RRETURN(UMI_S_NO_ERROR);
  384. error:
  385. for(i = 0; i < ulIndex; i++)
  386. if(pNtObjects[i].NTValue.octetstring.pByte != NULL)
  387. FreeADsMem(pNtObjects[i].NTValue.octetstring.pByte);
  388. RRETURN(hr);
  389. }
  390. //----------------------------------------------------------------------------
  391. // Function: UmiToEncryptedLPWSTRs
  392. //
  393. // Synopsis: Converts from UMI_PROPERTY structure to array of NT objects,
  394. // each containing an encrypted string. Used so that passwords
  395. // are not stored in cleartext.
  396. //
  397. // Arguments:
  398. //
  399. // pPropArray Pointer to UMI_PROPERTY structure
  400. // pNtObjects Array of NT objects that returns the values.
  401. // ulNumValues Number of values stored in pPropArray
  402. //
  403. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  404. //
  405. // Modifies: *pNtObject to return the converted value.
  406. //
  407. //----------------------------------------------------------------------------
  408. HRESULT UmiToEncryptedLPWSTRs(
  409. UMI_PROPERTY *pPropArray,
  410. LPNTOBJECT pNtObjects,
  411. ULONG ulNumValues
  412. )
  413. {
  414. ULONG ulIndex = 0, i = 0;
  415. LPWSTR pszStr = NULL;
  416. HRESULT hr = UMI_S_NO_ERROR;
  417. UNICODE_STRING Password;
  418. UCHAR Seed = UMI_ENCODE_SEED3;
  419. ADsAssert( (pPropArray != NULL) && (pNtObjects != NULL) );
  420. ADsAssert(pPropArray->pUmiValue != NULL);
  421. for(ulIndex = 0; ulIndex < ulNumValues; ulIndex++)
  422. {
  423. pszStr = pPropArray->pUmiValue->pszStrValue[ulIndex];
  424. pNtObjects[ulIndex].NTType = NT_SYNTAX_ID_EncryptedString;
  425. if(pszStr != NULL) {
  426. pNtObjects[ulIndex].NTValue.pszValue = AllocADsStr(pszStr);
  427. if(NULL == pNtObjects[ulIndex].NTValue.pszValue)
  428. BAIL_ON_FAILURE(hr = UMI_E_OUT_OF_MEMORY);
  429. RtlInitUnicodeString(&Password,
  430. pNtObjects[ulIndex].NTValue.pszValue);
  431. RtlRunEncodeUnicodeString(&Seed, &Password);
  432. }
  433. else
  434. pNtObjects[ulIndex].NTValue.pszValue = NULL;
  435. }
  436. RRETURN(UMI_S_NO_ERROR);
  437. error:
  438. for(i = 0; i < ulIndex; i++)
  439. if(pNtObjects[i].NTValue.pszValue != NULL)
  440. FreeADsStr(pNtObjects[i].NTValue.pszValue);
  441. RRETURN(hr);
  442. }
  443. //----------------------------------------------------------------------------
  444. // Function: UmiToWinNTType
  445. //
  446. // Synopsis: Converts from UMI_PROPERTY structure to NT objects that can be
  447. // stored in the cache.
  448. //
  449. // Arguments:
  450. //
  451. // dwSyntaxId Syntax of property
  452. // pPropArray Pointer to UMI_PROPERTY structure
  453. // ppNtObjects Returns a pointer to an NT object that can be stored in the
  454. // cache.
  455. //
  456. // Returns: UMI_S_NO_ERROR if successful. Error code otherwise.
  457. //
  458. // Modifies: *ppNtObjects to return a pointer to NT object
  459. //
  460. //----------------------------------------------------------------------------
  461. HRESULT UmiToWinNTType(
  462. DWORD dwSyntaxId,
  463. UMI_PROPERTY *pPropArray,
  464. LPNTOBJECT *ppNtObjects
  465. )
  466. {
  467. ULONG ulNumValues = 0;
  468. HRESULT hr = UMI_S_NO_ERROR;
  469. LPNTOBJECT pNtObjects = NULL;
  470. ADsAssert((pPropArray != NULL) && (ppNtObjects != NULL));
  471. *ppNtObjects = NULL;
  472. ulNumValues = pPropArray->uCount;
  473. pNtObjects = (LPNTOBJECT) AllocADsMem(ulNumValues * sizeof(NTOBJECT));
  474. if(NULL == pNtObjects)
  475. BAIL_ON_FAILURE(hr = UMI_E_OUT_OF_MEMORY);
  476. switch(dwSyntaxId) {
  477. case NT_SYNTAX_ID_BOOL:
  478. if(pPropArray->uType != UMI_TYPE_BOOL)
  479. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  480. hr = UmiToBooleans(pPropArray, pNtObjects, ulNumValues);
  481. BAIL_ON_FAILURE(hr);
  482. break;
  483. case NT_SYNTAX_ID_SYSTEMTIME:
  484. if(pPropArray->uType != UMI_TYPE_SYSTEMTIME)
  485. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  486. hr = UmiToSystemTimes(pPropArray, pNtObjects, ulNumValues);
  487. BAIL_ON_FAILURE(hr);
  488. break;
  489. case NT_SYNTAX_ID_DWORD:
  490. if(pPropArray->uType != UMI_TYPE_I4)
  491. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  492. hr = UmiToDwords(pPropArray, pNtObjects, ulNumValues);
  493. BAIL_ON_FAILURE(hr);
  494. break;
  495. case NT_SYNTAX_ID_DATE:
  496. if(pPropArray->uType != UMI_TYPE_SYSTEMTIME)
  497. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  498. hr = UmiToDates(pPropArray, pNtObjects, ulNumValues);
  499. BAIL_ON_FAILURE(hr);
  500. break;
  501. case NT_SYNTAX_ID_DATE_1970:
  502. if(pPropArray->uType != UMI_TYPE_SYSTEMTIME)
  503. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  504. hr = UmiToDate70s(pPropArray, pNtObjects, ulNumValues);
  505. BAIL_ON_FAILURE(hr);
  506. break;
  507. case NT_SYNTAX_ID_LPTSTR:
  508. if(pPropArray->uType != UMI_TYPE_LPWSTR)
  509. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  510. hr = UmiToLPWSTRs(pPropArray, pNtObjects, ulNumValues,
  511. NT_SYNTAX_ID_LPTSTR);
  512. BAIL_ON_FAILURE(hr);
  513. break;
  514. case NT_SYNTAX_ID_DelimitedString:
  515. if(pPropArray->uType != UMI_TYPE_LPWSTR)
  516. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  517. hr = UmiToLPWSTRs(pPropArray, pNtObjects, ulNumValues,
  518. NT_SYNTAX_ID_DelimitedString);
  519. BAIL_ON_FAILURE(hr);
  520. break;
  521. case NT_SYNTAX_ID_NulledString:
  522. if(pPropArray->uType != UMI_TYPE_LPWSTR)
  523. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  524. hr = UmiToLPWSTRs(pPropArray, pNtObjects, ulNumValues,
  525. NT_SYNTAX_ID_NulledString);
  526. BAIL_ON_FAILURE(hr);
  527. break;
  528. case NT_SYNTAX_ID_OCTETSTRING:
  529. if(pPropArray->uType != UMI_TYPE_OCTETSTRING)
  530. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  531. hr = UmiToOctetStrings(pPropArray, pNtObjects, ulNumValues);
  532. BAIL_ON_FAILURE(hr);
  533. break;
  534. case NT_SYNTAX_ID_EncryptedString:
  535. if(pPropArray->uType != UMI_TYPE_LPWSTR)
  536. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  537. hr = UmiToEncryptedLPWSTRs(pPropArray, pNtObjects, ulNumValues);
  538. BAIL_ON_FAILURE(hr);
  539. break;
  540. default:
  541. BAIL_ON_FAILURE(hr = UMI_E_CANT_CONVERT_DATA);
  542. } // switch
  543. *ppNtObjects = pNtObjects;
  544. RRETURN(UMI_S_NO_ERROR);
  545. error:
  546. if(pNtObjects != NULL)
  547. FreeADsMem(pNtObjects);
  548. RRETURN(hr);
  549. }