Changeset 15112 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Dec 8, 2008 3:23:40 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r15106 r15112 81 81 insque(pData, &pData->icmp_socket, &udb); 82 82 #else 83 pData->hmIcmpLibrary = LoadLibrary("Iphlpapi.dll"); 84 if (pData->hmIcmpLibrary != NULL) { 85 pData->pfIcmpParseReplies = (long (WINAPI *)(void *, long))GetProcAddress(pData->hmIcmpLibrary, "IcmpParseReplies"); 86 } 87 if (pData->pfIcmpParseReplies == NULL) { 88 FreeLibrary(pData->hmIcmpLibrary); 89 pData->hmIcmpLibrary = LoadLibrary("Icmp.dll"); 90 if (pData->hmIcmpLibrary == NULL) { 91 LogRel(("Icmp.dll couldn't be loaded")); 92 return (1); 93 } 94 pData->pfIcmpParseReplies = (long (WINAPI *)(void *, long))GetProcAddress(pData->hmIcmpLibrary, "IcmpParseReplies"); 95 } 96 if (pData->pfIcmpParseReplies == NULL) { 97 LogRel(("Can't find IcmpParseReplies symbol")); 98 FreeLibrary(pData->hmIcmpLibrary); 99 return (1); 100 } 83 101 pData->icmp_socket.s = IcmpCreateFile(); 84 102 pData->phEvents[VBOX_ICMP_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL); … … 130 148 } 131 149 if (found == 1) 132 return cm;150 return icm; 133 151 134 152 return NULL; … … 301 319 ipopt.Ttl = ip->ip_ttl; 302 320 status = IcmpSendEcho2(pData->icmp_socket.s, pData->phEvents[VBOX_ICMP_EVENT_INDEX], 303 NULL, NULL, addr.sin_addr.s_addr, icp , icmplen, &ipopt,321 NULL, NULL, addr.sin_addr.s_addr, icp->icmp_data, icmplen - offsetof(struct icmp, icmp_data) , &ipopt, 304 322 pData->pvIcmpBuffer, pData->szIcmpBuffer, 10); 305 323 if (status == 0 && (error = GetLastError()) != ERROR_IO_PENDING) -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r15086 r15112 140 140 void *pvIcmpBuffer; 141 141 size_t szIcmpBuffer; 142 /* Accordin MSDN specification IcmpParseReplies 143 * function should be detected in runtime 144 */ 145 long (WINAPI * pfIcmpParseReplies)(void *, long); 146 HMODULE hmIcmpLibrary; 142 147 #endif 143 148 #endif -
trunk/src/VBox/Devices/Network/slirp/socket.c
r15105 r15112 14 14 #endif 15 15 #if defined(VBOX_WITH_SLIRP_ICMP) && defined (RT_OS_WINDOWS) 16 #include <iphlpapi.h> 16 17 #include <icmpapi.h> 17 18 #endif … … 843 844 ICMP_ECHO_REPLY *icr; 844 845 u_char code = ~0; 845 len = IcmpParseReplies(pData->pvIcmpBuffer, pData->szIcmpBuffer);846 len = pData->pfIcmpParseReplies(pData->pvIcmpBuffer, pData->szIcmpBuffer); 846 847 if (len <= 0) { 847 848 LogRel(("Error (%d) occured on ICMP receiving \n", GetLastError()));
Note:
See TracChangeset
for help on using the changeset viewer.