- moved event, semaphore, mutex implementation from kernel32 to ntdll
- added mutant implementation in ntdll, and use it for mutex
  implementation in kernel32
- added access parameter on event, semaphore, timer creation in
  wineserver (as ntdll interface requires it)
- added missing definitions in include/winternl.h

diff --git a/server/mutex.c b/server/mutex.c
index 1bb07eb..af13dd9 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -156,7 +156,7 @@
     reply->handle = 0;
     if ((mutex = create_mutex( get_req_data(), get_req_data_size(), req->owned )))
     {
-        reply->handle = alloc_handle( current->process, mutex, MUTEX_ALL_ACCESS, req->inherit );
+        reply->handle = alloc_handle( current->process, mutex, req->access, req->inherit );
         release_object( mutex );
     }
 }
@@ -177,7 +177,11 @@
                                                  MUTEX_MODIFY_STATE, &mutex_ops )))
     {
         if (!mutex->count || (mutex->owner != current)) set_error( STATUS_MUTANT_NOT_OWNED );
-        else if (!--mutex->count) do_release( mutex );
+        else
+        {
+            reply->prev_count = mutex->count;
+            if (!--mutex->count) do_release( mutex );
+        }
         release_object( mutex );
     }
 }