[MPR] Implement WNetClearConnections()

This has been submitted upstream.

CORE-15012
This commit is contained in:
Pierre Schweitzer 2018-09-11 08:08:56 +02:00
parent 74620c94d3
commit cf0112a6e6
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 59 additions and 0 deletions

View file

@ -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)

View file

@ -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
/*