PC Review


Reply
 
 
Leon McCalla
Guest
Posts: n/a
 
      22nd Mar 2004
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


 
Reply With Quote
 
 
 
 
John Phillips
Guest
Posts: n/a
 
      22nd Mar 2004
Are you sure that CreateMutex() fails? Just that you're not checking the
return value in your code snippet, and I've seen many a person misuse the
GetLastError() function.

--
John Phillips
MVP - Windows SDK


"Leon McCalla" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Tao Zhou
Guest
Posts: n/a
 
      5th Apr 2004
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

"Leon McCalla" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Alexander Grigoriev
Guest
Posts: n/a
 
      5th Apr 2004
If CreateMutex succeeded, LastError is not reset to zero.

You can only check GetLastError if CreateMutex() call failed.

"Tao Zhou" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> "Leon McCalla" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
security requirements of the createmutex call S.Tripathy\(nospam!\) Microsoft Windows 2000 Developer 0 8th Apr 2004 03:34 PM
createmutex Leon McCalla Microsoft Windows 2000 Security 3 5th Apr 2004 08:26 PM
CreateMutex Tibor Meinczinger Microsoft Dot NET Compact Framework 0 15th Jul 2003 04:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:03 AM.