From: nki00 on
Say, if I create a named object like this in one process:

CreateEvent(NULL, FALSE, FALSE, _T("MyNamedEvent"));

and then open it in another process (service):

HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, _T("MyNamedEvent"));
if(hEvent && GetLastError() == ERROR_ALREADY_EXISTS)
{
//What process created hEvent event originally?
}

Is there any way to determine what process created it originally?





That's how I'm intending to see if any of the client processes that are
connected to this service process are still "alive". To up the security I
need to get a process that created such named event and if I have its ID
I'll be able to tell that it's "my process" and not some imposter setting
that named event.


From: David Schwartz on
On Jun 10, 3:01 pm, "nki00" <lukkycha...(a)gmail.com> wrote:

> That's how I'm intending to see if any of the client processes that are
> connected to this service process are still "alive". To up the security I
> need to get a process that created such named event and if I have its ID
> I'll be able to tell that it's "my process" and not some imposter setting
> that named event.

The first parameter to CreateEvent controls who can and can't access
the named event, so you don't have to worry about impostors. If all
your processes are cooperating (as they must be), just have them
register in some known place, such as an agreed-upon file whose
location is tracked in the registry.

DS
From: nki00 on
Thanks. But what exactly should I specify for the first parameter to the
CreateEvent?


From: David Schwartz on
On Jun 10, 6:06 pm, "nki00" <lukkycha...(a)gmail.com> wrote:

> Thanks. But what exactly should I specify for the first parameter to the
> CreateEvent?

It all depends on what constitutes an "impostor".

DS