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.

44 lines
908 B

  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #undef NDEBUG
  5. #include <assert.h>
  6. #include <windows.h>
  7. #include <winsock.h>
  8. #include <winioctl.h>
  9. int __cdecl main(int argc, char *argv[])
  10. {
  11. WSADATA wsaData;
  12. DWORD address, err;
  13. WORD wVersionRequired;
  14. UCHAR nameBuff[128];
  15. if (argc != 2) {
  16. printf("Usage : address <IP Address>\n");
  17. return 0;
  18. }
  19. wVersionRequired = MAKEWORD(2, 0);
  20. err = WSAStartup(wVersionRequired, &wsaData);
  21. if (err != 0) {
  22. printf("WSAStartup returned %d\n", err);
  23. return 0;
  24. }
  25. printf("Socket initialized. Version : %d, High : %d\n",
  26. wsaData.wVersion,
  27. wsaData.wHighVersion);
  28. address = 0xffffffff;
  29. strcpy(nameBuff, argv[1]);
  30. address = inet_addr (nameBuff);
  31. printf("Address in STRING : %s. Address in ULONG is 0x%08x\n",
  32. nameBuff, address);
  33. WSACleanup();
  34. return 0;
  35. }