Author: fireball Date: Sat Aug 4 12:49:47 2007 New Revision: 28153
URL: http://svn.reactos.org/svn/reactos?rev=28153&view=rev Log: - Fix NtSetInformationThread(ThreadBasePriority) - Fix buffer overflow in KeRosDumpStackFrames - Fix usage of garbage/uninitialized handle entry local variable in ObpCreateHandle - Fix buffer overflow and logic bug in IoConnectInterrupt - Fix MSVC warnings
Modified: trunk/reactos/include/ndk/ntndk.h trunk/reactos/ntoskrnl/cc/fs.c trunk/reactos/ntoskrnl/config/cmname.c trunk/reactos/ntoskrnl/config/cmsysini.c trunk/reactos/ntoskrnl/ex/fmutex.c trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/ex/sysinfo.c trunk/reactos/ntoskrnl/inbv/inbv.c trunk/reactos/ntoskrnl/io/iomgr/controller.c trunk/reactos/ntoskrnl/io/iomgr/device.c trunk/reactos/ntoskrnl/io/iomgr/deviface.c trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c trunk/reactos/ntoskrnl/io/iomgr/error.c trunk/reactos/ntoskrnl/io/iomgr/file.c trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c trunk/reactos/ntoskrnl/io/iomgr/irq.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c trunk/reactos/ntoskrnl/ke/bug.c trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S trunk/reactos/ntoskrnl/ke/i386/exp.c trunk/reactos/ntoskrnl/ke/i386/kiinit.c trunk/reactos/ntoskrnl/ke/procobj.c trunk/reactos/ntoskrnl/ke/queue.c trunk/reactos/ntoskrnl/lpc/complete.c trunk/reactos/ntoskrnl/lpc/connect.c trunk/reactos/ntoskrnl/lpc/reply.c trunk/reactos/ntoskrnl/lpc/send.c trunk/reactos/ntoskrnl/mm/procsup.c trunk/reactos/ntoskrnl/ob/obhandle.c trunk/reactos/ntoskrnl/ps/psmgr.c trunk/reactos/ntoskrnl/ps/query.c trunk/reactos/ntoskrnl/ps/thread.c
Modified: trunk/reactos/include/ndk/ntndk.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ntndk.h?rev=281... ============================================================================== --- trunk/reactos/include/ndk/ntndk.h (original) +++ trunk/reactos/include/ndk/ntndk.h Sat Aug 4 12:49:47 2007 @@ -38,7 +38,6 @@ #include <excpt.h> // C Standard Header #include <stdarg.h> // C Standard Header #include <umtypes.h> // General Definitions -#include <intrin.h> // Use Inlined Intrinsics
// // Type Headers
Modified: trunk/reactos/ntoskrnl/cc/fs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/fs.c?rev=28153&... ============================================================================== --- trunk/reactos/ntoskrnl/cc/fs.c (original) +++ trunk/reactos/ntoskrnl/cc/fs.c Sat Aug 4 12:49:47 2007 @@ -239,6 +239,6 @@ UNIMPLEMENTED; return FALSE; #else - return CcRosReleaseFileCache(FileObject); + return NT_SUCCESS(CcRosReleaseFileCache(FileObject)); #endif }
Modified: trunk/reactos/ntoskrnl/config/cmname.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmname.c?re... ============================================================================== --- trunk/reactos/ntoskrnl/config/cmname.c (original) +++ trunk/reactos/ntoskrnl/config/cmname.c Sat Aug 4 12:49:47 2007 @@ -102,7 +102,7 @@ * that it will remain that way forever, so -never- assume this code * below internally! */ - return Length * sizeof(WCHAR); + return (USHORT)Length * sizeof(WCHAR); }
LONG
Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c?... ============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c Sat Aug 4 12:49:47 2007 @@ -455,7 +455,7 @@ }
/* Setup the unicode string */ - RtlInitEmptyUnicodeString(&CmpLoadOptions, Buffer, Length); + RtlInitEmptyUnicodeString(&CmpLoadOptions, Buffer, (USHORT)Length);
/* Add the load options and null-terminate */ RtlAnsiStringToUnicodeString(&CmpLoadOptions, &LoadString, FALSE);
Modified: trunk/reactos/ntoskrnl/ex/fmutex.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/fmutex.c?rev=28... ============================================================================== --- trunk/reactos/ntoskrnl/ex/fmutex.c (original) +++ trunk/reactos/ntoskrnl/ex/fmutex.c Sat Aug 4 12:49:47 2007 @@ -135,7 +135,7 @@
/* Erase the owner */ FastMutex->Owner = NULL; - OldIrql = FastMutex->OldIrql; + OldIrql = (KIRQL)FastMutex->OldIrql;
/* Increase the count */ if (InterlockedIncrement(&FastMutex->Count) <= 0)
Modified: trunk/reactos/ntoskrnl/ex/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=2815... ============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c (original) +++ trunk/reactos/ntoskrnl/ex/init.c Sat Aug 4 12:49:47 2007 @@ -1094,7 +1094,7 @@ }
/* Update length */ - CmCSDVersionString.MaximumLength = sizeof(Buffer) - Remaining; + CmCSDVersionString.MaximumLength = (USHORT)sizeof(Buffer) - Remaining; }
/* Check if we have an RC number */
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=2... ============================================================================== --- trunk/reactos/ntoskrnl/ex/sysinfo.c (original) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c Sat Aug 4 12:49:47 2007 @@ -65,7 +65,7 @@ ModuleInfo->ImageSize = LdrEntry->SizeOfImage; ModuleInfo->Flags = LdrEntry->Flags; ModuleInfo->LoadCount = LdrEntry->LoadCount; - ModuleInfo->LoadOrderIndex = ModuleCount; + ModuleInfo->LoadOrderIndex = (USHORT)ModuleCount; ModuleInfo->InitOrderIndex = 0;
/* Setup name */ @@ -231,7 +231,7 @@ { ANSI_STRING AName; UNICODE_STRING WName; - BOOLEAN Result; + ARC_STATUS Result; PCH Value; ANSI_STRING AValue; UNICODE_STRING WValue; @@ -417,7 +417,7 @@ TRUE); if(NT_SUCCESS(Status)) { - BOOLEAN Result = HalSetEnvironmentVariable(AName.Buffer, + ARC_STATUS Result = HalSetEnvironmentVariable(AName.Buffer, AValue.Buffer);
Status = (Result ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); @@ -766,7 +766,7 @@ SpiCur->UserTime.QuadPart = pr->Pcb.UserTime * 100000LL; SpiCur->KernelTime.QuadPart = pr->Pcb.KernelTime * 100000LL; SpiCur->ImageName.Length = strlen(pr->ImageFileName) * sizeof(WCHAR); - SpiCur->ImageName.MaximumLength = inLen; + SpiCur->ImageName.MaximumLength = (USHORT)inLen; SpiCur->ImageName.Buffer = (void*)(pCur+curSize);
// copy name to the end of the struct @@ -1058,7 +1058,7 @@
for (Count = 0; HandleCount > 0 ; HandleCount--) { - Shi->Handles[i].UniqueProcessId = (ULONG)pr->UniqueProcessId; + Shi->Handles[i].UniqueProcessId = (USHORT)(ULONG)pr->UniqueProcessId; Count++; i++; }
Modified: trunk/reactos/ntoskrnl/inbv/inbv.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/inbv/inbv.c?rev=28... ============================================================================== --- trunk/reactos/ntoskrnl/inbv/inbv.c (original) +++ trunk/reactos/ntoskrnl/inbv/inbv.c Sat Aug 4 12:49:47 2007 @@ -372,7 +372,7 @@ if (InbvBootDriverInstalled) { /* Call bootvid */ - VidSolidColorFill(Left, Top, Width, Height, Color); + VidSolidColorFill(Left, Top, Width, Height, (UCHAR)Color); }
/* FIXME: Headless */
Modified: trunk/reactos/ntoskrnl/io/iomgr/controller.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/controlle... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/controller.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/controller.c Sat Aug 4 12:49:47 2007 @@ -92,7 +92,7 @@ /* Zero the Object and set its data */ RtlZeroMemory(Controller, sizeof(CONTROLLER_OBJECT) + Size); Controller->Type = IO_TYPE_CONTROLLER; - Controller->Size = sizeof(CONTROLLER_OBJECT) + Size; + Controller->Size = (CSHORT)sizeof(CONTROLLER_OBJECT) + Size; Controller->ControllerExtension = (Controller + 1);
/* Initialize its Queue */
Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/device.c?... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/device.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/device.c Sat Aug 4 12:49:47 2007 @@ -765,7 +765,7 @@ * because that's only padding for the DevObjExt and not part of the Object. */ CreatedDeviceObject->Type = IO_TYPE_DEVICE; - CreatedDeviceObject->Size = sizeof(DEVICE_OBJECT) + DeviceExtensionSize; + CreatedDeviceObject->Size = (USHORT)sizeof(DEVICE_OBJECT) + DeviceExtensionSize;
/* The kernel extension is after the driver internal extension */ DeviceObjectExtension = (PDEVOBJ_EXTENSION) @@ -1402,7 +1402,7 @@ IopStartNextPacketByKeyEx(DeviceObject, Key, DOE_SIO_WITH_KEY | - (Cancelable) ? DOE_SIO_CANCELABLE : 0); + (Cancelable ? DOE_SIO_CANCELABLE : 0)); } else { @@ -1431,7 +1431,7 @@ IopStartNextPacketByKeyEx(DeviceObject, 0, DOE_SIO_NO_KEY | - (Cancelable) ? DOE_SIO_CANCELABLE : 0); + (Cancelable ? DOE_SIO_CANCELABLE : 0)); } else {
Modified: trunk/reactos/ntoskrnl/io/iomgr/deviface.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/deviface.... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/deviface.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/deviface.c Sat Aug 4 12:49:47 2007 @@ -300,7 +300,7 @@ }
/* Open device key */ - KeyName.Length = KeyName.MaximumLength = DeviceBi->NameLength; + KeyName.Length = KeyName.MaximumLength = (USHORT)DeviceBi->NameLength; KeyName.Buffer = DeviceBi->Name; InitializeObjectAttributes( &ObjectAttributes, @@ -370,7 +370,7 @@ goto cleanup; }
- KeyName.Length = KeyName.MaximumLength = ReferenceBi->NameLength; + KeyName.Length = KeyName.MaximumLength = (USHORT)ReferenceBi->NameLength; KeyName.Buffer = ReferenceBi->Name; if (RtlEqualUnicodeString(&KeyName, &Control, TRUE)) { @@ -475,7 +475,7 @@ Status = STATUS_UNSUCCESSFUL; goto cleanup; } - KeyName.Length = KeyName.MaximumLength = bip->DataLength - 4 * sizeof(WCHAR); + KeyName.Length = KeyName.MaximumLength = (USHORT)bip->DataLength - 4 * sizeof(WCHAR); KeyName.Buffer = &((PWSTR)bip->Data)[4]; if (KeyName.Length && KeyName.Buffer[KeyName.Length / sizeof(WCHAR)] == UNICODE_NULL) { @@ -976,7 +976,7 @@ return STATUS_INVALID_PARAMETER_1; } GuidString.Buffer = StartPosition; - GuidString.MaximumLength = GuidString.Length = (ULONG_PTR)(EndPosition + 1) - (ULONG_PTR)StartPosition; + GuidString.MaximumLength = GuidString.Length = (USHORT)((ULONG_PTR)(EndPosition + 1) - (ULONG_PTR)StartPosition);
/* Get pointer to the PDO */ Status = IoGetDeviceObjectPointer(
Modified: trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/drvrlist.... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c Sat Aug 4 12:49:47 2007 @@ -323,8 +323,8 @@ if (KeyInfo->NameLength < MAX_PATH * sizeof(WCHAR)) {
- SubKeyName.Length = KeyInfo->NameLength; - SubKeyName.MaximumLength = KeyInfo->NameLength + sizeof(WCHAR); + SubKeyName.Length = (USHORT)KeyInfo->NameLength; + SubKeyName.MaximumLength = (USHORT)KeyInfo->NameLength + sizeof(WCHAR); SubKeyName.Buffer = KeyInfo->Name; SubKeyName.Buffer[SubKeyName.Length / sizeof(WCHAR)] = 0;
Modified: trunk/reactos/ntoskrnl/io/iomgr/error.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/error.c?r... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/error.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/error.c Sat Aug 4 12:49:47 2007 @@ -338,8 +338,8 @@ if (NT_SUCCESS(Status)) { /* Success, update the information */ - ObjectNameInfo->Name.Length = 100 - - DriverNameLength; + ObjectNameInfo->Name.Length = (USHORT)100 - + DriverNameLength; } } } @@ -434,7 +434,8 @@
/* Update size */ InterlockedExchangeAdd(&IopTotalLogSize, - -(LogEntry->Size - sizeof(ERROR_LOG_ENTRY))); + -(LONG)(LogEntry->Size - + sizeof(ERROR_LOG_ENTRY))); }
/* Free the LPC Message */ @@ -557,7 +558,7 @@
/* Decrease total allocation size and free the entry */ InterlockedExchangeAdd(&IopTotalLogSize, - -(LogEntry->Size - sizeof(ERROR_LOG_ENTRY))); + -(LONG)(LogEntry->Size - sizeof(ERROR_LOG_ENTRY))); ExFreePool(LogEntry); }
Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?re... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/file.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/file.c Sat Aug 4 12:49:47 2007 @@ -512,7 +512,7 @@ StackLoc->Parameters.Create.EaLength = OpenPacket->EaLength;
/* Set the flags */ - StackLoc->Flags = OpenPacket->Options; + StackLoc->Flags = (UCHAR)OpenPacket->Options; StackLoc->Flags |= !(Attributes & OBJ_CASE_INSENSITIVE) ? SL_CASE_SENSITIVE: 0; break; @@ -764,7 +764,8 @@ FileObject->DeviceObject = NULL;
/* Save this now because the FO might go away */ - OpenCancelled = FileObject->Flags & FO_FILE_OPEN_CANCELLED; + OpenCancelled = FileObject->Flags & FO_FILE_OPEN_CANCELLED ? + TRUE : FALSE;
/* Clear the file object in the open packet */ OpenPacket->FileObject = NULL; @@ -1370,9 +1371,10 @@
/* Setup the length and maximum length */ FileLength = (ULONG_PTR)p - (ULONG_PTR)ObjectNameInfo; - ObjectNameInfo->Name.Length = FileLength - sizeof(OBJECT_NAME_INFORMATION); - ObjectNameInfo->Name.MaximumLength = ObjectNameInfo->Name.Length + - sizeof(UNICODE_NULL); + ObjectNameInfo->Name.Length = (USHORT)FileLength - + sizeof(OBJECT_NAME_INFORMATION); + ObjectNameInfo->Name.MaximumLength = (USHORT)ObjectNameInfo->Name.Length + + sizeof(UNICODE_NULL);
/* Free buffer and return */ ExFreePool(LocalInfo); @@ -1745,8 +1747,8 @@ OpenPacket.OriginalAttributes = *ObjectAttributes; OpenPacket.AllocationSize = SafeAllocationSize; OpenPacket.CreateOptions = CreateOptions; - OpenPacket.FileAttributes = FileAttributes; - OpenPacket.ShareAccess = ShareAccess; + OpenPacket.FileAttributes = (USHORT)FileAttributes; + OpenPacket.ShareAccess = (USHORT)ShareAccess; OpenPacket.EaBuffer = SystemEaBuffer; OpenPacket.EaLength = EaLength; OpenPacket.Options = Options; @@ -2078,7 +2080,7 @@ IoIsFileOriginRemote(IN PFILE_OBJECT FileObject) { /* Return the flag status */ - return (FileObject->Flags & FO_REMOTE_ORIGIN); + return FileObject->Flags & FO_REMOTE_ORIGIN ? TRUE : FALSE; }
/*
Modified: trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c Sat Aug 4 12:49:47 2007 @@ -533,8 +533,8 @@
/* Enumerate the Bus. */ BusString.Buffer = BasicInformation->Name; - BusString.Length = BasicInformation->NameLength; - BusString.MaximumLength = BasicInformation->NameLength; + BusString.Length = (USHORT)BasicInformation->NameLength; + BusString.MaximumLength = (USHORT)BasicInformation->NameLength;
/* Open a handle to the Root Registry Key */ InitializeObjectAttributes(
Modified: trunk/reactos/ntoskrnl/io/iomgr/irq.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irq.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/irq.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/irq.c Sat Aug 4 12:49:47 2007 @@ -36,28 +36,28 @@ PIO_INTERRUPT IoInterrupt; PKSPIN_LOCK SpinLockUsed; BOOLEAN FirstRun = TRUE; - ULONG count; - LONG i; + CCHAR Count = 0; + KAFFINITY Affinity; PAGED_CODE();
/* Assume failure */ *InterruptObject = NULL;
- /* Convert the Mask */ - ProcessorEnableMask &= ((1 << KeNumberProcessors) - 1); + /* Get the affinity */ + Affinity = ProcessorEnableMask & KeActiveProcessors; + while (Affinity) + { + /* Increase count */ + if (Affinity & 1) Count++; + Affinity >>= 1; + }
- /* Make sure at least one CPU is on it */ - if (!ProcessorEnableMask) return STATUS_INVALID_PARAMETER; - - /* Determine the allocation */ - for (i = 0, count = 0; i < KeNumberProcessors; i++) - { - if (ProcessorEnableMask & (1 << i)) count++; - } + /* Make sure we have a valid CPU count */ + if (!Count) return STATUS_INVALID_PARAMETER;
/* Allocate the array of I/O Interrupts */ IoInterrupt = ExAllocatePoolWithTag(NonPagedPool, - (count - 1)* sizeof(KINTERRUPT) + + (Count - 1) * sizeof(KINTERRUPT) + sizeof(IO_INTERRUPT), TAG_KINTERRUPT); if (!IoInterrupt) return STATUS_INSUFFICIENT_RESOURCES; @@ -74,10 +74,10 @@ RtlZeroMemory(IoInterrupt, sizeof(IO_INTERRUPT));
/* Now create all the interrupts */ - for (i = 0; i < KeNumberProcessors; i++) + for (Count = 0; Affinity; Count++, Affinity >>= 1) { /* Check if it's enabled for this CPU */ - if (ProcessorEnableMask & (1 << i)) + if (Affinity & 1) { /* Check which one we will use */ InterruptUsed = FirstRun ? &IoInterrupt->FirstInterrupt : Interrupt; @@ -92,7 +92,7 @@ SynchronizeIrql, InterruptMode, ShareVector, - i, + Count, FloatingSave);
/* Connect it */ @@ -122,7 +122,7 @@ else { /* Move on to the next one */ - IoInterrupt->Interrupt[i] = Interrupt++; + IoInterrupt->Interrupt[(UCHAR)Count] = Interrupt++; } } }
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotif... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpnotify.c Sat Aug 4 12:49:47 2007 @@ -10,9 +10,9 @@
/* INCLUDES ******************************************************************/
+#include <ntoskrnl.h> #define NDEBUG -#include <ntoskrnl.h> -#include <internal/debug.h> +#include <debug.h>
#if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, IopInitPnpNotificationImplementation)
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnprepor... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c Sat Aug 4 12:49:47 2007 @@ -10,9 +10,9 @@
/* INCLUDES ******************************************************************/
+#include <ntoskrnl.h> #define NDEBUG -#include <ntoskrnl.h> -#include <internal/debug.h> +#include <debug.h>
/* FUNCTIONS *****************************************************************/
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c Sat Aug 4 12:49:47 2007 @@ -287,7 +287,7 @@ String->Buffer = ExAllocatePoolWithTag(PagedPool, ValueLength, TAG_PNP_ROOT); if (String->Buffer == NULL) return STATUS_NO_MEMORY; - String->Length = String->MaximumLength = ValueLength; + String->Length = String->MaximumLength = (USHORT)ValueLength; RtlCopyMemory(String->Buffer, ValueData, ValueLength); if (ValueLength > 0 && String->Buffer[ValueLength / sizeof(WCHAR) - 1] == L'\0') String->Length -= sizeof(WCHAR);
Modified: trunk/reactos/ntoskrnl/ke/bug.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=28153... ============================================================================== --- trunk/reactos/ntoskrnl/ke/bug.c (original) +++ trunk/reactos/ntoskrnl/ke/bug.c Sat Aug 4 12:49:47 2007 @@ -143,7 +143,7 @@ PLDR_DATA_TABLE_ENTRY LdrEntry;
/* If the caller didn't ask, assume 32 frames */ - if (!FrameCount) FrameCount = 32; + if (!FrameCount || FrameCount > 32) FrameCount = 32;
/* Get the current frames */ FrameCount = RtlCaptureStackBackTrace(2, FrameCount, (PVOID*)Frames, NULL);
Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ctxswitch.... ============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S (original) +++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S Sat Aug 4 12:49:47 2007 @@ -10,7 +10,7 @@
/* INCLUDES ******************************************************************/
-#include <roscfg.h> +//#include <roscfg.h> #include <ndk/asm.h> .intel_syntax noprefix
Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/exp.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/exp.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c Sat Aug 4 12:49:47 2007 @@ -170,7 +170,8 @@ if (Mask != NewMask) { /* Update it */ - KeGetCurrentThread()->DispatcherHeader.DebugActive = NewMask; + KeGetCurrentThread()->DispatcherHeader.DebugActive = + (BOOLEAN)NewMask; } }
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?r... ============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/kiinit.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c Sat Aug 4 12:49:47 2007 @@ -216,10 +216,11 @@ CurrentSample->TSCStart;
/* Compute CPU Speed */ - CurrentSample->MHz = ((CurrentSample->TSCDelta * - CurrentSample->PerfFreq.QuadPart + - 500000) / - (CurrentSample->PerfDelta * 1000000)); + CurrentSample->MHz = (ULONG)((CurrentSample->TSCDelta * + CurrentSample-> + PerfFreq.QuadPart + 500000) / + (CurrentSample->PerfDelta * + 1000000));
/* Check if this isn't the first sample */ if (Sample)
Modified: trunk/reactos/ntoskrnl/ke/procobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/procobj.c?rev=2... ============================================================================== --- trunk/reactos/ntoskrnl/ke/procobj.c (original) +++ trunk/reactos/ntoskrnl/ke/procobj.c Sat Aug 4 12:49:47 2007 @@ -308,7 +308,7 @@
/* Save the current base priority and update it */ OldPriority = Process->BasePriority; - Process->BasePriority = Priority; + Process->BasePriority = (SCHAR)Priority;
/* Calculate the priority delta */ Delta = Priority - OldPriority; @@ -364,7 +364,7 @@ }
/* Update priority and quantum */ - Thread->BasePriority = NewPriority; + Thread->BasePriority = (SCHAR)NewPriority; Thread->Quantum = Thread->QuantumReset;
/* Disable decrements and update priority */ @@ -426,7 +426,7 @@ }
/* Update priority and quantum */ - Thread->BasePriority = NewPriority; + Thread->BasePriority = (SCHAR)NewPriority; Thread->Quantum = Thread->QuantumReset;
/* Disable decrements and update priority */
Modified: trunk/reactos/ntoskrnl/ke/queue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/queue.c?rev=281... ============================================================================== --- trunk/reactos/ntoskrnl/ke/queue.c (original) +++ trunk/reactos/ntoskrnl/ke/queue.c Sat Aug 4 12:49:47 2007 @@ -358,7 +358,7 @@ { /* Check if the timer expired */ InterruptTime.QuadPart = KeQueryInterruptTime(); - if (InterruptTime.QuadPart >= Timer->DueTime.QuadPart) + if ((ULONG64)InterruptTime.QuadPart >= Timer->DueTime.QuadPart) { /* It did, so we don't need to wait */ QueueEntry = (PLIST_ENTRY)STATUS_TIMEOUT;
Modified: trunk/reactos/ntoskrnl/lpc/complete.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/complete.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/lpc/complete.c (original) +++ trunk/reactos/ntoskrnl/lpc/complete.c Sat Aug 4 12:49:47 2007 @@ -134,8 +134,8 @@ }
/* Set the sizes of our reply message */ - Message->Request.u1.s1.DataLength = sizeof(LPCP_CONNECTION_MESSAGE) + - ConnectionInfoLength; + Message->Request.u1.s1.DataLength = (CSHORT)ConnectionInfoLength + + sizeof(LPCP_CONNECTION_MESSAGE); Message->Request.u1.s1.TotalLength = sizeof(LPCP_MESSAGE) + Message->Request.u1.s1.DataLength;
Modified: trunk/reactos/ntoskrnl/lpc/connect.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/connect.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/lpc/connect.c (original) +++ trunk/reactos/ntoskrnl/lpc/connect.c Sat Aug 4 12:49:47 2007 @@ -352,8 +352,8 @@ ConnectMessage->SectionToMap = SectionToMap;
/* Set the data for the connection request message */ - Message->Request.u1.s1.DataLength = sizeof(LPCP_CONNECTION_MESSAGE) + - ConnectionInfoLength; + Message->Request.u1.s1.DataLength = (CSHORT)ConnectionInfoLength + + sizeof(LPCP_CONNECTION_MESSAGE); Message->Request.u1.s1.TotalLength = sizeof(LPCP_MESSAGE) + Message->Request.u1.s1.DataLength; Message->Request.u2.s2.Type = LPC_CONNECTION_REQUEST;
Modified: trunk/reactos/ntoskrnl/lpc/reply.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/reply.c?rev=28... ============================================================================== --- trunk/reactos/ntoskrnl/lpc/reply.c (original) +++ trunk/reactos/ntoskrnl/lpc/reply.c Sat Aug 4 12:49:47 2007 @@ -180,8 +180,8 @@ if (ReplyMessage) { /* Validate its length */ - if ((ReplyMessage->u1.s1.DataLength + sizeof(PORT_MESSAGE)) > - ReplyMessage->u1.s1.TotalLength) + if (((ULONG)ReplyMessage->u1.s1.DataLength + sizeof(PORT_MESSAGE)) > + (ULONG)ReplyMessage->u1.s1.TotalLength) { /* Fail */ return STATUS_INVALID_PARAMETER; @@ -204,8 +204,9 @@ if (ReplyMessage) { /* Validate its length in respect to the port object */ - if ((ReplyMessage->u1.s1.TotalLength > Port->MaxMessageLength) || - (ReplyMessage->u1.s1.TotalLength <= ReplyMessage->u1.s1.DataLength)) + if (((ULONG)ReplyMessage->u1.s1.TotalLength > Port->MaxMessageLength) || + ((ULONG)ReplyMessage->u1.s1.TotalLength <= + (ULONG)ReplyMessage->u1.s1.DataLength)) { /* Too large, fail */ ObDereferenceObject(Port); @@ -408,9 +409,9 @@ Message = NULL;
/* Setup the receive message */ - ReceiveMessage->u1.s1.TotalLength = sizeof(LPCP_MESSAGE) + - ConnectionInfoLength; - ReceiveMessage->u1.s1.DataLength = ConnectionInfoLength; + ReceiveMessage->u1.s1.TotalLength = (CSHORT)(sizeof(LPCP_MESSAGE) + + ConnectionInfoLength); + ReceiveMessage->u1.s1.DataLength = (CSHORT)ConnectionInfoLength; RtlCopyMemory(ReceiveMessage + 1, ConnectMessage + 1, ConnectionInfoLength);
Modified: trunk/reactos/ntoskrnl/lpc/send.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/send.c?rev=281... ============================================================================== --- trunk/reactos/ntoskrnl/lpc/send.c (original) +++ trunk/reactos/ntoskrnl/lpc/send.c Sat Aug 4 12:49:47 2007 @@ -60,8 +60,8 @@ if (LpcMessage->u2.s2.DataInfoOffset) return STATUS_INVALID_PARAMETER;
/* Validate message sizes */ - if ((LpcMessage->u1.s1.TotalLength > Port->MaxMessageLength) || - (LpcMessage->u1.s1.TotalLength <= LpcMessage->u1.s1.DataLength)) + if (((ULONG)LpcMessage->u1.s1.TotalLength > Port->MaxMessageLength) || + ((ULONG)LpcMessage->u1.s1.TotalLength <= (ULONG)LpcMessage->u1.s1.DataLength)) { /* Fail */ return STATUS_PORT_MESSAGE_TOO_LONG; @@ -241,8 +241,8 @@ MessageType = LpcRequest->u2.s2.Type;
/* Validate the length */ - if ((LpcRequest->u1.s1.DataLength + sizeof(PORT_MESSAGE)) > - LpcRequest->u1.s1.TotalLength) + if (((ULONG)LpcRequest->u1.s1.DataLength + sizeof(PORT_MESSAGE)) > + (ULONG)LpcRequest->u1.s1.TotalLength) { /* Fail */ return STATUS_INVALID_PARAMETER; @@ -258,8 +258,8 @@ if (!NT_SUCCESS(Status)) return Status;
/* Validate the message length */ - if ((LpcRequest->u1.s1.TotalLength > Port->MaxMessageLength) || - (LpcRequest->u1.s1.TotalLength <= LpcRequest->u1.s1.DataLength)) + if (((ULONG)LpcRequest->u1.s1.TotalLength > Port->MaxMessageLength) || + ((ULONG)LpcRequest->u1.s1.TotalLength <= (ULONG)LpcRequest->u1.s1.DataLength)) { /* Fail */ ObDereferenceObject(Port);
Modified: trunk/reactos/ntoskrnl/mm/procsup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/procsup.c?rev=2... ============================================================================== --- trunk/reactos/ntoskrnl/mm/procsup.c (original) +++ trunk/reactos/ntoskrnl/mm/procsup.c Sat Aug 4 12:49:47 2007 @@ -40,7 +40,7 @@ }
/* Save the old priority and update it */ - OldPriority = Process->Vm.Flags.MemoryPriority; + OldPriority = (UCHAR)Process->Vm.Flags.MemoryPriority; Process->Vm.Flags.MemoryPriority = MemoryPriority;
/* Return the old priority */ @@ -331,7 +331,7 @@ Peb->OSMinorVersion = NtMinorVersion; Peb->OSBuildNumber = (USHORT)(NtBuildNumber & 0x3FFF); Peb->OSPlatformId = 2; /* VER_PLATFORM_WIN32_NT */ - Peb->OSCSDVersion = CmNtCSDVersion; + Peb->OSCSDVersion = (USHORT)CmNtCSDVersion;
/* Heap and Debug Data */ Peb->NumberOfProcessors = KeNumberProcessors;
Modified: trunk/reactos/ntoskrnl/ob/obhandle.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/ob/obhandle.c (original) +++ trunk/reactos/ntoskrnl/ob/obhandle.c Sat Aug 4 12:49:47 2007 @@ -1362,7 +1362,7 @@ { /* Dereference it as many times as required */ InterlockedExchangeAdd(&ObjectHeader->PointerCount, - -AdditionalReferences); + -(LONG)AdditionalReferences); }
/* Decrement the handle count and detach */ @@ -1457,6 +1457,9 @@ return STATUS_OBJECT_TYPE_MISMATCH; }
+ /* Save the object header */ + NewEntry.Object = ObjectHeader; + /* Check if this is a kernel handle */ if (HandleAttributes & OBJ_KERNEL_HANDLE) { @@ -1529,9 +1532,6 @@
/* Now we can release the object */ if (Context) ObpCleanupDirectoryLookup(Context); - - /* Save the object header */ - NewEntry.Object = ObjectHeader;
/* Save the access mask */ NewEntry.GrantedAccess = GrantedAccess; @@ -1617,7 +1617,7 @@ { /* Dereference it many times */ InterlockedExchangeAdd(&ObjectHeader->PointerCount, - -(AdditionalReferences - 1)); + -(LONG)(AdditionalReferences - 1)); }
/* Dereference the object one last time */
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=281... ============================================================================== --- trunk/reactos/ntoskrnl/ps/psmgr.c (original) +++ trunk/reactos/ntoskrnl/ps/psmgr.c Sat Aug 4 12:49:47 2007 @@ -58,7 +58,7 @@
/* PRIVATE FUNCTIONS *********************************************************/
-ULONG +USHORT NTAPI NameToOrdinal(IN PCHAR Name, IN PVOID DllBase,
Modified: trunk/reactos/ntoskrnl/ps/query.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=281... ============================================================================== --- trunk/reactos/ntoskrnl/ps/query.c (original) +++ trunk/reactos/ntoskrnl/ps/query.c Sat Aug 4 12:49:47 2007 @@ -815,7 +815,7 @@ (Priority < THREAD_BASE_PRIORITY_MIN)) { /* These ones are OK */ - if ((Priority != THREAD_BASE_PRIORITY_LOWRT + 1) || + if ((Priority != THREAD_BASE_PRIORITY_LOWRT + 1) && (Priority != THREAD_BASE_PRIORITY_IDLE - 1)) { /* Check if the process is real time */
Modified: trunk/reactos/ntoskrnl/ps/thread.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/thread.c?rev=28... ============================================================================== --- trunk/reactos/ntoskrnl/ps/thread.c (original) +++ trunk/reactos/ntoskrnl/ps/thread.c Sat Aug 4 12:49:47 2007 @@ -703,7 +703,7 @@ NTAPI PsGetThreadHardErrorsAreDisabled(IN PETHREAD Thread) { - return Thread->HardErrorsAreDisabled; + return Thread->HardErrorsAreDisabled ? TRUE : FALSE; }
/* @@ -823,7 +823,7 @@ NTAPI PsIsThreadImpersonating(IN PETHREAD Thread) { - return Thread->ActiveImpersonationInfo; + return Thread->ActiveImpersonationInfo ? TRUE : FALSE; }
/*