Determine the process ID of a process that created a named object

  • Follow


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.


0
Reply nki00 6/10/2010 10:01:34 PM

On Jun 10, 3:01=A0pm, "nki00" <lukkycha...@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
0
Reply David 6/11/2010 12:11:03 AM


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


0
Reply nki00 6/11/2010 1:06:44 AM

On Jun 10, 6:06=A0pm, "nki00" <lukkycha...@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
0
Reply David 6/11/2010 7:48:35 PM

3 Replies
325 Views

(page loaded in 0.081 seconds)

Similiar Articles:













7/25/2012 1:34:37 AM


Reply: