* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+ ((type *)((char *)(ptr)-(uintptr_t)(&((type *)0)->member)))
/**
* list_for_each - iterate over a list
AcpiOsGetThreadId (void)
{
/* Thread ID must be non-zero */
- return (ULONG)PsGetCurrentThreadId() + 1;
+ return (ULONG_PTR)PsGetCurrentThreadId() + 1;
}
ACPI_STATUS
UNREFERENCED_PARAMETER(Interface);
/* Make sure it's the expected interface */
- if ((ULONG)InterfaceData != CmResourceTypeBusNumber)
+ if ((ULONG_PTR)InterfaceData != CmResourceTypeBusNumber)
{
/* Arbiter support must have been initialized first */
if (FdoExtension->ArbitersInitialized)
UNREFERENCED_PARAMETER(Interface);
/* Make sure it's the expected interface */
- if ((ULONG)InterfaceData != CmResourceTypePort)
+ if ((ULONG_PTR)InterfaceData != CmResourceTypePort)
{
/* Arbiter support must have been initialized first */
if (FdoExtension->ArbitersInitialized)
UNREFERENCED_PARAMETER(Interface);
/* Make sure it's the expected interface */
- if ((ULONG)InterfaceData != CmResourceTypeMemory)
+ if ((ULONG_PTR)InterfaceData != CmResourceTypeMemory)
{
/* Arbiter support must have been initialized first */
if (FdoExtension->ArbitersInitialized)
UNREFERENCED_PARAMETER(Size);
/* Make sure it's the right resource type */
- if ((ULONG)InterfaceData != CmResourceTypeInterrupt)
+ if ((ULONG_PTR)InterfaceData != CmResourceTypeInterrupt)
{
/* Fail this invalid request */
DPRINT1("PCI - IRQ trans constructor doesn't like %p in InterfaceSpecificData\n",
/* Get the bus, and use this as the interface-specific data */
BaseBus = FdoExtension->BaseBus;
- InterfaceData = (PVOID)BaseBus;
+ InterfaceData = UlongToPtr(BaseBus);
/* Check if this is the root bus */
if (PCI_IS_ROOT_FDO(FdoExtension))
return TRUE;
}
- return ((ULONG)KeyQueryOutput.KeyInfo.Data != 1);
+ return ((ULONG_PTR)KeyQueryOutput.KeyInfo.Data != 1);
}
VOID
/* Store the old count and increment */
Result = &Object->PointerCount;
- InterlockedIncrement((PLONG)&Object->PointerCount);
+ InterlockedIncrementSizeT(&Object->PointerCount);
/* Return the initial value */
return *Result;
VOID
FltpObjectPointerDereference(_In_ PFLT_OBJECT Object)
{
- if (!InterlockedDecrement((PLONG)Object->PointerCount))
+ if (InterlockedDecrementSizeT(&Object->PointerCount) == 0)
{
// Cleanup
FLT_ASSERT(FALSE);
PIO_STACK_LOCATION NextIrpSp;
PAFD_SEND_INFO SendReq = NULL;
PAFD_MAPBUF Map;
- UINT TotalBytesCopied = 0, TotalBytesProcessed = 0, SpaceAvail, i;
+ SIZE_T TotalBytesCopied = 0, TotalBytesProcessed = 0, SpaceAvail, i;
UINT SendLength, BytesCopied;
BOOLEAN HaltSendQueue;
/* We are doing this internally, so we'll signal this event we've stashed in the MacBlock */
ASSERT(MacBlock->Unknown1 != NULL);
ASSERT(MacBlock->Unknown3 == NULL);
- MacBlock->Unknown3 = (PVOID)Status;
+ MacBlock->Unknown3 = UlongToPtr(Status);
KeSetEvent(MacBlock->Unknown1, IO_NO_INCREMENT, FALSE);
}
if (NdisStatus == NDIS_STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
- NdisStatus = (NDIS_STATUS)MacBlock->Unknown3;
+ NdisStatus = PtrToUlong(MacBlock->Unknown3);
}
*BytesRead = NdisRequest->DATA.SET_INFORMATION.BytesRead;
if (NdisStatus == NDIS_STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
- NdisStatus = (NDIS_STATUS)MacBlock->Unknown3;
+ NdisStatus = PtrToUlong(MacBlock->Unknown3);
}
*BytesWritten = NdisRequest->DATA.QUERY_INFORMATION.BytesWritten;
#define CP CHECKPOINT
#define ASSERT_KM_POINTER(_x) \
- ASSERT(((PVOID)_x) != (PVOID)0xcccccccc); \
- ASSERT(((PVOID)_x) >= (PVOID)0x80000000);
+ ASSERT(((ULONG_PTR)(_x)) != (ULONG_PTR)0xccccccccccccccccULL); \
+ ASSERT(((PVOID)(_x)) >= MmSystemRangeStart);
/* EOF */
do
{
KeStallExecutionProcessor(10);
- PortStatus = READ_PORT_UCHAR((PUCHAR)(FdoDeviceExtension->BaseAddress + 1));
+ PortStatus = READ_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress + 1));
ulCount++;
}
while (ulCount < 500000 && !(PortStatus & LP_PBUSY));
}
/* Write character */
- WRITE_PORT_UCHAR((PUCHAR)FdoDeviceExtension->BaseAddress, Buffer[i]);
+ WRITE_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress), Buffer[i]);
KeStallExecutionProcessor(10);
- WRITE_PORT_UCHAR((PUCHAR)(FdoDeviceExtension->BaseAddress + 2), (LP_PSELECP | LP_PINITP | LP_PSTROBE));
+ WRITE_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress + 2), (LP_PSELECP | LP_PINITP | LP_PSTROBE));
KeStallExecutionProcessor(10);
- WRITE_PORT_UCHAR((PUCHAR)(FdoDeviceExtension->BaseAddress + 2), (LP_PSELECP | LP_PINITP));
+ WRITE_PORT_UCHAR(UlongToPtr(FdoDeviceExtension->BaseAddress + 2), (LP_PSELECP | LP_PINITP));
}
Irp->IoStatus.Information = 0;
{
/* Free slot found, attempt to use it */
ASSERT(!CHANNEL_SLOT_IS_IN_USE(i));
- _InterlockedCompareExchange((PLONG)&ChannelArray[i], (LONG)NewChannel, 0);
+ InterlockedCompareExchangePointer((PVOID*)&ChannelArray[i], NewChannel, NULL);
if (ChannelArray[i] == NewChannel) break;
}
}
IN PVOID SystemArgument2)
{
HEADLESS_RSP_GET_BYTE ByteValue;
- ULONG ValueSize;
+ SIZE_T ValueSize;
BOOLEAN GotChar;
NTSTATUS Status;
PSAC_DEVICE_EXTENSION SacExtension;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING DestinationString;
HANDLE Handle;
- SIZE_T ResultLength = 0;
+ ULONG ResultLength = 0;
SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC GetRegistryValueBuffer: Entering.\n");
CHECK_PARAMETER1(KeyName);
CHECK_PARAMETER2(ValueName);
IN PWCHAR ExtraData)
{
NTSTATUS Status;
- ULONG Size;
+ SIZE_T Size;
PWCHAR p;
CHECK_PARAMETER1(Buffer);
ULONG SuiteTypeMessage;
BOOLEAN SetupInProgress = FALSE;
GUID SystemGuid;
- ULONG RealSize, Size, OutputSize;
+ SIZE_T RealSize, Size, OutputSize;
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo;
RTL_OSVERSIONINFOEXW VersionInformation;
SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC Initialize Machine Information : Entering.\n");
{
PWCHAR XmlBuffer;
PHEADLESS_CMD_SET_BLUE_SCREEN_DATA BsBuffer;
- ULONG Length, HeaderLength, TotalLength;
+ SIZE_T Length, HeaderLength, TotalLength;
NTSTATUS Status;
ULONG i;
PartialDescriptor->u.Port.Start.u.LowPart,
PartialDescriptor->u.Port.Length);
if (PartialDescriptor->u.Port.Length >= 6)
- DeviceExtension->ControllerInfo.BaseAddress = (PUCHAR)PartialDescriptor->u.Port.Start.u.LowPart;
+ DeviceExtension->ControllerInfo.BaseAddress = (PUCHAR)(ULONG_PTR)PartialDescriptor->u.Port.Start.QuadPart;
break;
case CmResourceTypeInterrupt:
if (PartialDescriptor->Type == CmResourceTypePort)
{
- if ((PUCHAR)PartialDescriptor->u.Port.Start.LowPart == DeviceExtension->ControllerInfo.BaseAddress)
+ if ((PUCHAR)(ULONG_PTR)PartialDescriptor->u.Port.Start.QuadPart == DeviceExtension->ControllerInfo.BaseAddress)
ControllerFound = TRUE;
}
}
{
PULONG Register;
Register = (PULONG)UsbCmd;
- WRITE_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBCMD), *Register);
+ WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + EHCI_USBCMD), *Register);
}
VOID
{
PULONG Register;
Register = (PULONG)UsbCmd;
- *Register = READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBCMD));
+ *Register = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + EHCI_USBCMD));
}
ULONG
CUSBHardwareDevice::EHCI_READ_REGISTER_ULONG(ULONG Offset)
{
- return READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + Offset));
+ return READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + Offset));
}
VOID
CUSBHardwareDevice::EHCI_WRITE_REGISTER_ULONG(ULONG Offset, ULONG Value)
{
- WRITE_REGISTER_ULONG((PULONG)((ULONG)m_Base + Offset), Value);
+ WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + Offset), Value);
}
VOID
//
// each entry is a 4 bit field EHCI 2.2.5
//
- Value = READ_REGISTER_UCHAR((PUCHAR)(ULONG)ResourceBase + EHCI_HCSP_PORTROUTE + Count);
+ Value = READ_REGISTER_UCHAR((PUCHAR)(ULONG_PTR)ResourceBase + EHCI_HCSP_PORTROUTE + Count);
m_Capabilities.PortRoute[Count*2] = (Value & 0xF0);
if ((Count*2) + 1 < m_Capabilities.HCSParams.PortCount)
//
// Set m_Base to the address of Operational Register Space
//
- m_Base = (PULONG)((ULONG)ResourceBase + m_Capabilities.Length);
+ m_Base = (PULONG)((ULONG_PTR)ResourceBase + m_Capabilities.Length);
break;
}
}
return TRUE;
}
- KeInsertQueueDpc(&This->m_IntDpcObject, This, (PVOID)CStatus);
+ KeInsertQueueDpc(&This->m_IntDpcObject, This, UlongToPtr(CStatus));
return TRUE;
}
EHCI_USBCMD_CONTENT UsbCmd;
This = (CUSBHardwareDevice*) SystemArgument1;
- CStatus = (ULONG) SystemArgument2;
+ CStatus = PtrToUlong(SystemArgument2);
DPRINT("EhciDeferredRoutine CStatus %lx\n", CStatus);
// defer processing
//
DPRINT("Status %x Acknowledge %x FrameNumber %x\n", Status, Acknowledge, This->m_HCCA->CurrentFrameNumber);
- KeInsertQueueDpc(&This->m_IntDpcObject, (PVOID)Status, (PVOID)(DoneHead & ~1));
+ KeInsertQueueDpc(&This->m_IntDpcObject, UlongToPtr(Status), UlongToPtr(DoneHead & ~1));
//
// interrupt handled
// get parameters
//
This = (CUSBHardwareDevice*)DeferredContext;
- CStatus = (ULONG) SystemArgument1;
- DoneHead = (ULONG)SystemArgument2;
+ CStatus = PtrToUlong(SystemArgument1);
+ DoneHead = PtrToUlong(SystemArgument2);
DPRINT("OhciDeferredRoutine Status %x DoneHead %x\n", CStatus, DoneHead);
return FALSE;
}
- if (Context->csw->Tag != (ULONG)Context->csw)
+ if (Context->csw->Tag != (ULONG_PTR)Context->csw)
{
- DPRINT1("[USBSTOR] Expected Tag %x but got %x\n", (ULONG)Context->csw, Context->csw->Tag);
+ DPRINT1("[USBSTOR] Expected Tag %Ix but got %x\n", (ULONG_PTR)Context->csw, Context->csw->Tag);
return FALSE;
}
//
// now build the cbw
//
- USBSTOR_BuildCBW((ULONG)Context->cbw,
+ USBSTOR_BuildCBW(PtrToUlong(Context->cbw),
TransferDataLength,
PDODeviceExtension->LUN,
CommandLength,
//
// Store Resource base
//
- m_Base = (PULONG)ResourceDescriptor->u.Port.Start.LowPart; //FIXME
+ m_Base = (PULONG)(ULONG_PTR)ResourceDescriptor->u.Port.Start.QuadPart; //FIXME
DPRINT("UHCI Base %p Length %x\n", m_Base, ResourceDescriptor->u.Port.Length);
break;
}
// back up start of modify register
//
ASSERT(m_Base);
- UCHAR sofValue = READ_PORT_UCHAR((PUCHAR)((ULONG)m_Base + UHCI_SOFMOD));
+ UCHAR sofValue = READ_PORT_UCHAR((PUCHAR)m_Base + UHCI_SOFMOD);
//
// perform global reset
//
// restore start of modify register
//
- WRITE_PORT_UCHAR((PUCHAR)((ULONG)m_Base + UHCI_SOFMOD), sofValue);
+ WRITE_PORT_UCHAR((PUCHAR)m_Base + UHCI_SOFMOD, sofValue);
}
NTSTATUS
IN ULONG Register,
IN UCHAR Value)
{
- WRITE_PORT_UCHAR((PUCHAR)((ULONG)m_Base + Register), Value);
+ WRITE_PORT_UCHAR((PUCHAR)((PUCHAR)m_Base + Register), Value);
}
ULONG Register,
USHORT Value)
{
- WRITE_PORT_USHORT((PUSHORT)((ULONG)m_Base + Register), Value);
+ WRITE_PORT_USHORT((PUSHORT)((PUCHAR)m_Base + Register), Value);
}
ULONG Register,
ULONG Value)
{
- WRITE_PORT_ULONG((PULONG)((ULONG)m_Base + Register), Value);
+ WRITE_PORT_ULONG((PULONG)((PUCHAR)m_Base + Register), Value);
}
CUSBHardwareDevice::ReadRegister8(
ULONG Register)
{
- return READ_PORT_UCHAR((PUCHAR)((ULONG)m_Base + Register));
+ return READ_PORT_UCHAR((PUCHAR)((PUCHAR)m_Base + Register));
}
CUSBHardwareDevice::ReadRegister16(
ULONG Register)
{
- return READ_PORT_USHORT((PUSHORT)((ULONG)m_Base + Register));
+ return READ_PORT_USHORT((PUSHORT)((PUCHAR)m_Base + Register));
}
CUSBHardwareDevice::ReadRegister32(
ULONG Register)
{
- return READ_PORT_ULONG((PULONG)((ULONG)m_Base + Register));
+ return READ_PORT_ULONG((PULONG)((PUCHAR)m_Base + Register));
}
VOID
PPNP_BUS_INFORMATION BusInformation;
PDEVICE_RELATIONS DeviceRelations;
NTSTATUS Status;
- ULONG Index = 0, Length;
+ ULONG Index = 0;
+ SIZE_T Length;
USHORT VendorID, DeviceID;
ULONG HiSpeed, NumPorts;
WCHAR Buffer[300];
*ActiveProcessors = ActiveMap;
}
- RtlInitializeBitMap(&Bitmap, &ActiveMap, sizeof(ActiveMap) * 8);
+ RtlInitializeBitMap(&Bitmap, (PULONG)&ActiveMap, sizeof(ActiveMap) * 8);
return RtlNumberOfSetBits(&Bitmap);
}
/* Is ShadowCrit still owned? Shouldn't happen! */
if (RxContext->ShadowCritOwner != 0)
{
- DPRINT1("ShadowCritOwner not null! %p\n", (PVOID)RxContext->ShadowCritOwner);
+ DPRINT1("ShadowCritOwner not null! %lx\n", RxContext->ShadowCritOwner);
ASSERT(FALSE);
}
#endif
DeviceId,
(LPWAVEOPENDESC) Parameter1, /* unused */
Parameter2,
- (DWORD*) PrivateHandle);
+ (DWORD_PTR*) PrivateHandle);
VALIDATE_MMSYS_PARAMETER(*(DWORD_PTR*)PrivateHandle);
break;
}
IN PWSTR BaseDeviceName,
IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc)
{
- ULONG DeviceNameLength = 0;
+ SIZE_T DeviceNameLength = 0;
PWSTR DeviceName = NULL;
ULONG Index = 0;
HANDLE DeviceHandle;
IN LPWSTR ServiceName,
OUT PHKEY KeyHandle)
{
- ULONG KeyLength;
+ SIZE_T KeyLength;
PWCHAR ParametersKeyName;
VALIDATE_MMSYS_PARAMETER( ServiceName );
IN DWORD DeviceIndex,
OUT PHKEY KeyHandle)
{
- DWORD PathLength;
+ SIZE_T PathLength;
PWCHAR RegPath;
VALIDATE_MMSYS_PARAMETER( ServiceName );
PMIXER_LIST MixerList;
LPMIXER_DATA MixerData;
LPMIDI_INFO MidiInfo;
- ULONG Length;
+ SIZE_T Length;
MIXER_STATUS Status;
/* verify mixer context */
PMIXER_LIST MixerList;
LPMIXER_DATA MixerData;
LPWAVE_INFO WaveInfo;
- ULONG Length;
+ SIZE_T Length;
MIXER_STATUS Status;
/* verify mixer context */