Author: sginsberg
Date: Wed Feb 22 21:18:56 2012
New Revision: 55815
URL:
http://svn.reactos.org/svn/reactos?rev=55815&view=rev
Log:
[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.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/deviface.c
trunk/reactos/ntoskrnl/io/iomgr/volume.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
trunk/reactos/ntoskrnl/mm/balance.c
trunk/reactos/ntoskrnl/mm/i386/page.c
trunk/reactos/ntoskrnl/mm/mminit.c
trunk/reactos/ntoskrnl/ps/query.c
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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] Wed Feb 22 21:18:56 2012
@@ -737,7 +737,9 @@
{
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)
{
Modified: trunk/reactos/ntoskrnl/io/iomgr/volume.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/volume.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] Wed Feb 22 21:18:56 2012
@@ -1409,8 +1409,8 @@
}
/* 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 */
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Wed Feb 22 21:18:56 2012
@@ -199,7 +199,7 @@
while (*IdBuffer)
{
- ULONG StringLength = (ULONG)wcslen(IdBuffer) + 1, Index;
+ USHORT StringLength = (USHORT)wcslen(IdBuffer) + 1, Index;
IopFixupDeviceId(IdBuffer);
@@ -247,7 +247,7 @@
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))
{
Modified: trunk/reactos/ntoskrnl/mm/balance.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Wed Feb 22 21:18:56 2012
@@ -138,7 +138,7 @@
NTAPI
MiTrimMemoryConsumer(ULONG Consumer, ULONG InitialTarget)
{
- LONG Target = InitialTarget;
+ ULONG Target = InitialTarget;
ULONG NrFreedPages = 0;
NTSTATUS Status;
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Wed Feb 22 21:18:56 2012
@@ -217,7 +217,7 @@
KeMemoryBarrierWithoutFence();
/* Return, if we had success */
- return (BOOLEAN)SystemPde.u.Hard.Valid;
+ return SystemPde.u.Hard.Valid != 0;
}
NTSTATUS
@@ -549,7 +549,7 @@
{
if(!MiSynchronizeSystemPde(PointerPde))
return FALSE;
- return PointerPte->u.Hard.Valid;
+ return (BOOLEAN)PointerPte->u.Hard.Valid;
}
return FALSE;
}
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Wed Feb 22 21:18:56 2012
@@ -262,7 +262,7 @@
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 @@
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");
Modified: trunk/reactos/ntoskrnl/ps/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=55…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Wed Feb 22 21:18:56 2012
@@ -855,7 +855,7 @@
/* 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 @@
/* 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 @@
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 @@
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
+
+ /* Dereference the process */
+ ObDereferenceObject(Process);
break;
case ProcessWow64Information:
@@ -1067,8 +1076,11 @@
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 @@
/* Enter SEH for direct buffer read */
_SEH2_TRY
{
- BasePriority = *(PULONG)ProcessInformation;
+ BasePriority = *(KPRIORITY*)ProcessInformation;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@@ -1674,7 +1686,7 @@
/* Enter SEH for direct buffer read */
_SEH2_TRY
{
- DisableBoost = *(PULONG)ProcessInformation;
+ DisableBoost = *(PBOOLEAN)ProcessInformation;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@@ -1814,6 +1826,8 @@
/* Only supported on x86 */
#if defined (_X86_)
Ke386SetIOPL();
+#else
+ Status = STATUS_NOT_IMPLEMENTED;
#endif
/* Done */
break;