|
|
@ -80,12 +80,7 @@ |
|
|
|
#include <QLocalServer> |
|
|
|
#include <QLocalServer> |
|
|
|
#include <QLocalSocket> |
|
|
|
#include <QLocalSocket> |
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) |
|
|
|
#include "base/utils/misc.h" |
|
|
|
#include <QLibrary> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*); |
|
|
|
|
|
|
|
static PProcessIdToSessionId pProcessIdToSessionId = 0; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace QtLP_Private |
|
|
|
namespace QtLP_Private |
|
|
|
{ |
|
|
|
{ |
|
|
@ -121,17 +116,16 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId) |
|
|
|
+ QLatin1Char('-') + QString::number(idNum, 16); |
|
|
|
+ QLatin1Char('-') + QString::number(idNum, 16); |
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) |
|
|
|
#if defined(Q_OS_WIN) |
|
|
|
if (!pProcessIdToSessionId) { |
|
|
|
using PPROCESSIDTOSESSIONID = BOOL (WINAPI *)(DWORD, DWORD *); |
|
|
|
QLibrary lib("kernel32"); |
|
|
|
const auto processIdToSessionId = Utils::Misc::loadWinAPI<PPROCESSIDTOSESSIONID>("kernel32.dll", "ProcessIdToSessionId"); |
|
|
|
pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId"); |
|
|
|
|
|
|
|
} |
|
|
|
if (processIdToSessionId) { |
|
|
|
if (pProcessIdToSessionId) { |
|
|
|
|
|
|
|
DWORD sessionId = 0; |
|
|
|
DWORD sessionId = 0; |
|
|
|
pProcessIdToSessionId(GetCurrentProcessId(), &sessionId); |
|
|
|
processIdToSessionId(GetCurrentProcessId(), &sessionId); |
|
|
|
socketName += QLatin1Char('-') + QString::number(sessionId, 16); |
|
|
|
socketName += (QLatin1Char('-') + QString::number(sessionId, 16)); |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|
socketName += QLatin1Char('-') + QString::number(::getuid(), 16); |
|
|
|
socketName += (QLatin1Char('-') + QString::number(::getuid(), 16)); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
server = new QLocalServer(this); |
|
|
|
server = new QLocalServer(this); |
|
|
|