Browse Source

Fix misc::getUserIDString() on Windows.

Return current user name now (and not constant "0").
Also use Unicode version of GetUserName().
adaptive-webui-19844
Vladimir Golovnev (Glassez) 10 years ago
parent
commit
e52a8fb0b0
  1. 8
      src/core/misc.cpp

8
src/core/misc.cpp

@ -444,10 +444,10 @@ QString misc::getUserIDString() @@ -444,10 +444,10 @@ QString misc::getUserIDString()
{
QString uid = "0";
#ifdef Q_OS_WIN
char buffer[UNLEN + 1] = {0};
DWORD buffer_len = UNLEN + 1;
if (!GetUserNameA(buffer, &buffer_len))
uid = QString(buffer);
WCHAR buffer[UNLEN + 1] = {0};
DWORD buffer_len = sizeof(buffer)/sizeof(*buffer);
if (GetUserNameW(buffer, &buffer_len))
uid = QString::fromWCharArray(buffer);
#else
uid = QString::number(getuid());
#endif

Loading…
Cancel
Save