儲存庫 vbox 的更動 18323
- 時間撮記:
- 2009-3-26 下午03:29:16 (16 年 以前)
- 位置:
- trunk/src/VBox
- 檔案:
-
- 修改 5 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Makefile.kmk
r18208 r18323 767 767 Drivers_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND 768 768 endif 769 Drivers_SOURCES.win += Network/win/DrvIntNet-win.cpp770 769 endif 771 770 -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r18314 r18323 40 40 41 41 #include "../Builtins.h" 42 43 #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT)44 # include "win/DrvIntNet-win.h"45 #endif46 42 47 43 … … 1024 1020 strcpy(OpenReq.szTrunk, &pThis->szNetwork[sizeof("wif=") - 1]); 1025 1021 } 1026 1027 #elif defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT) 1028 if (OpenReq.enmTrunkType == kIntNetTrunkType_NetFlt 1029 || OpenReq.enmTrunkType == kIntNetTrunkType_NetAdp) 1030 { 1031 # ifndef VBOX_NETFLT_ONDEMAND_BIND 1032 /* 1033 * We have a ndis filter driver started on system boot before the VBoxDrv, 1034 * tell the filter driver to init VBoxNetFlt functionality. 1035 */ 1036 rc = drvIntNetWinConstruct(pDrvIns, pCfgHandle, OpenReq.enmTrunkType); 1037 AssertLogRelMsgRCReturn(rc, ("drvIntNetWinConstruct failed, rc=%Rrc", rc), rc); 1038 # endif 1039 1040 /* 1041 * <Describe what this does here or/and in the function docs of drvIntNetWinIfGuidToBindName>. 1042 */ 1043 char szBindName[INTNET_MAX_TRUNK_NAME]; 1044 rc = drvIntNetWinIfGuidToBindName(OpenReq.szTrunk, szBindName, INTNET_MAX_TRUNK_NAME); 1045 AssertLogRelMsgRCReturn(rc, ("drvIntNetWinIfGuidToBindName failed, rc=%Rrc", rc), rc); 1046 strcpy(OpenReq.szTrunk, szBindName); 1047 } 1048 #endif /* WINDOWS && NETFLT */ 1022 #endif /* DARWIN */ 1049 1023 1050 1024 /* -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp
r18108 r18323 61 61 static const RTGETOPTDEF g_aDHCPIPOptions[] 62 62 = { 63 { "--netname", 'n', RTGETOPT_REQ_STRING }, 64 { "-netname", 'n', RTGETOPT_REQ_STRING }, // deprecated (if removed check below) 65 { "--ifname", 'i', RTGETOPT_REQ_STRING }, 66 { "-ifname", 'i', RTGETOPT_REQ_STRING }, // deprecated 63 { "--netname", 't', RTGETOPT_REQ_STRING }, /* we use 't' instead of 'n' to avoid 64 * 1. the misspelled "-enable" long option to be treated as 'e' (for -enable) + 'n' (for -netname) + "<the_rest_opt>" (for net name) 65 * 2. the misspelled "-netmask" to be treated as 'n' (for -netname) + "<the_rest_opt>" (for net name) 66 */ 67 { "-netname", 't', RTGETOPT_REQ_STRING }, // deprecated (if removed check below) 68 { "--ifname", 'f', RTGETOPT_REQ_STRING }, /* we use 'f' instead of 'i' to avoid 69 * 1. the misspelled "-disable" long option to be treated as 'd' (for -disable) + 'i' (for -ifname) + "<the_rest_opt>" (for if name) 70 */ 71 { "-ifname", 'f', RTGETOPT_REQ_STRING }, // deprecated 67 72 { "--ip", 'a', RTGETOPT_REQ_STRING }, 68 73 { "-ip", 'a', RTGETOPT_REQ_STRING }, // deprecated … … 109 114 switch (c) 110 115 { 111 case ' n': // --netname116 case 't': // --netname 112 117 if(pNetName) 113 118 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --netname once."); … … 119 124 } 120 125 break; 121 case ' i': // --ifname126 case 'f': // --ifname 122 127 if(pIfName) 123 128 return errorSyntax(USAGE_DHCPSERVER, "You can only specify --ifname once."); -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r18292 r18323 1485 1485 H(); 1486 1486 } 1487 char szDriverGUID[RTUUID_STR_LENGTH]; 1488 strcpy(szDriverGUID , hostIFGuid.toString().raw()); 1489 const char *pszTrunk = szDriverGUID; 1487 1488 INetCfg *pNc; 1489 ComPtr<INetCfgComponent> pAdaptorComponent; 1490 LPWSTR lpszApp; 1491 int rc = VERR_INTNET_FLT_IF_NOT_FOUND; 1492 1493 hrc = VBoxNetCfgWinQueryINetCfg( FALSE, 1494 L"VirtualBox", 1495 &pNc, 1496 &lpszApp ); 1497 Assert(hrc == S_OK); 1498 if(hrc == S_OK) 1499 { 1500 /* get the adapter's INetCfgComponent*/ 1501 hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.ptr(), pAdaptorComponent.asOutParam()); 1502 if(hrc != S_OK) 1503 { 1504 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1505 LogRel(("NetworkAttachmentType_Bridged: VBoxNetCfgWinGetComponentByGuid failed, hrc (0x%x)", hrc)); 1506 H(); 1507 } 1508 } 1509 #define VBOX_WIN_BINDNAME_PREFIX "\\DEVICE\\" 1510 char szTrunkName[INTNET_MAX_TRUNK_NAME]; 1511 char *pszTrunkName = szTrunkName; 1512 wchar_t * pswzBindName; 1513 hrc = pAdaptorComponent->GetBindName(&pswzBindName); 1514 Assert(hrc == S_OK); 1515 if (hrc == S_OK) 1516 { 1517 int cwBindName = (int)wcslen(pswzBindName) + 1; 1518 int cbFullBindNamePrefix = sizeof(VBOX_WIN_BINDNAME_PREFIX); 1519 if(sizeof(szTrunkName) > cbFullBindNamePrefix + cwBindName) 1520 { 1521 strcpy(szTrunkName, VBOX_WIN_BINDNAME_PREFIX); 1522 pszTrunkName += cbFullBindNamePrefix-1; 1523 if(!WideCharToMultiByte(CP_ACP, 0, pswzBindName, cwBindName, pszTrunkName, 1524 sizeof(szTrunkName) - cbFullBindNamePrefix + 1, NULL, NULL)) 1525 { 1526 Assert(0); 1527 DWORD err = GetLastError(); 1528 hrc = HRESULT_FROM_WIN32(err); 1529 AssertMsgFailed(("%hrc=%Rhrc %#x\n", hrc, hrc)); 1530 LogRel(("NetworkAttachmentType_Bridged: WideCharToMultiByte failed, hr=%Rhrc (0x%x)\n", hrc, hrc)); 1531 } 1532 } 1533 else 1534 { 1535 Assert(0); 1536 LogRel(("NetworkAttachmentType_Bridged: insufficient szTrunkName buffer space\n")); 1537 /** @todo set appropriate error code */ 1538 hrc = E_FAIL; 1539 } 1540 1541 if(hrc != S_OK) 1542 { 1543 Assert(0); 1544 CoTaskMemFree(pswzBindName); 1545 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1546 H(); 1547 } 1548 1549 /* we're not freeing the bind name since we'll use it later for detecting wireless*/ 1550 } 1551 else 1552 { 1553 Assert(0); 1554 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1555 LogRel(("NetworkAttachmentType_Bridged: VBoxNetCfgWinGetComponentByGuid failed, hrc (0x%x)", hrc)); 1556 H(); 1557 } 1558 const char *pszTrunk = szTrunkName; 1559 /* we're not releasing the INetCfg stuff here since we use it later to figure out whether it is wireless */ 1560 1490 1561 # elif defined(RT_OS_LINUX) 1491 1562 /* @todo Check for malformed names. */ … … 1539 1610 # elif defined(RT_OS_WINDOWS) 1540 1611 # define DEVNAME_PREFIX L"\\\\.\\" 1541 INetCfg *pNc;1542 LPWSTR lpszApp;1543 HRESULT hr;1544 int rc = VERR_INTNET_FLT_IF_NOT_FOUND;1545 1546 1612 /* we are getting the medium type via IOCTL_NDIS_QUERY_GLOBAL_STATS Io Control 1547 1613 * there is a pretty long way till there though since we need to obtain the symbolic link name 1548 1614 * for the adapter device we are going to query given the device Guid */ 1549 hr = VBoxNetCfgWinQueryINetCfg( FALSE, 1550 L"VirtualBox", 1551 &pNc, 1552 &lpszApp ); 1553 Assert(hr == S_OK); 1554 if(hr == S_OK) 1555 { 1556 /* get the adapter's INetCfgComponent*/ 1557 INetCfgComponent *pAdaptorComponent; 1558 hr = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.ptr(), &pAdaptorComponent); 1559 Assert(hr == S_OK); 1560 if(hr == S_OK) 1561 { 1562 /* now get the bind name */ 1563 LPWSTR pName; 1564 hr = pAdaptorComponent->GetBindName(&pName); 1565 Assert(hr == S_OK); 1566 if(hr == S_OK) 1567 { 1568 /* prepend the "\\\\.\\" to the bind name to obtain the link name */ 1569 wchar_t FileName[MAX_PATH]; 1570 wcscpy(FileName, DEVNAME_PREFIX); 1571 wcscpy((wchar_t*)(((char*)FileName) + sizeof(DEVNAME_PREFIX) - sizeof(FileName[0])), pName); 1572 1573 /* open the device */ 1574 HANDLE hDevice = CreateFile(FileName, 1615 1616 /* prepend the "\\\\.\\" to the bind name to obtain the link name */ 1617 wchar_t FileName[MAX_PATH]; 1618 wcscpy(FileName, DEVNAME_PREFIX); 1619 wcscpy((wchar_t*)(((char*)FileName) + sizeof(DEVNAME_PREFIX) - sizeof(FileName[0])), pswzBindName); 1620 1621 /* open the device */ 1622 HANDLE hDevice = CreateFile(FileName, 1575 1623 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 1576 1624 NULL, … … 1578 1626 FILE_ATTRIBUTE_NORMAL, 1579 1627 NULL); 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1628 if (hDevice != INVALID_HANDLE_VALUE) 1629 { 1630 /* now issue the OID_GEN_PHYSICAL_MEDIUM query */ 1631 DWORD Oid = OID_GEN_PHYSICAL_MEDIUM; 1632 NDIS_PHYSICAL_MEDIUM PhMedium; 1633 DWORD cbResult; 1634 if (DeviceIoControl(hDevice, IOCTL_NDIS_QUERY_GLOBAL_STATS, &Oid, sizeof(Oid), &PhMedium, sizeof(PhMedium), &cbResult, NULL)) 1635 { 1636 /* that was simple, now examine PhMedium */ 1637 if(PhMedium == NdisPhysicalMediumWirelessWan 1590 1638 || PhMedium == NdisPhysicalMediumWirelessLan 1591 1639 || PhMedium == NdisPhysicalMediumNative802_11 … … 1593 1641 /*|| PhMedium == NdisPhysicalMediumWiMax*/ 1594 1642 ) 1595 1596 Log(("this is a wireles adapter"));1597 1643 { 1644 Log(("this is a wireless adapter")); 1645 rc = CFGMR3InsertInteger(pCfg, "SharedMacOnWire", true); RC_CHECK(); 1598 1646 Log(("Set SharedMacOnWire\n")); 1599 1600 1601 1602 Log(("this is NOT a wireles adapter"));1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 CoTaskMemFree(pName); 1621 }1622 VBoxNetCfgWinReleaseRef(pAdaptorComponent); 1623 }1624 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE );1625 }1647 } 1648 else 1649 { 1650 Log(("this is NOT a wireless adapter")); 1651 } 1652 } 1653 else 1654 { 1655 int winEr = GetLastError(); 1656 LogRel(("Console::configConstructor: DeviceIoControl failed, err (0x%x), ignoring\n", winEr)); 1657 Assert(winEr == ERROR_INVALID_PARAMETER || winEr == ERROR_NOT_SUPPORTED || winEr == ERROR_BAD_COMMAND); 1658 } 1659 1660 CloseHandle(hDevice); 1661 } 1662 else 1663 { 1664 int winEr = GetLastError(); 1665 LogRel(("Console::configConstructor: CreateFile failed, err (0x%x), ignoring\n", winEr)); 1666 AssertBreakpoint(); 1667 } 1668 1669 CoTaskMemFree(pswzBindName); 1670 1671 pAdaptorComponent.setNull(); 1672 /* release the pNc finally */ 1673 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1626 1674 # else 1627 1675 /** @todo PORTME: wireless detection */ … … 1790 1838 H(); 1791 1839 } 1792 char szDriverGUID[RTUUID_STR_LENGTH]; 1793 strcpy(szDriverGUID , hostIFGuid.toString().raw()); 1794 const char *pszTrunk = szDriverGUID; 1840 1841 INetCfg *pNc; 1842 ComPtr<INetCfgComponent> pAdaptorComponent; 1843 LPWSTR lpszApp; 1844 int rc = VERR_INTNET_FLT_IF_NOT_FOUND; 1845 1846 hrc = VBoxNetCfgWinQueryINetCfg( FALSE, 1847 L"VirtualBox", 1848 &pNc, 1849 &lpszApp ); 1850 Assert(hrc == S_OK); 1851 if(hrc == S_OK) 1852 { 1853 /* get the adapter's INetCfgComponent*/ 1854 hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.ptr(), pAdaptorComponent.asOutParam()); 1855 if(hrc != S_OK) 1856 { 1857 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1858 LogRel(("NetworkAttachmentType_HostOnly: VBoxNetCfgWinGetComponentByGuid failed, hrc (0x%x)", hrc)); 1859 H(); 1860 } 1861 } 1862 #define VBOX_WIN_BINDNAME_PREFIX "\\DEVICE\\" 1863 char szTrunkName[INTNET_MAX_TRUNK_NAME]; 1864 char *pszTrunkName = szTrunkName; 1865 wchar_t * pswzBindName; 1866 hrc = pAdaptorComponent->GetBindName(&pswzBindName); 1867 Assert(hrc == S_OK); 1868 if (hrc == S_OK) 1869 { 1870 int cwBindName = (int)wcslen(pswzBindName) + 1; 1871 int cbFullBindNamePrefix = sizeof(VBOX_WIN_BINDNAME_PREFIX); 1872 if(sizeof(szTrunkName) > cbFullBindNamePrefix + cwBindName) 1873 { 1874 strcpy(szTrunkName, VBOX_WIN_BINDNAME_PREFIX); 1875 pszTrunkName += cbFullBindNamePrefix-1; 1876 if(!WideCharToMultiByte(CP_ACP, 0, pswzBindName, cwBindName, pszTrunkName, 1877 sizeof(szTrunkName) - cbFullBindNamePrefix + 1, NULL, NULL)) 1878 { 1879 Assert(0); 1880 DWORD err = GetLastError(); 1881 hrc = HRESULT_FROM_WIN32(err); 1882 AssertMsgFailed(("%hrc=%Rhrc %#x\n", hrc, hrc)); 1883 LogRel(("NetworkAttachmentType_HostOnly: WideCharToMultiByte failed, hr=%Rhrc (0x%x)\n", hrc, hrc)); 1884 } 1885 } 1886 else 1887 { 1888 Assert(0); 1889 LogRel(("NetworkAttachmentType_HostOnly: insufficient szTrunkName buffer space\n")); 1890 /** @todo set appropriate error code */ 1891 hrc = E_FAIL; 1892 } 1893 1894 if(hrc != S_OK) 1895 { 1896 Assert(0); 1897 CoTaskMemFree(pswzBindName); 1898 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1899 H(); 1900 } 1901 } 1902 else 1903 { 1904 Assert(0); 1905 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1906 LogRel(("NetworkAttachmentType_HostOnly: VBoxNetCfgWinGetComponentByGuid failed, hrc (0x%x)", hrc)); 1907 H(); 1908 } 1909 1910 1911 CoTaskMemFree(pswzBindName); 1912 1913 pAdaptorComponent.setNull(); 1914 /* release the pNc finally */ 1915 VBoxNetCfgWinReleaseINetCfg( pNc, FALSE ); 1916 1917 const char *pszTrunk = szTrunkName; 1918 1795 1919 1796 1920 /* TODO: set the proper Trunk and Network values, currently the driver uses the first adapter instance */ -
trunk/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp
r8245 r18323 50 50 case STATUS_USER_APC: 51 51 return VERR_INTERRUPTED; 52 case STATUS_OBJECT_NAME_NOT_FOUND: 53 return VERR_FILE_NOT_FOUND; 52 54 } 53 55
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器