Fixes for problems with win32k

svn path=/trunk/; revision=2569
This commit is contained in:
David Welch 2002-01-27 03:25:45 +00:00
parent f48e849f05
commit 7d915349e5
5 changed files with 89 additions and 76 deletions

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -43,76 +43,81 @@ NextCluster(PDEVICE_EXTENSION DeviceExt,
ULONG i; ULONG i;
PULONG FatChain; PULONG FatChain;
NTSTATUS Status; 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) if (Fcb->FatChainSize == 0)
{ {
// paging file with zero length /* Paging file with zero length. */
*CurrentCluster = 0xffffffff; *CurrentCluster = 0xffffffff;
if (Extend) if (Extend)
{ {
Fcb->FatChain = ExAllocatePool(NonPagedPool, sizeof(ULONG)); Fcb->FatChain = ExAllocatePool(NonPagedPool, sizeof(ULONG));
if (!Fcb->FatChain) if (!Fcb->FatChain)
{ {
return STATUS_UNSUCCESSFUL; return STATUS_NO_MEMORY;
} }
Status = GetNextCluster(DeviceExt, 0, CurrentCluster, TRUE); Status = GetNextCluster(DeviceExt, 0, CurrentCluster, TRUE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ExFreePool(Fcb->FatChain); ExFreePool(Fcb->FatChain);
return Status; return Status;
} }
Fcb->FatChain[0] = *CurrentCluster; Fcb->FatChain[0] = *CurrentCluster;
Fcb->FatChainSize = 1; Fcb->FatChainSize = 1;
return Status; return Status;
} }
else else
{ {
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
} }
else else
{ {
for (i = 0; i < Fcb->FatChainSize; i++) for (i = 0; i < Fcb->FatChainSize; i++)
{ {
if (Fcb->FatChain[i] == *CurrentCluster) if (Fcb->FatChain[i] == *CurrentCluster)
break; break;
} }
if (i >= Fcb->FatChainSize) if (i >= Fcb->FatChainSize)
{ {
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
if (i == Fcb->FatChainSize - 1) if (i == Fcb->FatChainSize - 1)
{ {
if (Extend) if (Extend)
{ {
FatChain = ExAllocatePool(NonPagedPool, (i + 2) * sizeof(ULONG)); FatChain = ExAllocatePool(NonPagedPool,
if (!FatChain) (i + 2) * sizeof(ULONG));
{ if (!FatChain)
*CurrentCluster = 0xffffffff; {
return STATUS_UNSUCCESSFUL; *CurrentCluster = 0xffffffff;
} return STATUS_NO_MEMORY;
Status = GetNextCluster(DeviceExt, *CurrentCluster, CurrentCluster, TRUE); }
if (NT_SUCCESS(Status) && *CurrentCluster != 0xffffffff) Status = GetNextCluster(DeviceExt, *CurrentCluster,
{ CurrentCluster, TRUE);
memcpy(FatChain, Fcb->FatChain, (i + 1) * sizeof(ULONG)); if (NT_SUCCESS(Status) && *CurrentCluster != 0xffffffff)
FatChain[i + 1] = *CurrentCluster; {
ExFreePool(Fcb->FatChain); memcpy(FatChain, Fcb->FatChain, (i + 1) * sizeof(ULONG));
Fcb->FatChain = FatChain; FatChain[i + 1] = *CurrentCluster;
Fcb->FatChainSize = i + 2; ExFreePool(Fcb->FatChain);
} Fcb->FatChain = FatChain;
else Fcb->FatChainSize = i + 2;
ExFreePool(FatChain); }
return Status; else
} {
else ExFreePool(FatChain);
{ }
*CurrentCluster = 0xffffffff; return Status;
return STATUS_UNSUCCESSFUL; }
} else
} {
*CurrentCluster = Fcb->FatChain[i + 1]; *CurrentCluster = 0xffffffff;
return STATUS_SUCCESS; return STATUS_UNSUCCESSFUL;
} }
}
*CurrentCluster = Fcb->FatChain[i + 1];
return STATUS_SUCCESS;
}
} }
if (FirstCluster == 1) if (FirstCluster == 1)
{ {

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -18,6 +18,7 @@
#include <csrss/csrss.h> #include <csrss/csrss.h>
#include <ntdll/csr.h> #include <ntdll/csr.h>
#include <napi/shared_data.h> #include <napi/shared_data.h>
#include <user32/callback.h>
#define NDEBUG #define NDEBUG
#include <ntdll/ntdll.h> #include <ntdll/ntdll.h>
@ -123,6 +124,12 @@ LdrInitializeThunk (ULONG Unknown1,
Peb->TlsBitmap = &TlsBitMap; Peb->TlsBitmap = &TlsBitMap;
Peb->TlsExpansionCounter = TLS_MINIMUM_AVAILABLE; 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 */ /* initalize loader lock */
RtlInitializeCriticalSection (&LoaderLock); RtlInitializeCriticalSection (&LoaderLock);
Peb->LoaderLock = &LoaderLock; Peb->LoaderLock = &LoaderLock;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/pagefile.c * FILE: ntoskrnl/mm/pagefile.c
@ -421,6 +421,7 @@ NtCreatePagingFile(IN PUNICODE_STRING PageFileName,
NtClose(FileHandle); NtClose(FileHandle);
return(Status); return(Status);
} }
ExFreePool(Buffer);
Status = ObReferenceObjectByHandle(FileHandle, Status = ObReferenceObjectByHandle(FileHandle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,

View file

@ -36,7 +36,7 @@ typedef struct _USER_HANDLE_BLOCK
typedef struct _USER_HANDLE_TABLE typedef struct _USER_HANDLE_TABLE
{ {
LIST_ENTRY ListHead; LIST_ENTRY ListHead;
PFAST_MUTEX ListLock; FAST_MUTEX ListLock;
} USER_HANDLE_TABLE, *PUSER_HANDLE_TABLE; } USER_HANDLE_TABLE, *PUSER_HANDLE_TABLE;

View 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -34,13 +34,13 @@ BODY_TO_HEADER(PVOID ObjectBody)
VOID STATIC VOID STATIC
ObmpLockHandleTable(PUSER_HANDLE_TABLE HandleTable) ObmpLockHandleTable(PUSER_HANDLE_TABLE HandleTable)
{ {
ExAcquireFastMutex(HandleTable->ListLock); ExAcquireFastMutex(&HandleTable->ListLock);
} }
VOID STATIC VOID STATIC
ObmpUnlockHandleTable(PUSER_HANDLE_TABLE HandleTable) ObmpUnlockHandleTable(PUSER_HANDLE_TABLE HandleTable)
{ {
ExReleaseFastMutex(HandleTable->ListLock); ExReleaseFastMutex(&HandleTable->ListLock);
} }
VOID VOID
@ -482,7 +482,7 @@ VOID
ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable) ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable)
{ {
InitializeListHead(&HandleTable->ListHead); InitializeListHead(&HandleTable->ListHead);
ExInitializeFastMutex(HandleTable->ListLock); ExInitializeFastMutex(&HandleTable->ListLock);
} }
VOID VOID