Fix multiple networks on Windows
This commit is contained in:
parent
45b092532e
commit
a9e4fb0ed9
2 changed files with 35 additions and 23 deletions
|
@ -474,29 +474,6 @@ WindowsEthernetTap::WindowsEthernetTap(
|
|||
char data[1024];
|
||||
char tag[24];
|
||||
|
||||
// Initialize COM
|
||||
HRESULT hres = CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
if (FAILED(hres)) {
|
||||
throw std::runtime_error("WinEthernetTap: COM initialization failed");
|
||||
}
|
||||
|
||||
hres = CoInitializeSecurity(
|
||||
NULL,
|
||||
-1,
|
||||
NULL,
|
||||
NULL,
|
||||
RPC_C_AUTHN_LEVEL_DEFAULT,
|
||||
RPC_C_IMP_LEVEL_IMPERSONATE,
|
||||
NULL,
|
||||
EOAC_NONE,
|
||||
NULL
|
||||
);
|
||||
if (FAILED(hres)) {
|
||||
CoUninitialize();
|
||||
throw std::runtime_error("WinEthernetTap: Failed to initialize security");
|
||||
}
|
||||
|
||||
|
||||
// We "tag" registry entries with the network ID to identify persistent devices
|
||||
OSUtils::ztsnprintf(tag,sizeof(tag),"%.16llx",(unsigned long long)nwid);
|
||||
|
||||
|
@ -970,6 +947,12 @@ NET_IFINDEX WindowsEthernetTap::interfaceIndex() const
|
|||
void WindowsEthernetTap::threadMain()
|
||||
throw()
|
||||
{
|
||||
HRESULT hres = CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
if (FAILED(hres)) {
|
||||
fprintf(stderr, "WinEthernetTap: COM initialization failed");
|
||||
return;
|
||||
}
|
||||
|
||||
char tapReadBuf[ZT_MAX_MTU + 32];
|
||||
char tapPath[128];
|
||||
HANDLE wait4[3];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue