Browse Source

com & com security already initialized by here

pull/2/head
Grant Limberg 5 years ago
parent
commit
5188c7d41f
  1. 3
      osdep/EthernetTap.cpp
  2. 8
      osdep/WindowsEthernetTap.cpp

3
osdep/EthernetTap.cpp

@ -112,7 +112,7 @@ std::shared_ptr<EthernetTap> EthernetTap::newInstance(
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_AUTHN_LEVEL_PKT,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE,
@ -120,6 +120,7 @@ std::shared_ptr<EthernetTap> EthernetTap::newInstance(
);
if (FAILED(hres)) {
CoUninitialize();
fprintf(stderr, "WinEthernetTap: Failed to initialize security");
throw std::runtime_error("WinEthernetTap: Failed to initialize security");
}
_comInit = true;

8
osdep/WindowsEthernetTap.cpp

@ -816,13 +816,7 @@ void WindowsEthernetTap::setFriendlyName(const char *dn)
RegCloseKey(ifp);
}
HRESULT hr = CoInitialize(nullptr);
if (hr != S_OK) return;
CoInitializeSecurity(NULL, -1, NULL, NULL,
RPC_C_AUTHN_LEVEL_PKT,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL, EOAC_NONE, NULL);
if (hr != S_OK) return;
HRESULT hr = S_OK;
INetSharingManager *nsm;
hr = CoCreateInstance(__uuidof(NetSharingManager), NULL, CLSCTX_ALL, __uuidof(INetSharingManager), (void**)&nsm);

Loading…
Cancel
Save