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.

976 lines
22 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: ndsmrshl.cxx
  7. //
  8. // Contents:
  9. //
  10. // Functions:
  11. //
  12. // CopyABC1ToNDSSynId1
  13. // CopyABC2ToNDSSynId2
  14. // CopyABC3ToNDSSynId3
  15. // CopyABC4ToNDSSynId4
  16. // CopyABC5ToNDSSynId5
  17. // CopyABC6ToNDSSynId6
  18. // CopyABC7ToNDSSynId7
  19. // CopyABC8ToNDSSynId8
  20. // CopyABC9ToNDSSynId9
  21. // CopyABC10ToNDSSynId10
  22. // CopyABC11ToNDSSynId11
  23. // CopyABC12ToNDSSynId12
  24. // CopyABC13ToNDSSynId13
  25. // CopyABC14ToNDSSynId14
  26. // CopyABC15ToNDSSynId15
  27. // CopyABC16ToNDSSynId16
  28. // CopyABC17ToNDSSynId17
  29. // CopyABC18ToNDSSynId18
  30. // CopyABC19ToNDSSynId19
  31. // CopyABC20ToNDSSynId20
  32. // CopyABC21ToNDSSynId21
  33. // CopyABC22ToNDSSynId22
  34. // CopyABC23ToNDSSynId23
  35. // CopyABC24ToNDSSynId24
  36. // CopyABC25ToNDSSynId25
  37. // CopyABC26ToNDSSynId26
  38. // CopyABC27ToNDSSynId27
  39. //
  40. // History: 25-Apr-96 KrishnaG Created.
  41. //
  42. // Warnings: NDS Data type 6 is not yet supported (no problems just
  43. // not done!
  44. //
  45. // NDS Data type 16 need to complete the for loop code
  46. // NDS Data type 21 is the stream data type some stress.
  47. //----------------------------------------------------------------------------
  48. #include "nds.hxx"
  49. LPBYTE
  50. CopyNDSSynId1ToNDS1(
  51. LPBYTE lpByte,
  52. PNDSOBJECT lpNdsObject
  53. )
  54. {
  55. LPASN1_TYPE_1 lpASN1_1 = (LPASN1_TYPE_1) lpByte;
  56. lpASN1_1->DNString =
  57. (LPWSTR)AllocADsStr(
  58. lpNdsObject->NdsValue.value_1.DNString
  59. );
  60. lpByte = (LPBYTE ) lpASN1_1 + sizeof(ASN1_TYPE_1);
  61. return(lpByte);
  62. }
  63. LPBYTE
  64. CopyNDSSynId2ToNDS2(
  65. LPBYTE lpByte,
  66. PNDSOBJECT lpNdsObject
  67. )
  68. {
  69. LPASN1_TYPE_2 lpASN1_2 = (LPASN1_TYPE_2) lpByte;
  70. lpASN1_2->CaseExactString =
  71. (LPWSTR)AllocADsStr(
  72. lpNdsObject->NdsValue.value_2.CaseExactString
  73. );
  74. lpByte = (LPBYTE ) lpASN1_2 + sizeof(ASN1_TYPE_2);
  75. return(lpByte);
  76. }
  77. LPBYTE
  78. CopyNDSSynId3ToNDS3(
  79. LPBYTE lpByte,
  80. PNDSOBJECT lpNdsObject
  81. )
  82. {
  83. LPASN1_TYPE_3 lpASN1_3 = (LPASN1_TYPE_3) lpByte;
  84. lpASN1_3->CaseIgnoreString =
  85. (LPWSTR)AllocADsStr(
  86. lpNdsObject->NdsValue.value_3.CaseIgnoreString
  87. );
  88. lpByte = (LPBYTE ) lpASN1_3 + sizeof(ASN1_TYPE_3);
  89. return(lpByte);
  90. }
  91. LPBYTE
  92. CopyNDSSynId4ToNDS4(
  93. LPBYTE lpByte,
  94. PNDSOBJECT lpNdsObject
  95. )
  96. {
  97. LPASN1_TYPE_4 lpASN1_4 = (LPASN1_TYPE_4) lpByte;
  98. lpASN1_4->PrintableString =
  99. (LPWSTR)AllocADsStr(
  100. lpNdsObject->NdsValue.value_4.PrintableString
  101. );
  102. lpByte = (LPBYTE ) lpASN1_4 + sizeof(ASN1_TYPE_4);
  103. return(lpByte);
  104. }
  105. LPBYTE
  106. CopyNDSSynId5ToNDS5(
  107. LPBYTE lpByte,
  108. PNDSOBJECT lpNdsObject
  109. )
  110. {
  111. LPASN1_TYPE_5 lpASN1_5 = (LPASN1_TYPE_5) lpByte;
  112. lpASN1_5->NumericString =
  113. (LPWSTR)AllocADsStr(
  114. lpNdsObject->NdsValue.value_5.NumericString
  115. );
  116. lpByte = (LPBYTE ) lpASN1_5 + sizeof(ASN1_TYPE_5);
  117. return(lpByte);
  118. }
  119. LPBYTE
  120. CopyNDSSynId6ToNDS6(
  121. LPBYTE lpByte,
  122. PNDSOBJECT lpNdsObject
  123. )
  124. {
  125. LPASN1_TYPE_6 lpASN1_6 = (LPASN1_TYPE_6) lpByte;
  126. LPASN1_TYPE_6 lpASN1_6_Start = (LPASN1_TYPE_6) lpByte;
  127. LPNDS_ASN1_TYPE_6 lpNdsTempASN1_6 = NULL;
  128. lpNdsTempASN1_6 = &(lpNdsObject->NdsValue.value_6);
  129. lpASN1_6->String =
  130. (LPWSTR)AllocADsStr(
  131. lpNdsTempASN1_6->String
  132. );
  133. if (!lpASN1_6->String)
  134. return NULL;
  135. while ( lpNdsTempASN1_6->Next)
  136. {
  137. //lpASN1_6->Next = (LPASN1_TYPE_6)((LPBYTE)lpASN1_6 +sizeof(ASN1_TYPE_6));
  138. lpASN1_6->Next = (LPASN1_TYPE_6)AllocADsMem(sizeof(ASN1_TYPE_6));
  139. if (!lpASN1_6->Next)
  140. return NULL;
  141. lpASN1_6 = (LPASN1_TYPE_6)lpASN1_6->Next;
  142. lpNdsTempASN1_6 = lpNdsTempASN1_6->Next;
  143. lpASN1_6->String =
  144. (LPWSTR)AllocADsStr(
  145. lpNdsTempASN1_6->String
  146. );
  147. if (!lpASN1_6->String)
  148. return NULL;
  149. }
  150. lpASN1_6->Next = NULL;
  151. lpByte = (LPBYTE ) lpASN1_6_Start + sizeof(ASN1_TYPE_6);
  152. return(lpByte);
  153. }
  154. LPBYTE
  155. CopyNDSSynId7ToNDS7(
  156. LPBYTE lpByte,
  157. PNDSOBJECT lpNdsObject
  158. )
  159. {
  160. LPASN1_TYPE_8 lpASN1_8 = (LPASN1_TYPE_8) lpByte;
  161. lpASN1_8->Integer = lpNdsObject->NdsValue.value_8.Integer;
  162. lpByte = (LPBYTE ) lpASN1_8 + sizeof(ASN1_TYPE_8);
  163. return(lpByte);
  164. }
  165. LPBYTE
  166. CopyNDSSynId8ToNDS8(
  167. LPBYTE lpByte,
  168. PNDSOBJECT lpNdsObject
  169. )
  170. {
  171. LPASN1_TYPE_8 lpASN1_8 = (LPASN1_TYPE_8) lpByte;
  172. lpASN1_8->Integer = lpNdsObject->NdsValue.value_8.Integer;
  173. lpByte = (LPBYTE ) lpASN1_8 + sizeof(ASN1_TYPE_8);
  174. return(lpByte);
  175. }
  176. LPBYTE
  177. CopyNDSSynId9ToNDS9(
  178. LPBYTE lpByte,
  179. PNDSOBJECT lpNdsObject
  180. )
  181. {
  182. LPASN1_TYPE_9 lpASN1_9 = (LPASN1_TYPE_9) lpByte;
  183. LPBYTE pBuffer = NULL;
  184. lpASN1_9->Length = lpNdsObject->NdsValue.value_9.Length;
  185. pBuffer = (LPBYTE)AllocADsMem(lpASN1_9->Length);
  186. if (!pBuffer)
  187. return NULL;
  188. memcpy(
  189. pBuffer,
  190. lpNdsObject->NdsValue.value_9.OctetString,
  191. lpASN1_9->Length
  192. );
  193. lpASN1_9->OctetString = pBuffer;
  194. lpByte = (LPBYTE ) lpASN1_9 + sizeof(ASN1_TYPE_9);
  195. return(lpByte);
  196. }
  197. LPBYTE
  198. CopyNDSSynId10ToNDS10(
  199. LPBYTE lpByte,
  200. PNDSOBJECT lpNdsObject
  201. )
  202. {
  203. LPASN1_TYPE_10 lpASN1_10 = (LPASN1_TYPE_10) lpByte;
  204. lpASN1_10->TelephoneNumber =
  205. AllocADsStr(
  206. lpNdsObject->NdsValue.value_10.TelephoneNumber
  207. );
  208. lpByte = (LPBYTE ) lpASN1_10 + sizeof(ASN1_TYPE_10);
  209. return(lpByte);
  210. }
  211. LPBYTE
  212. CopyNDSSynId11ToNDS11(
  213. LPBYTE lpByte,
  214. PNDSOBJECT lpNdsObject
  215. )
  216. {
  217. LPBYTE pBuffer = NULL;
  218. LPASN1_TYPE_11 lpASN1_11 = (LPASN1_TYPE_11) lpByte;
  219. lpASN1_11->NumberOfBits = lpNdsObject->NdsValue.value_11.NumberOfBits;
  220. if (lpASN1_11->NumberOfBits) {
  221. pBuffer = (LPBYTE)AllocADsMem(lpASN1_11->NumberOfBits);
  222. if (!pBuffer)
  223. return NULL;
  224. memcpy(
  225. pBuffer,
  226. lpNdsObject->NdsValue.value_11.Parameters,
  227. lpASN1_11->NumberOfBits
  228. );
  229. lpASN1_11->Parameters = pBuffer;
  230. }
  231. else {
  232. lpASN1_11->Parameters = NULL;
  233. }
  234. lpASN1_11->TelephoneNumber =
  235. (LPWSTR)AllocADsStr(
  236. lpNdsObject->NdsValue.value_11.TelephoneNumber
  237. );
  238. if (!lpASN1_11->TelephoneNumber)
  239. return NULL;
  240. lpByte = (LPBYTE ) lpASN1_11 + sizeof(ASN1_TYPE_11);
  241. return(lpByte);
  242. }
  243. LPBYTE
  244. CopyNDSSynId12ToNDS12(
  245. LPBYTE lpByte,
  246. PNDSOBJECT lpNdsObject
  247. )
  248. {
  249. LPASN1_TYPE_12 lpASN1_12 = (LPASN1_TYPE_12) lpByte;
  250. LPBYTE pBuffer = NULL;
  251. lpASN1_12->AddressType = lpNdsObject->NdsValue.value_12.AddressType;
  252. lpASN1_12->AddressLength = lpNdsObject->NdsValue.value_12.AddressLength;
  253. pBuffer = (LPBYTE)AllocADsMem(lpASN1_12->AddressLength);
  254. if (!pBuffer)
  255. return NULL;
  256. memcpy(
  257. pBuffer,
  258. lpNdsObject->NdsValue.value_12.Address,
  259. lpASN1_12->AddressLength
  260. );
  261. lpASN1_12->Address = pBuffer;
  262. lpByte = (LPBYTE ) lpASN1_12 + sizeof(ASN1_TYPE_12);
  263. return(lpByte);
  264. }
  265. LPBYTE
  266. CopyNDSSynId13ToNDS13(
  267. LPBYTE lpByte,
  268. PNDSOBJECT lpNdsObject
  269. )
  270. {
  271. LPASN1_TYPE_13 lpASN1_13 = (LPASN1_TYPE_13) lpByte;
  272. LPASN1_TYPE_13 lpASN1_13_Start = (LPASN1_TYPE_13) lpByte;
  273. LPNDS_ASN1_TYPE_13 lpNdsTempASN1_13 = NULL;
  274. HRESULT hr = S_OK;
  275. lpNdsTempASN1_13 = &(lpNdsObject->NdsValue.value_13);
  276. hr = CopyOctetString(lpNdsTempASN1_13->Length,
  277. lpNdsTempASN1_13->Data,
  278. &lpASN1_13->Length,
  279. &lpASN1_13->Data);
  280. BAIL_ON_FAILURE(hr);
  281. while ( lpNdsTempASN1_13->Next)
  282. {
  283. //lpASN1_13->Next = (LPASN1_TYPE_13)((LPBYTE)lpASN1_13 +sizeof(ASN1_TYPE_13));
  284. lpASN1_13->Next = (LPASN1_TYPE_13)AllocADsMem(sizeof(ASN1_TYPE_13));
  285. lpASN1_13 = (LPASN1_TYPE_13)lpASN1_13->Next;
  286. lpNdsTempASN1_13 = lpNdsTempASN1_13->Next;
  287. hr = CopyOctetString(lpNdsTempASN1_13->Length,
  288. lpNdsTempASN1_13->Data,
  289. &lpASN1_13->Length,
  290. &lpASN1_13->Data);
  291. BAIL_ON_FAILURE(hr);
  292. }
  293. lpASN1_13->Next = NULL;
  294. lpByte = (LPBYTE ) lpASN1_13_Start + sizeof(ASN1_TYPE_13);
  295. error:
  296. return(lpByte);
  297. }
  298. LPBYTE
  299. CopyNDSSynId14ToNDS14(
  300. LPBYTE lpByte,
  301. PNDSOBJECT lpNdsObject
  302. )
  303. {
  304. LPASN1_TYPE_14 lpASN1_14 = (LPASN1_TYPE_14) lpByte;
  305. lpASN1_14->Type = lpNdsObject->NdsValue.value_14.Type;
  306. lpASN1_14->Address =
  307. (LPWSTR)AllocADsStr(
  308. lpNdsObject->NdsValue.value_14.Address
  309. );
  310. lpByte = (LPBYTE ) lpASN1_14 + sizeof(ASN1_TYPE_14);
  311. return(lpByte);
  312. }
  313. LPBYTE
  314. CopyNDSSynId15ToNDS15(
  315. LPBYTE lpByte,
  316. PNDSOBJECT lpNdsObject
  317. )
  318. {
  319. LPASN1_TYPE_15 lpASN1_15 = (LPASN1_TYPE_15) lpByte;
  320. lpASN1_15->Type = lpNdsObject->NdsValue.value_15.Type;
  321. lpASN1_15->VolumeName =
  322. (LPWSTR)AllocADsStr(
  323. lpNdsObject->NdsValue.value_15.VolumeName
  324. );
  325. lpASN1_15->Path =
  326. (LPWSTR)AllocADsStr(
  327. lpNdsObject->NdsValue.value_15.Path
  328. );
  329. lpByte = (LPBYTE ) lpASN1_15 + sizeof(ASN1_TYPE_15);
  330. return(lpByte);
  331. }
  332. LPBYTE
  333. CopyNDSSynId16ToNDS16(
  334. LPBYTE lpByte,
  335. PNDSOBJECT lpNdsObject
  336. )
  337. {
  338. LPASN1_TYPE_16 lpASN1_16 = (LPASN1_TYPE_16) lpByte;
  339. lpASN1_16->ReplicaType =
  340. lpNdsObject->NdsValue.value_16.ReplicaType;
  341. lpASN1_16->ReplicaNumber =
  342. lpNdsObject->NdsValue.value_16.ReplicaNumber;
  343. lpASN1_16->Count =
  344. lpNdsObject->NdsValue.value_16.Count;
  345. lpASN1_16->ReplicaAddressHint->AddressType =
  346. lpNdsObject->NdsValue.value_16.ReplicaAddressHints->AddressType;
  347. CopyOctetString(lpNdsObject->NdsValue.value_16.ReplicaAddressHints->AddressLength,
  348. lpNdsObject->NdsValue.value_16.ReplicaAddressHints->Address,
  349. &lpASN1_16->ReplicaAddressHint->AddressLength,
  350. &lpASN1_16->ReplicaAddressHint->Address);
  351. lpByte = (LPBYTE ) lpASN1_16 + sizeof(ASN1_TYPE_16);
  352. return(lpByte);
  353. }
  354. LPBYTE
  355. CopyNDSSynId17ToNDS17(
  356. LPBYTE lpByte,
  357. PNDSOBJECT lpNdsObject
  358. )
  359. {
  360. LPASN1_TYPE_17 lpASN1_17 = (LPASN1_TYPE_17) lpByte;
  361. lpASN1_17->ProtectedAttrName =
  362. (LPWSTR)AllocADsStr(
  363. lpNdsObject->NdsValue.value_17.ProtectedAttrName
  364. );
  365. lpASN1_17->SubjectName =
  366. (LPWSTR)AllocADsStr(
  367. lpNdsObject->NdsValue.value_17.SubjectName
  368. );
  369. lpASN1_17->Privileges = lpNdsObject->NdsValue.value_17.Privileges;
  370. lpByte = (LPBYTE ) lpASN1_17 + sizeof(ASN1_TYPE_17);
  371. return(lpByte);
  372. }
  373. LPBYTE
  374. CopyNDSSynId18ToNDS18(
  375. LPBYTE lpByte,
  376. PNDSOBJECT lpNdsObject
  377. )
  378. {
  379. LPASN1_TYPE_18 lpASN1_18 = (LPASN1_TYPE_18) lpByte;
  380. lpASN1_18->PostalAddress[0] =
  381. (LPWSTR)AllocADsStr(
  382. lpNdsObject->NdsValue.value_18.PostalAddress[0]
  383. );
  384. lpASN1_18->PostalAddress[1] =
  385. (LPWSTR)AllocADsStr(
  386. lpNdsObject->NdsValue.value_18.PostalAddress[1]
  387. );
  388. lpASN1_18->PostalAddress[2] =
  389. (LPWSTR)AllocADsStr(
  390. lpNdsObject->NdsValue.value_18.PostalAddress[2]
  391. );
  392. lpASN1_18->PostalAddress[3] =
  393. (LPWSTR)AllocADsStr(
  394. lpNdsObject->NdsValue.value_18.PostalAddress[3]
  395. );
  396. lpASN1_18->PostalAddress[4] =
  397. (LPWSTR)AllocADsStr(
  398. lpNdsObject->NdsValue.value_18.PostalAddress[4]
  399. );
  400. lpASN1_18->PostalAddress[5] =
  401. (LPWSTR)AllocADsStr(
  402. lpNdsObject->NdsValue.value_18.PostalAddress[5]
  403. );
  404. lpByte = (LPBYTE ) lpASN1_18 + sizeof(ASN1_TYPE_18);
  405. return(lpByte);
  406. }
  407. LPBYTE
  408. CopyNDSSynId19ToNDS19(
  409. LPBYTE lpByte,
  410. PNDSOBJECT lpNdsObject
  411. )
  412. {
  413. LPASN1_TYPE_19 lpASN1_19 = (LPASN1_TYPE_19) lpByte;
  414. lpNdsObject->NdsType = NDS_SYNTAX_ID_19;
  415. lpASN1_19->WholeSeconds
  416. = lpNdsObject->NdsValue.value_19.WholeSeconds;
  417. lpASN1_19->EventID
  418. = lpNdsObject->NdsValue.value_19.EventID;
  419. lpByte = (LPBYTE ) lpASN1_19 + sizeof(ASN1_TYPE_19);
  420. return(lpByte);
  421. }
  422. LPBYTE
  423. CopyNDSSynId20ToNDS20(
  424. LPBYTE lpByte,
  425. PNDSOBJECT lpNdsObject
  426. )
  427. {
  428. LPASN1_TYPE_20 lpASN1_20 = (LPASN1_TYPE_20) lpByte;
  429. lpASN1_20->ClassName =
  430. (LPWSTR)AllocADsStr(
  431. lpNdsObject->NdsValue.value_20.ClassName
  432. );
  433. lpByte = (LPBYTE ) lpASN1_20 + sizeof(ASN1_TYPE_20);
  434. return(lpByte);
  435. }
  436. LPBYTE
  437. CopyNDSSynId21ToNDS21(
  438. LPBYTE lpByte,
  439. PNDSOBJECT lpNdsObject
  440. )
  441. {
  442. LPASN1_TYPE_21 lpASN1_21 = (LPASN1_TYPE_21) lpByte;
  443. LPBYTE pBuffer = NULL;
  444. lpASN1_21->Length = lpNdsObject->NdsValue.value_21.Length;
  445. if (lpASN1_21->Length) {
  446. pBuffer = (LPBYTE)AllocADsMem(lpASN1_21->Length);
  447. if (!pBuffer)
  448. return NULL;
  449. memcpy(
  450. pBuffer,
  451. lpNdsObject->NdsValue.value_21.Data,
  452. lpASN1_21->Length
  453. );
  454. lpASN1_21->Data = pBuffer;
  455. }
  456. else {
  457. lpASN1_21->Data = NULL;
  458. }
  459. lpByte = (LPBYTE ) lpASN1_21 + sizeof(ASN1_TYPE_21);
  460. return(lpByte);
  461. }
  462. LPBYTE
  463. CopyNDSSynId22ToNDS22(
  464. LPBYTE lpByte,
  465. PNDSOBJECT lpNdsObject
  466. )
  467. {
  468. LPASN1_TYPE_22 lpASN1_22 = (LPASN1_TYPE_22) lpByte;
  469. lpASN1_22->Counter = lpNdsObject->NdsValue.value_22.Counter;
  470. lpByte = (LPBYTE ) lpASN1_22 + sizeof(ASN1_TYPE_22);
  471. return(lpByte);
  472. }
  473. LPBYTE
  474. CopyNDSSynId23ToNDS23(
  475. LPBYTE lpByte,
  476. PNDSOBJECT lpNdsObject
  477. )
  478. {
  479. LPASN1_TYPE_23 lpASN1_23 = (LPASN1_TYPE_23) lpByte;
  480. lpASN1_23->RemoteID = lpNdsObject->NdsValue.value_23.RemoteID;
  481. lpASN1_23->ObjectName =
  482. (LPWSTR)AllocADsStr(
  483. lpNdsObject->NdsValue.value_23.ObjectName
  484. );
  485. lpByte = (LPBYTE ) lpASN1_23 + sizeof(ASN1_TYPE_23);
  486. return(lpByte);
  487. }
  488. LPBYTE
  489. CopyNDSSynId24ToNDS24(
  490. LPBYTE lpByte,
  491. PNDSOBJECT lpNdsObject
  492. )
  493. {
  494. LPASN1_TYPE_24 lpASN1_24 = (LPASN1_TYPE_24) lpByte;
  495. lpASN1_24->Time = lpNdsObject->NdsValue.value_24.Time;
  496. lpByte = (LPBYTE ) lpASN1_24 + sizeof(ASN1_TYPE_24);
  497. return(lpByte);
  498. }
  499. LPBYTE
  500. CopyNDSSynId25ToNDS25(
  501. LPBYTE lpByte,
  502. PNDSOBJECT lpNdsObject
  503. )
  504. {
  505. LPASN1_TYPE_25 lpASN1_25 = (LPASN1_TYPE_25) lpByte;
  506. lpASN1_25->ObjectName =
  507. (LPWSTR)AllocADsStr(
  508. lpNdsObject->NdsValue.value_25.ObjectName
  509. );
  510. lpASN1_25->Level = lpNdsObject->NdsValue.value_25.Level;
  511. lpASN1_25->Interval = lpNdsObject->NdsValue.value_25.Interval;
  512. lpByte = (LPBYTE ) lpASN1_25 + sizeof(ASN1_TYPE_25);
  513. return(lpByte);
  514. }
  515. LPBYTE
  516. CopyNDSSynId26ToNDS26(
  517. LPBYTE lpByte,
  518. PNDSOBJECT lpNdsObject
  519. )
  520. {
  521. LPASN1_TYPE_26 lpASN1_26 = (LPASN1_TYPE_26) lpByte;
  522. lpASN1_26->ObjectName =
  523. (LPWSTR)AllocADsStr(
  524. lpNdsObject->NdsValue.value_26.ObjectName
  525. );
  526. lpASN1_26->Amount = lpNdsObject->NdsValue.value_26.Amount;
  527. lpByte = (LPBYTE ) lpASN1_26 + sizeof(ASN1_TYPE_26);
  528. return(lpByte);
  529. }
  530. LPBYTE
  531. CopyNDSSynId27ToNDS27(
  532. LPBYTE lpByte,
  533. PNDSOBJECT lpNdsObject
  534. )
  535. {
  536. LPASN1_TYPE_27 lpASN1_27 = (LPASN1_TYPE_27) lpByte;
  537. lpASN1_27->Interval = lpNdsObject->NdsValue.value_27.Interval;
  538. lpByte = (LPBYTE ) lpASN1_27 + sizeof(ASN1_TYPE_27);
  539. return(lpByte);
  540. }
  541. LPBYTE
  542. CopyNDSSynIdToNDS(
  543. DWORD dwSyntaxId,
  544. LPBYTE lpByte,
  545. PNDSOBJECT lpNdsObject
  546. )
  547. {
  548. switch (dwSyntaxId) {
  549. case 1:
  550. lpByte = CopyNDSSynId1ToNDS1(
  551. lpByte,
  552. lpNdsObject
  553. );
  554. break;
  555. case 2:
  556. lpByte = CopyNDSSynId2ToNDS2(
  557. lpByte,
  558. lpNdsObject
  559. );
  560. break;
  561. case 3:
  562. lpByte = CopyNDSSynId3ToNDS3(
  563. lpByte,
  564. lpNdsObject
  565. );
  566. break;
  567. case 4:
  568. lpByte = CopyNDSSynId4ToNDS4(
  569. lpByte,
  570. lpNdsObject
  571. );
  572. break;
  573. case 5:
  574. lpByte = CopyNDSSynId5ToNDS5(
  575. lpByte,
  576. lpNdsObject
  577. );
  578. break;
  579. case 6:
  580. lpByte = CopyNDSSynId6ToNDS6(
  581. lpByte,
  582. lpNdsObject
  583. );
  584. break;
  585. case 7:
  586. lpByte = CopyNDSSynId7ToNDS7(
  587. lpByte,
  588. lpNdsObject
  589. );
  590. break;
  591. case 8:
  592. lpByte = CopyNDSSynId8ToNDS8(
  593. lpByte,
  594. lpNdsObject
  595. );
  596. break;
  597. case 9:
  598. lpByte = CopyNDSSynId9ToNDS9(
  599. lpByte,
  600. lpNdsObject
  601. );
  602. break;
  603. case 10:
  604. lpByte = CopyNDSSynId10ToNDS10(
  605. lpByte,
  606. lpNdsObject
  607. );
  608. break;
  609. case 11:
  610. lpByte = CopyNDSSynId11ToNDS11(
  611. lpByte,
  612. lpNdsObject
  613. );
  614. break;
  615. case 12:
  616. lpByte = CopyNDSSynId12ToNDS12(
  617. lpByte,
  618. lpNdsObject
  619. );
  620. break;
  621. case 13:
  622. lpByte = CopyNDSSynId13ToNDS13(
  623. lpByte,
  624. lpNdsObject
  625. );
  626. break;
  627. case 14:
  628. lpByte = CopyNDSSynId14ToNDS14(
  629. lpByte,
  630. lpNdsObject
  631. );
  632. break;
  633. case 15:
  634. lpByte = CopyNDSSynId15ToNDS15(
  635. lpByte,
  636. lpNdsObject
  637. );
  638. break;
  639. case 16:
  640. lpByte = CopyNDSSynId16ToNDS16(
  641. lpByte,
  642. lpNdsObject
  643. );
  644. break;
  645. case 17:
  646. lpByte = CopyNDSSynId17ToNDS17(
  647. lpByte,
  648. lpNdsObject
  649. );
  650. break;
  651. case 18:
  652. lpByte = CopyNDSSynId18ToNDS18(
  653. lpByte,
  654. lpNdsObject
  655. );
  656. break;
  657. case 19:
  658. lpByte = CopyNDSSynId19ToNDS19(
  659. lpByte,
  660. lpNdsObject
  661. );
  662. break;
  663. case 20:
  664. lpByte = CopyNDSSynId20ToNDS20(
  665. lpByte,
  666. lpNdsObject
  667. );
  668. break;
  669. case 21:
  670. lpByte = CopyNDSSynId21ToNDS21(
  671. lpByte,
  672. lpNdsObject
  673. );
  674. break;
  675. case 22:
  676. lpByte = CopyNDSSynId22ToNDS22(
  677. lpByte,
  678. lpNdsObject
  679. );
  680. break;
  681. case 23:
  682. lpByte = CopyNDSSynId23ToNDS23(
  683. lpByte,
  684. lpNdsObject
  685. );
  686. break;
  687. case 24:
  688. lpByte = CopyNDSSynId24ToNDS24(
  689. lpByte,
  690. lpNdsObject
  691. );
  692. break;
  693. case 25:
  694. lpByte = CopyNDSSynId25ToNDS25(
  695. lpByte,
  696. lpNdsObject
  697. );
  698. break;
  699. case 26:
  700. lpByte = CopyNDSSynId26ToNDS26(
  701. lpByte,
  702. lpNdsObject
  703. );
  704. break;
  705. case 27:
  706. lpByte = CopyNDSSynId27ToNDS27(
  707. lpByte,
  708. lpNdsObject
  709. );
  710. break;
  711. default:
  712. break;
  713. }
  714. return(lpByte);
  715. }
  716. HRESULT
  717. MarshallNDSSynIdToNDS(
  718. DWORD dwSyntaxId,
  719. PNDSOBJECT pNdsObject,
  720. DWORD dwNumValues,
  721. LPBYTE lpValue
  722. )
  723. {
  724. DWORD i = 0;
  725. HRESULT hr = S_OK;
  726. for (i = 0; i < dwNumValues; i++) {
  727. lpValue = CopyNDSSynIdToNDS(
  728. dwSyntaxId,
  729. lpValue,
  730. (pNdsObject + i)
  731. );
  732. if (!lpValue) {
  733. hr = E_OUTOFMEMORY;
  734. BAIL_ON_FAILURE(hr);
  735. }
  736. }
  737. error:
  738. RRETURN(hr);
  739. }