Bernhard Loos : server: ReleaseMutex doesn't need any access rights.

Alexandre Julliard julliard at winehq.org
Fri Sep 23 10:56:52 CDT 2011


Module: wine
Branch: master
Commit: 0d36c27e3ba2019b6c660cae49bc8e207c033984
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0d36c27e3ba2019b6c660cae49bc8e207c033984

Author: Bernhard Loos <bernhardloos at googlemail.com>
Date:   Wed Sep 14 14:49:03 2011 +0200

server: ReleaseMutex doesn't need any access rights.

---

 dlls/kernel32/tests/sync.c |    4 +++-
 server/mutex.c             |    4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c
index dd87f3e..1695713 100644
--- a/dlls/kernel32/tests/sync.c
+++ b/dlls/kernel32/tests/sync.c
@@ -158,13 +158,15 @@ static void test_mutex(void)
     for (i = 0; i < 32; i++)
     {
         hOpened = OpenMutex(0x1 << i, FALSE, "WineTestMutex");
-        ReleaseMutex(hCreated);
         if(hOpened != NULL)
         {
+            ret = ReleaseMutex(hOpened);
+            ok(ret, "ReleaseMutex failed with error %d, access %x\n", GetLastError(), 1 << i);
             CloseHandle(hOpened);
         }
         else
         {
+            ReleaseMutex(hCreated);
             failed |=0x1 << i;
         }
     }
diff --git a/server/mutex.c b/server/mutex.c
index faedcf3..d21f341 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -175,7 +175,7 @@ static int mutex_signal( struct object *obj, unsigned int access )
     struct mutex *mutex = (struct mutex *)obj;
     assert( obj->ops == &mutex_ops );
 
-    if (!(access & SYNCHRONIZE))  /* FIXME: MUTEX_MODIFY_STATE? */
+    if (!(access & SYNCHRONIZE))
     {
         set_error( STATUS_ACCESS_DENIED );
         return 0;
@@ -265,7 +265,7 @@ DECL_HANDLER(release_mutex)
     struct mutex *mutex;
 
     if ((mutex = (struct mutex *)get_handle_obj( current->process, req->handle,
-                                                 MUTEX_MODIFY_STATE, &mutex_ops )))
+                                                 0, &mutex_ops )))
     {
         if (!mutex->count || (mutex->owner != current)) set_error( STATUS_MUTANT_NOT_OWNED );
         else




More information about the wine-cvs mailing list