From 8820bc1c17edbc26cf2b8f7fa3ea8d18c0094e84 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 9 May 2016 14:37:46 +0200 Subject: [PATCH] Windows: Fix Share menu #4781 --- .../windows/OCContextMenu/OCClientInterface.cpp | 15 ++++++++++++++- .../windows/OCUtil/RemotePathChecker.cpp | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp index 7d9783bfa..7f21292cf 100644 --- a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp +++ b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp @@ -34,10 +34,23 @@ using namespace std; #define PIPE_TIMEOUT 5*1000 //ms #define SOCK_BUFFER 4096 +// TODO: Unify this with RemotePathChecker.cpp +#define BUFSIZE 512 +std::wstring getUserName() { + DWORD len = BUFSIZE; + TCHAR buf[BUFSIZE]; + if (GetUserName(buf, &len)) { + return std::wstring(&buf[0], len); + } else { + return std::wstring(); + } +} + OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo() { auto pipename = std::wstring(L"\\\\.\\pipe\\"); - pipename += L"ownCloud"; + pipename += L"ownCloud\\"; + pipename += getUserName(); CommunicationSocket socket; if (!WaitNamedPipe(pipename.data(), PIPE_TIMEOUT)) { diff --git a/shell_integration/windows/OCUtil/RemotePathChecker.cpp b/shell_integration/windows/OCUtil/RemotePathChecker.cpp index d03a38350..fcca9893a 100644 --- a/shell_integration/windows/OCUtil/RemotePathChecker.cpp +++ b/shell_integration/windows/OCUtil/RemotePathChecker.cpp @@ -31,8 +31,8 @@ using namespace std; +// FIXME: Unify this with OCClientInterface.cpp #define BUFSIZE 512 - std::wstring getUserName() { DWORD len = BUFSIZE; TCHAR buf[BUFSIZE]; -- 2.30.2