I used to simply search for the (mutex) handle with process explorer and then close it, so that I'm able to start a second instance.
I would very much like to do it with LSS. I'm guessing that a breakpoint script on CreateMutexA is the way to go. But since I'm not a realy a windows fan, I was wondering if CreateMutexA, ReleaseMutexA and OpenMutexA are realy the only API calls that deal with this kind of objects ? If so, would anybody know the 'usual' way to verify if a mutex already exists ? Would it be to execute CreateMutexA again and check for the return value or more likely that it is OpenMutexA and check that return value ?
From what I found in the win32.hlp file, I only get the following returned:
------------------------------------------------------------------------------
The ReleaseMutex function releases ownership of the specified mutex object.
BOOL ReleaseMutex(
HANDLE hMutex // handle of mutex object
);
------------------------------------------------------------------------------
The OpenMutex function returns a handle of an existing named mutex object.
HANDLE OpenMutex(
DWORD dwDesiredAccess, // access flag
BOOL bInheritHandle, // inherit flag
LPCTSTR lpName // pointer to mutex-object name
);
-----------------------------------------------------------------------------
HANDLE CreateMutex(
LPSECURITY_ATTRIBUTES lpMutexAttributes, // pointer to security attributes
BOOL bInitialOwner, // flag for initial ownership
LPCTSTR lpName // pointer to mutex-object name
);
------------------------------------------------------------------------------
As you can see, only the ReleaseMutexA function returns a BOOL and the others return a HANDLE... This doesn't realy give me much insight in what I should be using to test is a mutex exists...
I was thinking of attaching the breakpoint script to CreateMutexA, see if the Mutex name = 'gameIwantothack', if the mutex doesn't exist then do nothin, if the mutex DOES exist, then ReleaseMutexA of the old Mutex, so that the new one can be created by the game/tool...
Anybody know how I can have LSS check if a Mutex exists?
UPDATE: I just noticed that there is also a CloseHandle api call... which API calls should I be using to accomplish my goal? Any and all hints are welcome.
UPDATE2: It appears that I jumped the gun a bit and that those API calls aren't available in LSS.
L.Spiro, would you mind looking into including them into the next update, please ? That would be great