Modified: trunk/reactos/include/ndk/mmtypes.h
Modified: trunk/reactos/include/reactos/helper.h
Modified: trunk/reactos/ntoskrnl/ex/init.c
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/io/deviface.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/kd/kdmain.c
Modified: trunk/reactos/ntoskrnl/lpc/reply.c
Modified: trunk/reactos/ntoskrnl/mm/elf.inc.h
Modified: trunk/reactos/ntoskrnl/mm/pe.c
Modified: trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/mm/virtual.c
Modified: trunk/reactos/w32api/include/ddk/winddk.h
--- trunk/reactos/include/ndk/mmtypes.h 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/include/ndk/mmtypes.h 2005-11-29 11:44:04 UTC (rev 19748)
@@ -28,9 +28,9 @@
//
// Page-Rounding Macros
//
-#define PAGE_ROUND_DOWN(x) (((ULONG)x)&(~(PAGE_SIZE-1)))
+#define PAGE_ROUND_DOWN(x) (((ULONG_PTR)x)&(~(PAGE_SIZE-1)))
#define PAGE_ROUND_UP(x) \
- ( (((ULONG)x)%PAGE_SIZE) ? ((((ULONG)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG)x) )
+ ( (((ULONG_PTR)x)%PAGE_SIZE) ? ((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) )
//
// Macro for generating pool tags
--- trunk/reactos/include/reactos/helper.h 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/include/reactos/helper.h 2005-11-29 11:44:04 UTC (rev 19748)
@@ -20,11 +20,11 @@
#endif
#ifndef PAGE_ROUND_DOWN
-#define PAGE_ROUND_DOWN(x) (((ULONG)x)&(~(PAGE_SIZE-1)))
+#define PAGE_ROUND_DOWN(x) (((ULONG_PTR)x)&(~(PAGE_SIZE-1)))
#endif
#ifndef PAGE_ROUND_UP
-#define PAGE_ROUND_UP(x) ( (((ULONG)x)%PAGE_SIZE) ? ((((ULONG)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG)x) )
+#define PAGE_ROUND_UP(x) ( (((ULONG_PTR)x)%PAGE_SIZE) ? ((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) )
#endif
#define ABS_VALUE(V) (((V) < 0) ? -(V) : (V))
--- trunk/reactos/ntoskrnl/ex/init.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/ex/init.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -89,7 +89,7 @@
/* Create local parameter line copy */
ParamBuffer = ExAllocatePool(PagedPool, 256);
- strcpy (ParamBuffer, (char *)ParameterLine);
+ strcpy (ParamBuffer, (const char *)ParameterLine);
DPRINT("%s\n", ParamBuffer);
/* Cut options off */
--- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h 2005-11-29 11:44:04 UTC (rev 19748)
@@ -123,7 +123,7 @@
(((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) || \
(ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) ? \
ExRaiseStatus (STATUS_ACCESS_VIOLATION), Default : \
- *(Type *)&(*(volatile Type *)(Ptr)))
+ *(Type *)(Ptr))
#define ProbeForReadBoolean(Ptr) ProbeForReadGenericType(Ptr, BOOLEAN, FALSE)
#define ProbeForReadUchar(Ptr) ProbeForReadGenericType(Ptr, UCHAR, 0)
--- trunk/reactos/ntoskrnl/io/deviface.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/io/deviface.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -882,6 +882,7 @@
PWCHAR StartPosition;
PWCHAR EndPosition;
NTSTATUS Status;
+ GUID EventGuid;
if (SymbolicLinkName == NULL)
return STATUS_INVALID_PARAMETER_1;
@@ -917,10 +918,11 @@
return Status;
}
+ EventGuid = Enable ? GUID_DEVICE_INTERFACE_ARRIVAL : GUID_DEVICE_INTERFACE_REMOVAL;
IopNotifyPlugPlayNotification(
PhysicalDeviceObject,
EventCategoryDeviceInterfaceChange,
- Enable ? (LPGUID)&GUID_DEVICE_INTERFACE_ARRIVAL : (LPGUID)&GUID_DEVICE_INTERFACE_REMOVAL,
+ &EventGuid,
&GuidString,
(PVOID)SymbolicLinkName);
--- trunk/reactos/ntoskrnl/io/pnpmgr.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/io/pnpmgr.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -221,7 +221,7 @@
/* Query the device caps */
Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCaps);
- if (NT_SUCCESS(Status) && (DeviceCaps.Address != -1))
+ if (NT_SUCCESS(Status) && (DeviceCaps.Address != (ULONG)-1))
{
/* Return length */
*ResultLength = sizeof(ULONG);
--- trunk/reactos/ntoskrnl/kd/kdmain.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/kd/kdmain.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -217,7 +217,7 @@
NtQueryDebugFilterState(IN ULONG ComponentId,
IN ULONG Level)
{
- int i;
+ unsigned int i;
/* convert Level to mask if it isn't already one */
if ( Level < 32 )
@@ -241,7 +241,7 @@
IN ULONG Level,
IN BOOLEAN State)
{
- int i;
+ unsigned int i;
for ( i = 0; i < KdComponentTableEntries; i++ )
{
if ( ComponentId == KdComponentTable[i].ComponentId )
--- trunk/reactos/ntoskrnl/lpc/reply.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/lpc/reply.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -45,7 +45,7 @@
}
Size = sizeof(QUEUEDMESSAGE);
- if (LpcReply && LpcReply->u1.s1.TotalLength > sizeof(PORT_MESSAGE))
+ if (LpcReply && LpcReply->u1.s1.TotalLength > (CSHORT)sizeof(PORT_MESSAGE))
{
Size += LpcReply->u1.s1.TotalLength - sizeof(PORT_MESSAGE);
}
--- trunk/reactos/ntoskrnl/mm/elf.inc.h 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/mm/elf.inc.h 2005-11-29 11:44:04 UTC (rev 19748)
@@ -139,7 +139,7 @@
#ifndef RTL_CONTAINS_FIELD
#define RTL_CONTAINS_FIELD(P_, SIZE_, FIELD_) \
- ((((char *)(P_)) + (SIZE_)) > (((char *)(&((P_)->FIELD_))) + sizeof((P_)->FIELD_)))
+ ((ULONG_PTR)(P_) + (ULONG_PTR)(SIZE_) > (ULONG_PTR)&((P_)->FIELD_) + sizeof((P_)->FIELD_))
#endif
#define ELFFMT_FIELDS_EQUAL(TYPE1_, TYPE2_, FIELD_) \
@@ -266,8 +266,13 @@
{
PBYTE p;
ULONG nSafeInput;
+ union
+ {
+ CONST ULONG32 *ConstInput;
+ ULONG32 *Input;
+ }pInput = {Input};
- RtlRetrieveUlong(&nSafeInput, Input);
+ RtlRetrieveUlong(&nSafeInput, pInput.Input);
if(DataType == ELF_TARG_DATA)
return nSafeInput;
--- trunk/reactos/ntoskrnl/mm/pe.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/mm/pe.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -97,7 +97,7 @@
#ifndef RTL_CONTAINS_FIELD
#define RTL_CONTAINS_FIELD(P_, SIZE_, FIELD_) \
- ((((char *)(P_)) + (SIZE_)) > (((char *)(&((P_)->FIELD_))) + sizeof((P_)->FIELD_)))
+ ((ULONG_PTR)(P_) + (ULONG_PTR)(SIZE_) > (ULONG_PTR)&((P_)->FIELD_) + sizeof((P_)->FIELD_))
#endif
static __inline BOOLEAN IsPowerOf2(IN ULONG Number)
--- trunk/reactos/ntoskrnl/mm/section.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/mm/section.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -2744,8 +2744,8 @@
MmspCompareSegments(const void * x,
const void * y)
{
- PMM_SECTION_SEGMENT Segment1 = (PMM_SECTION_SEGMENT)x;
- PMM_SECTION_SEGMENT Segment2 = (PMM_SECTION_SEGMENT)y;
+ const MM_SECTION_SEGMENT *Segment1 = (const MM_SECTION_SEGMENT *)x;
+ const MM_SECTION_SEGMENT *Segment2 = (const MM_SECTION_SEGMENT *)y;
return
(Segment1->VirtualAddress - Segment2->VirtualAddress) >>
--- trunk/reactos/ntoskrnl/mm/virtual.c 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/ntoskrnl/mm/virtual.c 2005-11-29 11:44:04 UTC (rev 19748)
@@ -989,20 +989,20 @@
IN ULONG Length,
IN ULONG Alignment)
{
- ASSERT(Alignment == 1 || Alignment == 2 || Alignment == 4 || Alignment == 8);
+ if (Length != 0)
+ {
+ ASSERT(Alignment == 1 || Alignment == 2 || Alignment == 4 || Alignment == 8);
- if (Length == 0)
- return;
-
- if (((ULONG_PTR)Address & (Alignment - 1)) != 0)
- {
- ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT);
- }
- else if ((ULONG_PTR)Address + Length - 1 < (ULONG_PTR)Address ||
- (ULONG_PTR)Address + Length - 1 >= (ULONG_PTR)MmUserProbeAddress)
- {
- ExRaiseStatus (STATUS_ACCESS_VIOLATION);
- }
+ if (((ULONG_PTR)Address & (Alignment - 1)) != 0)
+ {
+ ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT);
+ }
+ else if ((ULONG_PTR)Address + Length - 1 < (ULONG_PTR)Address ||
+ (ULONG_PTR)Address + Length - 1 >= (ULONG_PTR)MmUserProbeAddress)
+ {
+ ExRaiseStatus (STATUS_ACCESS_VIOLATION);
+ }
+ }
}
@@ -1010,39 +1010,39 @@
* @implemented
*/
VOID STDCALL
-ProbeForWrite (IN CONST VOID *Address,
+ProbeForWrite (IN PVOID Address,
IN ULONG Length,
IN ULONG Alignment)
{
- volatile CHAR *Current;
- PCHAR Last;
+ volatile CHAR *Current;
+ PCHAR Last;
- ASSERT(Alignment == 1 || Alignment == 2 || Alignment == 4 || Alignment == 8);
+ if (Length != 0)
+ {
+ ASSERT(Alignment == 1 || Alignment == 2 || Alignment == 4 || Alignment == 8);
- if (Length == 0)
- return;
+ if (((ULONG_PTR)Address & (Alignment - 1)) != 0)
+ {
+ ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT);
+ }
- if (((ULONG_PTR)Address & (Alignment - 1)) != 0)
- {
- ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT);
- }
+ Last = (PCHAR)((ULONG_PTR)Address + Length - 1);
+ if ((ULONG_PTR)Last < (ULONG_PTR)Address ||
+ (ULONG_PTR)Last >= (ULONG_PTR)MmUserProbeAddress)
+ {
+ ExRaiseStatus (STATUS_ACCESS_VIOLATION);
+ }
- Last = (CHAR*)((ULONG_PTR)Address + Length - 1);
- if ((ULONG_PTR)Last < (ULONG_PTR)Address ||
- (ULONG_PTR)Last >= (ULONG_PTR)MmUserProbeAddress)
- {
- ExRaiseStatus (STATUS_ACCESS_VIOLATION);
- }
-
- /* Check for accessible pages */
- Current = (CHAR*)Address;
- *Current = *Current;
- Current = (PCHAR)((ULONG_PTR)PAGE_ROUND_DOWN(Current) + PAGE_SIZE);
- while (Current <= Last)
- {
- *Current = *Current;
- Current = (CHAR*)((ULONG_PTR)Current + PAGE_SIZE);
- }
+ /* Check for accessible pages, do *not* touch any memory outside of the
+ range!*/
+ Current = (volatile CHAR*)Address;
+ Last = (PCHAR)(PAGE_ROUND_DOWN(Last));
+ do
+ {
+ *Current = *Current;
+ Current = (volatile CHAR*)(PAGE_ROUND_DOWN(Current) + PAGE_SIZE);
+ } while (Current <= Last);
+ }
}
/* EOF */
--- trunk/reactos/w32api/include/ddk/winddk.h 2005-11-29 11:09:42 UTC (rev 19747)
+++ trunk/reactos/w32api/include/ddk/winddk.h 2005-11-29 11:44:04 UTC (rev 19748)
@@ -6738,7 +6738,7 @@
VOID
DDKAPI
ProbeForWrite(
- IN CONST VOID *Address,
+ IN PVOID Address,
IN ULONG Length,
IN ULONG Alignment);