Skip to content

Instantly share code, notes, and snippets.

@Warepire
Created July 18, 2017 18:09
Show Gist options
  • Save Warepire/6d4530983859493ee2a982be70a36da0 to your computer and use it in GitHub Desktop.
Save Warepire/6d4530983859493ee2a982be70a36da0 to your computer and use it in GitHub Desktop.
Mega-hacky fix to allow remote mounted drives
index 940ab77..bebc562 100644
--- a/source/application/wintaser.cpp
+++ b/source/application/wintaser.cpp
@@ -362,7 +362,20 @@ static std::wstring TranslateDeviceName(const std::wstring& filename)
size_t name_len = wcslen(name);
if (name_len < MAX_PATH)
{
- found = (_wcsnicmp(filename.c_str(), name, name_len) == 0);
+ if (filename.find(L"\\Device\\Mup") == 0) // HACK! - Symbolic links can't be resolved properly for \\Device\\Mup paths.
+ {
+ std::wstring substr = filename.substr(wcslen(L"\\Device\\Mup"));
+ size_t substr_end = substr.find(L'\\');
+ substr_end = substr.find(L'\\', substr_end + 1); // hostname
+ substr_end = substr.find(L'\\', substr_end + 1); // share name
+ substr = substr.substr(0, substr_end);
+ found = (wcsstr(name, substr.c_str()) != nullptr);
+ name_len = wcslen(L"\\Device\\Mup") + substr.size();
+ }
+ else
+ {
+ found = (_wcsnicmp(filename.c_str(), name, name_len) == 0);
+ }
if (found)
{
WCHAR temp_file[MAX_PATH];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment