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.

994 lines
24 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: ods2nds.cxx
  7. //
  8. // Contents: NDS Object to Variant Copy Routines
  9. //
  10. // Functions:
  11. //
  12. // History: 25-Apr-96 KrishnaG Created.
  13. //
  14. //
  15. //
  16. //----------------------------------------------------------------------------
  17. #include "nds.hxx"
  18. LPBYTE
  19. AdsTypeCopyDNString(
  20. PADSVALUE lpAdsSrcValue,
  21. PADSVALUE lpAdsDestValue,
  22. LPBYTE lpBuffer
  23. )
  24. {
  25. DWORD dwLength = 0;
  26. if(lpAdsSrcValue->dwType != ADSTYPE_DN_STRING){
  27. return(lpBuffer);
  28. }
  29. lpAdsDestValue->dwType = ADSTYPE_DN_STRING;
  30. lpAdsDestValue->DNString = (LPWSTR)lpBuffer;
  31. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->DNString);
  32. dwLength = (wcslen(lpAdsSrcValue->DNString) + 1)*sizeof(WCHAR);
  33. lpBuffer += dwLength;
  34. return(lpBuffer);
  35. }
  36. LPBYTE
  37. AdsTypeCopyCaseExactString(
  38. PADSVALUE lpAdsSrcValue,
  39. PADSVALUE lpAdsDestValue,
  40. LPBYTE lpBuffer
  41. )
  42. {
  43. DWORD dwLength = 0;
  44. if(lpAdsSrcValue->dwType != ADSTYPE_CASE_EXACT_STRING){
  45. return(lpBuffer);
  46. }
  47. lpAdsDestValue->dwType = ADSTYPE_CASE_EXACT_STRING;
  48. lpAdsDestValue->CaseExactString = (LPWSTR)lpBuffer;
  49. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->CaseExactString);
  50. dwLength = (wcslen(lpAdsSrcValue->CaseExactString) + 1)*sizeof(WCHAR);
  51. lpBuffer += dwLength;
  52. return(lpBuffer);
  53. }
  54. LPBYTE
  55. AdsTypeCopyCaseIgnoreString(
  56. PADSVALUE lpAdsSrcValue,
  57. PADSVALUE lpAdsDestValue,
  58. LPBYTE lpBuffer
  59. )
  60. {
  61. DWORD dwLength = 0;
  62. if(lpAdsSrcValue->dwType != ADSTYPE_CASE_IGNORE_STRING){
  63. return(lpBuffer);
  64. }
  65. lpAdsDestValue->dwType = ADSTYPE_CASE_IGNORE_STRING;
  66. lpAdsDestValue->CaseIgnoreString = (LPWSTR)lpBuffer;
  67. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->CaseIgnoreString);
  68. dwLength = (wcslen(lpAdsSrcValue->CaseIgnoreString) + 1)*sizeof(WCHAR);
  69. lpBuffer += dwLength;
  70. return(lpBuffer);
  71. }
  72. LPBYTE
  73. AdsTypeCopyPrintableString(
  74. PADSVALUE lpAdsSrcValue,
  75. PADSVALUE lpAdsDestValue,
  76. LPBYTE lpBuffer
  77. )
  78. {
  79. DWORD dwLength = 0;
  80. if(lpAdsSrcValue->dwType != ADSTYPE_PRINTABLE_STRING){
  81. return(lpBuffer);
  82. }
  83. lpAdsDestValue->dwType = ADSTYPE_PRINTABLE_STRING;
  84. lpAdsDestValue->PrintableString = (LPWSTR)lpBuffer;
  85. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->PrintableString);
  86. dwLength = (wcslen(lpAdsSrcValue->PrintableString) + 1)*sizeof(WCHAR);
  87. lpBuffer += dwLength;
  88. return(lpBuffer);
  89. }
  90. LPBYTE
  91. AdsTypeCopyNumericString(
  92. PADSVALUE lpAdsSrcValue,
  93. PADSVALUE lpAdsDestValue,
  94. LPBYTE lpBuffer
  95. )
  96. {
  97. DWORD dwLength = 0;
  98. if(lpAdsSrcValue->dwType != ADSTYPE_NUMERIC_STRING){
  99. return(lpBuffer);
  100. }
  101. lpAdsDestValue->dwType = ADSTYPE_NUMERIC_STRING;
  102. lpAdsDestValue->NumericString = (LPWSTR)lpBuffer;
  103. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->NumericString);
  104. dwLength = (wcslen(lpAdsSrcValue->NumericString) + 1)*sizeof(WCHAR);
  105. lpBuffer += dwLength;
  106. return(lpBuffer);
  107. }
  108. LPBYTE
  109. AdsTypeCopyBoolean(
  110. PADSVALUE lpAdsSrcValue,
  111. PADSVALUE lpAdsDestValue,
  112. LPBYTE lpBuffer
  113. )
  114. {
  115. if(lpAdsSrcValue->dwType != ADSTYPE_BOOLEAN){
  116. return(lpBuffer);
  117. }
  118. lpAdsDestValue->dwType = ADSTYPE_BOOLEAN;
  119. lpAdsDestValue->Boolean =
  120. lpAdsSrcValue->Boolean;
  121. return(lpBuffer);
  122. }
  123. LPBYTE
  124. AdsTypeCopyInteger(
  125. PADSVALUE lpAdsSrcValue,
  126. PADSVALUE lpAdsDestValue,
  127. LPBYTE lpBuffer
  128. )
  129. {
  130. if(lpAdsSrcValue->dwType != ADSTYPE_INTEGER){
  131. return(lpBuffer);
  132. }
  133. lpAdsDestValue->dwType = ADSTYPE_INTEGER;
  134. lpAdsDestValue->Integer =
  135. lpAdsSrcValue->Integer;
  136. return(lpBuffer);
  137. }
  138. LPBYTE
  139. AdsTypeCopyOctetString(
  140. PADSVALUE lpAdsSrcValue,
  141. PADSVALUE lpAdsDestValue,
  142. LPBYTE lpBuffer
  143. )
  144. {
  145. LPBYTE lpByteStream = NULL;
  146. DWORD dwNumBytes = 0;
  147. if(lpAdsSrcValue->dwType != ADSTYPE_OCTET_STRING){
  148. return(lpBuffer);
  149. }
  150. lpAdsDestValue->dwType = ADSTYPE_OCTET_STRING;
  151. dwNumBytes = lpAdsSrcValue->OctetString.dwLength;
  152. memcpy(
  153. lpBuffer,
  154. lpAdsSrcValue->OctetString.lpValue,
  155. dwNumBytes
  156. );
  157. lpAdsDestValue->OctetString.dwLength = dwNumBytes;
  158. lpAdsDestValue->OctetString.lpValue = lpBuffer;
  159. lpBuffer += dwNumBytes;
  160. return(lpBuffer);
  161. }
  162. LPBYTE
  163. AdsTypeCopyTime(
  164. PADSVALUE lpAdsSrcValue,
  165. PADSVALUE lpAdsDestValue,
  166. LPBYTE lpBuffer
  167. )
  168. {
  169. if(lpAdsSrcValue->dwType != ADSTYPE_UTC_TIME){
  170. return(lpBuffer);
  171. }
  172. lpAdsDestValue->dwType = ADSTYPE_UTC_TIME;
  173. lpAdsDestValue->UTCTime =
  174. lpAdsSrcValue->UTCTime;
  175. return(lpBuffer);
  176. }
  177. LPBYTE
  178. AdsTypeCopyObjectClass(
  179. PADSVALUE lpAdsSrcValue,
  180. PADSVALUE lpAdsDestValue,
  181. LPBYTE lpBuffer
  182. )
  183. {
  184. DWORD dwLength = 0;
  185. if(lpAdsSrcValue->dwType != ADSTYPE_OBJECT_CLASS){
  186. return(lpBuffer);
  187. }
  188. lpAdsDestValue->dwType = ADSTYPE_OBJECT_CLASS;
  189. lpAdsDestValue->ClassName = (LPWSTR)lpBuffer;
  190. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->ClassName);
  191. dwLength = (wcslen(lpAdsSrcValue->ClassName) + 1)*sizeof(WCHAR);
  192. lpBuffer += dwLength;
  193. return(lpBuffer);
  194. }
  195. //
  196. // New Code
  197. //
  198. LPBYTE
  199. AdsTypeCopyCaseIgnoreList(
  200. PADSVALUE lpAdsSrcValue,
  201. PADSVALUE lpAdsDestValue,
  202. LPBYTE lpBuffer
  203. )
  204. {
  205. DWORD dwLength = 0;
  206. PADS_CASEIGNORE_LIST pAdsNext = lpAdsSrcValue->pCaseIgnoreList;
  207. PADS_CASEIGNORE_LIST pNdsOutput = NULL;
  208. PADS_CASEIGNORE_LIST pNdsCurrent = NULL;
  209. if(lpAdsSrcValue->dwType != ADSTYPE_CASEIGNORE_LIST){
  210. return(lpBuffer);
  211. }
  212. if (lpAdsSrcValue->pCaseIgnoreList == NULL) {
  213. return(lpBuffer);
  214. }
  215. lpAdsDestValue->pCaseIgnoreList = (PADS_CASEIGNORE_LIST)lpBuffer;
  216. lpBuffer+=sizeof(ADS_CASEIGNORE_LIST);
  217. pNdsOutput = lpAdsDestValue->pCaseIgnoreList;
  218. lpAdsDestValue->dwType = ADSTYPE_CASEIGNORE_LIST;
  219. pNdsOutput->String = (LPWSTR)lpBuffer;
  220. wcscpy((LPWSTR)lpBuffer, pAdsNext->String);
  221. dwLength = (wcslen(pAdsNext->String) + 1)*sizeof(WCHAR);
  222. lpBuffer += dwLength;
  223. pAdsNext = pAdsNext->Next;
  224. while (pAdsNext) {
  225. pNdsCurrent = (PADS_CASEIGNORE_LIST)lpBuffer;
  226. lpBuffer += sizeof(ADS_CASEIGNORE_LIST);
  227. pNdsCurrent->String = (LPWSTR)lpBuffer;
  228. wcscpy((LPWSTR)lpBuffer, pAdsNext->String);
  229. dwLength = (wcslen(pAdsNext->String) + 1)*sizeof(WCHAR);
  230. lpBuffer += dwLength;
  231. pNdsOutput->Next = pNdsCurrent;
  232. pNdsOutput = pNdsOutput->Next;
  233. pAdsNext = pAdsNext->Next;
  234. }
  235. pNdsOutput->Next = NULL;
  236. return(lpBuffer);
  237. }
  238. LPBYTE
  239. AdsTypeCopyOctetList(
  240. PADSVALUE lpAdsSrcValue,
  241. PADSVALUE lpAdsDestValue,
  242. LPBYTE lpBuffer
  243. )
  244. {
  245. LPBYTE lpByteStream = NULL;
  246. DWORD dwNumBytes = 0;
  247. DWORD dwLength = 0;
  248. PADS_OCTET_LIST pAdsNext = lpAdsSrcValue->pOctetList;
  249. PADS_OCTET_LIST pNdsOutput = NULL;
  250. PADS_OCTET_LIST pNdsCurrent = NULL;
  251. if(lpAdsSrcValue->dwType != ADSTYPE_OCTET_LIST){
  252. return(lpBuffer);
  253. }
  254. if (lpAdsSrcValue->pOctetList == NULL) {
  255. return(lpBuffer);
  256. }
  257. lpAdsDestValue->dwType = ADSTYPE_OCTET_LIST;
  258. lpAdsDestValue->pOctetList = (PADS_OCTET_LIST)lpBuffer;
  259. lpBuffer+=sizeof(ADS_OCTET_LIST);
  260. pNdsOutput = lpAdsDestValue->pOctetList;
  261. dwNumBytes = pAdsNext->Length;
  262. memcpy(
  263. lpBuffer,
  264. pAdsNext->Data,
  265. dwNumBytes
  266. );
  267. pNdsOutput->Length = dwNumBytes;
  268. pNdsOutput->Data = lpBuffer;
  269. lpBuffer += dwNumBytes;
  270. pAdsNext = pAdsNext->Next;
  271. while (pAdsNext) {
  272. pNdsCurrent = (PADS_OCTET_LIST)lpBuffer;
  273. lpBuffer += sizeof(ADS_OCTET_LIST);
  274. dwNumBytes = pAdsNext->Length;
  275. memcpy(
  276. lpBuffer,
  277. pAdsNext->Data,
  278. dwNumBytes
  279. );
  280. pNdsCurrent->Length = dwNumBytes;
  281. pNdsCurrent->Data = lpBuffer;
  282. lpBuffer += dwNumBytes;
  283. pNdsOutput->Next = pNdsCurrent;
  284. pNdsOutput = pNdsOutput->Next;
  285. pAdsNext = pAdsNext->Next;
  286. }
  287. pNdsOutput->Next = NULL;
  288. return(lpBuffer);
  289. }
  290. LPBYTE
  291. AdsTypeCopyPath(
  292. PADSVALUE lpAdsSrcValue,
  293. PADSVALUE lpAdsDestValue,
  294. LPBYTE lpBuffer
  295. )
  296. {
  297. DWORD dwLength = 0;
  298. if(lpAdsSrcValue->dwType != ADSTYPE_PATH){
  299. return(lpBuffer);
  300. }
  301. if (lpAdsSrcValue->pPath == NULL) {
  302. return(lpBuffer);
  303. }
  304. lpAdsDestValue->dwType = ADSTYPE_PATH;
  305. lpAdsDestValue->pPath = (PADS_PATH)lpBuffer;
  306. lpBuffer+=sizeof(ADS_PATH);
  307. lpAdsDestValue->pPath->Type =
  308. lpAdsSrcValue->pPath->Type;
  309. lpAdsDestValue->pPath->VolumeName = (LPWSTR)lpBuffer;
  310. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->pPath->VolumeName);
  311. dwLength = (wcslen(lpAdsSrcValue->pPath->VolumeName) + 1)*sizeof(WCHAR);
  312. lpBuffer += dwLength;
  313. lpAdsDestValue->pPath->Path= (LPWSTR)lpBuffer;
  314. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->pPath->Path);
  315. dwLength = (wcslen(lpAdsSrcValue->pPath->Path) + 1)*sizeof(WCHAR);
  316. lpBuffer += dwLength;
  317. return(lpBuffer);
  318. }
  319. LPBYTE
  320. AdsTypeCopyPostalAddress(
  321. PADSVALUE lpAdsSrcValue,
  322. PADSVALUE lpAdsDestValue,
  323. LPBYTE lpBuffer
  324. )
  325. {
  326. DWORD dwLength = 0;
  327. long i;
  328. if(lpAdsSrcValue->dwType != ADSTYPE_POSTALADDRESS){
  329. return(lpBuffer);
  330. }
  331. if (lpAdsSrcValue->pPostalAddress == NULL) {
  332. return(lpBuffer);
  333. }
  334. lpAdsDestValue->pPostalAddress = (PADS_POSTALADDRESS)lpBuffer;
  335. lpBuffer+=sizeof(ADS_POSTALADDRESS);
  336. lpAdsDestValue->dwType = ADSTYPE_POSTALADDRESS;
  337. for (i=0;i<6;i++) {
  338. if (lpAdsSrcValue->pPostalAddress->PostalAddress[i]) {
  339. lpAdsDestValue->pPostalAddress->PostalAddress[i] = (LPWSTR)lpBuffer;
  340. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->pPostalAddress->PostalAddress[i]);
  341. dwLength = (wcslen(lpAdsSrcValue->pPostalAddress->PostalAddress[i]) + 1)*sizeof(WCHAR);
  342. lpBuffer += dwLength;
  343. }
  344. else {
  345. lpAdsDestValue->pPostalAddress->PostalAddress[i] = (LPWSTR)lpBuffer;
  346. *((WCHAR*)lpBuffer) = '\0';
  347. lpBuffer += sizeof(WCHAR);
  348. }
  349. }
  350. return(lpBuffer);
  351. }
  352. LPBYTE
  353. AdsTypeCopyTimestamp(
  354. PADSVALUE lpAdsSrcValue,
  355. PADSVALUE lpAdsDestValue,
  356. LPBYTE lpBuffer
  357. )
  358. {
  359. DWORD dwLength = 0;
  360. if(lpAdsSrcValue->dwType != ADSTYPE_TIMESTAMP){
  361. return(lpBuffer);
  362. }
  363. lpAdsDestValue->dwType = ADSTYPE_TIMESTAMP;
  364. lpAdsDestValue->Timestamp.WholeSeconds =
  365. lpAdsSrcValue->Timestamp.WholeSeconds;
  366. lpAdsDestValue->Timestamp.EventID =
  367. lpAdsSrcValue->Timestamp.EventID;
  368. return(lpBuffer);
  369. }
  370. LPBYTE
  371. AdsTypeCopyBackLink(
  372. PADSVALUE lpAdsSrcValue,
  373. PADSVALUE lpAdsDestValue,
  374. LPBYTE lpBuffer
  375. )
  376. {
  377. DWORD dwLength = 0;
  378. if(lpAdsSrcValue->dwType != ADSTYPE_BACKLINK){
  379. return(lpBuffer);
  380. }
  381. lpAdsDestValue->dwType = ADSTYPE_BACKLINK;
  382. lpAdsDestValue->BackLink.RemoteID =
  383. lpAdsSrcValue->BackLink.RemoteID;
  384. lpAdsDestValue->BackLink.ObjectName = (LPWSTR)lpBuffer;
  385. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->BackLink.ObjectName);
  386. dwLength = (wcslen(lpAdsSrcValue->BackLink.ObjectName) + 1)*sizeof(WCHAR);
  387. lpBuffer += dwLength;
  388. return(lpBuffer);
  389. }
  390. LPBYTE
  391. AdsTypeCopyTypedName(
  392. PADSVALUE lpAdsSrcValue,
  393. PADSVALUE lpAdsDestValue,
  394. LPBYTE lpBuffer
  395. )
  396. {
  397. DWORD dwLength = 0;
  398. if(lpAdsSrcValue->dwType != ADSTYPE_TYPEDNAME){
  399. return(lpBuffer);
  400. }
  401. if (lpAdsSrcValue->pTypedName == NULL) {
  402. return(lpBuffer);
  403. }
  404. lpAdsDestValue->dwType = ADSTYPE_TYPEDNAME;
  405. lpAdsDestValue->pTypedName = (PADS_TYPEDNAME)lpBuffer;
  406. lpBuffer+=sizeof(ADS_TYPEDNAME);
  407. lpAdsDestValue->pTypedName->Interval =
  408. lpAdsSrcValue->pTypedName->Interval;
  409. lpAdsDestValue->pTypedName->Level =
  410. lpAdsSrcValue->pTypedName->Level;
  411. lpAdsDestValue->pTypedName->ObjectName = (LPWSTR)lpBuffer;
  412. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->pTypedName->ObjectName);
  413. dwLength = (wcslen(lpAdsSrcValue->pTypedName->ObjectName) + 1)*sizeof(WCHAR);
  414. lpBuffer += dwLength;
  415. return(lpBuffer);
  416. }
  417. LPBYTE
  418. AdsTypeCopyHold(
  419. PADSVALUE lpAdsSrcValue,
  420. PADSVALUE lpAdsDestValue,
  421. LPBYTE lpBuffer
  422. )
  423. {
  424. DWORD dwLength = 0;
  425. if(lpAdsSrcValue->dwType != ADSTYPE_HOLD){
  426. return(lpBuffer);
  427. }
  428. lpAdsDestValue->dwType = ADSTYPE_HOLD;
  429. lpAdsDestValue->Hold.Amount =
  430. lpAdsSrcValue->Hold.Amount;
  431. lpAdsDestValue->Hold.ObjectName = (LPWSTR)lpBuffer;
  432. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->Hold.ObjectName);
  433. dwLength = (wcslen(lpAdsSrcValue->Hold.ObjectName) + 1)*sizeof(WCHAR);
  434. lpBuffer += dwLength;
  435. return(lpBuffer);
  436. }
  437. LPBYTE
  438. AdsTypeCopyEmail(
  439. PADSVALUE lpAdsSrcValue,
  440. PADSVALUE lpAdsDestValue,
  441. LPBYTE lpBuffer
  442. )
  443. {
  444. DWORD dwLength = 0;
  445. if(lpAdsSrcValue->dwType != ADSTYPE_EMAIL){
  446. return(lpBuffer);
  447. }
  448. lpAdsDestValue->dwType = ADSTYPE_EMAIL;
  449. lpAdsDestValue->Email.Type =
  450. lpAdsSrcValue->Email.Type;
  451. lpAdsDestValue->Email.Address = (LPWSTR)lpBuffer;
  452. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->Email.Address);
  453. dwLength = (wcslen(lpAdsSrcValue->Email.Address) + 1)*sizeof(WCHAR);
  454. lpBuffer += dwLength;
  455. return(lpBuffer);
  456. }
  457. LPBYTE
  458. AdsTypeCopyNetAddress(
  459. PADSVALUE lpAdsSrcValue,
  460. PADSVALUE lpAdsDestValue,
  461. LPBYTE lpBuffer
  462. )
  463. {
  464. LPBYTE lpByteStream = NULL;
  465. DWORD dwNumBytes = 0;
  466. DWORD dwLength = 0;
  467. if(lpAdsSrcValue->dwType != ADSTYPE_NETADDRESS){
  468. return(lpBuffer);
  469. }
  470. if (lpAdsSrcValue->pNetAddress == NULL) {
  471. return(lpBuffer);
  472. }
  473. lpAdsDestValue->pNetAddress = (PADS_NETADDRESS)lpBuffer;
  474. lpBuffer+=sizeof(ADS_NETADDRESS);
  475. lpAdsDestValue->dwType = ADSTYPE_NETADDRESS;
  476. lpAdsDestValue->pNetAddress->AddressType =
  477. lpAdsSrcValue->pNetAddress->AddressType;
  478. dwNumBytes = lpAdsSrcValue->pNetAddress->AddressLength;
  479. memcpy(
  480. lpBuffer,
  481. lpAdsSrcValue->pNetAddress->Address,
  482. dwNumBytes
  483. );
  484. lpAdsDestValue->pNetAddress->AddressLength = dwNumBytes;
  485. lpAdsDestValue->pNetAddress->Address = lpBuffer;
  486. lpBuffer += dwNumBytes;
  487. return(lpBuffer);
  488. }
  489. LPBYTE
  490. AdsTypeCopyFaxNumber(
  491. PADSVALUE lpAdsSrcValue,
  492. PADSVALUE lpAdsDestValue,
  493. LPBYTE lpBuffer
  494. )
  495. {
  496. LPBYTE lpByteStream = NULL;
  497. DWORD dwNumBytes = 0;
  498. DWORD dwLength = 0;
  499. if(lpAdsSrcValue->dwType != ADSTYPE_FAXNUMBER){
  500. return(lpBuffer);
  501. }
  502. if (lpAdsSrcValue->pFaxNumber == NULL) {
  503. return(lpBuffer);
  504. }
  505. lpAdsDestValue->pFaxNumber = (PADS_FAXNUMBER)lpBuffer;
  506. lpBuffer+=sizeof(ADS_FAXNUMBER);
  507. lpAdsDestValue->dwType = ADSTYPE_FAXNUMBER;
  508. lpAdsDestValue->pFaxNumber->TelephoneNumber = (LPWSTR)lpBuffer;
  509. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->pFaxNumber->TelephoneNumber);
  510. dwLength = (wcslen(lpAdsSrcValue->pFaxNumber->TelephoneNumber) + 1)*sizeof(WCHAR);
  511. lpBuffer += dwLength;
  512. dwNumBytes = lpAdsSrcValue->pFaxNumber->NumberOfBits;
  513. memcpy(
  514. lpBuffer,
  515. lpAdsSrcValue->pFaxNumber->Parameters,
  516. dwNumBytes
  517. );
  518. lpAdsDestValue->pFaxNumber->NumberOfBits = dwNumBytes;
  519. lpAdsDestValue->pFaxNumber->Parameters = lpBuffer;
  520. lpBuffer += dwNumBytes;
  521. return(lpBuffer);
  522. }
  523. LPBYTE
  524. AdsTypeCopyReplicaPointer(
  525. PADSVALUE lpAdsSrcValue,
  526. PADSVALUE lpAdsDestValue,
  527. LPBYTE lpBuffer
  528. )
  529. {
  530. LPBYTE lpByteStream = NULL;
  531. DWORD dwNumBytes = 0;
  532. DWORD dwLength = 0;
  533. if(lpAdsSrcValue->dwType != ADSTYPE_REPLICAPOINTER){
  534. return(lpBuffer);
  535. }
  536. if (lpAdsSrcValue->pReplicaPointer == NULL) {
  537. return(lpBuffer);
  538. }
  539. lpAdsDestValue->pReplicaPointer = (PADS_REPLICAPOINTER)lpBuffer;
  540. lpBuffer+=sizeof(ADS_REPLICAPOINTER);
  541. lpAdsDestValue->dwType = ADSTYPE_REPLICAPOINTER;
  542. lpAdsDestValue->pReplicaPointer->ReplicaType =
  543. lpAdsSrcValue->pReplicaPointer->ReplicaType;
  544. lpAdsDestValue->pReplicaPointer->ReplicaNumber =
  545. lpAdsSrcValue->pReplicaPointer->ReplicaNumber;
  546. lpAdsDestValue->pReplicaPointer->Count =
  547. lpAdsSrcValue->pReplicaPointer->Count;
  548. lpAdsDestValue->pReplicaPointer->ServerName = (LPWSTR)lpBuffer;
  549. wcscpy((LPWSTR)lpBuffer, lpAdsSrcValue->pReplicaPointer->ServerName);
  550. dwLength = (wcslen(lpAdsSrcValue->pReplicaPointer->ServerName) + 1)*sizeof(WCHAR);
  551. lpBuffer += dwLength;
  552. lpAdsDestValue->pReplicaPointer->ReplicaAddressHints = (ADS_NETADDRESS*)lpBuffer;
  553. lpBuffer += sizeof(ADS_NETADDRESS);
  554. lpAdsDestValue->pReplicaPointer->ReplicaAddressHints->AddressType =
  555. lpAdsSrcValue->pReplicaPointer->ReplicaAddressHints->AddressType;
  556. dwNumBytes = lpAdsSrcValue->pReplicaPointer->ReplicaAddressHints->AddressLength;
  557. memcpy(
  558. lpBuffer,
  559. lpAdsSrcValue->pReplicaPointer->ReplicaAddressHints->Address,
  560. dwNumBytes
  561. );
  562. lpAdsDestValue->pReplicaPointer->ReplicaAddressHints->AddressLength = dwNumBytes;
  563. lpAdsDestValue->pReplicaPointer->ReplicaAddressHints->Address = lpBuffer;
  564. lpBuffer += dwNumBytes;
  565. return(lpBuffer);
  566. }
  567. //
  568. // END OF NEW CODE
  569. //
  570. LPBYTE
  571. AdsTypeCopy(
  572. PADSVALUE lpAdsSrcValue,
  573. PADSVALUE lpAdsDestValue,
  574. LPBYTE lpBuffer
  575. )
  576. {
  577. switch (lpAdsSrcValue->dwType){
  578. case ADSTYPE_DN_STRING:
  579. lpBuffer = AdsTypeCopyDNString(
  580. lpAdsSrcValue,
  581. lpAdsDestValue,
  582. lpBuffer
  583. );
  584. break;
  585. case ADSTYPE_CASE_EXACT_STRING:
  586. lpBuffer = AdsTypeCopyCaseExactString(
  587. lpAdsSrcValue,
  588. lpAdsDestValue,
  589. lpBuffer
  590. );
  591. break;
  592. case ADSTYPE_CASE_IGNORE_STRING:
  593. lpBuffer = AdsTypeCopyCaseIgnoreString(
  594. lpAdsSrcValue,
  595. lpAdsDestValue,
  596. lpBuffer
  597. );
  598. break;
  599. case ADSTYPE_PRINTABLE_STRING:
  600. lpBuffer = AdsTypeCopyPrintableString(
  601. lpAdsSrcValue,
  602. lpAdsDestValue,
  603. lpBuffer
  604. );
  605. break;
  606. case ADSTYPE_NUMERIC_STRING:
  607. lpBuffer = AdsTypeCopyNumericString(
  608. lpAdsSrcValue,
  609. lpAdsDestValue,
  610. lpBuffer
  611. );
  612. break;
  613. case ADSTYPE_BOOLEAN:
  614. lpBuffer = AdsTypeCopyBoolean(
  615. lpAdsSrcValue,
  616. lpAdsDestValue,
  617. lpBuffer
  618. );
  619. break;
  620. case ADSTYPE_INTEGER:
  621. lpBuffer = AdsTypeCopyInteger(
  622. lpAdsSrcValue,
  623. lpAdsDestValue,
  624. lpBuffer
  625. );
  626. break;
  627. case ADSTYPE_OCTET_STRING:
  628. lpBuffer = AdsTypeCopyOctetString(
  629. lpAdsSrcValue,
  630. lpAdsDestValue,
  631. lpBuffer
  632. );
  633. break;
  634. case ADSTYPE_UTC_TIME:
  635. lpBuffer = AdsTypeCopyTime(
  636. lpAdsSrcValue,
  637. lpAdsDestValue,
  638. lpBuffer
  639. );
  640. break;
  641. case ADSTYPE_OBJECT_CLASS:
  642. lpBuffer = AdsTypeCopyObjectClass(
  643. lpAdsSrcValue,
  644. lpAdsDestValue,
  645. lpBuffer
  646. );
  647. break;
  648. case ADSTYPE_CASEIGNORE_LIST:
  649. lpBuffer = AdsTypeCopyCaseIgnoreList(
  650. lpAdsSrcValue,
  651. lpAdsDestValue,
  652. lpBuffer
  653. );
  654. break;
  655. case ADSTYPE_FAXNUMBER:
  656. lpBuffer = AdsTypeCopyFaxNumber(
  657. lpAdsSrcValue,
  658. lpAdsDestValue,
  659. lpBuffer
  660. );
  661. break;
  662. case ADSTYPE_NETADDRESS:
  663. lpBuffer = AdsTypeCopyNetAddress(
  664. lpAdsSrcValue,
  665. lpAdsDestValue,
  666. lpBuffer
  667. );
  668. break;
  669. case ADSTYPE_OCTET_LIST:
  670. lpBuffer = AdsTypeCopyOctetList(
  671. lpAdsSrcValue,
  672. lpAdsDestValue,
  673. lpBuffer
  674. );
  675. break;
  676. case ADSTYPE_EMAIL:
  677. lpBuffer = AdsTypeCopyEmail(
  678. lpAdsSrcValue,
  679. lpAdsDestValue,
  680. lpBuffer
  681. );
  682. break;
  683. case ADSTYPE_PATH:
  684. lpBuffer = AdsTypeCopyPath(
  685. lpAdsSrcValue,
  686. lpAdsDestValue,
  687. lpBuffer
  688. );
  689. break;
  690. case ADSTYPE_REPLICAPOINTER:
  691. lpBuffer = AdsTypeCopyReplicaPointer(
  692. lpAdsSrcValue,
  693. lpAdsDestValue,
  694. lpBuffer
  695. );
  696. break;
  697. case ADSTYPE_TIMESTAMP:
  698. lpBuffer = AdsTypeCopyTimestamp(
  699. lpAdsSrcValue,
  700. lpAdsDestValue,
  701. lpBuffer
  702. );
  703. break;
  704. case ADSTYPE_POSTALADDRESS:
  705. lpBuffer = AdsTypeCopyPostalAddress(
  706. lpAdsSrcValue,
  707. lpAdsDestValue,
  708. lpBuffer
  709. );
  710. break;
  711. case ADSTYPE_BACKLINK:
  712. lpBuffer = AdsTypeCopyBackLink(
  713. lpAdsSrcValue,
  714. lpAdsDestValue,
  715. lpBuffer
  716. );
  717. break;
  718. case ADSTYPE_TYPEDNAME:
  719. lpBuffer = AdsTypeCopyTypedName(
  720. lpAdsSrcValue,
  721. lpAdsDestValue,
  722. lpBuffer
  723. );
  724. break;
  725. case ADSTYPE_HOLD:
  726. lpBuffer = AdsTypeCopyHold(
  727. lpAdsSrcValue,
  728. lpAdsDestValue,
  729. lpBuffer
  730. );
  731. break;
  732. default:
  733. break;
  734. }
  735. return(lpBuffer);
  736. }