mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
fix code that depends on GCC's void* pointer arithmetic extension
svn path=/trunk/; revision=16420
This commit is contained in:
parent
a4a9299b16
commit
945ed508b6
30 changed files with 109 additions and 112 deletions
|
@ -63,9 +63,9 @@ NTSTATUS STDCALL RamdrvDispatchReadWrite(PDEVICE_OBJECT DeviceObject,
|
|||
Stk->Parameters.Read.Length = devext->Size - Stk->Parameters.Read.ByteOffset.u.LowPart;
|
||||
if( Stk->MajorFunction == IRP_MJ_READ )
|
||||
RtlCopyMemory( MmGetSystemAddressForMdl( Irp->MdlAddress ),
|
||||
devext->Buffer + Stk->Parameters.Read.ByteOffset.u.LowPart,
|
||||
(PVOID)((ULONG_PTR)devext->Buffer + Stk->Parameters.Read.ByteOffset.u.LowPart),
|
||||
Stk->Parameters.Read.Length );
|
||||
else RtlCopyMemory( devext->Buffer + Stk->Parameters.Read.ByteOffset.u.LowPart,
|
||||
else RtlCopyMemory( (PVOID)((ULONG_PTR)devext->Buffer + Stk->Parameters.Read.ByteOffset.u.LowPart),
|
||||
MmGetSystemAddressForMdl( Irp->MdlAddress ),
|
||||
Stk->Parameters.Read.Length );
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
|
|
|
@ -69,10 +69,10 @@ CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
|||
Record = (PDIR_RECORD)*Block;
|
||||
while (Index < *pIndex)
|
||||
{
|
||||
(*Ptr) += Record->RecordLength;
|
||||
(*Ptr) = (PVOID)((ULONG_PTR)(*Ptr) + Record->RecordLength);
|
||||
(*CurrentOffset) += Record->RecordLength;
|
||||
Record = *Ptr;
|
||||
if (*Ptr - *Block >= BLOCKSIZE || Record->RecordLength == 0)
|
||||
if ((ULONG_PTR)(*Ptr) - (ULONG_PTR)(*Block) >= BLOCKSIZE || Record->RecordLength == 0)
|
||||
{
|
||||
DPRINT("Map next sector\n");
|
||||
CcUnpinData(*Context);
|
||||
|
@ -96,7 +96,7 @@ CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
|||
}
|
||||
}
|
||||
|
||||
if (*Ptr - *Block >= BLOCKSIZE || Record->RecordLength == 0)
|
||||
if ((ULONG_PTR)(*Ptr) - (ULONG_PTR)(*Block) >= BLOCKSIZE || Record->RecordLength == 0)
|
||||
{
|
||||
DPRINT("Map next sector\n");
|
||||
CcUnpinData(*Context);
|
||||
|
@ -259,11 +259,11 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
Record = (PDIR_RECORD) (Block + Offset % BLOCKSIZE);
|
||||
Record = (PDIR_RECORD) ((ULONG_PTR)Block + Offset % BLOCKSIZE);
|
||||
if (Offset)
|
||||
{
|
||||
Offset += Record->RecordLength;
|
||||
Record = (PVOID)Record + Record->RecordLength;
|
||||
Record = (PDIR_RECORD)((ULONG_PTR)Record + Record->RecordLength);
|
||||
}
|
||||
|
||||
while(TRUE)
|
||||
|
@ -356,7 +356,7 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
}
|
||||
|
||||
Offset += Record->RecordLength;
|
||||
Record = (PVOID)Record + Record->RecordLength;
|
||||
Record = (PDIR_RECORD)((ULONG_PTR)Record + Record->RecordLength);
|
||||
DirIndex++;
|
||||
}
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
|
||||
Offset += Record->RecordLength;
|
||||
BlockOffset += Record->RecordLength;
|
||||
Record = (PDIR_RECORD)(Block + BlockOffset);
|
||||
Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
|
||||
if (BlockOffset >= BLOCKSIZE || Record->RecordLength == 0)
|
||||
{
|
||||
DPRINT("Map next sector\n");
|
||||
|
@ -597,7 +597,7 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
DPRINT("CcMapData() failed\n");
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
Record = (PDIR_RECORD)(Block + BlockOffset);
|
||||
Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
|
||||
}
|
||||
|
||||
if (Offset >= DirSize)
|
||||
|
|
|
@ -390,7 +390,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
Information = Irp->IoStatus.Information;
|
||||
Length = IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length;
|
||||
ASSERT (Information <= Length);
|
||||
Buffer += Information;
|
||||
Buffer = (PVOID)((ULONG_PTR)Buffer + Information);
|
||||
Length -= Information;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
|
@ -450,24 +450,24 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
while (Length > 0 && Fcb->ReadDataAvailable > 0)
|
||||
{
|
||||
CopyLength = min(Fcb->ReadDataAvailable, Length);
|
||||
if (Fcb->ReadPtr + CopyLength <= Fcb->Data + Fcb->MaxDataLength)
|
||||
if ((ULONG_PTR)Fcb->ReadPtr + CopyLength <= (ULONG_PTR)Fcb->Data + Fcb->MaxDataLength)
|
||||
{
|
||||
memcpy(Buffer, Fcb->ReadPtr, CopyLength);
|
||||
Fcb->ReadPtr += CopyLength;
|
||||
if (Fcb->ReadPtr == Fcb->Data + Fcb->MaxDataLength)
|
||||
Fcb->ReadPtr = (PVOID)((ULONG_PTR)Fcb->ReadPtr + CopyLength);
|
||||
if (Fcb->ReadPtr == (PVOID)((ULONG_PTR)Fcb->Data + Fcb->MaxDataLength))
|
||||
{
|
||||
Fcb->ReadPtr = Fcb->Data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TempLength = Fcb->Data + Fcb->MaxDataLength - Fcb->ReadPtr;
|
||||
TempLength = (ULONG)((ULONG_PTR)Fcb->Data + Fcb->MaxDataLength - (ULONG_PTR)Fcb->ReadPtr);
|
||||
memcpy(Buffer, Fcb->ReadPtr, TempLength);
|
||||
memcpy(Buffer + TempLength, Fcb->Data, CopyLength - TempLength);
|
||||
Fcb->ReadPtr = Fcb->Data + CopyLength - TempLength;
|
||||
memcpy((PVOID)((ULONG_PTR)Buffer + TempLength), Fcb->Data, CopyLength - TempLength);
|
||||
Fcb->ReadPtr = (PVOID)((ULONG_PTR)Fcb->Data + CopyLength - TempLength);
|
||||
}
|
||||
|
||||
Buffer += CopyLength;
|
||||
Buffer = (PVOID)((ULONG_PTR)Buffer + CopyLength);
|
||||
Length -= CopyLength;
|
||||
Information += CopyLength;
|
||||
|
||||
|
@ -505,7 +505,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (Fcb->ReadDataAvailable > Length)
|
||||
{
|
||||
memmove(Fcb->Data, Fcb->Data + Length,
|
||||
memmove(Fcb->Data, (PVOID)((ULONG_PTR)Fcb->Data + Length),
|
||||
Fcb->ReadDataAvailable - Length);
|
||||
Fcb->ReadDataAvailable -= Length;
|
||||
Status = STATUS_MORE_ENTRIES;
|
||||
|
@ -694,21 +694,21 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
while (Length > 0 && ReaderFcb->WriteQuotaAvailable > 0)
|
||||
{
|
||||
CopyLength = min(Length, ReaderFcb->WriteQuotaAvailable);
|
||||
if (ReaderFcb->WritePtr + CopyLength <= ReaderFcb->Data + ReaderFcb->MaxDataLength)
|
||||
if ((ULONG_PTR)ReaderFcb->WritePtr + CopyLength <= (ULONG_PTR)ReaderFcb->Data + ReaderFcb->MaxDataLength)
|
||||
{
|
||||
memcpy(ReaderFcb->WritePtr, Buffer, CopyLength);
|
||||
ReaderFcb->WritePtr += CopyLength;
|
||||
if (ReaderFcb->WritePtr == ReaderFcb->Data + ReaderFcb->MaxDataLength)
|
||||
ReaderFcb->WritePtr = (PVOID)((ULONG_PTR)ReaderFcb->WritePtr + CopyLength);
|
||||
if ((ULONG_PTR)ReaderFcb->WritePtr == (ULONG_PTR)ReaderFcb->Data + ReaderFcb->MaxDataLength)
|
||||
{
|
||||
ReaderFcb->WritePtr = ReaderFcb->Data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TempLength = ReaderFcb->Data + ReaderFcb->MaxDataLength - ReaderFcb->WritePtr;
|
||||
TempLength = (ULONG)((ULONG_PTR)ReaderFcb->Data + ReaderFcb->MaxDataLength - (ULONG_PTR)ReaderFcb->WritePtr);
|
||||
memcpy(ReaderFcb->WritePtr, Buffer, TempLength);
|
||||
memcpy(ReaderFcb->Data, Buffer + TempLength, CopyLength - TempLength);
|
||||
ReaderFcb->WritePtr = ReaderFcb->Data + CopyLength - TempLength;
|
||||
ReaderFcb->WritePtr = (PVOID)((ULONG_PTR)ReaderFcb->Data + CopyLength - TempLength);
|
||||
}
|
||||
|
||||
Buffer += CopyLength;
|
||||
|
|
|
@ -125,7 +125,7 @@ NtfsDumpFileNameAttribute(PATTRIBUTE Attribute)
|
|||
ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
|
||||
// DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
|
||||
|
||||
FileNameAttr = (PFILENAME_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset);
|
||||
FileNameAttr = (PFILENAME_ATTRIBUTE)((ULONG_PTR)ResAttr + ResAttr->ValueOffset);
|
||||
DbgPrint(" '%.*S' ", FileNameAttr->NameLength, FileNameAttr->Name);
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ NtfsDumpVolumeNameAttribute(PATTRIBUTE Attribute)
|
|||
ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
|
||||
// DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
|
||||
|
||||
VolumeName = (PWCHAR)((PVOID)ResAttr + ResAttr->ValueOffset);
|
||||
VolumeName = (PWCHAR)((ULONG_PTR)ResAttr + ResAttr->ValueOffset);
|
||||
DbgPrint(" '%.*S' ", ResAttr->ValueLength / sizeof(WCHAR), VolumeName);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ NtfsDumpVolumeInformationAttribute(PATTRIBUTE Attribute)
|
|||
ResAttr = (PRESIDENT_ATTRIBUTE)Attribute;
|
||||
// DbgPrint(" Length %lu Offset %hu ", ResAttr->ValueLength, ResAttr->ValueOffset);
|
||||
|
||||
VolInfoAttr = (PVOLINFO_ATTRIBUTE)((PVOID)ResAttr + ResAttr->ValueOffset);
|
||||
VolInfoAttr = (PVOLINFO_ATTRIBUTE)((ULONG_PTR)ResAttr + ResAttr->ValueOffset);
|
||||
DbgPrint(" NTFS Version %u.%u Flags 0x%04hx ",
|
||||
VolInfoAttr->MajorVersion,
|
||||
VolInfoAttr->MinorVersion,
|
||||
|
|
|
@ -208,7 +208,7 @@ ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
|||
|
||||
ULONG n = m > 0 ? (index & m) : 0;
|
||||
|
||||
memcpy(file, p + n * BytesPerFileRecord, BytesPerFileRecord);
|
||||
memcpy(file, (PVOID)((ULONG_PTR)p + n * BytesPerFileRecord), BytesPerFileRecord);
|
||||
|
||||
ExFreePool(p);
|
||||
|
||||
|
@ -290,7 +290,7 @@ BOOL bitset(PUCHAR bitmap, ULONG i)
|
|||
|
||||
VOID FixupUpdateSequenceArray(PFILE_RECORD_HEADER file)
|
||||
{
|
||||
PUSHORT usa = (PUSHORT)((PVOID)file + file->Ntfs.UsaOffset);
|
||||
PUSHORT usa = (PUSHORT)((ULONG_PTR)file + file->Ntfs.UsaOffset);
|
||||
PUSHORT sector = (PUSHORT)file;
|
||||
ULONG i;
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ PIP_PACKET ReassembleDatagram(
|
|||
/* Copy the header into the buffer */
|
||||
RtlCopyMemory(IPPacket->Header, &IPDR->IPv4Header, IPDR->HeaderSize);
|
||||
|
||||
Data = IPPacket->Header + IPDR->HeaderSize;
|
||||
Data = (PVOID)((ULONG_PTR)IPPacket->Header + IPDR->HeaderSize);
|
||||
IPPacket->Data = Data;
|
||||
|
||||
/* Copy data from all fragments into buffer */
|
||||
|
|
|
@ -44,7 +44,7 @@ NTSTATUS AddUDPHeaderIPv4(
|
|||
sizeof(UDP_HEADER), (PVOID *)&UDPHeader );
|
||||
|
||||
/* Build UDP header */
|
||||
UDPHeader = (PUDP_HEADER)(IPPacket->Data - sizeof(UDP_HEADER));
|
||||
UDPHeader = (PUDP_HEADER)((ULONG_PTR)IPPacket->Data - sizeof(UDP_HEADER));
|
||||
/* Port values are already big-endian values */
|
||||
UDPHeader->SourcePort = LocalPort;
|
||||
UDPHeader->DestPort = RemotePort;
|
||||
|
|
|
@ -564,7 +564,7 @@ MiniportHalt(
|
|||
NdisMDeregisterInterrupt(&Adapter->InterruptObject);
|
||||
|
||||
/* deregister i/o port range */
|
||||
NdisMDeregisterIoPortRange(Adapter->MiniportAdapterHandle, Adapter->IoBaseAddress, NUMBER_OF_PORTS, Adapter->PortOffset);
|
||||
NdisMDeregisterIoPortRange(Adapter->MiniportAdapterHandle, Adapter->IoBaseAddress, NUMBER_OF_PORTS, (PVOID)Adapter->PortOffset);
|
||||
|
||||
/* free shared memory */
|
||||
MiFreeSharedMemory(Adapter);
|
||||
|
@ -852,8 +852,8 @@ MiniportInitialize(
|
|||
}
|
||||
|
||||
/* register an IO port range */
|
||||
Status = NdisMRegisterIoPortRange(&Adapter->PortOffset, Adapter->MiniportAdapterHandle,
|
||||
Adapter->IoBaseAddress, NUMBER_OF_PORTS);
|
||||
Status = NdisMRegisterIoPortRange((PVOID*)&Adapter->PortOffset, Adapter->MiniportAdapterHandle,
|
||||
(UINT)Adapter->IoBaseAddress, NUMBER_OF_PORTS);
|
||||
if(Status != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
DPRINT1("NdisMRegisterIoPortRange failed: 0x%x\n", Status);
|
||||
|
@ -914,7 +914,7 @@ MiniportInitialize(
|
|||
NdisMFreeMapRegisters(Adapter->MiniportAdapterHandle); /* doesn't hurt to free if we never alloc'd? */
|
||||
|
||||
if(Adapter->PortOffset)
|
||||
NdisMDeregisterIoPortRange(Adapter->MiniportAdapterHandle, Adapter->IoBaseAddress, NUMBER_OF_PORTS, Adapter->PortOffset);
|
||||
NdisMDeregisterIoPortRange(Adapter->MiniportAdapterHandle, Adapter->IoBaseAddress, NUMBER_OF_PORTS, (PVOID)Adapter->PortOffset);
|
||||
|
||||
if(InterruptRegistered)
|
||||
NdisMDeregisterInterrupt(&Adapter->InterruptObject);
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef struct _ADAPTER
|
|||
ULONG Flags;
|
||||
ULONG InterruptVector;
|
||||
ULONG IoBaseAddress;
|
||||
PVOID PortOffset;
|
||||
ULONG_PTR PortOffset;
|
||||
NDIS_MINIPORT_INTERRUPT InterruptObject;
|
||||
NDIS_MEDIA_STATE MediaState;
|
||||
NDIS_MINIPORT_TIMER MediaDetectionTimer;
|
||||
|
|
|
@ -487,7 +487,7 @@ NdisMStartBufferPhysicalMapping(
|
|||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = 0;
|
||||
VOID *CurrentVa;
|
||||
PVOID CurrentVa;
|
||||
ULONG TotalLength;
|
||||
PHYSICAL_ADDRESS ReturnedAddress;
|
||||
UINT LoopCount = 0;
|
||||
|
@ -514,7 +514,7 @@ NdisMStartBufferPhysicalMapping(
|
|||
PhysicalAddressArray[LoopCount].Length = Length;
|
||||
|
||||
TotalLength -= Length;
|
||||
CurrentVa += Length;
|
||||
CurrentVa = (PVOID)((ULONG_PTR)CurrentVa + Length);
|
||||
|
||||
LoopCount++;
|
||||
}
|
||||
|
|
|
@ -3066,7 +3066,7 @@ AtapiInitDma(PATAPI_MINIPORT_EXTENSION DevExt,
|
|||
DPRINT("AtapiInitDma()\n");
|
||||
|
||||
StartAddress = Srb->DataBuffer;
|
||||
EndAddress = StartAddress + Srb->DataTransferLength;
|
||||
EndAddress = (PVOID)((ULONG_PTR)StartAddress + Srb->DataTransferLength);
|
||||
DevExt->PRDCount = 0;
|
||||
|
||||
while (StartAddress < EndAddress)
|
||||
|
@ -3105,7 +3105,7 @@ AtapiInitDma(PATAPI_MINIPORT_EXTENSION DevExt,
|
|||
return FALSE;
|
||||
}
|
||||
PhysicalAddress.u.LowPart += tmpLength;
|
||||
StartAddress += tmpLength;
|
||||
StartAddress = (PVOID)((ULONG_PTR)StartAddress + tmpLength);
|
||||
Length -= tmpLength;
|
||||
PRDEntry->PhysAddress = PhysicalAddress.u.LowPart;
|
||||
}
|
||||
|
@ -3114,7 +3114,7 @@ AtapiInitDma(PATAPI_MINIPORT_EXTENSION DevExt,
|
|||
PRDEntry->PhysAddress = PhysicalAddress.u.LowPart;
|
||||
PRDEntry->Length = tmpLength;
|
||||
PRDEntry++;
|
||||
StartAddress += tmpLength;
|
||||
StartAddress = (PVOID)((ULONG_PTR)StartAddress + tmpLength);
|
||||
PhysicalAddress.u.LowPart += tmpLength;
|
||||
Length -= tmpLength;
|
||||
}
|
||||
|
|
|
@ -1485,10 +1485,10 @@ CdromDeviceControlCompletion (IN PDEVICE_OBJECT DeviceObject,
|
|||
if (Retry == TRUE &&
|
||||
(ULONG)OrigNextIrpStack->Parameters.Others.Argument1 > 0)
|
||||
{
|
||||
DPRINT1 ("Try again (Retry count %lu)\n",
|
||||
DPRINT1 ("Try again (Retry count 0x%p)\n",
|
||||
(ULONG)OrigNextIrpStack->Parameters.Others.Argument1);
|
||||
|
||||
(ULONG)OrigNextIrpStack->Parameters.Others.Argument1--;
|
||||
OrigNextIrpStack->Parameters.Others.Argument1 = (PVOID)((ULONG_PTR)OrigNextIrpStack->Parameters.Others.Argument1 - 1);
|
||||
|
||||
/* Release 'old' buffers */
|
||||
ExFreePool (Srb->SenseInfoBuffer);
|
||||
|
|
|
@ -478,7 +478,7 @@ ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension,
|
|||
}
|
||||
if (Srb == NULL)
|
||||
{
|
||||
EndAddress = DeviceExtension->VirtualAddress + DeviceExtension->CommonBufferLength;
|
||||
EndAddress = (PVOID)((ULONG_PTR)DeviceExtension->VirtualAddress + DeviceExtension->CommonBufferLength);
|
||||
if (VirtualAddress >= DeviceExtension->VirtualAddress && VirtualAddress < EndAddress)
|
||||
{
|
||||
Offset = (ULONG_PTR)VirtualAddress - (ULONG_PTR)DeviceExtension->VirtualAddress;
|
||||
|
@ -506,14 +506,14 @@ ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension,
|
|||
}
|
||||
else
|
||||
{
|
||||
EndAddress = Srb->DataBuffer + Srb->DataTransferLength;
|
||||
EndAddress = (PVOID)((ULONG_PTR)Srb->DataBuffer + Srb->DataTransferLength);
|
||||
if (VirtualAddress == NULL)
|
||||
{
|
||||
VirtualAddress = Srb->DataBuffer;
|
||||
}
|
||||
else if (VirtualAddress < Srb->DataBuffer || VirtualAddress >= EndAddress)
|
||||
{
|
||||
EndAddress = Srb->SenseInfoBuffer + Srb->SenseInfoBufferLength;
|
||||
EndAddress = (PVOID)((ULONG_PTR)Srb->SenseInfoBuffer + Srb->SenseInfoBufferLength);
|
||||
if (VirtualAddress < Srb->SenseInfoBuffer || VirtualAddress >= EndAddress)
|
||||
{
|
||||
PhysicalAddress.QuadPart = 0LL;
|
||||
|
@ -530,18 +530,18 @@ ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension,
|
|||
}
|
||||
|
||||
BufferLength = PAGE_SIZE - (ULONG_PTR)VirtualAddress % PAGE_SIZE;
|
||||
while (VirtualAddress + BufferLength < EndAddress)
|
||||
while ((ULONG_PTR)VirtualAddress + BufferLength < (ULONG_PTR)EndAddress)
|
||||
{
|
||||
NextPhysicalAddress = MmGetPhysicalAddress(VirtualAddress + BufferLength);
|
||||
NextPhysicalAddress = MmGetPhysicalAddress((PVOID)((ULONG_PTR)VirtualAddress + BufferLength));
|
||||
if (PhysicalAddress.QuadPart + BufferLength != NextPhysicalAddress.QuadPart)
|
||||
{
|
||||
break;
|
||||
}
|
||||
BufferLength += PAGE_SIZE;
|
||||
}
|
||||
if (VirtualAddress + BufferLength >= EndAddress)
|
||||
if ((ULONG_PTR)VirtualAddress + BufferLength >= (ULONG_PTR)EndAddress)
|
||||
{
|
||||
BufferLength = EndAddress - VirtualAddress;
|
||||
BufferLength = (ULONG)((ULONG_PTR)EndAddress - (ULONG_PTR)VirtualAddress);
|
||||
}
|
||||
}
|
||||
if (Length != NULL)
|
||||
|
@ -1786,7 +1786,7 @@ SpiAllocateSrbExtension(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
|||
if (index != 0xffffffff)
|
||||
{
|
||||
DeviceExtension->CurrentSrbExtensions++;
|
||||
Srb->SrbExtension = DeviceExtension->VirtualAddress + index * DeviceExtension->SrbExtensionSize;
|
||||
Srb->SrbExtension = (PVOID)((ULONG_PTR)DeviceExtension->VirtualAddress + index * DeviceExtension->SrbExtensionSize);
|
||||
}
|
||||
}
|
||||
DPRINT("%x\n", Srb->SrbExtension);
|
||||
|
|
|
@ -52,14 +52,14 @@ DIBtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
|
|||
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
|
||||
{
|
||||
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy,
|
||||
Source->pvScan0 + SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1),
|
||||
(PVOID)((ULONG_PTR)Source->pvScan0 + SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1)),
|
||||
Source->lDelta, SourcePoint->x % 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Perform color translation */
|
||||
DIB_BltToVGAWithXlate(DestRect->left, DestRect->top, dx, dy,
|
||||
Source->pvScan0 + SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1),
|
||||
(PVOID)((ULONG_PTR)Source->pvScan0 + SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1)),
|
||||
Source->lDelta, ColorTranslation);
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
@ -409,7 +409,7 @@ void DIB_BltFromVGA(int x, int y, int w, int h, void *b, int Dest_lDelta)
|
|||
/* Reset the destination. */
|
||||
for (j = 0; j < h; j++)
|
||||
{
|
||||
memset(b + (j * Dest_lDelta), 0, abs(Dest_lDelta));
|
||||
memset((PVOID)((ULONG_PTR)b + (j * Dest_lDelta)), 0, abs(Dest_lDelta));
|
||||
}
|
||||
|
||||
for (plane = 0; plane < 4; plane++)
|
||||
|
@ -986,7 +986,7 @@ void DFB_BltToDIB(int x, int y, int w, int h, void *b, int bw, void *bdib, int d
|
|||
int i, j, dib_shift;
|
||||
|
||||
bpX = b;
|
||||
dib = bdib + y * dibw + (x / 2);
|
||||
dib = (unsigned char *)bdib + y * dibw + (x / 2);
|
||||
|
||||
for (i=w; i>0; i--) {
|
||||
|
||||
|
@ -1015,7 +1015,7 @@ void DIB_BltToDFB(int x, int y, int w, int h, void *b, int bw, void *bdib, int d
|
|||
int i, j, dib_shift, dib_and;
|
||||
|
||||
bpX = b;
|
||||
dib = bdib + y * dibw + (x / 2);
|
||||
dib = (unsigned char *)bdib + y * dibw + (x / 2);
|
||||
|
||||
for (i=w; i>0; i--) {
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ IntVideoPortImageDirectoryEntryToData(
|
|||
if (Va == 0)
|
||||
return NULL;
|
||||
|
||||
return (PVOID)(BaseAddress + Va);
|
||||
return (PVOID)((ULONG_PTR)BaseAddress + Va);
|
||||
}
|
||||
|
||||
PVOID STDCALL
|
||||
|
@ -103,7 +103,7 @@ IntVideoPortGetProcAddress(
|
|||
((ULONG_PTR)BaseAddress + (ULONG_PTR)ExportDir->AddressOfNames);
|
||||
for (i = 0; i < ExportDir->NumberOfNames; i++, NamePtr++, OrdinalPtr++)
|
||||
{
|
||||
if (!_strnicmp((PCHAR)FunctionName, (PCHAR)(BaseAddress + *NamePtr),
|
||||
if (!_strnicmp((PCHAR)FunctionName, (PCHAR)((ULONG_PTR)BaseAddress + *NamePtr),
|
||||
strlen((PCHAR)FunctionName)))
|
||||
{
|
||||
return (PVOID)((ULONG_PTR)BaseAddress +
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
sizeof (IMAGE_NT_SIGNATURE) + \
|
||||
sizeof (IMAGE_FILE_HEADER)))
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
#define RVA(m, b) ((ULONG)b + m)
|
||||
#define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m)))
|
||||
#define NTSTAT_SEVERITY_SHIFT 30
|
||||
#define NTSTAT_SEVERITY_MASK 0x00000003
|
||||
#define NTSTAT_FACILITY_SHIFT 16
|
||||
|
|
|
@ -13,11 +13,8 @@ void *_lsearch(const void *key, void *base, size_t *nelp, size_t width,
|
|||
if (ret_find != NULL)
|
||||
return ret_find;
|
||||
|
||||
#ifdef __GNUC__
|
||||
memcpy(base + (*nelp*width), key, width);
|
||||
#else
|
||||
memcpy((int*)base + (*nelp*width), key, width);
|
||||
#endif
|
||||
memcpy((void*)((int*)base + (*nelp*width)), key, width);
|
||||
|
||||
(*nelp)++;
|
||||
return base;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ InternalFindNextFile (
|
|||
|
||||
if (IData->pFileInfo->NextEntryOffset != 0)
|
||||
{
|
||||
IData->pFileInfo = (PVOID)IData->pFileInfo + IData->pFileInfo->NextEntryOffset;
|
||||
IData->pFileInfo = (PVOID)((ULONG_PTR)IData->pFileInfo + IData->pFileInfo->NextEntryOffset);
|
||||
DPRINT("Found %.*S\n",IData->pFileInfo->FileNameLength/sizeof(WCHAR), IData->pFileInfo->FileName);
|
||||
return TRUE;
|
||||
}
|
||||
IData->pFileInfo = (PVOID)IData + sizeof(KERNEL32_FIND_FILE_DATA);
|
||||
IData->pFileInfo = (PVOID)((ULONG_PTR)IData + sizeof(KERNEL32_FIND_FILE_DATA));
|
||||
IData->pFileInfo->FileIndex = 0;
|
||||
Status = NtQueryDirectoryFile (IData->DirectoryHandle,
|
||||
NULL,
|
||||
|
@ -271,7 +271,7 @@ InternalFindFirstFile (
|
|||
SetLastErrorByStatus (Status);
|
||||
return(NULL);
|
||||
}
|
||||
IData->pFileInfo = (PVOID)IData + sizeof(KERNEL32_FIND_FILE_DATA);
|
||||
IData->pFileInfo = (PVOID)((ULONG_PTR)IData + sizeof(KERNEL32_FIND_FILE_DATA));
|
||||
IData->pFileInfo->FileIndex = 0;
|
||||
|
||||
Status = NtQueryDirectoryFile (IData->DirectoryHandle,
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef struct __GLOBAL_LOCAL_HANDLE
|
|||
|
||||
#define HANDLE_TO_INTERN(h) ((PGLOBAL_HANDLE)(((char *)(h))-4))
|
||||
#define INTERN_TO_HANDLE(i) ((HGLOBAL) &((i)->Pointer))
|
||||
#define POINTER_TO_HANDLE(p) (*(PHANDLE)(p - HANDLE_SIZE))
|
||||
#define POINTER_TO_HANDLE(p) (*(PHANDLE)((ULONG_PTR)p - HANDLE_SIZE))
|
||||
#define ISHANDLE(h) ((((ULONG)(h)) & 0x4)!=0)
|
||||
#define ISPOINTER(h) ((((ULONG)(h)) & 0x4)==0)
|
||||
|
||||
|
@ -105,7 +105,7 @@ GlobalAlloc(UINT uFlags,
|
|||
if (palloc)
|
||||
{
|
||||
*(PHANDLE)palloc = INTERN_TO_HANDLE(phandle);
|
||||
phandle->Pointer = palloc + HANDLE_SIZE;
|
||||
phandle->Pointer = (PVOID)((ULONG_PTR)palloc + HANDLE_SIZE);
|
||||
}
|
||||
else /*failed to allocate the memory block*/
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ GlobalFree(HGLOBAL hMem)
|
|||
}
|
||||
|
||||
if(phandle->Pointer)
|
||||
RtlFreeHeap(GetProcessHeap(), 0, phandle->Pointer - HANDLE_SIZE);
|
||||
RtlFreeHeap(GetProcessHeap(), 0, (PVOID)((ULONG_PTR)phandle->Pointer - HANDLE_SIZE));
|
||||
|
||||
RtlFreeHeap(GetProcessHeap(), 0, phandle);
|
||||
}
|
||||
|
@ -549,7 +549,7 @@ GlobalReAlloc(HGLOBAL hMem,
|
|||
if(phandle->Pointer)
|
||||
{
|
||||
palloc = RtlReAllocateHeap(GetProcessHeap(), heap_flags,
|
||||
phandle->Pointer - HANDLE_SIZE,
|
||||
(PVOID)((ULONG_PTR)phandle->Pointer - HANDLE_SIZE),
|
||||
dwBytes + HANDLE_SIZE);
|
||||
if (0 == palloc)
|
||||
{
|
||||
|
@ -558,7 +558,7 @@ GlobalReAlloc(HGLOBAL hMem,
|
|||
else
|
||||
{
|
||||
*(PHANDLE)palloc = hMem;
|
||||
phandle->Pointer = palloc + HANDLE_SIZE;
|
||||
phandle->Pointer = (PVOID)((ULONG_PTR)palloc + HANDLE_SIZE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -571,7 +571,7 @@ GlobalReAlloc(HGLOBAL hMem,
|
|||
else
|
||||
{
|
||||
*(PHANDLE)palloc = hMem;
|
||||
phandle->Pointer = palloc + HANDLE_SIZE;
|
||||
phandle->Pointer = (PVOID)((ULONG_PTR)palloc + HANDLE_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ GlobalReAlloc(HGLOBAL hMem,
|
|||
{
|
||||
if(phandle->Pointer)
|
||||
{
|
||||
RtlFreeHeap(GetProcessHeap(), 0, phandle->Pointer - HANDLE_SIZE);
|
||||
RtlFreeHeap(GetProcessHeap(), 0, (PVOID)((ULONG_PTR)phandle->Pointer - HANDLE_SIZE));
|
||||
phandle->Pointer = 0;
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ GlobalSize(HGLOBAL hMem)
|
|||
{
|
||||
if (0 != phandle->Pointer)/*NOT DISCARDED*/
|
||||
{
|
||||
retval = RtlSizeHeap(GetProcessHeap(), 0, phandle->Pointer - HANDLE_SIZE);
|
||||
retval = RtlSizeHeap(GetProcessHeap(), 0, (PVOID)((ULONG_PTR)phandle->Pointer - HANDLE_SIZE));
|
||||
|
||||
if (retval == (SIZE_T)-1) /*RtlSizeHeap failed*/
|
||||
{
|
||||
|
|
|
@ -505,7 +505,7 @@ static NTSTATUS KlInitPeb(HANDLE ProcessHandle,
|
|||
while(*ptr++);
|
||||
}
|
||||
ptr++;
|
||||
EnvSize = (PVOID)ptr - ParentEnv;
|
||||
EnvSize = (ULONG)((ULONG_PTR)ptr - (ULONG_PTR)ParentEnv);
|
||||
}
|
||||
else if (NtCurrentPeb()->ProcessParameters->Environment != NULL)
|
||||
{
|
||||
|
@ -572,7 +572,7 @@ static NTSTATUS KlInitPeb(HANDLE ProcessHandle,
|
|||
/* write pointer to environment */
|
||||
Offset = FIELD_OFFSET(RTL_USER_PROCESS_PARAMETERS, Environment);
|
||||
NtWriteVirtualMemory(ProcessHandle,
|
||||
(PVOID)(PpbBase + Offset),
|
||||
(PVOID)((ULONG_PTR)PpbBase + Offset),
|
||||
&EnvPtr,
|
||||
sizeof(EnvPtr),
|
||||
&BytesWritten);
|
||||
|
|
|
@ -48,7 +48,7 @@ CsrCaptureParameterBuffer(PVOID ParameterBuffer,
|
|||
memcpy(Block, ParameterBuffer, ParameterBufferSize);
|
||||
}
|
||||
*ClientAddress = Block;
|
||||
*ServerAddress = Block - CsrSectionMapBase + CsrSectionMapServerBase;
|
||||
*ServerAddress = (PVOID)((ULONG_PTR)Block - (ULONG_PTR)CsrSectionMapBase + (ULONG_PTR)CsrSectionMapServerBase);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ __true_LdrInitializeThunk (ULONG Unknown1,
|
|||
&NlsTable);
|
||||
RtlResetRtlTranslations (&NlsTable);
|
||||
|
||||
NTHeaders = (PIMAGE_NT_HEADERS)(ImageBase + PEDosHeader->e_lfanew);
|
||||
NTHeaders = (PIMAGE_NT_HEADERS)((ULONG_PTR)ImageBase + PEDosHeader->e_lfanew);
|
||||
|
||||
/* Get number of processors */
|
||||
Status = ZwQuerySystemInformation(SystemBasicInformation,
|
||||
|
|
|
@ -162,7 +162,7 @@ static inline VOID LdrpTlsCallback(PLDR_DATA_TABLE_ENTRY Module, ULONG dwReason)
|
|||
TRACE_LDR("%wZ - Calling tls callback at %x\n",
|
||||
&Module->BaseDllName, TlsCallback);
|
||||
TlsCallback(Module->DllBase, dwReason, NULL);
|
||||
TlsCallback++;
|
||||
TlsCallback = (PIMAGE_TLS_CALLBACK)((ULONG_PTR)TlsCallback + sizeof(PVOID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ LdrpInitializeTlsForThread(VOID)
|
|||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
TlsData = (PVOID)TlsPointers + LdrpTlsCount * sizeof(PVOID);
|
||||
TlsData = (PVOID)((ULONG_PTR)TlsPointers + LdrpTlsCount * sizeof(PVOID));
|
||||
Teb->ThreadLocalStoragePointer = TlsPointers;
|
||||
|
||||
TlsInfo = LdrpTlsArray;
|
||||
|
@ -216,12 +216,12 @@ LdrpInitializeTlsForThread(VOID)
|
|||
if (TlsInfo->TlsDataSize)
|
||||
{
|
||||
memcpy(TlsData, TlsInfo->StartAddressOfRawData, TlsInfo->TlsDataSize);
|
||||
TlsData += TlsInfo->TlsDataSize;
|
||||
TlsData = (PVOID)((ULONG_PTR)TlsData + TlsInfo->TlsDataSize);
|
||||
}
|
||||
if (TlsInfo->TlsZeroSize)
|
||||
{
|
||||
memset(TlsData, 0, TlsInfo->TlsZeroSize);
|
||||
TlsData += TlsInfo->TlsZeroSize;
|
||||
TlsData = (PVOID)((ULONG_PTR)TlsData + TlsInfo->TlsZeroSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ LdrAddModuleEntry(PVOID ImageBase,
|
|||
Module->DllBase = (PVOID)ImageBase;
|
||||
Module->EntryPoint = (PVOID)NTHeaders->OptionalHeader.AddressOfEntryPoint;
|
||||
if (Module->EntryPoint != 0)
|
||||
Module->EntryPoint += (ULONG)Module->DllBase;
|
||||
Module->EntryPoint = (PVOID)((ULONG_PTR)Module->EntryPoint + (ULONG_PTR)Module->DllBase);
|
||||
Module->SizeOfImage = LdrpGetResidentSize(NTHeaders);
|
||||
if (NtCurrentPeb()->Ldr->Initialized == TRUE)
|
||||
{
|
||||
|
@ -803,7 +803,7 @@ LdrFindEntryForAddress(PVOID Address,
|
|||
DPRINT("Scanning %wZ at %p\n", &ModulePtr->BaseDllName, ModulePtr->DllBase);
|
||||
|
||||
if ((Address >= ModulePtr->DllBase) &&
|
||||
(Address <= (ModulePtr->DllBase + ModulePtr->SizeOfImage)))
|
||||
((ULONG_PTR)Address <= ((ULONG_PTR)ModulePtr->DllBase + ModulePtr->SizeOfImage)))
|
||||
{
|
||||
*Module = ModulePtr;
|
||||
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||
|
@ -1030,7 +1030,7 @@ LdrGetExportByOrdinal (
|
|||
ExportDir->AddressOfFunctions
|
||||
);
|
||||
DPRINT(
|
||||
"LdrGetExportByOrdinal(Ordinal %d) = %x\n",
|
||||
"LdrGetExportByOrdinal(Ordinal %d) = %p\n",
|
||||
Ordinal,
|
||||
RVA(BaseAddress, ExFunctions[Ordinal - ExportDir->Base] )
|
||||
);
|
||||
|
@ -1270,7 +1270,7 @@ LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders,
|
|||
{
|
||||
Count = (RelocationDir->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) /
|
||||
sizeof(USHORT);
|
||||
Page = ImageBase + RelocationDir->VirtualAddress;
|
||||
Page = (PVOID)((ULONG_PTR)ImageBase + (ULONG_PTR)RelocationDir->VirtualAddress);
|
||||
TypeOffset = (PUSHORT)(RelocationDir + 1);
|
||||
|
||||
/* Unprotect the page(s) we're about to relocate. */
|
||||
|
@ -1289,7 +1289,7 @@ LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders,
|
|||
if (RelocationDir->VirtualAddress + PAGE_SIZE <
|
||||
NTHeaders->OptionalHeader.SizeOfImage)
|
||||
{
|
||||
ProtectPage2 = ProtectPage + PAGE_SIZE;
|
||||
ProtectPage2 = (PVOID)((ULONG_PTR)ProtectPage + PAGE_SIZE);
|
||||
Status = NtProtectVirtualMemory(NtCurrentProcess(),
|
||||
&ProtectPage2,
|
||||
&ProtectSize,
|
||||
|
@ -1391,16 +1391,16 @@ LdrpProcessImportDirectoryEntry(PLDR_DATA_TABLE_ENTRY Module,
|
|||
}
|
||||
|
||||
/* Get the import address list. */
|
||||
ImportAddressList = (PVOID *)(Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
ImportAddressList = (PVOID *)((ULONG_PTR)Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
|
||||
/* Get the list of functions to import. */
|
||||
if (ImportModuleDirectory->OriginalFirstThunk != 0)
|
||||
{
|
||||
FunctionNameList = (PULONG) (Module->DllBase + (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
|
||||
FunctionNameList = (PULONG) ((ULONG_PTR)Module->DllBase + (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
FunctionNameList = (PULONG)(Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
FunctionNameList = (PULONG)((ULONG_PTR)Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
}
|
||||
|
||||
/* Get the size of IAT. */
|
||||
|
@ -1550,16 +1550,16 @@ LdrpAdjustImportDirectory(PLDR_DATA_TABLE_ENTRY Module,
|
|||
{
|
||||
|
||||
/* Get the import address list. */
|
||||
ImportAddressList = (PVOID *)(Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
ImportAddressList = (PVOID *)((ULONG_PTR)Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
|
||||
/* Get the list of functions to import. */
|
||||
if (ImportModuleDirectory->OriginalFirstThunk != 0)
|
||||
{
|
||||
FunctionNameList = (PULONG) (Module->DllBase + (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
|
||||
FunctionNameList = (PULONG) ((ULONG_PTR)Module->DllBase + (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
FunctionNameList = (PULONG)(Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
FunctionNameList = (PULONG)((ULONG_PTR)Module->DllBase + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||
}
|
||||
|
||||
/* Get the size of IAT. */
|
||||
|
@ -1585,15 +1585,15 @@ LdrpAdjustImportDirectory(PLDR_DATA_TABLE_ENTRY Module,
|
|||
|
||||
NTHeaders = RtlImageNtHeader (ImportedModule->DllBase);
|
||||
Start = (PVOID)NTHeaders->OptionalHeader.ImageBase;
|
||||
End = Start + ImportedModule->SizeOfImage;
|
||||
Offset = ImportedModule->DllBase - Start;
|
||||
End = (PVOID)((ULONG_PTR)Start + ImportedModule->SizeOfImage);
|
||||
Offset = (ULONG)((ULONG_PTR)ImportedModule->DllBase - (ULONG_PTR)Start);
|
||||
|
||||
/* Walk through function list and fixup addresses. */
|
||||
while (*FunctionNameList != 0L)
|
||||
{
|
||||
if (*ImportAddressList >= Start && *ImportAddressList < End)
|
||||
{
|
||||
(*ImportAddressList) += Offset;
|
||||
(*ImportAddressList) = (PVOID)((ULONG_PTR)(*ImportAddressList) + Offset);
|
||||
}
|
||||
ImportAddressList++;
|
||||
FunctionNameList++;
|
||||
|
@ -1903,7 +1903,7 @@ PEPFUNC LdrPEStartup (PVOID ImageBase,
|
|||
* to the DLL's image.
|
||||
*/
|
||||
DosHeader = (PIMAGE_DOS_HEADER) ImageBase;
|
||||
NTHeaders = (PIMAGE_NT_HEADERS) (ImageBase + DosHeader->e_lfanew);
|
||||
NTHeaders = (PIMAGE_NT_HEADERS) ((ULONG_PTR)ImageBase + DosHeader->e_lfanew);
|
||||
|
||||
/*
|
||||
* If the base address is different from the
|
||||
|
@ -1978,7 +1978,7 @@ PEPFUNC LdrPEStartup (PVOID ImageBase,
|
|||
DPRINT("AddressOfEntryPoint = %x\n",(ULONG)NTHeaders->OptionalHeader.AddressOfEntryPoint);
|
||||
if (NTHeaders->OptionalHeader.AddressOfEntryPoint != 0)
|
||||
{
|
||||
EntryPoint = (PEPFUNC) (ImageBase
|
||||
EntryPoint = (PEPFUNC) ((ULONG_PTR)ImageBase
|
||||
+ NTHeaders->OptionalHeader.AddressOfEntryPoint);
|
||||
}
|
||||
DPRINT("LdrPEStartup() = %x\n",EntryPoint);
|
||||
|
@ -3108,17 +3108,17 @@ LdrProcessRelocationBlock(IN PVOID Address,
|
|||
break;
|
||||
|
||||
case IMAGE_REL_BASED_HIGH:
|
||||
ShortPtr = (PUSHORT)(Address + Offset);
|
||||
ShortPtr = (PUSHORT)((ULONG_PTR)Address + Offset);
|
||||
*ShortPtr += HIWORD(Delta);
|
||||
break;
|
||||
|
||||
case IMAGE_REL_BASED_LOW:
|
||||
ShortPtr = (PUSHORT)(Address + Offset);
|
||||
ShortPtr = (PUSHORT)((ULONG_PTR)Address + Offset);
|
||||
*ShortPtr += LOWORD(Delta);
|
||||
break;
|
||||
|
||||
case IMAGE_REL_BASED_HIGHLOW:
|
||||
LongPtr = (PULONG)(Address + Offset);
|
||||
LongPtr = (PULONG)((ULONG_PTR)Address + Offset);
|
||||
*LongPtr += Delta;
|
||||
break;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ RtlRosInitializeContext
|
|||
if(!NT_SUCCESS(nErrCode)) return nErrCode;
|
||||
|
||||
/* too many parameters */
|
||||
if((nParamsSize + sizeof(ULONG_PTR)) > (SIZE_T)(pStackBase - pStackLimit))
|
||||
if((nParamsSize + sizeof(ULONG_PTR)) > (SIZE_T)((ULONG_PTR)pStackBase - (ULONG_PTR)pStackLimit))
|
||||
return STATUS_STACK_OVERFLOW;
|
||||
|
||||
memset(Context, 0, sizeof(CONTEXT));
|
||||
|
|
|
@ -72,7 +72,7 @@ RtlImageDirectoryEntryToData (
|
|||
*Size = NtHeader->OptionalHeader.DataDirectory[Directory].Size;
|
||||
|
||||
if (bFlag)
|
||||
return (PVOID)(BaseAddress + Va);
|
||||
return (PVOID)((ULONG_PTR)BaseAddress + Va);
|
||||
|
||||
/* image mapped as ordinary file, we must find raw pointer */
|
||||
return (PVOID)RtlImageRvaToVa (NtHeader, BaseAddress, Va, NULL);
|
||||
|
@ -138,10 +138,10 @@ RtlImageRvaToVa (
|
|||
*SectionHeader = Section;
|
||||
}
|
||||
|
||||
return (ULONG)(BaseAddress +
|
||||
return (ULONG)((ULONG_PTR)BaseAddress +
|
||||
Rva +
|
||||
Section->PointerToRawData -
|
||||
Section->VirtualAddress);
|
||||
(ULONG_PTR)Section->VirtualAddress);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -161,7 +161,7 @@ static NTSTATUS KlInitPeb (HANDLE ProcessHandle,
|
|||
/* write pointer to environment */
|
||||
Offset = FIELD_OFFSET(RTL_USER_PROCESS_PARAMETERS, Environment);
|
||||
ZwWriteVirtualMemory(ProcessHandle,
|
||||
(PVOID)(PpbBase + Offset),
|
||||
(PVOID)((ULONG_PTR)PpbBase + Offset),
|
||||
&EnvPtr,
|
||||
sizeof(EnvPtr),
|
||||
&BytesWritten);
|
||||
|
@ -291,7 +291,7 @@ RtlCreateUserProcess(
|
|||
0,
|
||||
&Sii.StackReserve,
|
||||
&Sii.StackCommit,
|
||||
ImageBaseAddress + (ULONG)Sii.EntryPoint,
|
||||
(PVOID)((ULONG_PTR)ImageBaseAddress + (ULONG_PTR)Sii.EntryPoint),
|
||||
(PVOID)PEB_BASE,
|
||||
&ProcessInfo->ThreadHandle,
|
||||
&ProcessInfo->ClientId
|
||||
|
|
|
@ -787,7 +787,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
|
|||
!(QueryEntry->Flags & RTL_QUERY_REGISTRY_NOEXPAND))
|
||||
{
|
||||
DPRINT("Expand REG_MULTI_SZ type\n");
|
||||
StringPtr = (PWSTR)((PVOID)FullValueInfo + FullValueInfo->DataOffset);
|
||||
StringPtr = (PWSTR)((ULONG_PTR)FullValueInfo + FullValueInfo->DataOffset);
|
||||
while (*StringPtr != 0)
|
||||
{
|
||||
StringLen = (wcslen(StringPtr) + 1) * sizeof(WCHAR);
|
||||
|
@ -807,7 +807,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
|
|||
{
|
||||
DPRINT("Expand REG_EXPAND_SZ type\n");
|
||||
|
||||
StringPtr = (PWSTR)((PVOID)FullValueInfo + FullValueInfo->DataOffset);
|
||||
StringPtr = (PWSTR)((ULONG_PTR)FullValueInfo + FullValueInfo->DataOffset);
|
||||
ExpandBuffer = ExAllocatePool(PagedPool, FullValueInfo->DataLength * 2);
|
||||
if (ExpandBuffer == NULL)
|
||||
{
|
||||
|
@ -841,7 +841,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
|
|||
{
|
||||
Status = QueryEntry->QueryRoutine(ValueName,
|
||||
FullValueInfo->Type,
|
||||
(PVOID)FullValueInfo + FullValueInfo->DataOffset,
|
||||
(PVOID)((ULONG_PTR)FullValueInfo + FullValueInfo->DataOffset),
|
||||
FullValueInfo->DataLength,
|
||||
Context,
|
||||
QueryEntry->EntryContext);
|
||||
|
|
|
@ -534,7 +534,7 @@ LoadBitmapImage(HINSTANCE hInstance, LPCWSTR lpszName, UINT fuLoad)
|
|||
}
|
||||
HeaderSize = sizeof(BITMAPINFOHEADER) + ColorCount * sizeof(RGBQUAD);
|
||||
}
|
||||
Data = (PVOID)BitmapInfo + HeaderSize;
|
||||
Data = (PVOID)((ULONG_PTR)BitmapInfo + HeaderSize);
|
||||
|
||||
PrivateInfo = RtlAllocateHeap(GetProcessHeap(), 0, HeaderSize);
|
||||
if (PrivateInfo == NULL)
|
||||
|
|
Loading…
Reference in a new issue