Discussion:
createmutex
(too old to reply)
Tao Zhou
2004-04-05 13:22:49 UTC
Permalink
First, you need to check hRunMutex if it is previous valid mutex handle, if
you don't use, release it.
Second, you can use different name every time to createmutex.
Finally, if you need to create new mutex every time rather than use existed
mutex, you also need to control the number of mutex.

Tao
I created a DLL that hooks int to a service and it ran for about 3 months
but now suddenly it is failing.
The problem is that the CreateMutex functions in the DLL are all failing
due
to Error 183 (ERROR_ALREADY_EXISTS). Even if i create the Mutex with a
new
name or with a NULL name i keep getting the error. what is the problem?
hRunMutex = CreateMutex(NULL, TRUE, NULL );
StringCbPrintf(junk,250,"hRunMutex: GetLastError %d\n", GetLastError() );
Leon
Alexander Grigoriev
2004-04-05 18:26:43 UTC
Permalink
If CreateMutex succeeded, LastError is not reset to zero.

You can only check GetLastError if CreateMutex() call failed.
Post by Tao Zhou
First, you need to check hRunMutex if it is previous valid mutex handle, if
you don't use, release it.
Second, you can use different name every time to createmutex.
Finally, if you need to create new mutex every time rather than use existed
mutex, you also need to control the number of mutex.
Tao
I created a DLL that hooks int to a service and it ran for about 3 months
but now suddenly it is failing.
The problem is that the CreateMutex functions in the DLL are all failing
due
to Error 183 (ERROR_ALREADY_EXISTS). Even if i create the Mutex with a
new
name or with a NULL name i keep getting the error. what is the problem?
hRunMutex = CreateMutex(NULL, TRUE, NULL );
StringCbPrintf(junk,250,"hRunMutex: GetLastError %d\n",
GetLastError() );
Post by Tao Zhou
Leon
Loading...