Automatically detect Ethernet tap friendly name in Windows shouldBind stuff.
This commit is contained in:
parent
e8390afad5
commit
79e2fd4586
6 changed files with 37 additions and 19 deletions
|
@ -810,6 +810,7 @@ void WindowsEthernetTap::setFriendlyName(const char *dn)
|
|||
{
|
||||
if (!_initialized)
|
||||
return;
|
||||
|
||||
HKEY ifp;
|
||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,(std::string("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\") + _netCfgInstanceId).c_str(),0,KEY_READ|KEY_WRITE,&ifp) == ERROR_SUCCESS) {
|
||||
RegSetKeyValueA(ifp,"Connection","Name",REG_SZ,(LPCVOID)dn,(DWORD)(strlen(dn)+1));
|
||||
|
@ -864,6 +865,16 @@ void WindowsEthernetTap::setFriendlyName(const char *dn)
|
|||
ev->Release();
|
||||
}
|
||||
nsecc->Release();
|
||||
|
||||
_friendlyName_m.lock();
|
||||
_friendlyName = dn;
|
||||
_friendlyName_m.unlock();
|
||||
}
|
||||
|
||||
std::string WindowsEthernetTap::friendlyName() const
|
||||
{
|
||||
Mutex::Lock l(_friendlyName_m);
|
||||
return _friendlyName;
|
||||
}
|
||||
|
||||
void WindowsEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue