I have created a mutex inside a service using
TCHAR sznam[] = "Global\\mutex_hello";
ServHand = CreateMutex(NULL,FALSE,sznam);
SetNamedSecurityInfo(sznam, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, 0, 0, (PACL) NULL, NULL);
now i want to use this mutex from application running in diffrent session.
serv = OpenMutex(MUTEX_ALL_ACCESS,TRUE,"Global\\mutex_hello");;
DWORD abc;
if(serv == NULL)
WriteLog("file not found");
abc = WaitForSingleObject(serv,INFINITE);
if(abc == WAIT_OBJECT_0)
MessageBox(NULL,"object signaled","object signalled",MB_OK);
else
if(abc == WAIT_TIMEOUT)
MessageBox(NULL,"WAIT_TIMEOUT","WAIT_TIMEOUT",MB_OK);
else(abc == WAIT_ABANDONED)
MessageBox(NULL,"wait abondened","wait abondened",MB_OK);
This process is launched from the service into sessions by using createProcessAsUser.
After creating a mutex from service, i launched this process.
This process is always returning WAIT_ABANDONED whenever we
call a waitforsingleobject on that mutex.
Can anyone explain why this is happening since mutex is a global object and can be used across sessions

Mutex across multiple sessions
AnonymousI
Which OS are you running under
Are you entirely positive that your service is still running when your app tries to gain access to the mutex If the service has exited, the mutex will have actually been abandoned and will be available to your app.
-- Tim --