Changeset 70196 in vbox
- Timestamp:
- Dec 18, 2017 1:40:49 PM (7 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp
r70173 r70196 26 26 #include <VBox/VBoxGuestLib.h> 27 27 28 #define WIN32_NO_STATUS 29 #include <iprt/win/ws2tcpip.h> 30 #include <iprt/win/winsock2.h> 31 #undef WIN32_NO_STATUS 28 32 #include <iprt/nt/nt-and-windows.h> 33 #include <iprt/win/iphlpapi.h> 29 34 #include <process.h> 30 35 #include <aclapi.h> … … 58 63 decltype(RegisterServiceCtrlHandlerExA) *g_pfnRegisterServiceCtrlHandlerExA; /**< W2K+ */ 59 64 decltype(ChangeServiceConfig2A) *g_pfnChangeServiceConfig2A; /**< W2K+ */ 65 decltype(GetNamedSecurityInfoA) *g_pfnGetNamedSecurityInfoA; /**< NT4+ */ 66 decltype(SetEntriesInAclA) *g_pfnSetEntriesInAclA; /**< NT4+ */ 67 decltype(SetNamedSecurityInfoA) *g_pfnSetNamedSecurityInfoA; /**< NT4+ */ 60 68 /** @} */ 61 69 … … 74 82 /** @} */ 75 83 84 /** @name API from IPHLPAPI.DLL 85 * @{ */ 86 decltype(GetAdaptersInfo) *g_pfnGetAdaptersInfo; 87 /** @} */ 88 89 /** @name APIs from WS2_32.DLL 90 * @note WSAIoctl is not present in wsock32.dll, so no point in trying the 91 * fallback here. 92 * @{ */ 93 decltype(WSAStartup) *g_pfnWSAStartup; 94 decltype(WSACleanup) *g_pfnWSACleanup; 95 decltype(WSASocketA) *g_pfnWSASocketA; 96 decltype(WSAIoctl) *g_pfnWSAIoctl; 97 decltype(WSAGetLastError) *g_pfnWSAGetLastError; 98 decltype(closesocket) *g_pfnclosesocket; 99 decltype(inet_ntoa) *g_pfninet_ntoa; 100 101 /** @} */ 76 102 77 103 /** … … 90 116 RESOLVE_SYMBOL(RegisterServiceCtrlHandlerExA); 91 117 RESOLVE_SYMBOL(ChangeServiceConfig2A); 118 RESOLVE_SYMBOL(GetNamedSecurityInfoA); 119 RESOLVE_SYMBOL(SetEntriesInAclA); 120 RESOLVE_SYMBOL(SetNamedSecurityInfoA); 92 121 RTLdrClose(hLdrMod); 93 122 } … … 114 143 RTLdrClose(hLdrMod); 115 144 } 116 } 117 118 119 /** 120 * @todo Format code style. 145 146 /* From IPHLPAPI.DLL: */ 147 rc = RTLdrLoadSystem("iphlpapi.dll", false /*fNoUnload*/, &hLdrMod); 148 if (RT_SUCCESS(rc)) 149 { 150 RESOLVE_SYMBOL(GetAdaptersInfo); 151 RTLdrClose(hLdrMod); 152 } 153 154 /* From WS2_32.DLL: */ 155 rc = RTLdrLoadSystem("ws2_32.dll", false /*fNoUnload*/, &hLdrMod); 156 if (RT_SUCCESS(rc)) 157 { 158 RESOLVE_SYMBOL(WSAStartup); 159 RESOLVE_SYMBOL(WSACleanup); 160 RESOLVE_SYMBOL(WSASocketA); 161 RESOLVE_SYMBOL(WSAIoctl); 162 RESOLVE_SYMBOL(WSAGetLastError); 163 RESOLVE_SYMBOL(closesocket); 164 RESOLVE_SYMBOL(inet_ntoa); 165 RTLdrClose(hLdrMod); 166 } 167 } 168 169 170 /** 121 171 * @todo Add full unicode support. 122 172 * @todo Add event log capabilities / check return values. 123 173 */ 124 static DWORD vgsvcWinAddAceToObjectsSecurityDescriptor(LPTSTR pszObjName, 125 SE_OBJECT_TYPE ObjectType, 126 LPTSTR pszTrustee, 127 TRUSTEE_FORM TrusteeForm, 128 DWORD dwAccessRights, 129 ACCESS_MODE AccessMode, 130 DWORD dwInheritance) 131 { 132 PACL pOldDACL = NULL, pNewDACL = NULL; 133 PSECURITY_DESCRIPTOR pSD = NULL; 134 EXPLICIT_ACCESS ea; 135 136 if (NULL == pszObjName) 137 return ERROR_INVALID_PARAMETER; 138 139 /* Get a pointer to the existing DACL. */ 140 DWORD dwRes = GetNamedSecurityInfo(pszObjName, ObjectType, DACL_SECURITY_INFORMATION, NULL, NULL, &pOldDACL, NULL, &pSD); 141 if (ERROR_SUCCESS != dwRes) 142 { 143 if (dwRes == ERROR_FILE_NOT_FOUND) 144 VGSvcError("AddAceToObjectsSecurityDescriptor: Object not found/installed: %s\n", pszObjName); 174 static int vgsvcWinAddAceToObjectsSecurityDescriptor(LPTSTR pszObjName, SE_OBJECT_TYPE enmObjectType, const char *pszTrustee, 175 TRUSTEE_FORM enmTrusteeForm, DWORD dwAccessRights, ACCESS_MODE fAccessMode, 176 DWORD dwInheritance) 177 { 178 int rc; 179 if ( g_pfnGetNamedSecurityInfoA 180 && g_pfnSetEntriesInAclA 181 && g_pfnSetNamedSecurityInfoA) 182 { 183 /* Get a pointer to the existing DACL. */ 184 PSECURITY_DESCRIPTOR pSD = NULL; 185 PACL pOldDACL = NULL; 186 DWORD rcWin = g_pfnGetNamedSecurityInfoA(pszObjName, enmObjectType, DACL_SECURITY_INFORMATION, 187 NULL, NULL, &pOldDACL, NULL, &pSD); 188 if (rcWin == ERROR_SUCCESS) 189 { 190 /* Initialize an EXPLICIT_ACCESS structure for the new ACE. */ 191 EXPLICIT_ACCESSA ExplicitAccess; 192 RT_ZERO(ExplicitAccess); 193 ExplicitAccess.grfAccessPermissions = dwAccessRights; 194 ExplicitAccess.grfAccessMode = fAccessMode; 195 ExplicitAccess.grfInheritance = dwInheritance; 196 ExplicitAccess.Trustee.TrusteeForm = enmTrusteeForm; 197 ExplicitAccess.Trustee.ptstrName = (char *)pszTrustee; 198 199 /* Create a new ACL that merges the new ACE into the existing DACL. */ 200 PACL pNewDACL = NULL; 201 rcWin = g_pfnSetEntriesInAclA(1, &ExplicitAccess, pOldDACL, &pNewDACL); 202 if (rcWin == ERROR_SUCCESS) 203 { 204 /* Attach the new ACL as the object's DACL. */ 205 rcWin = g_pfnSetNamedSecurityInfoA(pszObjName, enmObjectType, DACL_SECURITY_INFORMATION, 206 NULL, NULL, pNewDACL, NULL); 207 if (rcWin == ERROR_SUCCESS) 208 rc = VINF_SUCCESS; 209 else 210 { 211 VGSvcError("AddAceToObjectsSecurityDescriptor: SetNamedSecurityInfo: Error %u\n", rcWin); 212 rc = RTErrConvertFromWin32(rcWin); 213 } 214 if (pNewDACL) 215 LocalFree(pNewDACL); 216 } 217 else 218 { 219 VGSvcError("AddAceToObjectsSecurityDescriptor: SetEntriesInAcl: Error %u\n", rcWin); 220 rc = RTErrConvertFromWin32(rcWin); 221 } 222 if (pSD) 223 LocalFree(pSD); 224 } 145 225 else 146 VGSvcError("AddAceToObjectsSecurityDescriptor: GetNamedSecurityInfo: Error %u\n", dwRes); 147 goto l_Cleanup; 148 } 149 150 /* Initialize an EXPLICIT_ACCESS structure for the new ACE. */ 151 ZeroMemory(&ea, sizeof(EXPLICIT_ACCESS)); 152 ea.grfAccessPermissions = dwAccessRights; 153 ea.grfAccessMode = AccessMode; 154 ea.grfInheritance= dwInheritance; 155 ea.Trustee.TrusteeForm = TrusteeForm; 156 ea.Trustee.ptstrName = pszTrustee; 157 158 /* Create a new ACL that merges the new ACE into the existing DACL. */ 159 dwRes = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL); 160 if (ERROR_SUCCESS != dwRes) 161 { 162 VGSvcError("AddAceToObjectsSecurityDescriptor: SetEntriesInAcl: Error %u\n", dwRes); 163 goto l_Cleanup; 164 } 165 166 /* Attach the new ACL as the object's DACL. */ 167 dwRes = SetNamedSecurityInfo(pszObjName, ObjectType, DACL_SECURITY_INFORMATION, NULL, NULL, pNewDACL, NULL); 168 if (ERROR_SUCCESS != dwRes) 169 { 170 VGSvcError("AddAceToObjectsSecurityDescriptor: SetNamedSecurityInfo: Error %u\n", dwRes); 171 goto l_Cleanup; 172 } 173 174 /** @todo get rid of that spaghetti jump ... */ 175 l_Cleanup: 176 177 if(pSD != NULL) 178 LocalFree((HLOCAL) pSD); 179 if(pNewDACL != NULL) 180 LocalFree((HLOCAL) pNewDACL); 181 182 return dwRes; 226 { 227 if (rcWin == ERROR_FILE_NOT_FOUND) 228 VGSvcError("AddAceToObjectsSecurityDescriptor: Object not found/installed: %s\n", pszObjName); 229 else 230 VGSvcError("AddAceToObjectsSecurityDescriptor: GetNamedSecurityInfo: Error %u\n", rcWin); 231 rc = RTErrConvertFromWin32(rcWin); 232 } 233 } 234 else 235 rc = VINF_SUCCESS; /* fake it */ 236 return rc; 183 237 } 184 238 … … 381 435 int rc = VINF_SUCCESS; 382 436 383 /* Create a well-known SID for the "Builtin Users" group. */ 437 /* 438 * Create a well-known SID for the "Builtin Users" group and modify the ACE 439 * for the shared folders miniport redirector DN (whatever DN means). 440 */ 384 441 PSID pBuiltinUsersSID = NULL; 385 442 SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_LOCAL_SID_AUTHORITY; 386 443 if (AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_LOCAL_RID, 0, 0, 0, 0, 0, 0, 0, &pBuiltinUsersSID)) 387 444 { 388 DWORD dwRes = vgsvcWinAddAceToObjectsSecurityDescriptor(TEXT("\\\\.\\VBoxMiniRdrDN"), 389 SE_FILE_OBJECT, 390 (LPTSTR)pBuiltinUsersSID, 391 TRUSTEE_IS_SID, 392 FILE_GENERIC_READ | FILE_GENERIC_WRITE, 393 SET_ACCESS, 394 NO_INHERITANCE); 395 if (dwRes != ERROR_SUCCESS) 396 { 397 if (dwRes == ERROR_FILE_NOT_FOUND) 398 { 399 /* If we don't find our "VBoxMiniRdrDN" (for Shared Folders) object above, 400 don't report an error; it just might be not installed. Otherwise this 401 would cause the SCM to hang on starting up the service. */ 402 rc = VINF_SUCCESS; 403 } 404 else 405 rc = RTErrConvertFromWin32(dwRes); 406 } 445 rc = vgsvcWinAddAceToObjectsSecurityDescriptor(TEXT("\\\\.\\VBoxMiniRdrDN"), SE_FILE_OBJECT, 446 (LPTSTR)pBuiltinUsersSID, TRUSTEE_IS_SID, 447 FILE_GENERIC_READ | FILE_GENERIC_WRITE, SET_ACCESS, NO_INHERITANCE); 448 /* If we don't find our "VBoxMiniRdrDN" (for Shared Folders) object above, 449 don't report an error; it just might be not installed. Otherwise this 450 would cause the SCM to hang on starting up the service. */ 451 if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND) 452 rc = VINF_SUCCESS; 453 454 FreeSid(pBuiltinUsersSID); 407 455 } 408 456 else 409 457 rc = RTErrConvertFromWin32(GetLastError()); 410 411 458 if (RT_SUCCESS(rc)) 412 459 { 460 /* 461 * Start the service. 462 */ 413 463 vgsvcWinSetStatus(SERVICE_START_PENDING, 0); 414 464 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r70171 r70196 212 212 extern decltype(ZwQuerySystemInformation) *g_pfnZwQuerySystemInformation; 213 213 # endif 214 #endif 215 216 #ifdef RT_OS_WINDOWS 214 extern ULONG (WINAPI *g_pfnGetAdaptersInfo)(struct _IP_ADAPTER_INFO *, PULONG); 215 #ifdef WINSOCK_VERSION 216 extern decltype(WSAStartup) *g_pfnWSAStartup; 217 extern decltype(WSACleanup) *g_pfnWSACleanup; 218 extern decltype(WSASocketA) *g_pfnWSASocketA; 219 extern decltype(WSAIoctl) *g_pfnWSAIoctl; 220 extern decltype(WSAGetLastError) *g_pfnWSAGetLastError; 221 extern decltype(closesocket) *g_pfnclosesocket; 222 extern decltype(inet_ntoa) *g_pfninet_ntoa; 223 # endif /* WINSOCK_VERSION */ 224 217 225 # ifdef VBOX_WITH_GUEST_PROPS 218 226 extern int VGSvcVMInfoWinWriteUsers(PVBOXSERVICEVEPROPCACHE pCache, char **ppszUserList, uint32_t *pcUsersInList); 219 227 extern int VGSvcVMInfoWinGetComponentVersions(uint32_t uClientID); 220 228 # endif /* VBOX_WITH_GUEST_PROPS */ 229 221 230 #endif /* RT_OS_WINDOWS */ 222 231 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
r70173 r70196 219 219 if (!GetVersionExA((OSVERSIONINFO *)&g_WinVersion)) 220 220 { 221 AssertFailed();222 221 RT_ZERO(g_WinVersion); 223 222 g_WinVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 224 223 if (!GetVersionExA((OSVERSIONINFO *)&g_WinVersion)) 224 { 225 AssertFailed(); 225 226 RT_ZERO(g_WinVersion); 227 } 226 228 } 227 229 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r70173 r70196 553 553 554 554 #ifdef RT_OS_WINDOWS 555 # ifndef TARGET_NT4556 555 rc = VGSvcVMInfoWinWriteUsers(&g_VMInfoPropCache, &pszUserList, &cUsersInList); 557 # else558 rc = VERR_NOT_IMPLEMENTED;559 # endif560 556 561 557 #elif defined(RT_OS_FREEBSD) … … 936 932 937 933 #ifdef RT_OS_WINDOWS 938 IP_ADAPTER_INFO *pAdpInfo = NULL; 939 940 # ifndef TARGET_NT4 941 ULONG cbAdpInfo = sizeof(*pAdpInfo); 942 pAdpInfo = (IP_ADAPTER_INFO *)RTMemAlloc(cbAdpInfo); 934 /* */ 935 if ( !g_pfnGetAdaptersInfo 936 && ( !g_pfnWSAIoctl 937 || !g_pfnWSASocketA 938 || !g_pfnWSAGetLastError 939 || !g_pfninet_ntoa 940 || !g_pfnclosesocket) ) 941 return VINF_SUCCESS; 942 943 ULONG cbAdpInfo = sizeof(IP_ADAPTER_INFO); 944 IP_ADAPTER_INFO *pAdpInfo = (IP_ADAPTER_INFO *)RTMemAlloc(cbAdpInfo); 943 945 if (!pAdpInfo) 944 946 { … … 946 948 return VERR_NO_MEMORY; 947 949 } 948 DWORD dwRet = GetAdaptersInfo(pAdpInfo, &cbAdpInfo);950 DWORD dwRet = g_pfnGetAdaptersInfo ? g_pfnGetAdaptersInfo(pAdpInfo, &cbAdpInfo) : ERROR_NO_DATA; 949 951 if (dwRet == ERROR_BUFFER_OVERFLOW) 950 952 { … … 953 955 { 954 956 pAdpInfo = pAdpInfoNew; 955 dwRet = GetAdaptersInfo(pAdpInfo, &cbAdpInfo);957 dwRet = g_pfnGetAdaptersInfo(pAdpInfo, &cbAdpInfo); 956 958 } 957 959 } … … 964 966 dwRet = ERROR_SUCCESS; 965 967 } 966 967 968 if (dwRet != ERROR_SUCCESS) 968 969 { 969 if (pAdpInfo) 970 RTMemFree(pAdpInfo); 970 RTMemFree(pAdpInfo); 971 971 VGSvcError("VMInfo/Network: Failed to get adapter info: Error %d\n", dwRet); 972 972 return RTErrConvertFromWin32(dwRet); 973 973 } 974 # endif /* !TARGET_NT4 */ 975 976 SOCKET sd = WSASocket(AF_INET, SOCK_DGRAM, 0, 0, 0, 0); 974 975 SOCKET sd = g_pfnWSASocketA(AF_INET, SOCK_DGRAM, 0, 0, 0, 0); 977 976 if (sd == SOCKET_ERROR) /* Socket invalid. */ 978 977 { 979 int wsaErr = WSAGetLastError();978 int wsaErr = g_pfnWSAGetLastError(); 980 979 /* Don't complain/bail out with an error if network stack is not up; can happen 981 980 * on NT4 due to start up when not connected shares dialogs pop up. */ … … 992 991 } 993 992 994 INTERFACE_INFO aInterfaces[20] = {0};995 DWORD cbReturned= 0;996 # ifdef TARGET_NT4993 INTERFACE_INFO aInterfaces[20] = {0}; 994 DWORD cbReturned = 0; 995 # ifdef RT_ARCH_x86 997 996 /* Workaround for uninitialized variable used in memcpy in GetTcpipInterfaceList 998 997 (NT4SP1 at least). It seems to be happy enough with garbages, no failure … … 1012 1011 } 1013 1012 # endif 1014 i f (WSAIoctl(sd,1015 SIO_GET_INTERFACE_LIST,1016 NULL, /* pvInBuffer */1017 0, /* cbInBuffer */1018 &aInterfaces[0], /* pvOutBuffer */1019 sizeof(aInterfaces), /* cbOutBuffer */1020 &cbReturned,1021 NULL, /* pOverlapped */1022 NULL)/* pCompletionRoutine */1023 1024 { 1025 VGSvcError("VMInfo/Network: Failed to WSAIoctl() on socket: Error: %d\n", WSAGetLastError());1013 int rc = g_pfnWSAIoctl(sd, 1014 SIO_GET_INTERFACE_LIST, 1015 NULL, /* pvInBuffer */ 1016 0, /* cbInBuffer */ 1017 &aInterfaces[0], /* pvOutBuffer */ 1018 sizeof(aInterfaces), /* cbOutBuffer */ 1019 &cbReturned, 1020 NULL, /* pOverlapped */ 1021 NULL); /* pCompletionRoutine */ 1022 if (rc == SOCKET_ERROR) 1023 { 1024 VGSvcError("VMInfo/Network: Failed to WSAIoctl() on socket: Error: %d\n", g_pfnWSAGetLastError()); 1026 1025 if (pAdpInfo) 1027 1026 RTMemFree(pAdpInfo); 1028 return RTErrConvertFromWin32(WSAGetLastError()); 1029 } 1027 g_pfnclosesocket(sd); 1028 return RTErrConvertFromWin32(g_pfnWSAGetLastError()); 1029 } 1030 g_pfnclosesocket(sd); 1030 1031 int cIfacesSystem = cbReturned / sizeof(INTERFACE_INFO); 1031 1032 … … 1041 1042 Assert(pAddress); 1042 1043 char szIp[32]; 1043 RTStrPrintf(szIp, sizeof(szIp), "%s", inet_ntoa(pAddress->sin_addr));1044 RTStrPrintf(szIp, sizeof(szIp), "%s", g_pfninet_ntoa(pAddress->sin_addr)); 1044 1045 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/IP", cIfsReported); 1045 1046 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szIp); … … 1047 1048 pAddress = (sockaddr_in *) & (aInterfaces[i].iiBroadcastAddress); 1048 1049 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Broadcast", cIfsReported); 1049 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));1050 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", g_pfninet_ntoa(pAddress->sin_addr)); 1050 1051 1051 1052 pAddress = (sockaddr_in *)&(aInterfaces[i].iiNetmask); 1052 1053 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Netmask", cIfsReported); 1053 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));1054 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", g_pfninet_ntoa(pAddress->sin_addr)); 1054 1055 1055 1056 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/Status", cIfsReported); 1056 1057 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, nFlags & IFF_UP ? "Up" : "Down"); 1057 1058 1058 # ifndef TARGET_NT4 1059 IP_ADAPTER_INFO *pAdp; 1060 for (pAdp = pAdpInfo; pAdp; pAdp = pAdp->Next) 1061 if (!strcmp(pAdp->IpAddressList.IpAddress.String, szIp)) 1062 break; 1063 1064 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/MAC", cIfsReported); 1065 if (pAdp) 1066 { 1067 char szMac[32]; 1068 RTStrPrintf(szMac, sizeof(szMac), "%02X%02X%02X%02X%02X%02X", 1069 pAdp->Address[0], pAdp->Address[1], pAdp->Address[2], 1070 pAdp->Address[3], pAdp->Address[4], pAdp->Address[5]); 1071 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szMac); 1072 } 1073 else 1074 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, NULL); 1075 # endif /* !TARGET_NT4 */ 1059 if (pAdpInfo) 1060 { 1061 IP_ADAPTER_INFO *pAdp; 1062 for (pAdp = pAdpInfo; pAdp; pAdp = pAdp->Next) 1063 if (!strcmp(pAdp->IpAddressList.IpAddress.String, szIp)) 1064 break; 1065 1066 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/MAC", cIfsReported); 1067 if (pAdp) 1068 { 1069 char szMac[32]; 1070 RTStrPrintf(szMac, sizeof(szMac), "%02X%02X%02X%02X%02X%02X", 1071 pAdp->Address[0], pAdp->Address[1], pAdp->Address[2], 1072 pAdp->Address[3], pAdp->Address[4], pAdp->Address[5]); 1073 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szMac); 1074 } 1075 else 1076 VGSvcPropCacheUpdate(&g_VMInfoPropCache, szPropPath, NULL); 1077 } 1076 1078 1077 1079 cIfsReported++; … … 1079 1081 if (pAdpInfo) 1080 1082 RTMemFree(pAdpInfo); 1081 closesocket(sd);1082 1083 1083 1084 #elif defined(RT_OS_HAIKU) … … 1450 1451 #ifdef RT_OS_WINDOWS 1451 1452 /* Required for network information (must be called per thread). */ 1452 WSADATA wsaData; 1453 if (WSAStartup(MAKEWORD(2, 2), &wsaData)) 1454 VGSvcError("VMInfo/Network: WSAStartup failed! Error: %Rrc\n", RTErrConvertFromWin32(WSAGetLastError())); 1455 #endif /* RT_OS_WINDOWS */ 1453 if (g_pfnWSAStartup) 1454 { 1455 WSADATA wsaData; 1456 RT_ZERO(wsaData); 1457 if (g_pfnWSAStartup(MAKEWORD(2, 2), &wsaData)) 1458 VGSvcError("VMInfo/Network: WSAStartup failed! Error: %Rrc\n", RTErrConvertFromWin32(g_pfnWSAGetLastError())); 1459 } 1460 #endif 1456 1461 1457 1462 /* … … 1596 1601 1597 1602 #ifdef RT_OS_WINDOWS 1598 WSACleanup(); 1603 if (g_pfnWSACleanup) 1604 g_pfnWSACleanup(); 1599 1605 #endif 1600 1606
Note:
See TracChangeset
for help on using the changeset viewer.