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.

738 lines
13 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Freeright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: ndsufree.cxx
  7. //
  8. // Contents:
  9. //
  10. // Functions:
  11. //
  12. // FreeABC1ToNDSSynId1
  13. // FreeABC2ToNDSSynId2
  14. // FreeABC3ToNDSSynId3
  15. // FreeABC4ToNDSSynId4
  16. // FreeABC5ToNDSSynId5
  17. // FreeABC6ToNDSSynId6
  18. // FreeABC7ToNDSSynId7
  19. // FreeABC8ToNDSSynId8
  20. // FreeABC9ToNDSSynId9
  21. // FreeABC10ToNDSSynId10
  22. // FreeABC11ToNDSSynId11
  23. // FreeABC12ToNDSSynId12
  24. // FreeABC13ToNDSSynId13
  25. // FreeABC14ToNDSSynId14
  26. // FreeABC15ToNDSSynId15
  27. // FreeABC16ToNDSSynId16
  28. // FreeABC17ToNDSSynId17
  29. // FreeABC18ToNDSSynId18
  30. // FreeABC19ToNDSSynId19
  31. // FreeABC20ToNDSSynId20
  32. // FreeABC21ToNDSSynId21
  33. // FreeABC22ToNDSSynId22
  34. // FreeABC23ToNDSSynId23
  35. // FreeABC24ToNDSSynId24
  36. // FreeABC25ToNDSSynId25
  37. // FreeABC26ToNDSSynId26
  38. // FreeABC27ToNDSSynId27
  39. //
  40. // History: 15-Jul-97 FelixW Created.
  41. //
  42. //----------------------------------------------------------------------------
  43. #include "nds.hxx"
  44. LPBYTE
  45. FreeNDSSynId1ToNDS1(
  46. LPBYTE lpByte
  47. )
  48. {
  49. LPASN1_TYPE_1 lpASN1_1 = (LPASN1_TYPE_1) lpByte;
  50. if (lpASN1_1->DNString) {
  51. FreeADsStr(lpASN1_1->DNString);
  52. }
  53. lpByte = (LPBYTE ) lpASN1_1 + sizeof(ASN1_TYPE_1);
  54. return(lpByte);
  55. }
  56. LPBYTE
  57. FreeNDSSynId2ToNDS2(
  58. LPBYTE lpByte
  59. )
  60. {
  61. LPASN1_TYPE_2 lpASN1_2 = (LPASN1_TYPE_2) lpByte;
  62. if (lpASN1_2->CaseExactString) {
  63. FreeADsStr(lpASN1_2->CaseExactString);
  64. }
  65. lpByte = (LPBYTE ) lpASN1_2 + sizeof(ASN1_TYPE_2);
  66. return(lpByte);
  67. }
  68. LPBYTE
  69. FreeNDSSynId3ToNDS3(
  70. LPBYTE lpByte
  71. )
  72. {
  73. LPASN1_TYPE_3 lpASN1_3 = (LPASN1_TYPE_3) lpByte;
  74. if (lpASN1_3->CaseIgnoreString) {
  75. FreeADsStr(lpASN1_3->CaseIgnoreString);
  76. }
  77. lpByte = (LPBYTE ) lpASN1_3 + sizeof(ASN1_TYPE_3);
  78. return(lpByte);
  79. }
  80. LPBYTE
  81. FreeNDSSynId4ToNDS4(
  82. LPBYTE lpByte
  83. )
  84. {
  85. LPASN1_TYPE_4 lpASN1_4 = (LPASN1_TYPE_4) lpByte;
  86. if (lpASN1_4->PrintableString) {
  87. FreeADsStr(lpASN1_4->PrintableString);
  88. }
  89. lpByte = (LPBYTE ) lpASN1_4 + sizeof(ASN1_TYPE_4);
  90. return(lpByte);
  91. }
  92. LPBYTE
  93. FreeNDSSynId5ToNDS5(
  94. LPBYTE lpByte
  95. )
  96. {
  97. LPASN1_TYPE_5 lpASN1_5 = (LPASN1_TYPE_5) lpByte;
  98. if (lpASN1_5->NumericString) {
  99. FreeADsStr(lpASN1_5->NumericString);
  100. }
  101. lpByte = (LPBYTE ) lpASN1_5 + sizeof(ASN1_TYPE_5);
  102. return(lpByte);
  103. }
  104. LPBYTE
  105. FreeNDSSynId6ToNDS6(
  106. LPBYTE lpByte
  107. )
  108. {
  109. LPASN1_TYPE_6 lpASN1_6 = (LPASN1_TYPE_6) lpByte;
  110. LPASN1_TYPE_6 lpASN1_6Last = NULL;
  111. if (lpASN1_6->String) {
  112. FreeADsStr(lpASN1_6->String);
  113. }
  114. lpASN1_6 = lpASN1_6->Next;
  115. while (lpASN1_6)
  116. {
  117. if (lpASN1_6->String) {
  118. FreeADsStr(lpASN1_6->String);
  119. }
  120. lpASN1_6Last = lpASN1_6;
  121. lpASN1_6 = (LPASN1_TYPE_6)lpASN1_6->Next;
  122. FreeADsMem(lpASN1_6Last);
  123. }
  124. lpByte = lpByte + sizeof(ASN1_TYPE_6);
  125. return(lpByte);
  126. }
  127. LPBYTE
  128. FreeNDSSynId7ToNDS7(
  129. LPBYTE lpByte
  130. )
  131. {
  132. LPASN1_TYPE_7 lpASN1_7 = (LPASN1_TYPE_7) lpByte;
  133. lpByte = (LPBYTE ) lpASN1_7 + sizeof(ASN1_TYPE_7);
  134. return(lpByte);
  135. }
  136. LPBYTE
  137. FreeNDSSynId8ToNDS8(
  138. LPBYTE lpByte
  139. )
  140. {
  141. LPASN1_TYPE_8 lpASN1_8 = (LPASN1_TYPE_8) lpByte;
  142. lpByte = (LPBYTE ) lpASN1_8 + sizeof(ASN1_TYPE_8);
  143. return(lpByte);
  144. }
  145. LPBYTE
  146. FreeNDSSynId9ToNDS9(
  147. LPBYTE lpByte
  148. )
  149. {
  150. LPASN1_TYPE_9 lpASN1_9 = (LPASN1_TYPE_9) lpByte;
  151. if (lpASN1_9->OctetString) {
  152. FreeADsMem((LPBYTE)lpASN1_9->OctetString);
  153. }
  154. lpByte = (LPBYTE ) lpASN1_9 + sizeof(ASN1_TYPE_9);
  155. return(lpByte);
  156. }
  157. LPBYTE
  158. FreeNDSSynId10ToNDS10(
  159. LPBYTE lpByte
  160. )
  161. {
  162. LPASN1_TYPE_10 lpASN1_10 = (LPASN1_TYPE_10) lpByte;
  163. if (lpASN1_10->TelephoneNumber) {
  164. FreeADsStr(lpASN1_10->TelephoneNumber);
  165. }
  166. lpByte = (LPBYTE ) lpASN1_10 + sizeof(ASN1_TYPE_10);
  167. return(lpByte);
  168. }
  169. LPBYTE
  170. FreeNDSSynId11ToNDS11(
  171. LPBYTE lpByte
  172. )
  173. {
  174. LPASN1_TYPE_11 lpASN1_11 = (LPASN1_TYPE_11) lpByte;
  175. if (lpASN1_11->TelephoneNumber) {
  176. FreeADsStr(lpASN1_11->TelephoneNumber);
  177. }
  178. if (lpASN1_11->Parameters) {
  179. FreeADsMem(lpASN1_11->Parameters);
  180. }
  181. lpByte = (LPBYTE ) lpASN1_11 + sizeof(ASN1_TYPE_11);
  182. return(lpByte);
  183. }
  184. LPBYTE
  185. FreeNDSSynId12ToNDS12(
  186. LPBYTE lpByte
  187. )
  188. {
  189. LPASN1_TYPE_12 lpASN1_12 = (LPASN1_TYPE_12) lpByte;
  190. if (lpASN1_12->Address) {
  191. FreeADsMem((LPBYTE)lpASN1_12->Address);
  192. }
  193. lpByte = (LPBYTE ) lpASN1_12 + sizeof(ASN1_TYPE_12);
  194. return(lpByte);
  195. }
  196. LPBYTE
  197. FreeNDSSynId13ToNDS13(
  198. LPBYTE lpByte
  199. )
  200. {
  201. LPASN1_TYPE_13 lpASN1_13 = (LPASN1_TYPE_13) lpByte;
  202. LPASN1_TYPE_13 lpASN1_13Last = NULL;
  203. if (lpASN1_13->Data) {
  204. FreeADsMem(lpASN1_13->Data);
  205. }
  206. lpASN1_13 = lpASN1_13->Next;
  207. while (lpASN1_13)
  208. {
  209. if (lpASN1_13->Data) {
  210. FreeADsMem(lpASN1_13->Data);
  211. }
  212. lpASN1_13Last = lpASN1_13;
  213. lpASN1_13 = (LPASN1_TYPE_13)lpASN1_13->Next;
  214. FreeADsMem(lpASN1_13Last);
  215. }
  216. lpByte = lpByte + sizeof(ASN1_TYPE_13);
  217. return(lpByte);
  218. }
  219. LPBYTE
  220. FreeNDSSynId14ToNDS14(
  221. LPBYTE lpByte
  222. )
  223. {
  224. LPASN1_TYPE_14 lpASN1_14 = (LPASN1_TYPE_14) lpByte;
  225. if (lpASN1_14->Address) {
  226. FreeADsStr(lpASN1_14->Address);
  227. }
  228. lpByte = (LPBYTE ) lpASN1_14 + sizeof(ASN1_TYPE_14);
  229. return(lpByte);
  230. }
  231. LPBYTE
  232. FreeNDSSynId15ToNDS15(
  233. LPBYTE lpByte
  234. )
  235. {
  236. LPASN1_TYPE_15 lpASN1_15 = (LPASN1_TYPE_15) lpByte;
  237. if (lpASN1_15->VolumeName) {
  238. FreeADsStr(lpASN1_15->VolumeName);
  239. }
  240. if (lpASN1_15->Path) {
  241. FreeADsStr(lpASN1_15->Path);
  242. }
  243. lpByte = (LPBYTE ) lpASN1_15 + sizeof(ASN1_TYPE_15);
  244. return(lpByte);
  245. }
  246. LPBYTE
  247. FreeNDSSynId16ToNDS16(
  248. LPBYTE lpByte
  249. )
  250. {
  251. LPASN1_TYPE_16 lpASN1_16 = (LPASN1_TYPE_16) lpByte;
  252. if (lpASN1_16->ReplicaAddressHint->Address) {
  253. FreeADsMem(lpASN1_16->ReplicaAddressHint->Address);
  254. }
  255. lpByte = (LPBYTE ) lpASN1_16 + sizeof(ASN1_TYPE_16);
  256. return(lpByte);
  257. }
  258. LPBYTE
  259. FreeNDSSynId17ToNDS17(
  260. LPBYTE lpByte
  261. )
  262. {
  263. LPASN1_TYPE_17 lpASN1_17 = (LPASN1_TYPE_17) lpByte;
  264. if (lpASN1_17->ProtectedAttrName) {
  265. FreeADsStr(lpASN1_17->ProtectedAttrName);
  266. }
  267. if (lpASN1_17->SubjectName) {
  268. FreeADsStr(lpASN1_17->SubjectName);
  269. }
  270. lpByte = (LPBYTE ) lpASN1_17 + sizeof(ASN1_TYPE_17);
  271. return(lpByte);
  272. }
  273. LPBYTE
  274. FreeNDSSynId18ToNDS18(
  275. LPBYTE lpByte
  276. )
  277. {
  278. LPASN1_TYPE_18 lpASN1_18 = (LPASN1_TYPE_18) lpByte;
  279. if (lpASN1_18->PostalAddress[0]) {
  280. FreeADsStr(lpASN1_18->PostalAddress[0]);
  281. }
  282. if (lpASN1_18->PostalAddress[1]) {
  283. FreeADsStr(lpASN1_18->PostalAddress[1]);
  284. }
  285. if (lpASN1_18->PostalAddress[2]) {
  286. FreeADsStr(lpASN1_18->PostalAddress[2]);
  287. }
  288. if (lpASN1_18->PostalAddress[3]) {
  289. FreeADsStr(lpASN1_18->PostalAddress[3]);
  290. }
  291. if (lpASN1_18->PostalAddress[4]) {
  292. FreeADsStr(lpASN1_18->PostalAddress[4]);
  293. }
  294. if (lpASN1_18->PostalAddress[5]) {
  295. FreeADsStr(lpASN1_18->PostalAddress[5]);
  296. }
  297. lpByte = (LPBYTE ) lpASN1_18 + sizeof(ASN1_TYPE_18);
  298. return(lpByte);
  299. }
  300. LPBYTE
  301. FreeNDSSynId19ToNDS19(
  302. LPBYTE lpByte
  303. )
  304. {
  305. LPASN1_TYPE_19 lpASN1_19 = (LPASN1_TYPE_19) lpByte;
  306. lpByte = (LPBYTE ) lpASN1_19 + sizeof(ASN1_TYPE_19);
  307. return(lpByte);
  308. }
  309. LPBYTE
  310. FreeNDSSynId20ToNDS20(
  311. LPBYTE lpByte
  312. )
  313. {
  314. LPASN1_TYPE_20 lpASN1_20 = (LPASN1_TYPE_20) lpByte;
  315. if (lpASN1_20->ClassName) {
  316. FreeADsStr(lpASN1_20->ClassName);
  317. }
  318. lpByte = (LPBYTE ) lpASN1_20 + sizeof(ASN1_TYPE_20);
  319. return(lpByte);
  320. }
  321. LPBYTE
  322. FreeNDSSynId21ToNDS21(
  323. LPBYTE lpByte
  324. )
  325. {
  326. LPASN1_TYPE_21 lpASN1_21 = (LPASN1_TYPE_21) lpByte;
  327. if (lpASN1_21->Data) {
  328. FreeADsMem((LPBYTE)lpASN1_21->Data);
  329. }
  330. lpByte = (LPBYTE ) lpASN1_21 + sizeof(ASN1_TYPE_21);
  331. return(lpByte);
  332. }
  333. LPBYTE
  334. FreeNDSSynId22ToNDS22(
  335. LPBYTE lpByte
  336. )
  337. {
  338. LPASN1_TYPE_22 lpASN1_22 = (LPASN1_TYPE_22) lpByte;
  339. lpByte = (LPBYTE ) lpASN1_22 + sizeof(ASN1_TYPE_22);
  340. return(lpByte);
  341. }
  342. LPBYTE
  343. FreeNDSSynId23ToNDS23(
  344. LPBYTE lpByte
  345. )
  346. {
  347. LPASN1_TYPE_23 lpASN1_23 = (LPASN1_TYPE_23) lpByte;
  348. if (lpASN1_23->ObjectName) {
  349. FreeADsStr(lpASN1_23->ObjectName);
  350. }
  351. lpByte = (LPBYTE ) lpASN1_23 + sizeof(ASN1_TYPE_23);
  352. return(lpByte);
  353. }
  354. LPBYTE
  355. FreeNDSSynId24ToNDS24(
  356. LPBYTE lpByte
  357. )
  358. {
  359. LPASN1_TYPE_24 lpASN1_24 = (LPASN1_TYPE_24) lpByte;
  360. lpByte = (LPBYTE ) lpASN1_24 + sizeof(ASN1_TYPE_24);
  361. return(lpByte);
  362. }
  363. LPBYTE
  364. FreeNDSSynId25ToNDS25(
  365. LPBYTE lpByte
  366. )
  367. {
  368. LPASN1_TYPE_25 lpASN1_25 = (LPASN1_TYPE_25) lpByte;
  369. if (lpASN1_25->ObjectName) {
  370. FreeADsStr(lpASN1_25->ObjectName);
  371. }
  372. lpByte = (LPBYTE ) lpASN1_25 + sizeof(ASN1_TYPE_25);
  373. return(lpByte);
  374. }
  375. LPBYTE
  376. FreeNDSSynId26ToNDS26(
  377. LPBYTE lpByte
  378. )
  379. {
  380. LPASN1_TYPE_26 lpASN1_26 = (LPASN1_TYPE_26) lpByte;
  381. if (lpASN1_26->ObjectName) {
  382. FreeADsStr(lpASN1_26->ObjectName);
  383. }
  384. lpByte = (LPBYTE ) lpASN1_26 + sizeof(ASN1_TYPE_26);
  385. return(lpByte);
  386. }
  387. LPBYTE
  388. FreeNDSSynId27ToNDS27(
  389. LPBYTE lpByte
  390. )
  391. {
  392. LPASN1_TYPE_27 lpASN1_27 = (LPASN1_TYPE_27) lpByte;
  393. lpByte = (LPBYTE ) lpASN1_27 + sizeof(ASN1_TYPE_27);
  394. return(lpByte);
  395. }
  396. LPBYTE
  397. FreeNDSSynIdToNDS(
  398. DWORD dwSyntaxId,
  399. LPBYTE lpByte
  400. )
  401. {
  402. switch (dwSyntaxId) {
  403. case 1:
  404. lpByte = FreeNDSSynId1ToNDS1(
  405. lpByte
  406. );
  407. break;
  408. case 2:
  409. lpByte = FreeNDSSynId2ToNDS2(
  410. lpByte
  411. );
  412. break;
  413. case 3:
  414. lpByte = FreeNDSSynId3ToNDS3(
  415. lpByte
  416. );
  417. break;
  418. case 4:
  419. lpByte = FreeNDSSynId4ToNDS4(
  420. lpByte
  421. );
  422. break;
  423. case 5:
  424. lpByte = FreeNDSSynId5ToNDS5(
  425. lpByte
  426. );
  427. break;
  428. case 6:
  429. lpByte = FreeNDSSynId6ToNDS6(
  430. lpByte
  431. );
  432. break;
  433. case 7:
  434. lpByte = FreeNDSSynId7ToNDS7(
  435. lpByte
  436. );
  437. break;
  438. case 8:
  439. lpByte = FreeNDSSynId8ToNDS8(
  440. lpByte
  441. );
  442. break;
  443. case 9:
  444. lpByte = FreeNDSSynId9ToNDS9(
  445. lpByte
  446. );
  447. break;
  448. case 10:
  449. lpByte = FreeNDSSynId10ToNDS10(
  450. lpByte
  451. );
  452. break;
  453. case 11:
  454. lpByte = FreeNDSSynId11ToNDS11(
  455. lpByte
  456. );
  457. break;
  458. case 12:
  459. lpByte = FreeNDSSynId12ToNDS12(
  460. lpByte
  461. );
  462. break;
  463. case 13:
  464. lpByte = FreeNDSSynId13ToNDS13(
  465. lpByte
  466. );
  467. break;
  468. case 14:
  469. lpByte = FreeNDSSynId14ToNDS14(
  470. lpByte
  471. );
  472. break;
  473. case 15:
  474. lpByte = FreeNDSSynId15ToNDS15(
  475. lpByte
  476. );
  477. break;
  478. case 16:
  479. lpByte = FreeNDSSynId16ToNDS16(
  480. lpByte
  481. );
  482. break;
  483. case 17:
  484. lpByte = FreeNDSSynId17ToNDS17(
  485. lpByte
  486. );
  487. break;
  488. case 18:
  489. lpByte = FreeNDSSynId18ToNDS18(
  490. lpByte
  491. );
  492. break;
  493. case 19:
  494. lpByte = FreeNDSSynId19ToNDS19(
  495. lpByte
  496. );
  497. break;
  498. case 20:
  499. lpByte = FreeNDSSynId20ToNDS20(
  500. lpByte
  501. );
  502. break;
  503. case 21:
  504. lpByte = FreeNDSSynId21ToNDS21(
  505. lpByte
  506. );
  507. break;
  508. case 22:
  509. lpByte = FreeNDSSynId22ToNDS22(
  510. lpByte
  511. );
  512. break;
  513. case 23:
  514. lpByte = FreeNDSSynId23ToNDS23(
  515. lpByte
  516. );
  517. break;
  518. case 24:
  519. lpByte = FreeNDSSynId24ToNDS24(
  520. lpByte
  521. );
  522. break;
  523. case 25:
  524. lpByte = FreeNDSSynId25ToNDS25(
  525. lpByte
  526. );
  527. break;
  528. case 26:
  529. lpByte = FreeNDSSynId26ToNDS26(
  530. lpByte
  531. );
  532. break;
  533. case 27:
  534. lpByte = FreeNDSSynId27ToNDS27(
  535. lpByte
  536. );
  537. break;
  538. default:
  539. break;
  540. }
  541. return(lpByte);
  542. }
  543. HRESULT
  544. FreeMarshallMemory(
  545. DWORD dwSyntaxId,
  546. DWORD dwNumValues,
  547. LPBYTE lpValue
  548. )
  549. {
  550. DWORD i = 0;
  551. for (i = 0; i < dwNumValues; i++) {
  552. lpValue = FreeNDSSynIdToNDS(
  553. dwSyntaxId,
  554. lpValue
  555. );
  556. }
  557. RRETURN(S_OK);
  558. }