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.

46 lines
857 B

  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 <dnssdk.h>
  8. VOID
  9. PrintIpAddress (
  10. IN DWORD dwIpAddress );
  11. _cdecl
  12. main(int argc, char **argv)
  13. {
  14. PNETWORK_INFORMATION pNetworkInfo = NULL;
  15. printf( "Get the local adapter information list\n" );
  16. pNetworkInfo = DnsGetNetworkInformation();
  17. if ( pNetworkInfo )
  18. {
  19. printf( "Network Information:\n" );
  20. DnsFreeNetworkInformation( pNetworkInfo );
  21. }
  22. else
  23. {
  24. printf( "Could not get network information\n" );
  25. }
  26. return(0);
  27. }
  28. VOID
  29. PrintIpAddress (
  30. IN DWORD dwIpAddress )
  31. {
  32. printf( " %d.%d.%d.%d\n",
  33. ((BYTE *) &dwIpAddress)[0],
  34. ((BYTE *) &dwIpAddress)[1],
  35. ((BYTE *) &dwIpAddress)[2],
  36. ((BYTE *) &dwIpAddress)[3] );
  37. }