diff --git a/reactos/drivers/fs/vfat/rw.c b/reactos/drivers/fs/vfat/rw.c index 2a83878766b..af23e51c02d 100644 --- a/reactos/drivers/fs/vfat/rw.c +++ b/reactos/drivers/fs/vfat/rw.c @@ -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) { diff --git a/reactos/lib/ntdll/ldr/startup.c b/reactos/lib/ntdll/ldr/startup.c index 51381d48e70..8dd97903248 100644 --- a/reactos/lib/ntdll/ldr/startup.c +++ b/reactos/lib/ntdll/ldr/startup.c @@ -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 #include #include +#include #define NDEBUG #include @@ -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; diff --git a/reactos/ntoskrnl/mm/pagefile.c b/reactos/ntoskrnl/mm/pagefile.c index 5e7ea13d645..d6c462578c4 100644 --- a/reactos/ntoskrnl/mm/pagefile.c +++ b/reactos/ntoskrnl/mm/pagefile.c @@ -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, diff --git a/reactos/subsys/win32k/include/object.h b/reactos/subsys/win32k/include/object.h index ae5fdb405e4..ccfaa7af1b9 100644 --- a/reactos/subsys/win32k/include/object.h +++ b/reactos/subsys/win32k/include/object.h @@ -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; diff --git a/reactos/subsys/win32k/misc/object.c b/reactos/subsys/win32k/misc/object.c index 298de29750b..016c6420437 100644 --- a/reactos/subsys/win32k/misc/object.c +++ b/reactos/subsys/win32k/misc/object.c @@ -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