Fixes for problems with win32k
authorDavid Welch <welch@cwcom.net>
Sun, 27 Jan 2002 03:25:45 +0000 (03:25 +0000)
committerDavid Welch <welch@cwcom.net>
Sun, 27 Jan 2002 03:25:45 +0000 (03:25 +0000)
svn path=/trunk/; revision=2569

reactos/drivers/fs/vfat/rw.c
reactos/lib/ntdll/ldr/startup.c
reactos/ntoskrnl/mm/pagefile.c
reactos/subsys/win32k/include/object.h
reactos/subsys/win32k/misc/object.c

index 2a83878..af23e51 100644 (file)
@@ -1,5 +1,5 @@
 
-/* $Id: rw.c,v 1.37 2002/01/27 01:11:23 dwelch Exp $
+/* $Id: rw.c,v 1.38 2002/01/27 03:25:44 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -43,76 +43,81 @@ NextCluster(PDEVICE_EXTENSION DeviceExt,
       ULONG i;
       PULONG FatChain;
       NTSTATUS Status;
-      DPRINT("NextCluster(Fcb %x, FirstCluster %x, Extend %d)\n", Fcb, FirstCluster, Extend);
+      DPRINT("NextCluster(Fcb %x, FirstCluster %x, Extend %d)\n", Fcb, 
+            FirstCluster, Extend);
       if (Fcb->FatChainSize == 0)
-      {
-        // paging file with zero length
-        *CurrentCluster = 0xffffffff;
-        if (Extend)
-        {
-          Fcb->FatChain = ExAllocatePool(NonPagedPool, sizeof(ULONG));
-          if (!Fcb->FatChain)
-          {
-            return STATUS_UNSUCCESSFUL;
-          }
-          Status = GetNextCluster(DeviceExt, 0, CurrentCluster, TRUE);
-          if (!NT_SUCCESS(Status))
-          {
-            ExFreePool(Fcb->FatChain);
-            return Status;
-          }
-          Fcb->FatChain[0] = *CurrentCluster;
-          Fcb->FatChainSize = 1;
-          return Status;
-        }
-        else
-        {
-          return STATUS_UNSUCCESSFUL;
-        }
-      }
+       {
+         /* Paging file with zero length. */
+         *CurrentCluster = 0xffffffff;
+         if (Extend)
+           {
+             Fcb->FatChain = ExAllocatePool(NonPagedPool, sizeof(ULONG));
+             if (!Fcb->FatChain)
+               {
+                 return STATUS_NO_MEMORY;
+               }
+             Status = GetNextCluster(DeviceExt, 0, CurrentCluster, TRUE);
+             if (!NT_SUCCESS(Status))
+               {
+                 ExFreePool(Fcb->FatChain);
+                 return Status;
+               }
+             Fcb->FatChain[0] = *CurrentCluster;
+             Fcb->FatChainSize = 1;
+             return Status;
+           }
+         else
+           {
+             return STATUS_UNSUCCESSFUL;
+           }
+       }
       else
-      {
-        for (i = 0; i < Fcb->FatChainSize; i++)
-        {
-          if (Fcb->FatChain[i] == *CurrentCluster)
-            break;
-        }
-        if (i >= Fcb->FatChainSize)
-        {
-          return STATUS_UNSUCCESSFUL;
-        }
-        if (i == Fcb->FatChainSize - 1)
-        {
-          if (Extend)
-          {
-            FatChain = ExAllocatePool(NonPagedPool, (i + 2) * sizeof(ULONG));
-            if (!FatChain)
-            {
-              *CurrentCluster = 0xffffffff;
-              return STATUS_UNSUCCESSFUL;
-            }
-            Status = GetNextCluster(DeviceExt, *CurrentCluster, CurrentCluster, TRUE);
-            if (NT_SUCCESS(Status) && *CurrentCluster != 0xffffffff)
-            {
-              memcpy(FatChain, Fcb->FatChain, (i + 1) * sizeof(ULONG));
-              FatChain[i + 1] = *CurrentCluster;
-              ExFreePool(Fcb->FatChain);
-              Fcb->FatChain = FatChain;
-              Fcb->FatChainSize = i + 2;
-            }
-            else
-              ExFreePool(FatChain);
-            return Status;
-          }
-          else
-          {
-            *CurrentCluster = 0xffffffff;
-            return STATUS_UNSUCCESSFUL;
-          }
-        }
-        *CurrentCluster = Fcb->FatChain[i + 1];
-        return STATUS_SUCCESS;
-      }
+       {
+         for (i = 0; i < Fcb->FatChainSize; i++)
+           {
+             if (Fcb->FatChain[i] == *CurrentCluster)
+               break;
+           }
+         if (i >= Fcb->FatChainSize)
+           {
+             return STATUS_UNSUCCESSFUL;
+           }
+         if (i == Fcb->FatChainSize - 1)
+           {
+             if (Extend)
+               {
+                 FatChain = ExAllocatePool(NonPagedPool, 
+                                           (i + 2) * sizeof(ULONG));
+                 if (!FatChain)
+                   {
+                     *CurrentCluster = 0xffffffff;
+                     return STATUS_NO_MEMORY;
+                   }
+                 Status = GetNextCluster(DeviceExt, *CurrentCluster, 
+                                         CurrentCluster, TRUE);
+                 if (NT_SUCCESS(Status) && *CurrentCluster != 0xffffffff)
+                   {
+                     memcpy(FatChain, Fcb->FatChain, (i + 1) * sizeof(ULONG));
+                     FatChain[i + 1] = *CurrentCluster;
+                     ExFreePool(Fcb->FatChain);
+                     Fcb->FatChain = FatChain;
+                     Fcb->FatChainSize = i + 2;
+                   }
+                 else
+                   {
+                     ExFreePool(FatChain);
+                   }
+                 return Status;
+               }
+             else
+               {
+                 *CurrentCluster = 0xffffffff;
+                 return STATUS_UNSUCCESSFUL;
+               }
+           }
+         *CurrentCluster = Fcb->FatChain[i + 1];
+         return STATUS_SUCCESS;
+       }
     }
   if (FirstCluster == 1)
     {
index 51381d4..8dd9790 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: startup.c,v 1.34 2001/06/04 11:26:10 chorns Exp $
+/* $Id: startup.c,v 1.35 2002/01/27 03:25:44 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -18,6 +18,7 @@
 #include <csrss/csrss.h>
 #include <ntdll/csr.h>
 #include <napi/shared_data.h>
+#include <user32/callback.h>
 
 #define NDEBUG
 #include <ntdll/ntdll.h>
@@ -123,6 +124,12 @@ LdrInitializeThunk (ULONG Unknown1,
    Peb->TlsBitmap = &TlsBitMap;
    Peb->TlsExpansionCounter = TLS_MINIMUM_AVAILABLE;
 
+   /* Initialize table of callbacks for the kernel. */
+   Peb->KernelCallbackTable = 
+     RtlAllocateHeap(RtlGetProcessHeap(),
+                    0,
+                    sizeof(PVOID) * USER32_CALLBACK_MAXIMUM);
+
    /* initalize loader lock */
    RtlInitializeCriticalSection (&LoaderLock);
    Peb->LoaderLock = &LoaderLock;
index 5e7ea13..d6c4625 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: pagefile.c,v 1.15 2002/01/08 00:49:00 dwelch Exp $
+/* $Id: pagefile.c,v 1.16 2002/01/27 03:25:44 dwelch Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/mm/pagefile.c
@@ -421,6 +421,7 @@ NtCreatePagingFile(IN       PUNICODE_STRING PageFileName,
        NtClose(FileHandle);
        return(Status);
      }
+   ExFreePool(Buffer);
 
    Status = ObReferenceObjectByHandle(FileHandle,
                                      FILE_ALL_ACCESS,
index ae5fdb4..ccfaa7a 100644 (file)
@@ -36,7 +36,7 @@ typedef struct _USER_HANDLE_BLOCK
 typedef struct _USER_HANDLE_TABLE
 {
    LIST_ENTRY ListHead;
-   PFAST_MUTEX ListLock;
+   FAST_MUTEX ListLock;
 } USER_HANDLE_TABLE, *PUSER_HANDLE_TABLE;
 
 
index 298de29..016c642 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: object.c,v 1.2 2002/01/27 01:11:24 dwelch Exp $
+/* $Id: object.c,v 1.3 2002/01/27 03:25:45 dwelch Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -34,13 +34,13 @@ BODY_TO_HEADER(PVOID ObjectBody)
 VOID STATIC
 ObmpLockHandleTable(PUSER_HANDLE_TABLE HandleTable)
 {
-  ExAcquireFastMutex(HandleTable->ListLock);
+  ExAcquireFastMutex(&HandleTable->ListLock);
 }
 
 VOID STATIC
 ObmpUnlockHandleTable(PUSER_HANDLE_TABLE HandleTable)
 {
-  ExReleaseFastMutex(HandleTable->ListLock);
+  ExReleaseFastMutex(&HandleTable->ListLock);
 }
 
 VOID
@@ -482,7 +482,7 @@ VOID
 ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable)
 {
   InitializeListHead(&HandleTable->ListHead);
-  ExInitializeFastMutex(HandleTable->ListLock);
+  ExInitializeFastMutex(&HandleTable->ListLock);
 }
 
 VOID