From 8f9f382e1c97cab2e72e97495650c73ac4b97314 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 4 Jan 2013 14:50:19 +0100 Subject: Imported Upstream version 0.3.0.5 --- ExtraSocket.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 ExtraSocket.cpp (limited to 'ExtraSocket.cpp') diff --git a/ExtraSocket.cpp b/ExtraSocket.cpp new file mode 100644 index 0000000..08b0979 --- /dev/null +++ b/ExtraSocket.cpp @@ -0,0 +1,32 @@ +/** \file ExtraSocket.h +\brief Define the socket of ultracopier +\author alpha_one_x86 +\version 0.3 +\date 2010 +\licence GPL3, see the file COPYING */ + +#include "ExtraSocket.h" + +QString ExtraSocket::pathSocket(const QString &name) +{ +#ifdef Q_OS_UNIX + return name+"-"+QString::number(getuid()); +#else + QString userName; + DWORD size=0; + if(GetUserNameW(NULL,&size) || (GetLastError()!=ERROR_INSUFFICIENT_BUFFER)) + { + } + else + { + WCHAR * userNameW=new WCHAR[size]; + if(GetUserNameW(userNameW,&size)) + { + userName.fromWCharArray(userNameW,size*2); + userName=QString(QByteArray((char*)userNameW,size*2-2).toHex()); + } + delete userNameW; + } + return name+"-"+userName; +#endif +} -- cgit v1.2.3