Author: tkreuzer
Date: Mon Nov 17 21:41:21 2008
New Revision: 37435
URL:
http://svn.reactos.org/svn/reactos?rev=37435&view=rev
Log:
- Fix several ULONG/ULONG_PTR issues
- Add a parameter to DefaultQueryInfoBufferCheck for ULONG_PTR/SIZE_T ResultLength
Modified:
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/event.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/mutant.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sem.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sysinfo.c
branches/ros-amd64-bringup/reactos/ntoskrnl/ex/timer.c
branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/ntoskrnl.h
branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/iocomp.c
branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/irp.c
branches/ros-amd64-bringup/reactos/ntoskrnl/kd/kdmain.c
branches/ros-amd64-bringup/reactos/ntoskrnl/kd/wrappers/bochs.c
branches/ros-amd64-bringup/reactos/ntoskrnl/kdbg/kdb_symbols.c
branches/ros-amd64-bringup/reactos/ntoskrnl/mm/section.c
branches/ros-amd64-bringup/reactos/ntoskrnl/se/token.c
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/event.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/event.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/event.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -334,6 +334,7 @@
EventInformation,
EventInformationLength,
ReturnLength,
+ NULL,
PreviousMode);
if(!NT_SUCCESS(Status))
{
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/fastinterlck.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -36,9 +36,9 @@
{
Entry->Next = FirstEntry;
NextEntry = FirstEntry;
- FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head,
- (LONG)Entry,
- (LONG)FirstEntry);
+ FirstEntry = InterlockedCompareExchangePointer((PVOID*)Head,
+ (PVOID)Entry,
+ (PVOID)FirstEntry);
} while (FirstEntry != NextEntry);
return FirstEntry;
@@ -56,9 +56,9 @@
if (!FirstEntry) return NULL;
NextEntry = FirstEntry;
- FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head,
- (LONG)FirstEntry->Next,
- (LONG)FirstEntry);
+ FirstEntry = InterlockedCompareExchangePointer((PVOID*)Head,
+ (PVOID)FirstEntry->Next,
+ (PVOID)FirstEntry);
} while (FirstEntry != NextEntry);
return FirstEntry;
@@ -68,7 +68,7 @@
FASTCALL
ExInterlockedFlushSList(IN PSLIST_HEADER ListHead)
{
- return (PVOID)_InterlockedExchange((PLONG)&ListHead->Next.Next, (LONG)NULL);
+ return InterlockedExchangePointer((PVOID*)&ListHead->Next.Next, NULL);
}
PSLIST_ENTRY
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/mutant.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/mutant.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/mutant.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -245,6 +245,7 @@
MutantInformation,
MutantInformationLength,
ResultLength,
+ NULL,
PreviousMode);
if(!NT_SUCCESS(Status))
{
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sem.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sem.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sem.c [iso-8859-1] Mon Nov 17 21:41:21
2008
@@ -237,6 +237,7 @@
SemaphoreInformation,
SemaphoreInformationLength,
ReturnLength,
+ NULL,
PreviousMode);
if(!NT_SUCCESS(Status))
{
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -1055,7 +1055,7 @@
for (Count = 0; HandleCount > 0 ; HandleCount--)
{
- Shi->Handles[i].UniqueProcessId =
(USHORT)(ULONG)pr->UniqueProcessId;
+ Shi->Handles[i].UniqueProcessId =
(USHORT)(ULONG_PTR)pr->UniqueProcessId;
Count++;
i++;
}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ex/timer.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ex/timer.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ex/timer.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -522,6 +522,7 @@
TimerInformation,
TimerInformationLength,
ReturnLength,
+ NULL,
PreviousMode);
if(!NT_SUCCESS(Status)) return Status;
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/ntoskrnl.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/ntoskrnl.h [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/ntoskrnl.h [iso-8859-1]
Mon Nov 17 21:41:21 2008
@@ -213,6 +213,7 @@
PVOID Buffer,
ULONG BufferLength,
PULONG ReturnLength,
+ PULONG_PTR ReturnLengthLong,
KPROCESSOR_MODE PreviousMode)
{
NTSTATUS Status = STATUS_SUCCESS;
@@ -248,6 +249,10 @@
if (ReturnLength != NULL)
{
ProbeForWriteUlong(ReturnLength);
+ }
+ if (ReturnLengthLong != NULL)
+ {
+ ProbeForWrite(ReturnLengthLong, sizeof(ULONG_PTR),
sizeof(ULONG_PTR));
}
}
_SEH_HANDLE
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/iocomp.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/iocomp.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/iocomp.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -404,6 +404,7 @@
IoCompletionInformation,
IoCompletionInformationLength,
ResultLength,
+ NULL,
PreviousMode);
if (!NT_SUCCESS(Status)) return Status;
@@ -506,11 +507,11 @@
ListEntry = KeRemoveQueue(Queue, PreviousMode, Timeout);
/* If we got a timeout or user_apc back, return the status */
- if (((NTSTATUS)ListEntry == STATUS_TIMEOUT) ||
- ((NTSTATUS)ListEntry == STATUS_USER_APC))
+ if (((NTSTATUS)(ULONG_PTR)ListEntry == STATUS_TIMEOUT) ||
+ ((NTSTATUS)(ULONG_PTR)ListEntry == STATUS_USER_APC))
{
/* Set this as the status */
- Status = (NTSTATUS)ListEntry;
+ Status = (NTSTATUS)(ULONG_PTR)ListEntry;
}
else
{
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/irp.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -1191,7 +1191,7 @@
if (LastStackPtr->Control & SL_ERROR_RETURNED)
{
/* Get the error code */
- ErrorCode = (NTSTATUS)LastStackPtr->Parameters.Others.Argument4;
+ ErrorCode = PtrToUlong(LastStackPtr->Parameters.Others.Argument4);
}
/* Get the Current Stack and skip it */
@@ -1213,7 +1213,7 @@
/* Update the error for the current stack */
ErrorCode = Irp->IoStatus.Status;
StackPtr->Control |= SL_ERROR_RETURNED;
- LastStackPtr->Parameters.Others.Argument4 = (PVOID)ErrorCode;
+ LastStackPtr->Parameters.Others.Argument4 = UlongToPtr(ErrorCode);
LastStackPtr->Control |= SL_ERROR_RETURNED;
}
}
@@ -1587,7 +1587,7 @@
IoGetRequestorProcessId(IN PIRP Irp)
{
/* Return the requestor process' id */
- return (ULONG)(IoGetRequestorProcess(Irp)->UniqueProcessId);
+ return PtrToUlong(IoGetRequestorProcess(Irp)->UniqueProcessId);
}
/*
@@ -1759,5 +1759,5 @@
IoSetTopLevelIrp(IN PIRP Irp)
{
/* Set the IRP */
- PsGetCurrentThread()->TopLevelIrp = (ULONG)Irp;
-}
+ PsGetCurrentThread()->TopLevelIrp = (ULONG_PTR)Irp;
+}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd/kdmain.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/kd/kdmain.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd/kdmain.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -52,7 +52,7 @@
#ifdef DBG
case TAG('R', 'o', 's', ' '): /* ROS-INTERNAL */
{
- switch ((ULONG)Buffer1)
+ switch ((ULONG_PTR)Buffer1)
{
case DumpNonPagedPool:
MiDebugDumpNonPagedPool(FALSE);
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kd/wrappers/bochs.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/kd/wrappers/bochs.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/kd/wrappers/bochs.c [iso-8859-1] Mon Nov
17 21:41:21 2008
@@ -45,7 +45,7 @@
if (BootPhase == 0)
{
Value = READ_PORT_UCHAR(BOCHS_LOGGER_PORT);
- if (Value != (ULONG)BOCHS_LOGGER_PORT)
+ if (Value != (ULONG_PTR)BOCHS_LOGGER_PORT)
{
KdpDebugMode.Bochs = FALSE;
return;
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/kdbg/kdb_symbols.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/kdbg/kdb_symbols.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/kdbg/kdb_symbols.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -657,10 +657,10 @@
KdbpSymAddCachedFile(&LdrEntry->FullDllName,
LdrEntry->PatchInformation);
}
- DPRINT("Installed symbols: %wZ@%08x-%08x %p\n",
+ DPRINT("Installed symbols: %wZ@%p-%p %p\n",
&LdrEntry->BaseDllName,
LdrEntry->DllBase,
- LdrEntry->SizeOfImage + (ULONG)LdrEntry->DllBase,
+ (PVOID)(LdrEntry->SizeOfImage + (ULONG_PTR)LdrEntry->DllBase),
LdrEntry->PatchInformation);
}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/mm/section.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -4242,6 +4242,7 @@
sizeof(ExSectionInfoClass) /
sizeof(ExSectionInfoClass[0]),
SectionInformation,
SectionInformationLength,
+ NULL,
ResultLength,
PreviousMode);
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/se/token.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/se/token.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/se/token.c [iso-8859-1] Mon Nov 17
21:41:21 2008
@@ -871,6 +871,7 @@
TokenInformation,
TokenInformationLength,
ReturnLength,
+ NULL,
PreviousMode);
if(!NT_SUCCESS(Status))