summaryrefslogtreecommitdiff
path: root/shared/resolve_path.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:13:35 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:13:35 +0200
commit801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc (patch)
tree473f4a9ea5016f146fb2ff6085807bc91a84c84e /shared/resolve_path.cpp
parent3.20 (diff)
downloadFreeFileSync-801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc.tar.gz
FreeFileSync-801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc.tar.bz2
FreeFileSync-801e8b43b13f1cb67d9e9ba4aae5acb274ccdfbc.zip
3.21
Diffstat (limited to 'shared/resolve_path.cpp')
-rw-r--r--shared/resolve_path.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/shared/resolve_path.cpp b/shared/resolve_path.cpp
index a9d1e0e5..2a9cb7e6 100644
--- a/shared/resolve_path.cpp
+++ b/shared/resolve_path.cpp
@@ -29,18 +29,21 @@ Zstring resolveBrokenNetworkMap(const Zstring& dirname) //circumvent issue with
if (dirname.size() >= 2 && iswalpha(dirname[0]) && dirname[1] == L':')
{
Zstring driveLetter(dirname.c_str(), 2); //e.g.: "Q:"
- if (::GetFileAttributes((driveLetter + L'\\').c_str()) == INVALID_FILE_ATTRIBUTES)
+
+ //if (::GetFileAttributes((driveLetter + L'\\').c_str()) == INVALID_FILE_ATTRIBUTES) <- this will seriously block if network is not reachable!!!
{
DWORD bufferSize = 10000;
std::vector<wchar_t> remoteNameBuffer(bufferSize);
DWORD rv = ::WNetGetConnection(driveLetter.c_str(), //__in LPCTSTR lpLocalName in the form "<driveletter>:"
&remoteNameBuffer[0], //__out LPTSTR lpRemoteName,
&bufferSize); //__inout LPDWORD lpnLength
- (void)rv;
- //no error check here! remoteNameBuffer will be filled on ERROR_CONNECTION_UNAVAIL and maybe others?
+ if (rv == NO_ERROR ||
+ rv == ERROR_CONNECTION_UNAVAIL) //remoteNameBuffer will be filled nevertheless!
+ {
Zstring networkShare = &remoteNameBuffer[0];
if (!networkShare.empty())
return networkShare + (dirname.c_str() + 2); //replace "Q:\subdir" by "\\server\share\subdir"
+ }
}
}
return dirname;
bgstack15