[NTOSKRNL]

Some misc fixes to make kernel compile warning-free with /W3. Also fix a bug that completely broke the ProcessWx86Information case for NtQueryInformationProcess by missing to reference/dereference and acquiring the specified process' EPROCESS.

svn path=/trunk/; revision=55815
This commit is contained in:
Stefan Ginsberg 2012-02-22 21:18:56 +00:00
parent 26a8d7fa89
commit 4cb002ee80
7 changed files with 34 additions and 18 deletions

View file

@ -737,7 +737,9 @@ IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid,
{
PWSTR NewBuffer;
ReturnBuffer.MaximumLength = (USHORT)max(ReturnBuffer.MaximumLength * 2,
ReturnBuffer.Length + KeyName.Length + 2 * sizeof(WCHAR));
(USHORT)(ReturnBuffer.Length +
KeyName.Length +
2 * sizeof(WCHAR)));
NewBuffer = ExAllocatePool(PagedPool, ReturnBuffer.MaximumLength);
if (!NewBuffer)
{

View file

@ -1409,8 +1409,8 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
}
/* Set output string */
DosName->Length = VolumePathPtr->MultiSzLength;
DosName->MaximumLength = VolumePathPtr->MultiSzLength + sizeof(UNICODE_NULL);
DosName->Length = (USHORT)VolumePathPtr->MultiSzLength;
DosName->MaximumLength = (USHORT)VolumePathPtr->MultiSzLength + sizeof(UNICODE_NULL);
/* Our MOUNTMGR_VOLUME_PATHS will be used as output buffer */
DosName->Buffer = (PWSTR)VolumePathPtr;
/* Move name at the begin, RtlMoveMemory is OK with overlapping */

View file

@ -199,7 +199,7 @@ IopInstallCriticalDevice(PDEVICE_NODE DeviceNode)
while (*IdBuffer)
{
ULONG StringLength = (ULONG)wcslen(IdBuffer) + 1, Index;
USHORT StringLength = (USHORT)wcslen(IdBuffer) + 1, Index;
IopFixupDeviceId(IdBuffer);
@ -247,7 +247,7 @@ IopInstallCriticalDevice(PDEVICE_NODE DeviceNode)
ChildIdNameU.Buffer = IdBuffer;
ChildIdNameU.MaximumLength = ChildIdNameU.Length = (StringLength - 1) * sizeof(WCHAR);
RegKeyNameU.Buffer = BasicInfo->Name;
RegKeyNameU.MaximumLength = RegKeyNameU.Length = BasicInfo->NameLength;
RegKeyNameU.MaximumLength = RegKeyNameU.Length = (USHORT)BasicInfo->NameLength;
if (RtlEqualUnicodeString(&ChildIdNameU, &RegKeyNameU, TRUE))
{

View file

@ -138,7 +138,7 @@ ULONG
NTAPI
MiTrimMemoryConsumer(ULONG Consumer, ULONG InitialTarget)
{
LONG Target = InitialTarget;
ULONG Target = InitialTarget;
ULONG NrFreedPages = 0;
NTSTATUS Status;

View file

@ -217,7 +217,7 @@ MiSynchronizeSystemPde(PMMPDE PointerPde)
KeMemoryBarrierWithoutFence();
/* Return, if we had success */
return (BOOLEAN)SystemPde.u.Hard.Valid;
return SystemPde.u.Hard.Valid != 0;
}
NTSTATUS
@ -549,7 +549,7 @@ Mmi386MakeKernelPageTableGlobal(PVOID Address)
{
if(!MiSynchronizeSystemPde(PointerPde))
return FALSE;
return PointerPte->u.Hard.Valid;
return (BOOLEAN)PointerPte->u.Hard.Valid;
}
return FALSE;
}

View file

@ -262,7 +262,7 @@ MiDbgDumpAddressSpace(VOID)
DPRINT1(" 0x%p - 0x%p\t%s\n",
MmNonPagedPoolStart,
(ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes,
"ARM³ Non Paged Pool");
"ARM3 Non Paged Pool");
DPRINT1(" 0x%p - 0x%p\t%s\n",
MiSystemViewStart,
(ULONG_PTR)MiSystemViewStart + MmSystemViewSize,
@ -283,7 +283,7 @@ MiDbgDumpAddressSpace(VOID)
DPRINT1(" 0x%p - 0x%p\t%s\n",
MmPagedPoolStart,
(ULONG_PTR)MmPagedPoolStart + MmSizeOfPagedPoolInBytes,
"ARM³ Paged Pool");
"ARM3 Paged Pool");
DPRINT1(" 0x%p - 0x%p\t%s\n",
MmNonPagedSystemStart, MmNonPagedPoolExpansionStart,
"System PTE Space");

View file

@ -855,7 +855,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
/* Protect write in SEH */
_SEH2_TRY
{
/* Return the count of handles */
/* Return debug port's handle */
*(PHANDLE)ProcessInformation = DebugPort;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
@ -887,7 +887,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
/* Protect write in SEH */
_SEH2_TRY
{
/* Return the count of handles */
/* Return FALSE -- we don't support this */
*(PULONG)ProcessInformation = FALSE;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
@ -908,8 +908,14 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
break;
}
/* Indicate success */
Status = STATUS_SUCCESS;
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
PsProcessType,
PreviousMode,
(PVOID*)&Process,
NULL);
if (!NT_SUCCESS(Status)) break;
/* Protect write in SEH */
_SEH2_TRY
@ -923,6 +929,9 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
/* Dereference the process */
ObDereferenceObject(Process);
break;
case ProcessWow64Information:
@ -1067,8 +1076,11 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
PVOID ExceptionPort;
ULONG Break;
KAFFINITY ValidAffinity, Affinity = 0;
ULONG DefaultHardErrorMode = 0, BasePriority = 0, MemoryPriority = 0;
ULONG DisableBoost = 0, DebugFlags = 0, EnableFixup = 0, Boost = 0;
KPRIORITY BasePriority = 0;
UCHAR MemoryPriority = 0;
BOOLEAN DisableBoost = 0;
ULONG DefaultHardErrorMode = 0;
ULONG DebugFlags = 0, EnableFixup = 0, Boost = 0;
ULONG NoExecute = 0, VdmPower = 0;
BOOLEAN HasPrivilege;
PLIST_ENTRY Next;
@ -1448,7 +1460,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
/* Enter SEH for direct buffer read */
_SEH2_TRY
{
BasePriority = *(PULONG)ProcessInformation;
BasePriority = *(KPRIORITY*)ProcessInformation;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@ -1674,7 +1686,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
/* Enter SEH for direct buffer read */
_SEH2_TRY
{
DisableBoost = *(PULONG)ProcessInformation;
DisableBoost = *(PBOOLEAN)ProcessInformation;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@ -1814,6 +1826,8 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
/* Only supported on x86 */
#if defined (_X86_)
Ke386SetIOPL();
#else
Status = STATUS_NOT_IMPLEMENTED;
#endif
/* Done */
break;