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.

82 lines
1.9 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. _cdecl
  9. main(int argc, char **argv)
  10. {
  11. DWORD Status = NO_ERROR;
  12. WCHAR usName[MAX_PATH];
  13. LPSTR lpTemp = NULL, lpAddress = NULL;
  14. BYTE Part1, Part2, Part3, Part4;
  15. IP_ADDRESS Address;
  16. LONG cch;
  17. IP_ARRAY ipArray;
  18. #if 0
  19. if ( argc != 3 )
  20. {
  21. printf( "\nUsage: dnstest <DNS Name> <Server IP>\n" );
  22. printf( "\nWhere:\n" );
  23. printf( " DNS Name - Server_X.dbsd-test.microsoft.com\n" );
  24. return(-1);
  25. }
  26. lpAddress = argv[2];
  27. lpTemp = strtok( lpAddress, "." );
  28. Part1 = (BYTE) atoi( lpTemp );
  29. lpTemp = strtok( NULL, "." );
  30. Part2 = (BYTE) atoi( lpTemp );
  31. lpTemp = strtok( NULL, "." );
  32. Part3 = (BYTE) atoi( lpTemp );
  33. lpTemp = strtok( NULL, "." );
  34. Part4 = (BYTE) atoi( lpTemp );
  35. ((BYTE *) &Address)[0] = Part1;
  36. ((BYTE *) &Address)[1] = Part2;
  37. ((BYTE *) &Address)[2] = Part3;
  38. ((BYTE *) &Address)[3] = Part4;
  39. ipArray.cAddrCount = 1;
  40. ipArray.aipAddrs[0] = Address;
  41. #endif
  42. cch = MultiByteToWideChar(
  43. CP_ACP,
  44. 0L,
  45. argv[1],
  46. -1,
  47. usName,
  48. MAX_PATH
  49. );
  50. if (!cch) {
  51. return (GetLastError());
  52. }
  53. printf( "\nTesting dynamic update for name: %S", usName );
  54. Status = DnsUpdateTest_W( NULL,
  55. usName,
  56. 0, // DNS_UPDATE_TEST_USE_LOCAL_SYS_ACCT,
  57. NULL ); // &ipArray );
  58. if ( Status )
  59. {
  60. printf( "DnsUpdateTest call returned with status: 0x%.8X\n",
  61. Status );
  62. return(-1);
  63. }
  64. printf( "DnsReplaceRRSet call succeeded!\n" );
  65. return(0);
  66. }