mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-30 05:50:53 +03:00
Compare commits
No commits in common. "5ff3172991e0ab5a2a1cf48b7198c059f1cb0253" and "7e2ed880dc82c5bda29f73d973a4da78fabb59ab" have entirely different histories.
5ff3172991
...
7e2ed880dc
Binary file not shown.
Binary file not shown.
@ -977,7 +977,7 @@ static bool str2guid(const char* str, GUID *guid)
|
||||
{
|
||||
unsigned int u[11],k;
|
||||
|
||||
if (36 != strlen(str) || 11 != sscanf(str, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", u+0, u+1, u+2, u+3, u+4, u+5, u+6, u+7, u+8, u+9, u+10))
|
||||
if (11 != sscanf(str, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", u+0, u+1, u+2, u+3, u+4, u+5, u+6, u+7, u+8, u+9, u+10))
|
||||
return false;
|
||||
guid->Data1 = u[0];
|
||||
if ((u[1] & 0xFFFF0000) || (u[2] & 0xFFFF0000)) return false;
|
||||
@ -1110,9 +1110,10 @@ static bool nlm_filter_match(const struct str_list_head *nlm_list)
|
||||
bool bRet = true, bMatch = false;
|
||||
IEnumNetworks* pEnum;
|
||||
|
||||
if (SUCCEEDED(w_win32_error = pNetworkListManager->lpVtbl->GetNetworks(pNetworkListManager, NLM_ENUM_NETWORK_CONNECTED, &pEnum)))
|
||||
if (SUCCEEDED(w_win32_error = pNetworkListManager->lpVtbl->GetNetworks(pNetworkListManager, NLM_ENUM_NETWORK_ALL, &pEnum)))
|
||||
{
|
||||
INetwork* pNet;
|
||||
VARIANT_BOOL bIsConnected;
|
||||
GUID idNet,g;
|
||||
BSTR bstrName;
|
||||
char Name[128];
|
||||
@ -1125,21 +1126,26 @@ static bool nlm_filter_match(const struct str_list_head *nlm_list)
|
||||
break;
|
||||
}
|
||||
if (!pNet) break;
|
||||
if (SUCCEEDED(w_win32_error = pNet->lpVtbl->GetNetworkId(pNet, &idNet)) &&
|
||||
if (SUCCEEDED(w_win32_error = pNet->lpVtbl->get_IsConnected(pNet, &bIsConnected)) &&
|
||||
SUCCEEDED(w_win32_error = pNet->lpVtbl->GetNetworkId(pNet, &idNet)) &&
|
||||
SUCCEEDED(w_win32_error = pNet->lpVtbl->GetName(pNet, &bstrName)))
|
||||
{
|
||||
if (WideCharToMultiByte(CP_UTF8, 0, bstrName, -1, Name, sizeof(Name), NULL, NULL))
|
||||
if (bIsConnected)
|
||||
{
|
||||
LIST_FOREACH(nlm, nlm_list, next)
|
||||
if (WideCharToMultiByte(CP_UTF8, 0, bstrName, -1, Name, sizeof(Name), NULL, NULL))
|
||||
{
|
||||
bMatch = !strcmp(Name,nlm->str) || str2guid(nlm->str,&g) && !memcmp(&idNet,&g,sizeof(GUID));
|
||||
if (bMatch) break;
|
||||
LIST_FOREACH(nlm, nlm_list, next)
|
||||
{
|
||||
bMatch = !strcmp(Name,nlm->str) || str2guid(nlm->str,&g) && !memcmp(&idNet,&g,sizeof(GUID));
|
||||
if (bMatch) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
w_win32_error = HRESULT_FROM_WIN32(GetLastError());
|
||||
bRet = false;
|
||||
else
|
||||
{
|
||||
w_win32_error = HRESULT_FROM_WIN32(GetLastError());
|
||||
bRet = false;
|
||||
}
|
||||
|
||||
}
|
||||
SysFreeString(bstrName);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user