From a4398d1a2f8701873358f59fab6b31d5f8bfc678 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Sat, 22 Apr 2023 18:01:52 +0800 Subject: [PATCH] update --- example/src/tool/IPC.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/example/src/tool/IPC.cpp b/example/src/tool/IPC.cpp index 68533e93..ae7ef401 100644 --- a/example/src/tool/IPC.cpp +++ b/example/src/tool/IPC.cpp @@ -6,9 +6,7 @@ #include #include -#ifdef WIN32 -#include -#else +#ifndef _MSC_VER #include #endif @@ -90,7 +88,7 @@ time_t IPC::postEvent(const QString& name, const QByteArray& data, uint32_t dest memcpy(evt->data, data.constData(), data.length()); mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(nullptr)); evt->dest = dest; - evt->sender = GetCurrentProcessId(); + evt->sender = _getpid(); qDebug() << "postEvent " << name << "to" << dest; } globalMemory.unlock(); @@ -172,7 +170,7 @@ IPC::IPCEvent* IPC::fetchEvent() memset(evt, 0, sizeof(IPCEvent)); } - if (evt->posted && !evt->processed && evt->sender != GetCurrentProcessId() + if (evt->posted && !evt->processed && evt->sender != _getpid() && (evt->dest == profileId || (evt->dest == 0 && isCurrentOwnerNoLock()))) { return evt; }