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.

43 lines
720 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 <dnsapi.h>
  8. _cdecl
  9. main(int argc, char **argv)
  10. {
  11. LPWSTR pszHostName = NULL;
  12. pszHostName = DnsGetHostName();
  13. if ( pszHostName )
  14. {
  15. printf( "\n Host name (UNICODE): %S\n", pszHostName );
  16. LocalFree( pszHostName );
  17. }
  18. else
  19. {
  20. printf( "\n No host name found.\n" );
  21. }
  22. pszHostName = (LPWSTR) DnsGetHostName_A();
  23. if ( pszHostName )
  24. {
  25. printf( "\n Host name (ANSI): %s\n", (LPSTR) pszHostName );
  26. LocalFree( pszHostName );
  27. }
  28. else
  29. {
  30. printf( "\n No host name found.\n" );
  31. }
  32. return(0);
  33. }