Can one Process signal the event created by another process under different username(both process running under different username) ?

StackOverflow https://stackoverflow.com/questions/9000010

سؤال

Happening in Windows 7:

I have installed process proc1.exe as service.In the proc1, i am creating new process proc2.exe by creating session id and token and passing to CreateProcessAsUser().

In the Proc2, i am creating one event which is waiting for signal. In the Proc1, am sending the signal to that event by OpenEvent and SetEvent when i stop service.

if i start service, proc1.exe is running under SYSTEM username and proc2.exe is running under loggedin username(Taskmanager).

When i stop service, Proc1 is trying to send signal by calling OpenEvent. But OpenEvent returns NULL.

Both processes are running under different user. is it a problem to access that event ? if so, how to signal the event under different process and user ? PLease help me to find out.....

هل كانت مفيدة؟

المحلول

Your event is probably local to the session where it's created, i.e. if Proc2 created an event named "ShutdownSystem", then that event is only known to other processes within that session, much like local variables in a function.

If you want your event object to exist in a global manner and be accessible from other sessions, you should prefix it with "Global\" (e.g. name it "Global\ShutdownSystem"). The system would then create it in the global namespace.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top