- Timestamp:
- Nov 21, 2008 11:34:34 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r14349 r14485 72 72 # include <linux/if.h> 73 73 # include <linux/wireless.h> 74 #endif 75 76 #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT) 77 # include <VBox/WinNetConfig.h> 78 # include <Ntddndis.h> 79 # include <devguid.h> 74 80 #endif 75 81 … … 1286 1292 Log(("Failed to open wireless socket\n")); 1287 1293 } 1294 # elif defined(RT_OS_WINDOWS) 1295 # define DEVNAME_PREFIX L"\\\\.\\" 1296 INetCfg *pNc; 1297 LPWSTR lpszApp; 1298 HRESULT hr; 1299 int rc = VERR_INTNET_FLT_IF_NOT_FOUND; 1300 1301 /* we are getting the medium type via IOCTL_NDIS_QUERY_GLOBAL_STATS Io Control 1302 * there is a pretty long way till there though since we need to obtain the symbolic link name 1303 * for the adapter device we are going to query given the device Guid */ 1304 hr = VBoxNetCfgWinQueryINetCfg( FALSE, 1305 L"VirtualBox", 1306 &pNc, 1307 &lpszApp ); 1308 Assert(hr == S_OK); 1309 if(hr == S_OK) 1310 { 1311 /* get the adapter's INetCfgComponent*/ 1312 INetCfgComponent *pAdaptorComponent; 1313 hr = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.ptr(), &pAdaptorComponent); 1314 Assert(hr == S_OK); 1315 if(hr == S_OK) 1316 { 1317 /* now get the bind name */ 1318 LPWSTR pName; 1319 hr = pAdaptorComponent->GetBindName(&pName); 1320 Assert(hr == S_OK); 1321 if(hr == S_OK) 1322 { 1323 /* prepend the "\\\\.\\" to the bind name to obtain the link name */ 1324 wchar_t FileName[MAX_PATH]; 1325 wcscpy(FileName, DEVNAME_PREFIX); 1326 wcscpy((wchar_t*)(((char*)FileName) + sizeof(DEVNAME_PREFIX) - sizeof(FileName[0])), pName); 1327 1328 /* open the device */ 1329 HANDLE hDevice = CreateFile(FileName, 1330 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 1331 NULL, 1332 OPEN_EXISTING, 1333 FILE_ATTRIBUTE_NORMAL, 1334 NULL); 1335 Assert(hDevice != INVALID_HANDLE_VALUE); 1336 if (hDevice != INVALID_HANDLE_VALUE) 1337 { 1338 /* now issue the OID_GEN_PHYSICAL_MEDIUM query */ 1339 DWORD Oid = OID_GEN_PHYSICAL_MEDIUM; 1340 NDIS_PHYSICAL_MEDIUM PhMedium; 1341 DWORD cbResult; 1342 if (DeviceIoControl(hDevice, IOCTL_NDIS_QUERY_GLOBAL_STATS, &Oid, sizeof(Oid), &PhMedium, sizeof(PhMedium), &cbResult, NULL)) 1343 { 1344 /* that was simple, now examine PhMedium */ 1345 if(PhMedium == NdisPhysicalMediumWirelessWan 1346 || PhMedium == NdisPhysicalMediumNative802_11 1347 || PhMedium == NdisPhysicalMediumBluetooth 1348 /*|| PhMedium == NdisPhysicalMediumWiMax*/ 1349 ) 1350 { 1351 Log(("this is a wireles adapter")); 1352 rc = CFGMR3InsertInteger(pCfg, "SharedMacOnWire", true); RC_CHECK(); 1353 Log(("Set SharedMacOnWire\n")); 1354 } 1355 else 1356 { 1357 Log(("this is NOT a wireles adapter")); 1358 } 1359 } 1360 else 1361 { 1362 AssertBreakpoint(); 1363 int winEr = GetLastError(); 1364 LogRel(("Console::configConstructor: DeviceIoControl failed, err (0x%x), ignoring\n", winEr)); 1365 } 1366 1367 CloseHandle(hDevice); 1368 } 1369 else 1370 { 1371 int winEr = GetLastError(); 1372 LogRel(("Console::configConstructor: CreateFile failed, err (0x%x), ignoring\n", winEr)); 1373 } 1374 CoTaskMemFree(pName); 1375 } 1376 VBoxNetCfgWinReleaseRef(pAdaptorComponent); 1377 } 1378 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1379 } 1288 1380 # else 1289 1381 /** @todo PORTME: wireless detection */ -
trunk/src/VBox/Main/Makefile.kmk
r14439 r14485 464 464 $(LIB_REM) 465 465 466 ifdef VBOX_WITH_NETFLT 467 VBoxC_LIBS.win += $(PATH_LIB)/WinNetConfig.lib 468 endif 469 466 470 VBoxC_INTERMEDIATES = \ 467 471 $(VBOX_MAIN_PREREQS) \
Note:
See TracChangeset
for help on using the changeset viewer.