mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[MPR] Implement WNetClearConnections()
This has been submitted upstream. CORE-15012
This commit is contained in:
parent
74620c94d3
commit
cf0112a6e6
2 changed files with 59 additions and 0 deletions
|
@ -55,6 +55,7 @@
|
|||
@ stdcall WNetCancelConnection2W(wstr long long)
|
||||
@ stdcall WNetCancelConnectionA(str long)
|
||||
@ stdcall WNetCancelConnectionW(wstr long)
|
||||
@ stdcall WNetClearConnections(long)
|
||||
@ stdcall WNetCloseEnum(long)
|
||||
@ stdcall WNetConnectionDialog1A(ptr)
|
||||
@ stdcall WNetConnectionDialog1W(ptr)
|
||||
|
|
|
@ -2646,6 +2646,64 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
|
|||
return err;
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
/*****************************************************************
|
||||
* WNetClearConnections [MPR.@]
|
||||
*/
|
||||
DWORD WINAPI WNetClearConnections ( DWORD unknown )
|
||||
{
|
||||
HANDLE connected;
|
||||
DWORD ret, size, count;
|
||||
NETRESOURCEW * resources, * iter;
|
||||
|
||||
ret = WNetOpenEnumW(RESOURCE_CONNECTED, RESOURCETYPE_ANY, 0, NULL, &connected);
|
||||
if (ret != WN_SUCCESS)
|
||||
{
|
||||
if (ret != WN_NO_NETWORK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Means no provider, then, clearing is OK */
|
||||
return WN_SUCCESS;
|
||||
}
|
||||
|
||||
size = 0x1000;
|
||||
resources = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
if (!resources)
|
||||
{
|
||||
WNetCloseEnum(connected);
|
||||
return WN_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
size = 0x1000;
|
||||
count = -1;
|
||||
|
||||
memset(resources, 0, size);
|
||||
ret = WNetEnumResourceW(connected, &count, resources, &size);
|
||||
if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
|
||||
{
|
||||
iter = resources;
|
||||
for (; count; count--)
|
||||
{
|
||||
WNetCancelConnection2W(iter->lpLocalName, 0, TRUE);
|
||||
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
} while (ret != WN_NO_MORE_ENTRIES);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, resources);
|
||||
WNetCloseEnum(connected);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue