Changeset 53310 in vbox for trunk/src/VBox/Devices/Network/slirp
- Timestamp:
- Nov 12, 2014 4:16:52 AM (10 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_icmpwin.c
r53298 r53310 22 22 #include <icmpapi.h> 23 23 24 /*25 * XXX: we don't support w2k anymore, so we may just as well link to26 * iphlpapi.dll and use direct references now. Besides, we already27 * refer to some of Icmp* functions directly anyway.28 */29 #include <iprt/ldr.h>30 24 31 25 int 32 26 icmpwin_init(PNATState pData) 33 27 { 34 RTLDRMOD hLdrMod;35 int rc;36 37 rc = RTLdrLoadSystem("Iphlpapi.dll", true /*fNoUnload*/, &hLdrMod);38 if (RT_SUCCESS(rc))39 {40 pData->pfIcmpParseReplies = (long (WINAPI *)(void *, long))RTLdrGetFunction(hLdrMod, "IcmpParseReplies");41 pData->pfIcmpCloseHandle = (BOOL (WINAPI *)(HANDLE))RTLdrGetFunction(hLdrMod, "IcmpCloseHandle");42 RTLdrClose(hLdrMod);43 }44 45 if (pData->pfIcmpParseReplies == NULL)46 {47 int rc = RTLdrLoadSystem("Icmp.dll", true /*fNoUnload*/, &hLdrMod);48 if (RT_FAILURE(rc))49 {50 LogRel(("NAT: Icmp.dll could not be loaded: %Rrc\n", rc));51 return 1;52 }53 pData->pfIcmpParseReplies = (long (WINAPI *)(void *, long))RTLdrGetFunction(hLdrMod, "IcmpParseReplies");54 pData->pfIcmpCloseHandle = (BOOL (WINAPI *)(HANDLE))RTLdrGetFunction(hLdrMod, "IcmpCloseHandle");55 RTLdrClose(hLdrMod);56 }57 58 if (pData->pfIcmpParseReplies == NULL)59 {60 LogRel(("NAT: Can't find IcmpParseReplies symbol\n"));61 return 1;62 }63 if (pData->pfIcmpCloseHandle == NULL)64 {65 LogRel(("NAT: Can't find IcmpCloseHandle symbol\n"));66 return 1;67 }68 69 28 pData->icmp_socket.sh = IcmpCreateFile(); 70 29 pData->phEvents[VBOX_ICMP_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL); … … 79 38 icmpwin_finit(PNATState pData) 80 39 { 81 pData->pfIcmpCloseHandle(pData->icmp_socket.sh);40 IcmpCloseHandle(pData->icmp_socket.sh); 82 41 RTMemFree(pData->pvIcmpBuffer); 83 42 } -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r52754 r53310 203 203 void *pvIcmpBuffer; 204 204 uint32_t cbIcmpBuffer; 205 /* According MSDN specification IcmpParseReplies206 * function should be detected at runtime.207 */208 long (WINAPI * pfIcmpParseReplies)(void *, long);209 BOOL (WINAPI * pfIcmpCloseHandle)(HANDLE);210 205 # endif 211 206 #if defined(RT_OS_WINDOWS) -
trunk/src/VBox/Devices/Network/slirp/socket.c
r53056 r53310 1461 1461 int size; 1462 1462 1463 len = pData->pfIcmpParseReplies(pData->pvIcmpBuffer, pData->cbIcmpBuffer);1463 len = IcmpParseReplies(pData->pvIcmpBuffer, pData->cbIcmpBuffer); 1464 1464 if (len < 0) 1465 1465 {
Note:
See TracChangeset
for help on using the changeset viewer.