Changeset 13720 in vbox
- Timestamp:
- Oct 31, 2008 3:02:40 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38688
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Makefile.kmk
r13604 r13720 173 173 endif 174 174 175 ifdef VBOX_WITH_NETFLT 176 VBoxDD_LIBS.win += $(PATH_LIB)/WinNetConfig.lib 177 endif 178 175 179 ifeq ($(KBUILD_TARGET),solaris) 176 180 VBoxDD_LIBS += adm … … 191 195 VBoxDD_LDFLAGS.linux = -Wl,--no-undefined 192 196 VBoxDD_LDFLAGS.l4 = -Wl,--no-undefined 193 194 197 195 198 # -
trunk/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk
r13707 r13720 111 111 endif # signing 112 112 113 # 114 # WinNetConfig - static library with host network interface config API 115 # 116 LIBRARIES.win += WinNetConfig 117 WinNetConfig_TEMPLATE = VBOXR3STATIC 118 WinNetConfig_DEFS = _WIN32_WINNT=0x0500 _UNICODE UNICODE 119 WinNetConfig_SDKS = WINPSDK W2K3DDK 120 WinNetConfig_SOURCES = \ 121 win/WinNetConfig.cpp 113 122 114 123 else if1of ($(KBUILD_TARGET), linux solaris) -
trunk/src/VBox/Main/HostImpl.cpp
r13655 r13720 119 119 120 120 #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT) 121 # include < Netcfgn.h>121 # include <VBox/WinNetConfig.h> 122 122 #endif /* #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT) */ 123 123 … … 706 706 #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT) 707 707 # define VBOX_APP_NAME L"VirtualBox" 708 # define VBOX_NETCFG_LOCK_TIME_OUT 5000709 710 /*711 * Release reference712 */713 static VOID vboxNetCfgWinReleaseRef (IN IUnknown* punk)714 {715 if(punk)716 {717 punk->Release();718 }719 720 return;721 }722 723 /*724 * Get a reference to INetCfg.725 *726 * fGetWriteLock [in] If TRUE, Write lock.requested.727 * lpszAppName [in] Application name requesting the reference.728 * ppnc [out] Reference to INetCfg.729 * lpszLockedBy [in] Optional. Application who holds the write lock.730 *731 * Returns: S_OK on sucess, otherwise an error code.732 */733 static HRESULT vboxNetCfgWinQueryINetCfg (IN BOOL fGetWriteLock,734 IN LPCWSTR lpszAppName,735 OUT INetCfg** ppnc,736 OUT LPWSTR *lpszLockedBy)737 {738 INetCfg *pnc = NULL;739 INetCfgLock *pncLock = NULL;740 HRESULT hr = S_OK;741 742 /*743 * Initialize the output parameters.744 */745 *ppnc = NULL;746 747 if ( lpszLockedBy )748 {749 *lpszLockedBy = NULL;750 }751 /*752 * Create the object implementing INetCfg.753 */754 hr = CoCreateInstance( CLSID_CNetCfg,755 NULL, CLSCTX_INPROC_SERVER,756 IID_INetCfg,757 (void**)&pnc );758 if ( hr == S_OK )759 {760 761 if ( fGetWriteLock )762 {763 764 /*765 * Get the locking reference766 */767 hr = pnc->QueryInterface( IID_INetCfgLock,768 (LPVOID *)&pncLock );769 if ( hr == S_OK )770 {771 /*772 * Attempt to lock the INetCfg for read/write773 */774 hr = pncLock->AcquireWriteLock( VBOX_NETCFG_LOCK_TIME_OUT,775 lpszAppName,776 lpszLockedBy);777 if (hr == S_FALSE )778 {779 hr = NETCFG_E_NO_WRITE_LOCK;780 }781 }782 }783 784 if ( hr == S_OK )785 {786 /*787 * Initialize the INetCfg object.788 */789 hr = pnc->Initialize( NULL );790 791 if ( hr == S_OK )792 {793 *ppnc = pnc;794 pnc->AddRef();795 }796 else797 {798 /*799 * Initialize failed, if obtained lock, release it800 */801 if ( pncLock )802 {803 pncLock->ReleaseWriteLock();804 }805 }806 }807 808 vboxNetCfgWinReleaseRef( pncLock );809 vboxNetCfgWinReleaseRef( pnc );810 }811 812 return hr;813 }814 815 /*816 * Get a reference to INetCfg.817 *818 * pnc [in] Reference to INetCfg to release.819 * fHasWriteLock [in] If TRUE, reference was held with write lock.820 *821 * Returns: S_OK on sucess, otherwise an error code.822 *823 */824 static HRESULT vboxNetCfgWinReleaseINetCfg (IN INetCfg* pnc,825 IN BOOL fHasWriteLock)826 {827 INetCfgLock *pncLock = NULL;828 HRESULT hr = S_OK;829 830 /*831 * Uninitialize INetCfg832 */833 hr = pnc->Uninitialize();834 835 /*836 * If write lock is present, unlock it837 */838 if ( hr == S_OK && fHasWriteLock )839 {840 841 /*842 * Get the locking reference843 */844 hr = pnc->QueryInterface( IID_INetCfgLock,845 (LPVOID *)&pncLock);846 if ( hr == S_OK )847 {848 hr = pncLock->ReleaseWriteLock();849 vboxNetCfgWinReleaseRef( pncLock );850 }851 }852 853 vboxNetCfgWinReleaseRef( pnc );854 855 return hr;856 }857 708 858 709 static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc) … … 894 745 895 746 return rc; 896 }897 898 /*899 * Get network component's binding path enumerator reference.900 *901 * Arguments:902 * pncc [in] Network component reference.903 * dwBindingType [in] EBP_ABOVE or EBP_BELOW.904 * ppencbp [out] Enumerator reference.905 *906 * Returns: S_OK on sucess, otherwise an error code.907 */908 909 static HRESULT vboxNetCfgWinGetBindingPathEnum (IN INetCfgComponent *pncc,910 IN DWORD dwBindingType,911 OUT IEnumNetCfgBindingPath **ppencbp)912 {913 INetCfgComponentBindings *pnccb = NULL;914 HRESULT hr;915 916 *ppencbp = NULL;917 918 /* Get component's binding. */919 hr = pncc->QueryInterface( IID_INetCfgComponentBindings,920 (PVOID *)&pnccb );921 922 if ( hr == S_OK )923 {924 925 /* Get binding path enumerator reference. */926 hr = pnccb->EnumBindingPaths( dwBindingType,927 ppencbp );928 929 vboxNetCfgWinReleaseRef( pnccb );930 }931 932 return hr;933 }934 935 /*936 * Enumerates the first binding path.937 *938 * Arguments:939 * pencc [in] Binding path enumerator reference.940 * ppncc [out] Binding path reference.941 *942 * Returns: S_OK on sucess, otherwise an error code.943 */944 static HRESULT vboxNetCfgWinGetFirstBindingPath (IN IEnumNetCfgBindingPath *pencbp,945 OUT INetCfgBindingPath **ppncbp)946 {947 ULONG ulCount;948 HRESULT hr;949 950 *ppncbp = NULL;951 952 pencbp->Reset();953 954 hr = pencbp->Next( 1,955 ppncbp,956 &ulCount );957 958 return hr;959 }960 961 /*962 * Get binding interface enumerator reference.963 *964 * Arguments:965 * pncbp [in] Binding path reference.966 * ppencbp [out] Enumerator reference.967 *968 * Returns: S_OK on sucess, otherwise an error code.969 */970 static HRESULT vboxNetCfgWinGetBindingInterfaceEnum (IN INetCfgBindingPath *pncbp,971 OUT IEnumNetCfgBindingInterface **ppencbi)972 {973 HRESULT hr;974 975 *ppencbi = NULL;976 977 hr = pncbp->EnumBindingInterfaces( ppencbi );978 979 return hr;980 }981 982 /* Enumerates the first binding interface.983 *984 * Arguments:985 * pencbi [in] Binding interface enumerator reference.986 * ppncbi [out] Binding interface reference.987 *988 * Returns: S_OK on sucess, otherwise an error code.989 */990 static HRESULT vboxNetCfgWinGetFirstBindingInterface (IN IEnumNetCfgBindingInterface *pencbi,991 OUT INetCfgBindingInterface **ppncbi)992 {993 ULONG ulCount;994 HRESULT hr;995 996 *ppncbi = NULL;997 998 pencbi->Reset();999 1000 hr = pencbi->Next( 1,1001 ppncbi,1002 &ulCount );1003 1004 return hr;1005 }1006 1007 /*1008 * Enumerate the next binding interface.1009 *1010 * The function behaves just like vboxNetCfgWinGetFirstBindingInterface if1011 * it is called right after vboxNetCfgWinGetBindingInterfaceEnum.1012 *1013 * Arguments:1014 * pencbi [in] Binding interface enumerator reference.1015 * ppncbi [out] Binding interface reference.1016 *1017 * Returns: S_OK on sucess, otherwise an error code.1018 */1019 static HRESULT vboxNetCfgWinGetNextBindingInterface (IN IEnumNetCfgBindingInterface *pencbi,1020 OUT INetCfgBindingInterface **ppncbi)1021 {1022 ULONG ulCount;1023 HRESULT hr;1024 1025 *ppncbi = NULL;1026 1027 hr = pencbi->Next( 1,1028 ppncbi,1029 &ulCount );1030 1031 return hr;1032 }1033 1034 /* Enumerate the next binding path.1035 * The function behaves just like vboxNetCfgWinGetFirstBindingPath if1036 * it is called right after vboxNetCfgWinGetBindingPathEnum.1037 *1038 * Arguments:1039 * pencbp [in] Binding path enumerator reference.1040 * ppncbp [out] Binding path reference.1041 *1042 * Returns: S_OK on sucess, otherwise an error code.1043 */1044 static HRESULT vboxNetCfgWinGetNextBindingPath (IN IEnumNetCfgBindingPath *pencbp,1045 OUT INetCfgBindingPath **ppncbp)1046 {1047 ULONG ulCount;1048 HRESULT hr;1049 1050 *ppncbp = NULL;1051 1052 hr = pencbp->Next( 1,1053 ppncbp,1054 &ulCount );1055 1056 return hr;1057 747 } 1058 748 -
trunk/src/VBox/Main/Makefile.kmk
r13655 r13720 68 68 ifdef VBOX_WITH_NETFLT 69 69 VBOX_MAIN_DEFS += VBOX_WITH_NETFLT 70 ifdef VBOX_NETFLT_ONDEMAND_BIND71 VBoxSVC_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND72 endif73 70 endif 74 71 ifdef VBOX_WITH_GUEST_PROPS … … 319 316 endif 320 317 318 ifdef VBOX_WITH_NETFLT 319 VBoxSVC_LIBS.win += $(PATH_LIB)/WinNetConfig.lib 320 ifdef VBOX_NETFLT_ONDEMAND_BIND 321 VBoxSVC_DEFS.win += VBOX_NETFLT_ONDEMAND_BIND 322 endif 323 endif 321 324 VBoxSVC_LDFLAGS.darwin = -framework IOKit -framework SystemConfiguration 322 325 ifeq ($(KBUILD_TYPE),debug)
Note:
See TracChangeset
for help on using the changeset viewer.