Windows: Fix Share menu #4781

This commit is contained in:
Markus Goetz 2016-05-09 14:37:46 +02:00
parent 74f67c97a9
commit 8820bc1c17
2 changed files with 15 additions and 2 deletions

View file

@ -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)) {

View file

@ -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];