mirror of
https://github.com/tnodir/fort
synced 2024-11-15 03:26:01 +00:00
UI: ControlManager: Named pipe name is per user name.
This commit is contained in:
parent
4000db08b8
commit
4760547083
@ -210,5 +210,5 @@ void ControlManager::close()
|
||||
|
||||
QString ControlManager::getServerName(bool isService)
|
||||
{
|
||||
return QLatin1String(APP_BASE) + (isService ? "Svc" : QString()) + "Pipe";
|
||||
return QLatin1String(APP_BASE) + (isService ? "Svc" : OsUtil::userName()) + "Pipe";
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <qt_windows.h>
|
||||
|
||||
#include <lmcons.h>
|
||||
|
||||
#include "processinfo.h"
|
||||
|
||||
namespace {
|
||||
@ -97,6 +99,16 @@ qint32 OsUtil::getTickCount()
|
||||
return qint32(GetTickCount());
|
||||
}
|
||||
|
||||
QString OsUtil::userName()
|
||||
{
|
||||
wchar_t buf[UNLEN + 1];
|
||||
DWORD len = UNLEN + 1;
|
||||
if (GetUserNameW(buf, &len)) {
|
||||
return QString::fromWCharArray(buf, int(len) - 1); // skip terminationg null char.
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool OsUtil::isUserAdmin()
|
||||
{
|
||||
SID_IDENTIFIER_AUTHORITY idAuth = SECURITY_NT_AUTHORITY;
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
|
||||
static qint32 getTickCount();
|
||||
|
||||
static QString userName();
|
||||
static bool isUserAdmin();
|
||||
|
||||
static bool beep(BeepType type = BeepSimple);
|
||||
|
Loading…
Reference in New Issue
Block a user