diff --git a/reactos/include/ndk/exfuncs.h b/reactos/include/ndk/exfuncs.h index 58a2d7421ad..43c958a0883 100644 --- a/reactos/include/ndk/exfuncs.h +++ b/reactos/include/ndk/exfuncs.h @@ -93,6 +93,15 @@ ExfUnblockPushLock( PVOID CurrentWaitBlock ); +// +// Resource Functions +// +BOOLEAN +NTAPI +ExTryToAcquireResourceExclusiveLite( + IN PERESOURCE Resource +); + #endif // diff --git a/reactos/include/ndk/extypes.h b/reactos/include/ndk/extypes.h index 4ca7a30886d..e0c36000b04 100644 --- a/reactos/include/ndk/extypes.h +++ b/reactos/include/ndk/extypes.h @@ -104,6 +104,13 @@ extern ULONG NtBuildNumber; #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \ SYNCHRONIZE | \ MUTANT_QUERY_STATE) + +#define TIMER_QUERY_STATE 0x0001 +#define TIMER_MODIFY_STATE 0x0002 +#define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \ + SYNCHRONIZE | \ + TIMER_QUERY_STATE | \ + TIMER_MODIFY_STATE) #endif // diff --git a/reactos/include/ndk/halfuncs.h b/reactos/include/ndk/halfuncs.h index 358f6255454..01778c9621d 100644 --- a/reactos/include/ndk/halfuncs.h +++ b/reactos/include/ndk/halfuncs.h @@ -31,8 +31,10 @@ Author: // The DDK steals these away from you. // #ifdef _MSC_VER -//#pragma intrinsic(_enable) -//#pragma intrinsic(_disable) +void _enable(void); +void _disable(void); +#pragma intrinsic(_enable) +#pragma intrinsic(_disable) #endif // @@ -208,5 +210,12 @@ HalQueryRealTimeClock( IN PTIME_FIELDS RtcTime ); +NTHALAPI +VOID +NTAPI +HalSetRealTimeClock( + IN PTIME_FIELDS RtcTime +); + #endif #endif diff --git a/reactos/include/ndk/iofuncs.h b/reactos/include/ndk/iofuncs.h index e3a50f36f72..e559fedf86d 100644 --- a/reactos/include/ndk/iofuncs.h +++ b/reactos/include/ndk/iofuncs.h @@ -671,7 +671,6 @@ ZwDeviceIoControlFile( IN ULONG OutputBufferSize ); -#ifdef NTOS_MODE_USER NTSYSAPI NTSTATUS NTAPI @@ -679,7 +678,6 @@ ZwFlushBuffersFile( IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock ); -#endif NTSYSAPI NTSTATUS diff --git a/reactos/include/ndk/obfuncs.h b/reactos/include/ndk/obfuncs.h index eb55d2b4447..e9741369ccb 100644 --- a/reactos/include/ndk/obfuncs.h +++ b/reactos/include/ndk/obfuncs.h @@ -29,6 +29,16 @@ Author: // // Object Functions // +NTKERNELAPI +NTSTATUS +NTAPI +ObAssignSecurity( + IN PACCESS_STATE AccessState, + IN PSECURITY_DESCRIPTOR SecurityDescriptor, + IN PVOID Object, + IN POBJECT_TYPE Type +); + NTKERNELAPI NTSTATUS NTAPI diff --git a/reactos/include/psdk/winnt.h b/reactos/include/psdk/winnt.h index 854d94d5d76..0efe23bf6c7 100644 --- a/reactos/include/psdk/winnt.h +++ b/reactos/include/psdk/winnt.h @@ -478,10 +478,10 @@ typedef DWORD FLONG; #ifndef __NTDDK_H #define MUTANT_QUERY_STATE 0x0001 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE) -#endif #define TIMER_QUERY_STATE 0x0001 #define TIMER_MODIFY_STATE 0x0002 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE) +#endif /* * To prevent gcc compiler warnings, bracket these defines when initialising * a SID_IDENTIFIER_AUTHORITY, eg. diff --git a/reactos/ntoskrnl/cc/view.c b/reactos/ntoskrnl/cc/view.c index 87ded521c6a..0227bad7da6 100644 --- a/reactos/ntoskrnl/cc/view.c +++ b/reactos/ntoskrnl/cc/view.c @@ -358,7 +358,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed) for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++) { PFN_TYPE Page; - Page = MmGetPhysicalAddress((char*)current->BaseAddress + i * PAGE_SIZE).QuadPart >> PAGE_SHIFT; + Page = (PFN_TYPE)(MmGetPhysicalAddress((char*)current->BaseAddress + i * PAGE_SIZE).QuadPart >> PAGE_SHIFT); Status = MmPageOutPhysicalAddress(Page); if (!NT_SUCCESS(Status)) { diff --git a/reactos/ntoskrnl/cm/regobj.c b/reactos/ntoskrnl/cm/regobj.c index 6ed5f62ca10..a6b75b6fd86 100644 --- a/reactos/ntoskrnl/cm/regobj.c +++ b/reactos/ntoskrnl/cm/regobj.c @@ -276,8 +276,8 @@ CmiObjectParse(IN PVOID ParsedObject, Length = wcslen(StartPtr); - KeyName.Length = Length * sizeof(WCHAR); - KeyName.MaximumLength = KeyName.Length + sizeof(WCHAR); + KeyName.Length = (USHORT)Length * sizeof(WCHAR); + KeyName.MaximumLength = (USHORT)KeyName.Length + sizeof(WCHAR); KeyName.Buffer = ExAllocatePool(NonPagedPool, KeyName.MaximumLength); RtlCopyMemory(KeyName.Buffer, @@ -751,7 +751,7 @@ CmiObjectQueryName (PVOID ObjectBody, { ObjectNameInfo->Name.Buffer = (PWCHAR)(ObjectNameInfo + 1); ObjectNameInfo->Name.Length = 0; - ObjectNameInfo->Name.MaximumLength = Length - sizeof(OBJECT_NAME_INFORMATION); + ObjectNameInfo->Name.MaximumLength = (USHORT)Length - sizeof(OBJECT_NAME_INFORMATION); } @@ -931,13 +931,13 @@ CmiGetLinkTarget(PEREGISTRY_HIVE RegistryHive, if (TargetPath->Buffer == NULL && TargetPath->MaximumLength == 0) { TargetPath->Length = 0; - TargetPath->MaximumLength = ValueCell->DataSize + sizeof(WCHAR); + TargetPath->MaximumLength = (USHORT)ValueCell->DataSize + sizeof(WCHAR); TargetPath->Buffer = ExAllocatePool(NonPagedPool, TargetPath->MaximumLength); } - TargetPath->Length = min(TargetPath->MaximumLength - sizeof(WCHAR), - (ULONG) ValueCell->DataSize); + TargetPath->Length = min((USHORT)TargetPath->MaximumLength - sizeof(WCHAR), + (USHORT)ValueCell->DataSize); if (ValueCell->DataSize > 0) { diff --git a/reactos/ntoskrnl/deprecated/irq.c b/reactos/ntoskrnl/deprecated/irq.c index e7c90fa1602..8845090ee57 100644 --- a/reactos/ntoskrnl/deprecated/irq.c +++ b/reactos/ntoskrnl/deprecated/irq.c @@ -512,7 +512,7 @@ KiInterruptDispatch3 (ULONG vector, PKIRQ_TRAPFRAME Trapframe) DPRINT("PID: %d, TID: %d CS %04x/%04x\n", ((PETHREAD)CurrentThread)->ThreadsProcess->UniqueProcessId, ((PETHREAD)CurrentThread)->Cid.UniqueThread, - Trapframe->SegCs, + Trapframe->Cs, CurrentThread->TrapFrame ? CurrentThread->TrapFrame->SegCs : 0); if (CurrentThread->TrapFrame == NULL) { diff --git a/reactos/ntoskrnl/ex/locale.c b/reactos/ntoskrnl/ex/locale.c index c4ca67db2ba..b8589dd3a29 100644 --- a/reactos/ntoskrnl/ex/locale.c +++ b/reactos/ntoskrnl/ex/locale.c @@ -80,7 +80,7 @@ ExpGetCurrentUserUILanguage(IN PWSTR MuiName, if (NT_SUCCESS(Status)) { /* Return the language */ - *LanguageId = Value; + *LanguageId = (USHORT)Value; } } else diff --git a/reactos/ntoskrnl/ex/sysinfo.c b/reactos/ntoskrnl/ex/sysinfo.c index 0556c7eec2a..06b74006ac3 100644 --- a/reactos/ntoskrnl/ex/sysinfo.c +++ b/reactos/ntoskrnl/ex/sysinfo.c @@ -71,7 +71,7 @@ ExGetCurrentProcessorCpuUsage ( ScaledIdle = Prcb->IdleThread->KernelTime * 100; TotalTime = Prcb->KernelTime + Prcb->UserTime; if (TotalTime != 0) - *CpuUsage = 100 - (ScaledIdle / TotalTime); + *CpuUsage = (ULONG)(100 - (ScaledIdle / TotalTime)); else *CpuUsage = 0; } @@ -211,7 +211,9 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName, /* * Get the environment variable */ - Result = HalGetEnvironmentVariable(AName.Buffer, ValueBufferLength, Value); + Result = HalGetEnvironmentVariable(AName.Buffer, + (USHORT)ValueBufferLength, + Value); if(!Result) { RtlFreeAnsiString(&AName); diff --git a/reactos/ntoskrnl/fs/name.c b/reactos/ntoskrnl/fs/name.c index 49d87c5141d..2e9f09ddb75 100644 --- a/reactos/ntoskrnl/fs/name.c +++ b/reactos/ntoskrnl/fs/name.c @@ -297,13 +297,13 @@ FsRtlDissectDbcs(IN ANSI_STRING Name, } /* Now we have the First Part */ - FirstPart->Length = (i-FirstLoop); + FirstPart->Length = (USHORT)(i - FirstLoop); FirstPart->MaximumLength = FirstPart->Length; /* +2?? */ FirstPart->Buffer = &Name.Buffer[FirstLoop]; /* Make the second part if something is still left */ if (iLength = (Name.Length - (i+1)); + RemainingPart->Length = (USHORT)(Name.Length - (i+1)); RemainingPart->MaximumLength = RemainingPart->Length; /* +2?? */ RemainingPart->Buffer = &Name.Buffer[i+1]; } diff --git a/reactos/ntoskrnl/fs/util.c b/reactos/ntoskrnl/fs/util.c index 8f9704c56bf..58853bef3c5 100644 --- a/reactos/ntoskrnl/fs/util.c +++ b/reactos/ntoskrnl/fs/util.c @@ -42,8 +42,10 @@ RtlpInitializeResources(VOID) ULONG i; /* Allocate the Resource Buffer */ - FsRtlpResources = FsRtlAllocatePool(NonPagedPool, - FSRTL_MAX_RESOURCES*sizeof(ERESOURCE)); + FsRtlpResources = FsRtlAllocatePoolWithTag(NonPagedPool, + FSRTL_MAX_RESOURCES * + sizeof(ERESOURCE), + TAG('F', 's', 'R', 'e')); /* Initialize the Resources */ for (i = 0; i < FSRTL_MAX_RESOURCES; i++) diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c index 75309f193d3..96b282aba87 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -593,7 +593,7 @@ IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, return STATUS_INSUFFICIENT_RESOURCES; KeyName.Length = 0; - KeyName.MaximumLength = KeyNameLength; + KeyName.MaximumLength = (USHORT)KeyNameLength; KeyName.Buffer = KeyNameBuffer; /* @@ -619,7 +619,7 @@ IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, ExFreePool(KeyNameBuffer); return Status; } - KeyName.Length += DriverKeyLength - sizeof(UNICODE_NULL); + KeyName.Length += (USHORT)DriverKeyLength - sizeof(UNICODE_NULL); } else { @@ -750,7 +750,7 @@ IopGetBusTypeGuidIndex(LPGUID BusTypeGuid) sizeof(GUID)); /* The new entry is the index */ - FoundIndex = IopBusTypeGuidList->GuidCount; + FoundIndex = (USHORT)IopBusTypeGuidList->GuidCount; IopBusTypeGuidList->GuidCount++; Quickie: @@ -928,7 +928,7 @@ IopInitiatePnpIrp(PDEVICE_OBJECT DeviceObject, Irp->IoStatus.Information = 0; IrpSp = IoGetNextIrpStackLocation(Irp); - IrpSp->MinorFunction = MinorFunction; + IrpSp->MinorFunction = (UCHAR)MinorFunction; if (Stack) { @@ -1618,14 +1618,14 @@ IopGetParentIdPrefix(PDEVICE_NODE DeviceNode, Status = STATUS_UNSUCCESSFUL; else { - KeyValue.Length = KeyValue.MaximumLength = ParentIdPrefixInformation->DataLength; + KeyValue.Length = KeyValue.MaximumLength = (USHORT)ParentIdPrefixInformation->DataLength; KeyValue.Buffer = (PWSTR)ParentIdPrefixInformation->Data; } goto cleanup; } if (Status != STATUS_OBJECT_NAME_NOT_FOUND) { - KeyValue.Length = KeyValue.MaximumLength = ParentIdPrefixInformation->DataLength; + KeyValue.Length = KeyValue.MaximumLength = (USHORT)ParentIdPrefixInformation->DataLength; KeyValue.Buffer = (PWSTR)ParentIdPrefixInformation->Data; goto cleanup; } @@ -2711,7 +2711,7 @@ IopEnumerateDetectedDevices( IndexDevice++; /* Open device key */ - DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength; + DeviceName.Length = DeviceName.MaximumLength = (USHORT)pDeviceInformation->NameLength; DeviceName.Buffer = pDeviceInformation->Name; InitializeObjectAttributes(&ObjectAttributes, &DeviceName, OBJ_KERNEL_HANDLE, hDevicesKey, NULL); Status = ZwOpenKey( @@ -2832,7 +2832,7 @@ IopEnumerateDetectedDevices( goto cleanup; } IndexSubKey++; - DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength; + DeviceName.Length = DeviceName.MaximumLength = (USHORT)pDeviceInformation->NameLength; DeviceName.Buffer = pDeviceInformation->Name; Status = IopEnumerateDetectedDevices( @@ -2878,7 +2878,7 @@ IopEnumerateDetectedDevices( else { /* Assign hardware id to this device */ - ValueName.Length = ValueName.MaximumLength = pValueInformation->DataLength; + ValueName.Length = ValueName.MaximumLength = (USHORT)pValueInformation->DataLength; ValueName.Buffer = (PWCHAR)pValueInformation->Data; if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL) ValueName.Length -= sizeof(WCHAR); diff --git a/reactos/ntoskrnl/ke/i386/kiinit.c b/reactos/ntoskrnl/ke/i386/kiinit.c index ace598b406a..31b3f005733 100644 --- a/reactos/ntoskrnl/ke/i386/kiinit.c +++ b/reactos/ntoskrnl/ke/i386/kiinit.c @@ -438,21 +438,21 @@ KiInitializeKernel(IN PKPROCESS InitProcess, LdrInit1(); /* Set the NX Support policy */ - SharedUserData->NXSupportPolicy = NXSupportPolicy; + SharedUserData->NXSupportPolicy = (UCHAR)NXSupportPolicy; /* Set basic CPU Features that user mode can read */ SharedUserData->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = - (KeFeatureBits & KF_MMX); + (KeFeatureBits & KF_MMX) ? TRUE: FALSE; SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = - (KeFeatureBits & KF_CMPXCHG8B); + (KeFeatureBits & KF_CMPXCHG8B) ? TRUE: FALSE; SharedUserData->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = - ((KeFeatureBits & KF_FXSR) && (KeFeatureBits & KF_XMMI)); + ((KeFeatureBits & KF_FXSR) && (KeFeatureBits & KF_XMMI)) ? TRUE: FALSE; SharedUserData->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = - ((KeFeatureBits & KF_FXSR) && (KeFeatureBits & KF_XMMI64)); + ((KeFeatureBits & KF_FXSR) && (KeFeatureBits & KF_XMMI64)) ? TRUE: FALSE; SharedUserData->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = - (KeFeatureBits & KF_3DNOW); + (KeFeatureBits & KF_3DNOW) ? TRUE: FALSE; SharedUserData->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = - (KeFeatureBits & KF_RDTSC); + (KeFeatureBits & KF_RDTSC) ? TRUE: FALSE; /* Set up the thread-related fields in the PRCB */ Prcb->CurrentThread = InitThread; @@ -514,7 +514,7 @@ KiGetMachineBootPointers(IN PKGDTENTRY *Gdt, { KDESCRIPTOR GdtDescriptor, IdtDescriptor; KGDTENTRY TssSelector, PcrSelector; - ULONG Tr, Fs; + USHORT Tr, Fs; /* Get GDT and IDT descriptors */ Ke386GetGlobalDescriptorTable(GdtDescriptor); @@ -666,7 +666,7 @@ AppCpuInit: InitialThread, (PVOID)InitialStack, (PKPRCB)__readfsdword(KPCR_PRCB), - Cpu, + (CCHAR)Cpu, KeLoaderBlock); /* Set the priority of this thread to 0 */ diff --git a/reactos/ntoskrnl/ke/i386/v86vdm.c b/reactos/ntoskrnl/ke/i386/v86vdm.c index 6039657a7e8..517aba910ae 100644 --- a/reactos/ntoskrnl/ke/i386/v86vdm.c +++ b/reactos/ntoskrnl/ke/i386/v86vdm.c @@ -94,8 +94,8 @@ Ke386CallBios(IN ULONG Int, /* Save the old offset and base, and set the new ones */ OldOffset = Process->IopmOffset; OldBase = Tss->IoMapBase; - Process->IopmOffset = IOPM_OFFSET; - Tss->IoMapBase = IOPM_OFFSET; + Process->IopmOffset = (USHORT)IOPM_OFFSET; + Tss->IoMapBase = (USHORT)IOPM_OFFSET; /* Switch stacks and work the magic */ Ki386SetupAndExitToV86Mode(VdmTeb); diff --git a/reactos/ntoskrnl/ke/thrdschd.c b/reactos/ntoskrnl/ke/thrdschd.c index 95a49bd8342..e27f5c3b6ca 100644 --- a/reactos/ntoskrnl/ke/thrdschd.c +++ b/reactos/ntoskrnl/ke/thrdschd.c @@ -281,7 +281,7 @@ KiAdjustQuantumThread(IN PKTHREAD Thread) * due to the current ""scheduler"" in ROS, it can't be done * cleanly since it actualyl dispatches threads instead. */ - Thread->Priority = Priority; + Thread->Priority = (SCHAR)Priority; } else { @@ -310,7 +310,7 @@ KiSetPriorityThread(PKTHREAD Thread, if (OldPriority != Priority) { /* Set it */ - Thread->Priority = Priority; + Thread->Priority = (SCHAR)Priority; /* Choose action based on thread's state */ if (Thread->State == Ready) @@ -383,7 +383,7 @@ KiSetAffinityThread(IN PKTHREAD Thread, { KAFFINITY OldAffinity; ULONG ProcessorMask; - ULONG i; + CCHAR i; PKPCR Pcr; /* Make sure that the affinity is valid */ diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 1e07e06c23d..dc05771b429 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -1145,7 +1145,7 @@ LdrPEGetOrLoadModule ( RtlCopyMemory(NameBuffer, Module->FullDllName.Buffer, PathLength); RtlCopyMemory(NameBuffer + (PathLength / sizeof(WCHAR)), DriverName.Buffer, DriverName.Length); NameString.Buffer = NameBuffer; - NameString.MaximumLength = NameString.Length = PathLength + DriverName.Length; + NameString.MaximumLength = NameString.Length = (USHORT)PathLength + DriverName.Length; /* NULL-terminate */ NameString.MaximumLength += sizeof(WCHAR); diff --git a/reactos/ntoskrnl/lpc/reply.c b/reactos/ntoskrnl/lpc/reply.c index e67db081f06..21de54a18ba 100644 --- a/reactos/ntoskrnl/lpc/reply.c +++ b/reactos/ntoskrnl/lpc/reply.c @@ -65,7 +65,7 @@ EiReplyOrRequestPort (IN PEPORT Port, MessageReply->Message.ClientId.UniqueProcess = PsGetCurrentProcessId(); MessageReply->Message.ClientId.UniqueThread = PsGetCurrentThreadId(); - MessageReply->Message.u2.s2.Type = MessageType; + MessageReply->Message.u2.s2.Type = (CSHORT)MessageType; MessageReply->Message.MessageId = InterlockedIncrementUL(&LpcpNextMessageId); KeAcquireSpinLock(&Port->Lock, &oldIrql); @@ -276,7 +276,7 @@ NtReplyWaitReceivePortEx(IN HANDLE PortHandle, CRequest = (PEPORT_CONNECT_REQUEST_MESSAGE)&Request->Message; memcpy(&Header, &Request->Message, sizeof(PORT_MESSAGE)); - Header.u1.s1.DataLength = CRequest->ConnectDataLength; + Header.u1.s1.DataLength = (CSHORT)CRequest->ConnectDataLength; Header.u1.s1.TotalLength = Header.u1.s1.DataLength + sizeof(PORT_MESSAGE); if (PreviousMode != KernelMode) diff --git a/reactos/ntoskrnl/mm/pagefile.c b/reactos/ntoskrnl/mm/pagefile.c index b6253b2029e..5ce6407a4c7 100644 --- a/reactos/ntoskrnl/mm/pagefile.c +++ b/reactos/ntoskrnl/mm/pagefile.c @@ -586,7 +586,7 @@ MmDumpToPagingFile(ULONG BugCode, RetrievalPointers = PagingFileList[MmCoreDumpPageFile]->RetrievalPointers; /* Dump the header. */ - MdlMap[0] = MmGetPhysicalAddress(MmCoreDumpPageFrame).QuadPart >> PAGE_SHIFT; + MdlMap[0] = (ULONG)(MmGetPhysicalAddress(MmCoreDumpPageFrame).QuadPart >> PAGE_SHIFT); #if defined(__GNUC__) DiskOffset = MmGetOffsetPageFile(RetrievalPointers, (LARGE_INTEGER)0LL); diff --git a/reactos/ntoskrnl/ob/obdir.c b/reactos/ntoskrnl/ob/obdir.c index 9c6df161363..a0cfdda2bba 100644 --- a/reactos/ntoskrnl/ob/obdir.c +++ b/reactos/ntoskrnl/ob/obdir.c @@ -163,7 +163,7 @@ ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory, /* Save the result */ Context->HashValue = HashValue; - Context->HashIndex = HashIndex; + Context->HashIndex = (USHORT)HashIndex; /* Get the root entry and set it as our lookup bucket */ AllocatedEntry = &Directory->HashBuckets[HashIndex]; diff --git a/reactos/ntoskrnl/ob/obinit.c b/reactos/ntoskrnl/ob/obinit.c index 395b867fbbe..978888ad0ea 100644 --- a/reactos/ntoskrnl/ob/obinit.c +++ b/reactos/ntoskrnl/ob/obinit.c @@ -61,7 +61,7 @@ INIT_FUNCTION NTAPI ObInit2(VOID) { - ULONG i; + CCHAR i; PKPRCB Prcb; PNPAGED_LOOKASIDE_LIST CurrentList = NULL; diff --git a/reactos/ntoskrnl/ob/oblife.c b/reactos/ntoskrnl/ob/oblife.c index 4dd515dddb5..99c2b06f710 100644 --- a/reactos/ntoskrnl/ob/oblife.c +++ b/reactos/ntoskrnl/ob/oblife.c @@ -332,8 +332,8 @@ ObpCaptureObjectName(IN OUT PUNICODE_STRING CapturedName, } /* Setup the string */ - CapturedName->Length = StringLength; - CapturedName->MaximumLength = MaximumLength; + CapturedName->Length = (USHORT)StringLength; + CapturedName->MaximumLength = (USHORT)MaximumLength; CapturedName->Buffer = StringBuffer; /* Make sure we have a buffer */ diff --git a/reactos/ntoskrnl/ob/symlink.c b/reactos/ntoskrnl/ob/symlink.c index 088db566081..1f710720b20 100644 --- a/reactos/ntoskrnl/ob/symlink.c +++ b/reactos/ntoskrnl/ob/symlink.c @@ -13,10 +13,6 @@ #define NDEBUG #include -#if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, ObInitSymbolicLinkImplementation) -#endif - /* GLOBALS ******************************************************************/ POBJECT_TYPE ObSymbolicLinkType = NULL; @@ -165,8 +161,8 @@ ObpParseSymbolicLink(IN PVOID ParsedObject, if (NewTargetPath != FullPath->Buffer) ExFreePool(FullPath->Buffer); /* Update the path values */ - FullPath->Length = LengthUsed; - FullPath->MaximumLength = MaximumLength; + FullPath->Length = (USHORT)LengthUsed; + FullPath->MaximumLength = (USHORT)MaximumLength; FullPath->Buffer = NewTargetPath; /* Tell the parse routine to start reparsing */ @@ -247,7 +243,7 @@ NtCreateSymbolicLinkObject(OUT PHANDLE LinkHandle, { /* Round it down */ CapturedLinkTarget.MaximumLength = - ALIGN_DOWN(CapturedLinkTarget.MaximumLength, WCHAR); + (USHORT)ALIGN_DOWN(CapturedLinkTarget.MaximumLength, WCHAR); } /* Fail if the length is odd, or if the maximum is smaller or 0 */ diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 4c46dec4624..19c7a7161df 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -658,9 +658,9 @@ PspCreateProcess(OUT PHANDLE ProcessHandle, if (!NT_SUCCESS(Status)) goto Cleanup; /* Compute Quantum and Priority */ - Process->Pcb.BasePriority = PspComputeQuantumAndPriority(Process, - 0, - &Quantum); + Process->Pcb.BasePriority = (SCHAR)PspComputeQuantumAndPriority(Process, + 0, + &Quantum); Process->Pcb.QuantumReset = Quantum; /* Check if we have a parent other then the initial system process */ @@ -912,7 +912,7 @@ BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process) { - return Process->ProcessExiting; + return (BOOLEAN)Process->ProcessExiting; } /* @@ -1083,7 +1083,7 @@ NTAPI PsSetProcessPriorityClass(PEPROCESS Process, ULONG PriorityClass) { - Process->PriorityClass = PriorityClass; + Process->PriorityClass = (UCHAR)PriorityClass; } /* diff --git a/reactos/ntoskrnl/ps/security.c b/reactos/ntoskrnl/ps/security.c index bd6af32b2df..de5363ec96e 100644 --- a/reactos/ntoskrnl/ps/security.c +++ b/reactos/ntoskrnl/ps/security.c @@ -141,7 +141,7 @@ PspWriteTebImpersonationInfo(IN PETHREAD Thread, } /* Check if the thread is impersonating */ - IsImpersonating = Thread->ActiveImpersonationInfo; + IsImpersonating = (BOOLEAN)Thread->ActiveImpersonationInfo; if (IsImpersonating) { /* Set TEB data */ diff --git a/reactos/ntoskrnl/rtl/libsupp.c b/reactos/ntoskrnl/rtl/libsupp.c index fafe20bf6e8..3e1e9d6d74e 100644 --- a/reactos/ntoskrnl/rtl/libsupp.c +++ b/reactos/ntoskrnl/rtl/libsupp.c @@ -382,8 +382,8 @@ RtlpCreateUnicodeString( Source, Length); - UniDest->MaximumLength = Length; - UniDest->Length = Length - sizeof (WCHAR); + UniDest->MaximumLength = (USHORT)Length; + UniDest->Length = (USHORT)Length - sizeof (WCHAR); return TRUE; } diff --git a/reactos/ntoskrnl/rtl/misc.c b/reactos/ntoskrnl/rtl/misc.c index d61a6955777..5739852f847 100644 --- a/reactos/ntoskrnl/rtl/misc.c +++ b/reactos/ntoskrnl/rtl/misc.c @@ -73,9 +73,9 @@ RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation) if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) { RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)lpVersionInformation; - InfoEx->wServicePackMajor = (NtOSCSDVersion >> 8) & 0xFF; - InfoEx->wServicePackMinor = NtOSCSDVersion & 0xFF; - InfoEx->wSuiteMask = SharedUserData->SuiteMask; + InfoEx->wServicePackMajor = (USHORT)(NtOSCSDVersion >> 8) & 0xFF; + InfoEx->wServicePackMinor = (USHORT)(NtOSCSDVersion & 0xFF); + InfoEx->wSuiteMask = (USHORT)SharedUserData->SuiteMask; InfoEx->wProductType = SharedUserData->NtProductType; } diff --git a/reactos/ntoskrnl/se/sd.c b/reactos/ntoskrnl/se/sd.c index 170c19e9796..3d27f6910f9 100644 --- a/reactos/ntoskrnl/se/sd.c +++ b/reactos/ntoskrnl/se/sd.c @@ -810,7 +810,7 @@ SeQuerySecurityDescriptorInfo(IN PSECURITY_INFORMATION SecurityInformation, /* Build the new security descrtiptor */ RtlCreateSecurityDescriptorRelative(RelSD, SECURITY_DESCRIPTOR_REVISION); - RelSD->Control = Control; + RelSD->Control = (USHORT)Control; Current = (ULONG_PTR)(RelSD + 1); diff --git a/reactos/ntoskrnl/se/semgr.c b/reactos/ntoskrnl/se/semgr.c index d4e863c2e93..ba5d2ef7698 100644 --- a/reactos/ntoskrnl/se/semgr.c +++ b/reactos/ntoskrnl/se/semgr.c @@ -340,7 +340,7 @@ SeDefaultObjectMethod(PVOID Object, RtlCreateSecurityDescriptor(NewSd, SECURITY_DESCRIPTOR_REVISION1); /* We always build a self-relative descriptor */ - NewSd->Control = Control | SE_SELF_RELATIVE; + NewSd->Control = (USHORT)Control | SE_SELF_RELATIVE; Current = (ULONG_PTR)NewSd + sizeof(SECURITY_DESCRIPTOR); @@ -754,7 +754,7 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR _ParentDescriptor OPTIONAL, RtlCreateSecurityDescriptor(Descriptor, SECURITY_DESCRIPTOR_REVISION); - Descriptor->Control = Control | SE_SELF_RELATIVE; + Descriptor->Control = (USHORT)Control | SE_SELF_RELATIVE; Current = (ULONG_PTR)Descriptor + sizeof(SECURITY_DESCRIPTOR); diff --git a/reactos/ntoskrnl/se/token.c b/reactos/ntoskrnl/se/token.c index 841276a782c..b50e7803ea4 100644 --- a/reactos/ntoskrnl/se/token.c +++ b/reactos/ntoskrnl/se/token.c @@ -621,7 +621,7 @@ SeImpersonateClient(IN PSECURITY_CLIENT_CONTEXT ClientContext, PsImpersonateClient(ServerThread, ClientContext->ClientToken, 1, - (ULONG)b, + b, ClientContext->SecurityQos.ImpersonationLevel); }