Use server handles directly for Win32 handles. Removed use of K32OBJ.

diff --git a/scheduler/semaphore.c b/scheduler/semaphore.c
index 6fdcf70..b321331 100644
--- a/scheduler/semaphore.c
+++ b/scheduler/semaphore.c
@@ -7,18 +7,10 @@
 #include <assert.h>
 #include <string.h>
 #include "winerror.h"
-#include "k32obj.h"
-#include "process.h"
-#include "thread.h"
 #include "heap.h"
 #include "server/request.h"
 #include "server.h"
 
-typedef struct
-{
-    K32OBJ        header;
-} SEMAPHORE;
-
 
 /***********************************************************************
  *           CreateSemaphore32A   (KERNEL32.174)
@@ -29,8 +21,6 @@
     struct create_semaphore_request req;
     struct create_semaphore_reply reply;
     int len = name ? strlen(name) + 1 : 0;
-    HANDLE handle;
-    SEMAPHORE *sem;
 
     /* Check parameters */
 
@@ -47,15 +37,7 @@
     CLIENT_SendRequest( REQ_CREATE_SEMAPHORE, -1, 2, &req, sizeof(req), name, len );
     CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
     if (reply.handle == -1) return 0;
-
-    SYSTEM_LOCK();
-    sem = (SEMAPHORE *)K32OBJ_Create( K32OBJ_SEMAPHORE, sizeof(*sem),
-                                      name, reply.handle, SEMAPHORE_ALL_ACCESS,
-                                      sa, &handle);
-    if (sem) K32OBJ_DecCount( &sem->header );
-    SYSTEM_UNLOCK();
-    if (handle == INVALID_HANDLE_VALUE) handle = 0;
-    return handle;
+    return reply.handle;
 }
 
 
@@ -77,8 +59,6 @@
  */
 HANDLE WINAPI OpenSemaphoreA( DWORD access, BOOL inherit, LPCSTR name )
 {
-    HANDLE handle = 0;
-    K32OBJ *obj;
     struct open_named_obj_request req;
     struct open_named_obj_reply reply;
     int len = name ? strlen(name) + 1 : 0;
@@ -88,20 +68,8 @@
     req.inherit = inherit;
     CLIENT_SendRequest( REQ_OPEN_NAMED_OBJ, -1, 2, &req, sizeof(req), name, len );
     CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
-    if (reply.handle != -1)
-    {
-        SYSTEM_LOCK();
-        if ((obj = K32OBJ_FindNameType( name, K32OBJ_SEMAPHORE )) != NULL)
-        {
-            handle = HANDLE_Alloc( PROCESS_Current(), obj, access, inherit, reply.handle );
-            K32OBJ_DecCount( obj );
-            if (handle == INVALID_HANDLE_VALUE)
-                handle = 0; /* must return 0 on failure, not -1 */
-        }
-        else CLIENT_CloseHandle( reply.handle );
-        SYSTEM_UNLOCK();
-    }
-    return handle;
+    if (reply.handle == -1) return 0; /* must return 0 on failure, not -1 */
+    return reply.handle;
 }
 
 
@@ -130,10 +98,8 @@
         SetLastError( ERROR_INVALID_PARAMETER );
         return FALSE;
     }
-    req.handle = HANDLE_GetServerHandle( PROCESS_Current(), handle,
-                                         K32OBJ_SEMAPHORE, SEMAPHORE_MODIFY_STATE );
-    if (req.handle == -1) return FALSE;
-    req.count = (unsigned int)count;
+    req.handle = handle;
+    req.count  = (unsigned int)count;
     CLIENT_SendRequest( REQ_RELEASE_SEMAPHORE, -1, 1, &req, sizeof(req) );
     if (CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL )) return FALSE;
     if (previous) *previous = reply.prev_count;