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.

1672 lines
48 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <dnsapi.h>
  8. VOID
  9. GetStringA( char * );
  10. VOID
  11. GetStringW( WCHAR * );
  12. VOID
  13. PrintMenu( VOID );
  14. VOID
  15. DoInitialize( VOID );
  16. VOID
  17. DoTerminate( VOID );
  18. VOID
  19. DoRegisterWithPTR( VOID );
  20. VOID
  21. DoDeregisterWithPTR( VOID );
  22. VOID
  23. DoRegisterWithoutPTR( VOID );
  24. VOID
  25. DoDeregisterWithoutPTR( VOID );
  26. VOID
  27. DoRASRegisterWithPTR( VOID );
  28. VOID
  29. DoRASDeregisterWithPTR( VOID );
  30. VOID
  31. DoRemoveInterface( VOID );
  32. VOID
  33. DoMATAddSim( VOID );
  34. VOID
  35. DoMATAddDis( VOID );
  36. VOID
  37. DoMATAddMul( VOID );
  38. VOID
  39. DoMATModSim( VOID );
  40. VOID
  41. DoMATModDis( VOID );
  42. VOID
  43. DoMATModMul( VOID );
  44. VOID
  45. DoMATAddMulNTTEST( VOID );
  46. VOID
  47. PrintIpAddress ( DWORD IpAddress );
  48. _cdecl
  49. main(int argc, char **argv)
  50. {
  51. char String[256];
  52. Menu :
  53. PrintMenu();
  54. GetStringA( String );
  55. printf( "\n" );
  56. switch( atoi( String ) )
  57. {
  58. case 1 :
  59. DoInitialize();
  60. break;
  61. case 2 :
  62. DoTerminate();
  63. break;
  64. case 3 :
  65. DoRegisterWithPTR();
  66. break;
  67. case 4 :
  68. DoDeregisterWithPTR();
  69. break;
  70. case 5 :
  71. DoRegisterWithoutPTR();
  72. break;
  73. case 6 :
  74. DoDeregisterWithoutPTR();
  75. break;
  76. case 7 :
  77. DoRASRegisterWithPTR();
  78. break;
  79. case 8 :
  80. DoRASDeregisterWithPTR();
  81. break;
  82. case 9 :
  83. DoRemoveInterface();
  84. break;
  85. case 10 :
  86. DoMATAddSim();
  87. break;
  88. case 11 :
  89. DoMATAddDis();
  90. break;
  91. case 12 :
  92. DoMATAddMul();
  93. break;
  94. case 13 :
  95. DoMATModSim();
  96. break;
  97. case 14 :
  98. DoMATModDis();
  99. break;
  100. case 15 :
  101. DoMATModMul();
  102. break;
  103. case 16 :
  104. DoMATAddMulNTTEST();
  105. break;
  106. case 17 :
  107. DoTerminate();
  108. return( -1 );
  109. default :
  110. printf( "Invalid option\n" );
  111. }
  112. goto Menu;
  113. }
  114. VOID
  115. GetStringA( char * String )
  116. {
  117. WORD iter = 0;
  118. char ch = (char) getchar();
  119. while ( ch != 0x0a )
  120. {
  121. String[iter] = ch;
  122. ch = (char) getchar();
  123. iter++;
  124. }
  125. String[iter] = 0;
  126. }
  127. VOID
  128. GetStringW( WCHAR * String )
  129. {
  130. WORD iter = 0;
  131. WCHAR ch = (WCHAR) getchar();
  132. while ( ch != 0x0a )
  133. {
  134. String[iter] = ch;
  135. ch = (WCHAR) getchar();
  136. iter++;
  137. }
  138. String[iter] = 0;
  139. }
  140. VOID
  141. PrintMenu( VOID )
  142. {
  143. printf( "\n" );
  144. printf( "------------------------------------------------------\n" );
  145. printf( "| DHCP Asyncronous Registration Test Tool |\n" );
  146. printf( "------------------------------------------------------\n" );
  147. printf( "| |\n" );
  148. printf( "| 1) Initialize Asyncronous Registration API |\n" );
  149. printf( "| 2) Terminate Asyncronous Registration API |\n" );
  150. printf( "| 3) Register entry (with PTR) |\n" );
  151. printf( "| 4) Deregister entry (with PTR) |\n" );
  152. printf( "| 5) Register entry (without PTR) |\n" );
  153. printf( "| 6) Deregister entry (without PTR) |\n" );
  154. printf( "| 7) Register entry (RAS with PTR) |\n" );
  155. printf( "| 8) Deregister entry (RAS with PTR) |\n" );
  156. printf( "| 9) Remove interface |\n" );
  157. printf( "| 10) Multi-adapter test (Add - all similar) |\n" );
  158. printf( "| 11) Multi-adapter test (Add - disjoint) |\n" );
  159. printf( "| 12) Multi-adapter test (Add - multi-master) |\n" );
  160. printf( "| 13) Multi-adapter test (Mod - all similar) |\n" );
  161. printf( "| 14) Multi-adapter test (Mod - disjoint) |\n" );
  162. printf( "| 15) Multi-adapter test (Mod - multi-master) |\n" );
  163. printf( "| 16) Multi-adapter test (Mod NT Test - multi-master)|\n" );
  164. printf( "| 17) Quit |\n" );
  165. printf( "| |\n" );
  166. printf( ">>> " );
  167. }
  168. VOID
  169. PrintIpAddress ( DWORD IpAddress )
  170. {
  171. printf( " %d.%d.%d.%d\n",
  172. ((BYTE *) &IpAddress)[0],
  173. ((BYTE *) &IpAddress)[1],
  174. ((BYTE *) &IpAddress)[2],
  175. ((BYTE *) &IpAddress)[3] );
  176. }
  177. VOID
  178. DoInitialize( VOID )
  179. {
  180. DNS_STATUS Status = NO_ERROR;
  181. Status = DnsAsyncRegisterInit( NULL );
  182. printf( "DnsAsyncRegisterInit() returned: 0x%x\n", Status );
  183. }
  184. VOID
  185. DoTerminate( VOID )
  186. {
  187. DNS_STATUS Status = NO_ERROR;
  188. Status = DnsAsyncRegisterTerm();
  189. printf( "DnsAsyncRegisterTerm() returned: 0x%x\n", Status );
  190. }
  191. VOID
  192. DoRegisterWithPTR( VOID )
  193. {
  194. DNS_STATUS Status = NO_ERROR;
  195. char AdapterName[256];
  196. char HostName[256];
  197. char DomainName[256];
  198. char Address[500];
  199. LPSTR lpTemp = NULL;
  200. DWORD Part1, Part2, Part3, Part4;
  201. char seps[]=" ,\t\n";
  202. char* token;
  203. INT ipAddrCount;
  204. DWORD length, len;
  205. IP_ADDRESS ServerList[15];
  206. DWORD ServerListCount;
  207. REGISTER_HOST_ENTRY HostAddrs[5];
  208. REGISTER_HOST_STATUS RegisterStatus;
  209. if (!(RegisterStatus.hDoneEvent = CreateEventA( NULL,
  210. TRUE,
  211. FALSE,
  212. NULL)))
  213. {
  214. Status = GetLastError();
  215. printf( "Cant create event.\n" );
  216. printf ( "GetLastError() returned %x\n", Status );
  217. exit(1);
  218. }
  219. printf( "Adapter Name: " );
  220. GetStringA( AdapterName );
  221. printf( "\n" );
  222. printf( "Host Name: " );
  223. GetStringA( HostName );
  224. printf( "\n" );
  225. printf( "Domain Name: " );
  226. GetStringA( DomainName );
  227. printf( "\n" );
  228. printf( "IP Address(es): " );
  229. GetStringA( Address );
  230. printf( "\n" );
  231. ipAddrCount = 0;
  232. length = strlen( Address );
  233. token = strtok(Address, seps);
  234. if ( token )
  235. len = (DWORD) (token - Address);
  236. while ( token != NULL)
  237. {
  238. len += strlen( token ) + 1;
  239. lpTemp = strtok( token, "." );
  240. Part1 = atoi( lpTemp );
  241. lpTemp = strtok( NULL, "." );
  242. Part2 = atoi( lpTemp );
  243. lpTemp = strtok( NULL, "." );
  244. Part3 = atoi( lpTemp );
  245. lpTemp = strtok( NULL, "." );
  246. Part4 = atoi( lpTemp );
  247. printf( "\nRegistering DNS record for:\n" );
  248. printf("AdapterName = %s\n", AdapterName);
  249. printf("HostName = %s\n", HostName);
  250. printf("DomainName = %s\n", DomainName);
  251. printf( "Address: %d.%d.%d.%d\n", Part1, Part2, Part3, Part4 );
  252. HostAddrs[ipAddrCount].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  253. HostAddrs[ipAddrCount].Addr.ipAddr = (DWORD)(Part1) +
  254. (DWORD)(Part2 << 8) +
  255. (DWORD)(Part3 << 16) +
  256. (DWORD)(Part4 << 24);
  257. ipAddrCount++;
  258. if ( len < length )
  259. lpTemp = &Address[len];
  260. else
  261. lpTemp = NULL;
  262. token = strtok(lpTemp, seps);
  263. if ( token )
  264. len = (DWORD) (token - Address);
  265. }
  266. printf( "Server Address(es): " );
  267. GetStringA( Address );
  268. printf( "\n" );
  269. ServerListCount = 0;
  270. length = strlen( Address );
  271. token = strtok(Address, seps);
  272. if ( token )
  273. len = (DWORD) (token - Address);
  274. while ( token != NULL)
  275. {
  276. len += strlen( token ) + 1;
  277. lpTemp = strtok( token, "." );
  278. Part1 = atoi( lpTemp );
  279. lpTemp = strtok( NULL, "." );
  280. Part2 = atoi( lpTemp );
  281. lpTemp = strtok( NULL, "." );
  282. Part3 = atoi( lpTemp );
  283. lpTemp = strtok( NULL, "." );
  284. Part4 = atoi( lpTemp );
  285. ServerList[ServerListCount] = (DWORD)(Part1) +
  286. (DWORD)(Part2 << 8) +
  287. (DWORD)(Part3 << 16) +
  288. (DWORD)(Part4 << 24);
  289. ServerListCount++;
  290. if ( len < length )
  291. lpTemp = &Address[len];
  292. else
  293. lpTemp = NULL;
  294. token = strtok(lpTemp, seps);
  295. if ( token )
  296. len = (DWORD) (token - Address);
  297. }
  298. Status = DnsAsyncRegisterHostAddrs_A( AdapterName,
  299. HostName,
  300. HostAddrs,
  301. ipAddrCount,
  302. ServerList,
  303. ServerListCount,
  304. DomainName,
  305. &RegisterStatus,
  306. 300,
  307. DYNDNS_REG_PTR );
  308. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  309. if ( Status == NO_ERROR )
  310. {
  311. Status = WaitForSingleObject( RegisterStatus.hDoneEvent, INFINITE ) ;
  312. if ( Status != WAIT_OBJECT_0 )
  313. {
  314. printf( "DnsAsyncRegisterHostAddrs failed with %x.\n", Status ) ;
  315. exit(1) ;
  316. }
  317. else
  318. {
  319. printf( "DnsAsyncRegisterHostAddrs completes with: %x.\n",
  320. RegisterStatus.dwStatus ) ;
  321. }
  322. }
  323. }
  324. VOID
  325. DoDeregisterWithPTR( VOID )
  326. {
  327. DNS_STATUS Status = NO_ERROR;
  328. char AdapterName[256];
  329. char HostName[256];
  330. char DomainName[256];
  331. char Address[500];
  332. LPSTR lpTemp = NULL;
  333. DWORD Part1, Part2, Part3, Part4;
  334. char seps[]=" ,\t\n";
  335. char* token;
  336. INT ipAddrCount;
  337. DWORD length, len;
  338. IP_ADDRESS ServerList[15];
  339. DWORD ServerListCount;
  340. REGISTER_HOST_ENTRY HostAddrs[5];
  341. REGISTER_HOST_STATUS RegisterStatus;
  342. if (!(RegisterStatus.hDoneEvent = CreateEventA( NULL,
  343. TRUE,
  344. FALSE,
  345. NULL)))
  346. {
  347. Status = GetLastError();
  348. printf( "Cant create event.\n" );
  349. printf ( "GetLastError() returned %x\n", Status );
  350. exit(1);
  351. }
  352. printf( "Adapter Name: " );
  353. GetStringA( AdapterName );
  354. printf( "\n" );
  355. printf( "Host Name: " );
  356. GetStringA( HostName );
  357. printf( "\n" );
  358. printf( "Domain Name: " );
  359. GetStringA( DomainName );
  360. printf( "\n" );
  361. printf( "IP Address(es): " );
  362. GetStringA( Address );
  363. printf( "\n" );
  364. ipAddrCount = 0;
  365. length = strlen( Address );
  366. token = strtok(Address, seps);
  367. if ( token )
  368. len = (DWORD) (token - Address);
  369. while ( token != NULL)
  370. {
  371. len += strlen( token ) + 1;
  372. lpTemp = strtok( token, "." );
  373. Part1 = atoi( lpTemp );
  374. lpTemp = strtok( NULL, "." );
  375. Part2 = atoi( lpTemp );
  376. lpTemp = strtok( NULL, "." );
  377. Part3 = atoi( lpTemp );
  378. lpTemp = strtok( NULL, "." );
  379. Part4 = atoi( lpTemp );
  380. printf( "\nRegistering DNS record for:\n" );
  381. printf("AdapterName = %s\n", AdapterName);
  382. printf("HostName = %s\n", HostName);
  383. printf("DomainName = %s\n", DomainName);
  384. printf( "Address: %d.%d.%d.%d\n", Part1, Part2, Part3, Part4 );
  385. HostAddrs[ipAddrCount].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  386. HostAddrs[ipAddrCount].Addr.ipAddr = (DWORD)(Part1) +
  387. (DWORD)(Part2 << 8) +
  388. (DWORD)(Part3 << 16) +
  389. (DWORD)(Part4 << 24);
  390. ipAddrCount++;
  391. if ( len < length )
  392. lpTemp = &Address[len];
  393. else
  394. lpTemp = NULL;
  395. token = strtok(lpTemp, seps);
  396. if ( token )
  397. len = (DWORD) (token - Address);
  398. }
  399. printf( "Server Address(es): " );
  400. GetStringA( Address );
  401. printf( "\n" );
  402. ServerListCount = 0;
  403. length = strlen( Address );
  404. token = strtok(Address, seps);
  405. if ( token )
  406. len = (DWORD) (token - Address);
  407. while ( token != NULL)
  408. {
  409. len += strlen( token ) + 1;
  410. lpTemp = strtok( token, "." );
  411. Part1 = atoi( lpTemp );
  412. lpTemp = strtok( NULL, "." );
  413. Part2 = atoi( lpTemp );
  414. lpTemp = strtok( NULL, "." );
  415. Part3 = atoi( lpTemp );
  416. lpTemp = strtok( NULL, "." );
  417. Part4 = atoi( lpTemp );
  418. ServerList[ServerListCount] = (DWORD)(Part1) +
  419. (DWORD)(Part2 << 8) +
  420. (DWORD)(Part3 << 16) +
  421. (DWORD)(Part4 << 24);
  422. ServerListCount++;
  423. if ( len < length )
  424. lpTemp = &Address[len];
  425. else
  426. lpTemp = NULL;
  427. token = strtok(lpTemp, seps);
  428. if ( token )
  429. len = (DWORD) (token - Address);
  430. }
  431. Status = DnsAsyncRegisterHostAddrs_A( AdapterName,
  432. HostName,
  433. HostAddrs,
  434. ipAddrCount,
  435. ServerList,
  436. ServerListCount,
  437. DomainName,
  438. &RegisterStatus,
  439. 300,
  440. DYNDNS_REG_PTR |
  441. DYNDNS_DEL_ENTRY );
  442. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  443. if ( Status == NO_ERROR )
  444. {
  445. Status = WaitForSingleObject( RegisterStatus.hDoneEvent, INFINITE ) ;
  446. if ( Status != WAIT_OBJECT_0 )
  447. {
  448. printf( "DnsAsyncRegisterHostAddrs failed with %x.\n", Status ) ;
  449. exit(1) ;
  450. }
  451. else
  452. {
  453. printf( "DnsAsyncRegisterHostAddrs completes with: %x.\n",
  454. RegisterStatus.dwStatus ) ;
  455. }
  456. }
  457. }
  458. VOID
  459. DoRegisterWithoutPTR( VOID )
  460. {
  461. DNS_STATUS Status = NO_ERROR;
  462. char AdapterName[256];
  463. char HostName[256];
  464. char DomainName[256];
  465. char Address[500];
  466. LPSTR lpTemp = NULL;
  467. DWORD Part1, Part2, Part3, Part4;
  468. char seps[]=" ,\t\n";
  469. char* token;
  470. INT ipAddrCount;
  471. DWORD length, len;
  472. IP_ADDRESS ServerList[15];
  473. DWORD ServerListCount;
  474. REGISTER_HOST_ENTRY HostAddrs[5];
  475. REGISTER_HOST_STATUS RegisterStatus;
  476. if (!(RegisterStatus.hDoneEvent = CreateEventA( NULL,
  477. TRUE,
  478. FALSE,
  479. NULL)))
  480. {
  481. Status = GetLastError();
  482. printf( "Cant create event.\n" );
  483. printf ( "GetLastError() returned %x\n", Status );
  484. exit(1);
  485. }
  486. printf( "Adapter Name: " );
  487. GetStringA( AdapterName );
  488. printf( "\n" );
  489. printf( "Host Name: " );
  490. GetStringA( HostName );
  491. printf( "\n" );
  492. printf( "Domain Name: " );
  493. GetStringA( DomainName );
  494. printf( "\n" );
  495. printf( "IP Address(es): " );
  496. GetStringA( Address );
  497. printf( "\n" );
  498. ipAddrCount = 0;
  499. length = strlen( Address );
  500. token = strtok(Address, seps);
  501. if ( token )
  502. len = (DWORD) (token - Address);
  503. while ( token != NULL)
  504. {
  505. len += strlen( token ) + 1;
  506. lpTemp = strtok( token, "." );
  507. Part1 = atoi( lpTemp );
  508. lpTemp = strtok( NULL, "." );
  509. Part2 = atoi( lpTemp );
  510. lpTemp = strtok( NULL, "." );
  511. Part3 = atoi( lpTemp );
  512. lpTemp = strtok( NULL, "." );
  513. Part4 = atoi( lpTemp );
  514. printf( "\nRegistering DNS record for:\n" );
  515. printf("AdapterName = %s\n", AdapterName);
  516. printf("HostName = %s\n", HostName);
  517. printf("DomainName = %s\n", DomainName);
  518. printf( "Address: %d.%d.%d.%d\n", Part1, Part2, Part3, Part4 );
  519. HostAddrs[ipAddrCount].dwOptions = REGISTER_HOST_A;
  520. HostAddrs[ipAddrCount].Addr.ipAddr = (DWORD)(Part1) +
  521. (DWORD)(Part2 << 8) +
  522. (DWORD)(Part3 << 16) +
  523. (DWORD)(Part4 << 24);
  524. ipAddrCount++;
  525. if ( len < length )
  526. lpTemp = &Address[len];
  527. else
  528. lpTemp = NULL;
  529. token = strtok(lpTemp, seps);
  530. if ( token )
  531. len = (DWORD) (token - Address);
  532. }
  533. printf( "Server Address(es): " );
  534. GetStringA( Address );
  535. printf( "\n" );
  536. ServerListCount = 0;
  537. length = strlen( Address );
  538. token = strtok(Address, seps);
  539. if ( token )
  540. len = (DWORD) (token - Address);
  541. while ( token != NULL)
  542. {
  543. len += strlen( token ) + 1;
  544. lpTemp = strtok( token, "." );
  545. Part1 = atoi( lpTemp );
  546. lpTemp = strtok( NULL, "." );
  547. Part2 = atoi( lpTemp );
  548. lpTemp = strtok( NULL, "." );
  549. Part3 = atoi( lpTemp );
  550. lpTemp = strtok( NULL, "." );
  551. Part4 = atoi( lpTemp );
  552. ServerList[ServerListCount] = (DWORD)(Part1) +
  553. (DWORD)(Part2 << 8) +
  554. (DWORD)(Part3 << 16) +
  555. (DWORD)(Part4 << 24);
  556. ServerListCount++;
  557. if ( len < length )
  558. lpTemp = &Address[len];
  559. else
  560. lpTemp = NULL;
  561. token = strtok(lpTemp, seps);
  562. if ( token )
  563. len = (DWORD) (token - Address);
  564. }
  565. Status = DnsAsyncRegisterHostAddrs_A( AdapterName,
  566. HostName,
  567. HostAddrs,
  568. ipAddrCount,
  569. ServerList,
  570. ServerListCount,
  571. DomainName,
  572. &RegisterStatus,
  573. 300,
  574. 0 );
  575. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  576. if ( Status == NO_ERROR )
  577. {
  578. Status = WaitForSingleObject( RegisterStatus.hDoneEvent, INFINITE ) ;
  579. if ( Status != WAIT_OBJECT_0 )
  580. {
  581. printf( "DnsAsyncRegisterHostAddrs failed with %x.\n", Status ) ;
  582. exit(1) ;
  583. }
  584. else
  585. {
  586. printf( "DnsAsyncRegisterHostAddrs completes with: %x.\n",
  587. RegisterStatus.dwStatus ) ;
  588. }
  589. }
  590. }
  591. VOID
  592. DoDeregisterWithoutPTR( VOID )
  593. {
  594. DNS_STATUS Status = NO_ERROR;
  595. char AdapterName[256];
  596. char HostName[256];
  597. char DomainName[256];
  598. char Address[500];
  599. LPSTR lpTemp = NULL;
  600. DWORD Part1, Part2, Part3, Part4;
  601. char seps[]=" ,\t\n";
  602. char* token;
  603. INT ipAddrCount;
  604. DWORD length, len;
  605. IP_ADDRESS ServerList[15];
  606. DWORD ServerListCount;
  607. REGISTER_HOST_ENTRY HostAddrs[5];
  608. REGISTER_HOST_STATUS RegisterStatus;
  609. if (!(RegisterStatus.hDoneEvent = CreateEventA( NULL,
  610. TRUE,
  611. FALSE,
  612. NULL)))
  613. {
  614. Status = GetLastError();
  615. printf( "Cant create event.\n" );
  616. printf ( "GetLastError() returned %x\n", Status );
  617. exit(1);
  618. }
  619. printf( "Adapter Name: " );
  620. GetStringA( AdapterName );
  621. printf( "\n" );
  622. printf( "Host Name: " );
  623. GetStringA( HostName );
  624. printf( "\n" );
  625. printf( "Domain Name: " );
  626. GetStringA( DomainName );
  627. printf( "\n" );
  628. printf( "IP Address(es): " );
  629. GetStringA( Address );
  630. printf( "\n" );
  631. ipAddrCount = 0;
  632. length = strlen( Address );
  633. token = strtok(Address, seps);
  634. if ( token )
  635. len = (DWORD) (token - Address);
  636. while ( token != NULL)
  637. {
  638. len += strlen( token ) + 1;
  639. lpTemp = strtok( token, "." );
  640. Part1 = atoi( lpTemp );
  641. lpTemp = strtok( NULL, "." );
  642. Part2 = atoi( lpTemp );
  643. lpTemp = strtok( NULL, "." );
  644. Part3 = atoi( lpTemp );
  645. lpTemp = strtok( NULL, "." );
  646. Part4 = atoi( lpTemp );
  647. printf( "\nRegistering DNS record for:\n" );
  648. printf("AdapterName = %s\n", AdapterName);
  649. printf("HostName = %s\n", HostName);
  650. printf("DomainName = %s\n", DomainName);
  651. printf( "Address: %d.%d.%d.%d\n", Part1, Part2, Part3, Part4 );
  652. HostAddrs[ipAddrCount].dwOptions = REGISTER_HOST_A;
  653. HostAddrs[ipAddrCount].Addr.ipAddr = (DWORD)(Part1) +
  654. (DWORD)(Part2 << 8) +
  655. (DWORD)(Part3 << 16) +
  656. (DWORD)(Part4 << 24);
  657. ipAddrCount++;
  658. if ( len < length )
  659. lpTemp = &Address[len];
  660. else
  661. lpTemp = NULL;
  662. token = strtok(lpTemp, seps);
  663. if ( token )
  664. len = (DWORD) (token - Address);
  665. }
  666. printf( "Server Address(es): " );
  667. GetStringA( Address );
  668. printf( "\n" );
  669. ServerListCount = 0;
  670. length = strlen( Address );
  671. token = strtok(Address, seps);
  672. if ( token )
  673. len = (DWORD) (token - Address);
  674. while ( token != NULL)
  675. {
  676. len += strlen( token ) + 1;
  677. lpTemp = strtok( token, "." );
  678. Part1 = atoi( lpTemp );
  679. lpTemp = strtok( NULL, "." );
  680. Part2 = atoi( lpTemp );
  681. lpTemp = strtok( NULL, "." );
  682. Part3 = atoi( lpTemp );
  683. lpTemp = strtok( NULL, "." );
  684. Part4 = atoi( lpTemp );
  685. ServerList[ServerListCount] = (DWORD)(Part1) +
  686. (DWORD)(Part2 << 8) +
  687. (DWORD)(Part3 << 16) +
  688. (DWORD)(Part4 << 24);
  689. ServerListCount++;
  690. if ( len < length )
  691. lpTemp = &Address[len];
  692. else
  693. lpTemp = NULL;
  694. token = strtok(lpTemp, seps);
  695. if ( token )
  696. len = (DWORD) (token - Address);
  697. }
  698. Status = DnsAsyncRegisterHostAddrs_A( AdapterName,
  699. HostName,
  700. HostAddrs,
  701. ipAddrCount,
  702. ServerList,
  703. ServerListCount,
  704. DomainName,
  705. &RegisterStatus,
  706. 300,
  707. DYNDNS_DEL_ENTRY );
  708. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  709. if ( Status == NO_ERROR )
  710. {
  711. Status = WaitForSingleObject( RegisterStatus.hDoneEvent, INFINITE ) ;
  712. if ( Status != WAIT_OBJECT_0 )
  713. {
  714. printf( "DnsAsyncRegisterHostAddrs failed with %x.\n", Status ) ;
  715. exit(1) ;
  716. }
  717. else
  718. {
  719. printf( "DnsAsyncRegisterHostAddrs completes with: %x.\n",
  720. RegisterStatus.dwStatus ) ;
  721. }
  722. }
  723. }
  724. VOID
  725. DoRASRegisterWithPTR( VOID )
  726. {
  727. DNS_STATUS Status = NO_ERROR;
  728. char AdapterName[256];
  729. char HostName[256];
  730. char DomainName[256];
  731. char Address[500];
  732. LPSTR lpTemp = NULL;
  733. DWORD Part1, Part2, Part3, Part4;
  734. char seps[]=" ,\t\n";
  735. char* token;
  736. INT ipAddrCount;
  737. DWORD length, len;
  738. IP_ADDRESS ServerList[15];
  739. DWORD ServerListCount;
  740. REGISTER_HOST_ENTRY HostAddrs[5];
  741. REGISTER_HOST_STATUS RegisterStatus;
  742. if (!(RegisterStatus.hDoneEvent = CreateEventA( NULL,
  743. TRUE,
  744. FALSE,
  745. NULL)))
  746. {
  747. Status = GetLastError();
  748. printf( "Cant create event.\n" );
  749. printf ( "GetLastError() returned %x\n", Status );
  750. exit(1);
  751. }
  752. printf( "Adapter Name: " );
  753. GetStringA( AdapterName );
  754. printf( "\n" );
  755. printf( "Host Name: " );
  756. GetStringA( HostName );
  757. printf( "\n" );
  758. printf( "Domain Name: " );
  759. GetStringA( DomainName );
  760. printf( "\n" );
  761. printf( "IP Address(es): " );
  762. GetStringA( Address );
  763. printf( "\n" );
  764. ipAddrCount = 0;
  765. length = strlen( Address );
  766. token = strtok(Address, seps);
  767. if ( token )
  768. len = (DWORD) (token - Address);
  769. while ( token != NULL)
  770. {
  771. len += strlen( token ) + 1;
  772. lpTemp = strtok( token, "." );
  773. Part1 = atoi( lpTemp );
  774. lpTemp = strtok( NULL, "." );
  775. Part2 = atoi( lpTemp );
  776. lpTemp = strtok( NULL, "." );
  777. Part3 = atoi( lpTemp );
  778. lpTemp = strtok( NULL, "." );
  779. Part4 = atoi( lpTemp );
  780. printf( "\nRegistering DNS record for:\n" );
  781. printf("AdapterName = %s\n", AdapterName);
  782. printf("HostName = %s\n", HostName);
  783. printf("DomainName = %s\n", DomainName);
  784. printf( "Address: %d.%d.%d.%d\n", Part1, Part2, Part3, Part4 );
  785. HostAddrs[ipAddrCount].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  786. HostAddrs[ipAddrCount].Addr.ipAddr = (DWORD)(Part1) +
  787. (DWORD)(Part2 << 8) +
  788. (DWORD)(Part3 << 16) +
  789. (DWORD)(Part4 << 24);
  790. ipAddrCount++;
  791. if ( len < length )
  792. lpTemp = &Address[len];
  793. else
  794. lpTemp = NULL;
  795. token = strtok(lpTemp, seps);
  796. if ( token )
  797. len = (DWORD) (token - Address);
  798. }
  799. printf( "Server Address(es): " );
  800. GetStringA( Address );
  801. printf( "\n" );
  802. ServerListCount = 0;
  803. length = strlen( Address );
  804. token = strtok(Address, seps);
  805. if ( token )
  806. len = (DWORD) (token - Address);
  807. while ( token != NULL)
  808. {
  809. len += strlen( token ) + 1;
  810. lpTemp = strtok( token, "." );
  811. Part1 = atoi( lpTemp );
  812. lpTemp = strtok( NULL, "." );
  813. Part2 = atoi( lpTemp );
  814. lpTemp = strtok( NULL, "." );
  815. Part3 = atoi( lpTemp );
  816. lpTemp = strtok( NULL, "." );
  817. Part4 = atoi( lpTemp );
  818. ServerList[ServerListCount] = (DWORD)(Part1) +
  819. (DWORD)(Part2 << 8) +
  820. (DWORD)(Part3 << 16) +
  821. (DWORD)(Part4 << 24);
  822. ServerListCount++;
  823. if ( len < length )
  824. lpTemp = &Address[len];
  825. else
  826. lpTemp = NULL;
  827. token = strtok(lpTemp, seps);
  828. if ( token )
  829. len = (DWORD) (token - Address);
  830. }
  831. Status = DnsAsyncRegisterHostAddrs_A( AdapterName,
  832. HostName,
  833. HostAddrs,
  834. ipAddrCount,
  835. ServerList,
  836. ServerListCount,
  837. DomainName,
  838. &RegisterStatus,
  839. 300,
  840. DYNDNS_REG_PTR |
  841. DYNDNS_REG_RAS );
  842. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  843. if ( Status == NO_ERROR )
  844. {
  845. Status = WaitForSingleObject( RegisterStatus.hDoneEvent, INFINITE ) ;
  846. if ( Status != WAIT_OBJECT_0 )
  847. {
  848. printf( "DnsAsyncRegisterHostAddrs failed with %x.\n", Status ) ;
  849. exit(1) ;
  850. }
  851. else
  852. {
  853. printf( "DnsAsyncRegisterHostAddrs completes with: %x.\n",
  854. RegisterStatus.dwStatus ) ;
  855. }
  856. }
  857. }
  858. VOID
  859. DoRASDeregisterWithPTR( VOID )
  860. {
  861. DNS_STATUS Status = NO_ERROR;
  862. char AdapterName[256];
  863. char HostName[256];
  864. char DomainName[256];
  865. char Address[500];
  866. LPSTR lpTemp = NULL;
  867. DWORD Part1, Part2, Part3, Part4;
  868. char seps[]=" ,\t\n";
  869. char* token;
  870. INT ipAddrCount;
  871. DWORD length, len;
  872. IP_ADDRESS ServerList[15];
  873. DWORD ServerListCount;
  874. REGISTER_HOST_ENTRY HostAddrs[5];
  875. REGISTER_HOST_STATUS RegisterStatus;
  876. if (!(RegisterStatus.hDoneEvent = CreateEventA( NULL,
  877. TRUE,
  878. FALSE,
  879. NULL)))
  880. {
  881. Status = GetLastError();
  882. printf( "Cant create event.\n" );
  883. printf ( "GetLastError() returned %x\n", Status );
  884. exit(1);
  885. }
  886. printf( "Adapter Name: " );
  887. GetStringA( AdapterName );
  888. printf( "\n" );
  889. printf( "Host Name: " );
  890. GetStringA( HostName );
  891. printf( "\n" );
  892. printf( "Domain Name: " );
  893. GetStringA( DomainName );
  894. printf( "\n" );
  895. printf( "IP Address(es): " );
  896. GetStringA( Address );
  897. printf( "\n" );
  898. ipAddrCount = 0;
  899. length = strlen( Address );
  900. token = strtok(Address, seps);
  901. if ( token )
  902. len = (DWORD) (token - Address);
  903. while ( token != NULL)
  904. {
  905. len += strlen( token ) + 1;
  906. lpTemp = strtok( token, "." );
  907. Part1 = atoi( lpTemp );
  908. lpTemp = strtok( NULL, "." );
  909. Part2 = atoi( lpTemp );
  910. lpTemp = strtok( NULL, "." );
  911. Part3 = atoi( lpTemp );
  912. lpTemp = strtok( NULL, "." );
  913. Part4 = atoi( lpTemp );
  914. printf( "\nRegistering DNS record for:\n" );
  915. printf("AdapterName = %s\n", AdapterName);
  916. printf("HostName = %s\n", HostName);
  917. printf("DomainName = %s\n", DomainName);
  918. printf( "Address: %d.%d.%d.%d\n", Part1, Part2, Part3, Part4 );
  919. HostAddrs[ipAddrCount].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  920. HostAddrs[ipAddrCount].Addr.ipAddr = (DWORD)(Part1) +
  921. (DWORD)(Part2 << 8) +
  922. (DWORD)(Part3 << 16) +
  923. (DWORD)(Part4 << 24);
  924. ipAddrCount++;
  925. if ( len < length )
  926. lpTemp = &Address[len];
  927. else
  928. lpTemp = NULL;
  929. token = strtok(lpTemp, seps);
  930. if ( token )
  931. len = (DWORD) (token - Address);
  932. }
  933. printf( "Server Address(es): " );
  934. GetStringA( Address );
  935. printf( "\n" );
  936. ServerListCount = 0;
  937. length = strlen( Address );
  938. token = strtok(Address, seps);
  939. if ( token )
  940. len = (DWORD) (token - Address);
  941. while ( token != NULL)
  942. {
  943. len += strlen( token ) + 1;
  944. lpTemp = strtok( token, "." );
  945. Part1 = atoi( lpTemp );
  946. lpTemp = strtok( NULL, "." );
  947. Part2 = atoi( lpTemp );
  948. lpTemp = strtok( NULL, "." );
  949. Part3 = atoi( lpTemp );
  950. lpTemp = strtok( NULL, "." );
  951. Part4 = atoi( lpTemp );
  952. ServerList[ServerListCount] = (DWORD)(Part1) +
  953. (DWORD)(Part2 << 8) +
  954. (DWORD)(Part3 << 16) +
  955. (DWORD)(Part4 << 24);
  956. ServerListCount++;
  957. if ( len < length )
  958. lpTemp = &Address[len];
  959. else
  960. lpTemp = NULL;
  961. token = strtok(lpTemp, seps);
  962. if ( token )
  963. len = (DWORD) (token - Address);
  964. }
  965. Status = DnsAsyncRegisterHostAddrs_A( AdapterName,
  966. HostName,
  967. HostAddrs,
  968. ipAddrCount,
  969. ServerList,
  970. ServerListCount,
  971. DomainName,
  972. &RegisterStatus,
  973. 300,
  974. DYNDNS_REG_PTR |
  975. DYNDNS_REG_RAS |
  976. DYNDNS_DEL_ENTRY );
  977. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  978. if ( Status == NO_ERROR )
  979. {
  980. Status = WaitForSingleObject( RegisterStatus.hDoneEvent, INFINITE ) ;
  981. if ( Status != WAIT_OBJECT_0 )
  982. {
  983. printf( "DnsAsyncRegisterHostAddrs failed with %x.\n", Status ) ;
  984. exit(1) ;
  985. }
  986. else
  987. {
  988. printf( "DnsAsyncRegisterHostAddrs completes with: %x.\n",
  989. RegisterStatus.dwStatus ) ;
  990. }
  991. }
  992. }
  993. VOID
  994. DoRemoveInterface( VOID )
  995. {
  996. DNS_STATUS Status = NO_ERROR;
  997. char AdapterName[256];
  998. printf( "Adapter Name: " );
  999. GetStringA( AdapterName );
  1000. printf( "\n" );
  1001. Status = DnsAsyncRegisterHostAddrs_A( AdapterName,
  1002. NULL,
  1003. NULL,
  1004. 0,
  1005. NULL,
  1006. 0,
  1007. NULL,
  1008. NULL,
  1009. 0,
  1010. DYNDNS_DEL_ENTRY );
  1011. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1012. }
  1013. VOID
  1014. DoMATAddSim( VOID )
  1015. {
  1016. DNS_STATUS Status = NO_ERROR;
  1017. REGISTER_HOST_ENTRY HostAddrs[2];
  1018. IP_ADDRESS ServerIp;
  1019. ServerIp = inet_addr( "172.31.56.186" );
  1020. HostAddrs[0].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  1021. HostAddrs[0].Addr.ipAddr = inet_addr( "1.1.1.1" );
  1022. Status = DnsAsyncRegisterHostAddrs_A( "A",
  1023. "glennc",
  1024. HostAddrs,
  1025. 1,
  1026. &ServerIp,
  1027. 1,
  1028. "foo1.com",
  1029. NULL,
  1030. 60*5,
  1031. DYNDNS_REG_PTR );
  1032. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1033. HostAddrs[0].Addr.ipAddr = inet_addr( "2.2.2.2" );
  1034. Status = DnsAsyncRegisterHostAddrs_A( "B",
  1035. "glennc",
  1036. HostAddrs,
  1037. 1,
  1038. &ServerIp,
  1039. 1,
  1040. "foo1.com",
  1041. NULL,
  1042. 60*5,
  1043. DYNDNS_REG_PTR );
  1044. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1045. HostAddrs[0].Addr.ipAddr = inet_addr( "3.3.3.3" );
  1046. Status = DnsAsyncRegisterHostAddrs_A( "C",
  1047. "glennc",
  1048. HostAddrs,
  1049. 1,
  1050. &ServerIp,
  1051. 1,
  1052. "foo1.com",
  1053. NULL,
  1054. 60*5,
  1055. DYNDNS_REG_PTR );
  1056. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1057. }
  1058. VOID
  1059. DoMATAddDis( VOID )
  1060. {
  1061. DNS_STATUS Status = NO_ERROR;
  1062. REGISTER_HOST_ENTRY HostAddrs[2];
  1063. IP_ADDRESS ServerIp;
  1064. ServerIp = inet_addr( "172.31.56.187" );
  1065. HostAddrs[0].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  1066. HostAddrs[0].Addr.ipAddr = inet_addr( "1.1.1.1" );
  1067. Status = DnsAsyncRegisterHostAddrs_A( "A",
  1068. "glennc",
  1069. HostAddrs,
  1070. 1,
  1071. &ServerIp,
  1072. 1,
  1073. "upd.com",
  1074. NULL,
  1075. 60*5,
  1076. DYNDNS_REG_PTR );
  1077. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1078. HostAddrs[0].Addr.ipAddr = inet_addr( "2.2.2.2" );
  1079. Status = DnsAsyncRegisterHostAddrs_A( "B",
  1080. "glennc",
  1081. HostAddrs,
  1082. 1,
  1083. &ServerIp,
  1084. 1,
  1085. "upd.com",
  1086. NULL,
  1087. 60*5,
  1088. DYNDNS_REG_PTR );
  1089. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1090. ServerIp = inet_addr( "172.31.61.174" );
  1091. HostAddrs[0].Addr.ipAddr = inet_addr( "3.3.3.3" );
  1092. Status = DnsAsyncRegisterHostAddrs_A( "C",
  1093. "glennc",
  1094. HostAddrs,
  1095. 1,
  1096. &ServerIp,
  1097. 1,
  1098. "upd.com",
  1099. NULL,
  1100. 60*5,
  1101. DYNDNS_REG_PTR );
  1102. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1103. }
  1104. VOID
  1105. DoMATAddMul( VOID )
  1106. {
  1107. DNS_STATUS Status = NO_ERROR;
  1108. REGISTER_HOST_ENTRY HostAddrs[2];
  1109. IP_ADDRESS ServerIp;
  1110. ServerIp = inet_addr( "172.31.56.186" );
  1111. HostAddrs[0].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  1112. HostAddrs[0].Addr.ipAddr = inet_addr( "1.1.1.1" );
  1113. Status = DnsAsyncRegisterHostAddrs_A( "A",
  1114. "glennc",
  1115. HostAddrs,
  1116. 1,
  1117. &ServerIp,
  1118. 1,
  1119. "upd.com",
  1120. NULL,
  1121. 60*5,
  1122. DYNDNS_REG_PTR );
  1123. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1124. ServerIp = inet_addr( "172.31.56.187" );
  1125. HostAddrs[0].Addr.ipAddr = inet_addr( "2.2.2.2" );
  1126. Status = DnsAsyncRegisterHostAddrs_A( "B",
  1127. "glennc",
  1128. HostAddrs,
  1129. 1,
  1130. &ServerIp,
  1131. 1,
  1132. "upd.com",
  1133. NULL,
  1134. 60*5,
  1135. DYNDNS_REG_PTR );
  1136. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1137. ServerIp = inet_addr( "172.31.61.174" );
  1138. HostAddrs[0].Addr.ipAddr = inet_addr( "3.3.3.3" );
  1139. Status = DnsAsyncRegisterHostAddrs_A( "C",
  1140. "glennc",
  1141. HostAddrs,
  1142. 1,
  1143. &ServerIp,
  1144. 1,
  1145. "upd.com",
  1146. NULL,
  1147. 60*5,
  1148. DYNDNS_REG_PTR );
  1149. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1150. }
  1151. VOID
  1152. DoMATModSim( VOID )
  1153. {
  1154. DNS_STATUS Status = NO_ERROR;
  1155. REGISTER_HOST_ENTRY HostAddrs[2];
  1156. IP_ADDRESS ServerIp;
  1157. ServerIp = inet_addr( "172.31.56.186" );
  1158. HostAddrs[0].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  1159. HostAddrs[0].Addr.ipAddr = inet_addr( "1.1.1.2" );
  1160. Status = DnsAsyncRegisterHostAddrs_A( "A",
  1161. "glennc",
  1162. HostAddrs,
  1163. 1,
  1164. &ServerIp,
  1165. 1,
  1166. "foo1.com",
  1167. NULL,
  1168. 60*5,
  1169. DYNDNS_REG_PTR );
  1170. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1171. HostAddrs[0].Addr.ipAddr = inet_addr( "2.2.2.3" );
  1172. Status = DnsAsyncRegisterHostAddrs_A( "B",
  1173. "glennc",
  1174. HostAddrs,
  1175. 1,
  1176. &ServerIp,
  1177. 1,
  1178. "foo1.com",
  1179. NULL,
  1180. 60*5,
  1181. DYNDNS_REG_PTR );
  1182. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1183. HostAddrs[0].Addr.ipAddr = inet_addr( "3.3.3.3" );
  1184. Status = DnsAsyncRegisterHostAddrs_A( "C",
  1185. "glennc",
  1186. HostAddrs,
  1187. 1,
  1188. &ServerIp,
  1189. 1,
  1190. "foo1.com",
  1191. NULL,
  1192. 60*5,
  1193. DYNDNS_REG_PTR );
  1194. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1195. }
  1196. VOID
  1197. DoMATModDis( VOID )
  1198. {
  1199. DNS_STATUS Status = NO_ERROR;
  1200. REGISTER_HOST_ENTRY HostAddrs[2];
  1201. IP_ADDRESS ServerIp;
  1202. ServerIp = inet_addr( "172.31.56.186" );
  1203. HostAddrs[0].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  1204. HostAddrs[0].Addr.ipAddr = inet_addr( "1.1.1.2" );
  1205. Status = DnsAsyncRegisterHostAddrs_A( "A",
  1206. "glennc",
  1207. HostAddrs,
  1208. 1,
  1209. &ServerIp,
  1210. 1,
  1211. "upd.com",
  1212. NULL,
  1213. 60*5,
  1214. DYNDNS_REG_PTR );
  1215. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1216. HostAddrs[0].Addr.ipAddr = inet_addr( "2.2.2.3" );
  1217. Status = DnsAsyncRegisterHostAddrs_A( "B",
  1218. "glennc",
  1219. HostAddrs,
  1220. 1,
  1221. &ServerIp,
  1222. 1,
  1223. "upd.com",
  1224. NULL,
  1225. 60*5,
  1226. DYNDNS_REG_PTR );
  1227. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1228. ServerIp = inet_addr( "172.31.61.174" );
  1229. HostAddrs[0].Addr.ipAddr = inet_addr( "3.3.3.3" );
  1230. Status = DnsAsyncRegisterHostAddrs_A( "C",
  1231. "glennc",
  1232. HostAddrs,
  1233. 1,
  1234. &ServerIp,
  1235. 1,
  1236. "upd.com",
  1237. NULL,
  1238. 60*5,
  1239. DYNDNS_REG_PTR );
  1240. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1241. }
  1242. VOID
  1243. DoMATModMul( VOID )
  1244. {
  1245. DNS_STATUS Status = NO_ERROR;
  1246. REGISTER_HOST_ENTRY HostAddrs[2];
  1247. IP_ADDRESS ServerIp;
  1248. ServerIp = inet_addr( "172.31.56.186" );
  1249. HostAddrs[0].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  1250. HostAddrs[0].Addr.ipAddr = inet_addr( "1.1.1.2" );
  1251. Status = DnsAsyncRegisterHostAddrs_A( "A",
  1252. "glennc",
  1253. HostAddrs,
  1254. 1,
  1255. &ServerIp,
  1256. 1,
  1257. "upd.com",
  1258. NULL,
  1259. 60*5,
  1260. DYNDNS_REG_PTR );
  1261. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1262. ServerIp = inet_addr( "172.31.56.187" );
  1263. HostAddrs[0].Addr.ipAddr = inet_addr( "2.2.2.3" );
  1264. Status = DnsAsyncRegisterHostAddrs_A( "B",
  1265. "glennc",
  1266. HostAddrs,
  1267. 1,
  1268. &ServerIp,
  1269. 1,
  1270. "upd.com",
  1271. NULL,
  1272. 60*5,
  1273. DYNDNS_REG_PTR );
  1274. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1275. ServerIp = inet_addr( "172.31.61.174" );
  1276. HostAddrs[0].Addr.ipAddr = inet_addr( "3.3.3.3" );
  1277. Status = DnsAsyncRegisterHostAddrs_A( "C",
  1278. "glennc",
  1279. HostAddrs,
  1280. 1,
  1281. &ServerIp,
  1282. 1,
  1283. "upd.com",
  1284. NULL,
  1285. 60*5,
  1286. DYNDNS_REG_PTR );
  1287. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1288. }
  1289. VOID
  1290. DoMATAddMulNTTEST( VOID )
  1291. {
  1292. DNS_STATUS Status = NO_ERROR;
  1293. REGISTER_HOST_ENTRY HostAddrs[2];
  1294. IP_ADDRESS ServerIp;
  1295. ServerIp = inet_addr( "157.55.83.254" );
  1296. HostAddrs[0].dwOptions = REGISTER_HOST_A | REGISTER_HOST_PTR;
  1297. HostAddrs[0].Addr.ipAddr = inet_addr( "1.1.1.1" );
  1298. Status = DnsAsyncRegisterHostAddrs_A( "A",
  1299. "glennc",
  1300. HostAddrs,
  1301. 1,
  1302. &ServerIp,
  1303. 1,
  1304. "nttest.microsoft.com",
  1305. NULL,
  1306. 60*5,
  1307. DYNDNS_REG_PTR );
  1308. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1309. ServerIp = inet_addr( "172.31.52.7" );
  1310. HostAddrs[0].Addr.ipAddr = inet_addr( "2.2.2.2" );
  1311. Status = DnsAsyncRegisterHostAddrs_A( "B",
  1312. "glennc",
  1313. HostAddrs,
  1314. 1,
  1315. &ServerIp,
  1316. 1,
  1317. "nttest.microsoft.com",
  1318. NULL,
  1319. 60*5,
  1320. DYNDNS_REG_PTR );
  1321. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1322. ServerIp = inet_addr( "157.55.92.35" );
  1323. HostAddrs[0].Addr.ipAddr = inet_addr( "3.3.3.3" );
  1324. Status = DnsAsyncRegisterHostAddrs_A( "C",
  1325. "glennc",
  1326. HostAddrs,
  1327. 1,
  1328. &ServerIp,
  1329. 1,
  1330. "nttest.microsoft.com",
  1331. NULL,
  1332. 60*5,
  1333. DYNDNS_REG_PTR );
  1334. printf( "DnsAsyncRegisterHostAddrs_A() returned: 0x%x\n", Status );
  1335. }