mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-12 18:24:58 +08:00
Fix misc::getUserIDString() on Windows.
Return current user name now (and not constant "0"). Also use Unicode version of GetUserName().
This commit is contained in:
parent
ff9a281b72
commit
e52a8fb0b0
@ -444,10 +444,10 @@ QString misc::getUserIDString()
|
|||||||
{
|
{
|
||||||
QString uid = "0";
|
QString uid = "0";
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
char buffer[UNLEN + 1] = {0};
|
WCHAR buffer[UNLEN + 1] = {0};
|
||||||
DWORD buffer_len = UNLEN + 1;
|
DWORD buffer_len = sizeof(buffer)/sizeof(*buffer);
|
||||||
if (!GetUserNameA(buffer, &buffer_len))
|
if (GetUserNameW(buffer, &buffer_len))
|
||||||
uid = QString(buffer);
|
uid = QString::fromWCharArray(buffer);
|
||||||
#else
|
#else
|
||||||
uid = QString::number(getuid());
|
uid = QString::number(getuid());
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user