@bobnoordam

Disconnecting a network drive using the win32 api

// Disconnect network drive (local)
void disconnect(_TCHAR* localName)
{
	DWORD dwRetVal;
	DWORD dwFlags;
	dwFlags = CONNECT_UPDATE_PROFILE;
	dwRetVal = WNetCancelConnection2(localName, dwFlags, true);
	if (dwRetVal == NO_ERROR)
		wprintf(L"Connection removed %s\n", localName);
	else
		wprintf(L"Remove failed for %s with error %u\n", localName, dwRetVal);
}