Commit 07995500 authored by Pierre Schweitzer's avatar Pierre Schweitzer Committed by Alexandre Julliard

mpr: Implement WNetClearConnections().

parent 43d04a32
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
@ stdcall WNetCancelConnection2W(wstr long long) @ stdcall WNetCancelConnection2W(wstr long long)
@ stdcall WNetCancelConnectionA(str long) @ stdcall WNetCancelConnectionA(str long)
@ stdcall WNetCancelConnectionW(wstr long) @ stdcall WNetCancelConnectionW(wstr long)
@ stdcall WNetClearConnections(long)
@ stdcall WNetCloseEnum(long) @ stdcall WNetCloseEnum(long)
@ stdcall WNetConnectionDialog1A(ptr) @ stdcall WNetConnectionDialog1A(ptr)
@ stdcall WNetConnectionDialog1W(ptr) @ stdcall WNetConnectionDialog1W(ptr)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright 1999 Ulrich Weigand * Copyright 1999 Ulrich Weigand
* Copyright 2004 Juan Lang * Copyright 2004 Juan Lang
* Copyright 2007 Maarten Lankhorst * Copyright 2007 Maarten Lankhorst
* Copyright 2016 Pierre Schweitzer * Copyright 2016-2018 Pierre Schweitzer
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -2407,6 +2407,56 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel, ...@@ -2407,6 +2407,56 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
return err; return err;
} }
/*****************************************************************
* WNetClearConnections [MPR.@]
*/
DWORD WINAPI WNetClearConnections ( HWND owner )
{
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;
}
for (;;)
{
size = 0x1000;
count = -1;
memset(resources, 0, size);
ret = WNetEnumResourceW(connected, &count, resources, &size);
if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
{
for (iter = resources; count; count--, iter++)
WNetCancelConnection2W(iter->lpLocalName, 0, TRUE);
}
else
break;
}
HeapFree(GetProcessHeap(), 0, resources);
WNetCloseEnum(connected);
return ret;
}
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment