Peter350
Peter350

Reputation: 41

Create session mutex from a service?

Consider: Mutex Class (MSDN)

(And using WinObj from Sysinternals.)

How do I create a mutex for a session other than the one creating it?

I.e. From a system service in session 0, create a mutex in session 1?

I have attempted creating the mutex using

\Sessions\1\BaseNamedObjects\myName

But that fails.

Is it possible to write directly to the root of the Windows object namespace shown in WinObj?

Upvotes: 0

Views: 1779

Answers (1)

Ceky
Ceky

Reputation: 21

Try use "Global\" prefix in your mutex name. On a server that is running Terminal Services, a named system mutex can have two levels of visibility. If its name begins with the prefix "Global\", the mutex is visible in all terminal server sessions.

Or maybe you can try another approach. Instead of mutual exclusion try use CreateFileMapping and OpenFileMapping methods with "Global\" prefix in name.

Upvotes: 2

Related Questions