From e7e6699ae1fc3075cb20cab3918d4b050e96d978 Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Sun, 27 Sep 2009 20:07:43 +0000 Subject: [PATCH] - Use MAXUINT, MAXULONG, MAXDWORD, MAXULONGLONG and MAXULONGLONG instead of ~0 or casting -1 to unsigned. - bintype.c: Use INVALID_SET_FILE_POINTER instead of (DWORD)-1. - irp.c: KsGetNodeIdFromIrp returns KSFILTER_NODE (which is -1). - basetsd.h: Add missing MAXUINT and MAXULONGLONG. - typedefs.h: Add MAXULONG for mkhive. - elf.inc.h and pe.c: Remove incorrect and unneeded MAXULONG define. svn path=/trunk/; revision=43192 --- .../boot/freeldr/freeldr/arch/powerpc/mboot.c | 2 +- reactos/boot/freeldr/freeldr/debug.c | 2 +- reactos/boot/freeldr/freeldr/fs/ntfs.c | 2 +- .../boot/freeldr/freeldr/reactos/imageldr.c | 2 +- reactos/dll/cpl/console/colors.c | 12 +++++----- reactos/dll/cpl/console/layout.c | 2 +- reactos/dll/cpl/main/mouse.c | 2 +- reactos/dll/win32/kernel32/debug/debugger.c | 2 +- reactos/dll/win32/kernel32/file/bintype.c | 8 +++---- reactos/dll/win32/kernel32/file/file.c | 2 +- reactos/dll/win32/kernel32/misc/error.c | 2 +- reactos/dll/win32/opengl32/opengl32.c | 8 +++---- reactos/drivers/bus/pci/pdo.c | 4 ++-- reactos/drivers/filesystems/msfs/finfo.c | 4 ++-- reactos/drivers/ksfilter/ks/allocators.c | 2 +- reactos/drivers/ksfilter/ks/irp.c | 2 +- reactos/drivers/ksfilter/ks/topology.c | 2 +- reactos/drivers/serial/serial/serial.h | 2 +- .../wdm/audio/drivers/CMIDriver/mintopo.cpp | 2 +- .../wdm/audio/filters/splitter/splitter.c | 4 ++-- reactos/drivers/wdm/audio/legacy/stream/pnp.c | 2 +- .../drivers/wdm/audio/legacy/wdmaud/control.c | 4 ++-- .../drivers/wdm/audio/legacy/wdmaud/mixer.c | 2 +- reactos/hal/halppc/generic/dma.c | 24 +++++++++---------- reactos/hal/halx86/generic/dma.c | 22 ++++++++--------- reactos/include/host/typedefs.h | 2 ++ reactos/include/psdk/basetsd.h | 4 ++++ reactos/lib/cmlib/hivedata.h | 2 +- reactos/lib/rtl/bitmap.c | 24 +++++++++---------- reactos/lib/rtl/debug.c | 4 ++-- reactos/lib/rtl/heap.c | 6 ++--- reactos/lib/rtl/rangelist.c | 4 ++-- reactos/lib/rtl/registry.c | 2 +- reactos/lib/rtl/unicode.c | 2 +- reactos/ntoskrnl/ex/init.c | 4 ++-- reactos/ntoskrnl/fstub/disksup.c | 4 ++-- reactos/ntoskrnl/io/iomgr/drvrlist.c | 2 +- reactos/ntoskrnl/kdbg/kdb.c | 4 ++-- reactos/ntoskrnl/kdbg/kdb_cli.c | 4 ++-- reactos/ntoskrnl/ke/i386/irqobj.c | 4 ++-- reactos/ntoskrnl/mm/elf.inc.h | 8 ++----- reactos/ntoskrnl/mm/i386/pagepae.c | 4 ++-- reactos/ntoskrnl/mm/pe.c | 6 +---- reactos/ntoskrnl/po/power.c | 2 +- reactos/ntoskrnl/ps/psmgr.c | 2 +- reactos/ntoskrnl/ps/query.c | 4 ++-- 46 files changed, 109 insertions(+), 111 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c b/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c index feef98a59d3..a7c2f39e8ec 100644 --- a/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c +++ b/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c @@ -815,7 +815,7 @@ FrLdrCloseModule(ULONG_PTR ModuleBase, if (ModuleData) { /* Make sure this is the right module and that it hasn't been closed */ - if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == (ULONG_PTR)-1)) { + if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == MAXULONG_PTR)) { /* Close the Module */ ModuleData->ModEnd = ModuleData->ModStart + ModuleSize; diff --git a/reactos/boot/freeldr/freeldr/debug.c b/reactos/boot/freeldr/freeldr/debug.c index e0088d116d9..f0bb431785f 100644 --- a/reactos/boot/freeldr/freeldr/debug.c +++ b/reactos/boot/freeldr/freeldr/debug.c @@ -311,7 +311,7 @@ MsgBoxPrint(const char *Format, ...) Length = _vsnprintf(Buffer, 512, Format, ap); /* Check if we went past the buffer */ - if (Length == (ULONG)-1) + if (Length == MAXULONG) { /* Terminate it if we went over-board */ Buffer[sizeof(Buffer) - 1] = '\n'; diff --git a/reactos/boot/freeldr/freeldr/fs/ntfs.c b/reactos/boot/freeldr/freeldr/fs/ntfs.c index b9617942f5e..8373e42b1b3 100644 --- a/reactos/boot/freeldr/freeldr/fs/ntfs.c +++ b/reactos/boot/freeldr/freeldr/fs/ntfs.c @@ -292,7 +292,7 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT { CurrentOffset += DataRunLength * Volume->ClusterSize; DataRun = NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength); - if (DataRunLength != (ULONGLONG)-1) + if (DataRunLength != MAXULONGLONG) { DataRunStartLCN = LastLCN + DataRunOffset; LastLCN = DataRunStartLCN; diff --git a/reactos/boot/freeldr/freeldr/reactos/imageldr.c b/reactos/boot/freeldr/freeldr/reactos/imageldr.c index 1a3af5eeb6b..1e50115c83f 100644 --- a/reactos/boot/freeldr/freeldr/reactos/imageldr.c +++ b/reactos/boot/freeldr/freeldr/reactos/imageldr.c @@ -177,7 +177,7 @@ FrLdrCloseModule(ULONG_PTR ModuleBase, if (ModuleData) { /* Make sure this is the right module and that it hasn't been closed */ - if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == (ULONG_PTR)-1)) { + if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == MAXULONG_PTR)) { /* Close the Module */ ModuleData->ModEnd = ModuleData->ModStart + ModuleSize; diff --git a/reactos/dll/cpl/console/colors.c b/reactos/dll/cpl/console/colors.c index 81587a012a8..f7dde527868 100644 --- a/reactos/dll/cpl/console/colors.c +++ b/reactos/dll/cpl/console/colors.c @@ -44,9 +44,9 @@ ColorsProc( LPNMUPDOWN lpnmud; LPPSHNOTIFY lppsn; LPDRAWITEMSTRUCT drawItem; - DWORD red = -1; - DWORD green = -1; - DWORD blue = -1; + DWORD red = MAXDWORD; + DWORD green = MAXDWORD; + DWORD blue = MAXDWORD; pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER); @@ -116,7 +116,7 @@ ColorsProc( break; } - if (red == (DWORD)-1) + if (red == MAXDWORD) { red = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0); if (HIWORD(red)) @@ -127,7 +127,7 @@ ColorsProc( red = LOBYTE(red); } - if (green == (DWORD)-1) + if (green == MAXDWORD) { green = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_GETPOS, 0, 0); if (HIWORD(green)) @@ -138,7 +138,7 @@ ColorsProc( green = LOBYTE(green); } - if (blue == (DWORD)-1) + if (blue == MAXDWORD) { blue = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_GETPOS, 0, 0); if (HIWORD(blue)) diff --git a/reactos/dll/cpl/console/layout.c b/reactos/dll/cpl/console/layout.c index 3d6df8b4c90..592ba610168 100644 --- a/reactos/dll/cpl/console/layout.c +++ b/reactos/dll/cpl/console/layout.c @@ -160,7 +160,7 @@ LayoutProc( SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(xres, 0)); SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), UDM_SETRANGE, 0, (LPARAM)MAKELONG(yres, 0)); - if (pConInfo->WindowPosition != (DWORD)-1) + if (pConInfo->WindowPosition != MAXDWORD) { SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, LOWORD(pConInfo->WindowPosition), FALSE); SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, HIWORD(pConInfo->WindowPosition), FALSE); diff --git a/reactos/dll/cpl/main/mouse.c b/reactos/dll/cpl/main/mouse.c index 684cceebc6b..0c4f76d4cd5 100644 --- a/reactos/dll/cpl/main/mouse.c +++ b/reactos/dll/cpl/main/mouse.c @@ -968,7 +968,7 @@ OnDrawItem(UINT idCtl, GetSysColor(COLOR_WINDOWTEXT)); } - if (lpdis->itemID != (UINT)-1) + if (lpdis->itemID != MAXUINT) { CopyRect(&rc, &lpdis->rcItem); rc.left += 5; diff --git a/reactos/dll/win32/kernel32/debug/debugger.c b/reactos/dll/win32/kernel32/debug/debugger.c index 07e7ce7ab35..83c8a8dfc8a 100644 --- a/reactos/dll/win32/kernel32/debug/debugger.c +++ b/reactos/dll/win32/kernel32/debug/debugger.c @@ -232,7 +232,7 @@ ProcessIdToHandle(IN DWORD dwProcessId) CLIENT_ID ClientId; /* If we don't have a PID, look it up */ - if (dwProcessId == (DWORD)-1) dwProcessId = (DWORD)CsrGetProcessId(); + if (dwProcessId == MAXDWORD) dwProcessId = (DWORD)CsrGetProcessId(); /* Open a handle to the process */ ClientId.UniqueThread = NULL; diff --git a/reactos/dll/win32/kernel32/file/bintype.c b/reactos/dll/win32/kernel32/file/bintype.c index ac992e2aed9..98d8f676da9 100644 --- a/reactos/dll/win32/kernel32/file/bintype.c +++ b/reactos/dll/win32/kernel32/file/bintype.c @@ -38,7 +38,7 @@ InternalIsOS2OrOldWin(HANDLE hFile, IMAGE_DOS_HEADER *mz, IMAGE_OS2_HEADER *ne) CurPos = SetFilePointer(hFile, 0, NULL, FILE_CURRENT); /* read modref table */ - if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_modtab, NULL, FILE_BEGIN) == (DWORD)-1) || + if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_modtab, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) || (!(modtab = HeapAlloc(GetProcessHeap(), 0, ne->ne_cmod * sizeof(WORD)))) || (!(ReadFile(hFile, modtab, ne->ne_cmod * sizeof(WORD), &Read, NULL))) || (Read != (DWORD)ne->ne_cmod * sizeof(WORD))) @@ -47,7 +47,7 @@ InternalIsOS2OrOldWin(HANDLE hFile, IMAGE_DOS_HEADER *mz, IMAGE_OS2_HEADER *ne) } /* read imported names table */ - if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_imptab, NULL, FILE_BEGIN) == (DWORD)-1) || + if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_imptab, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) || (!(nametab = HeapAlloc(GetProcessHeap(), 0, ne->ne_enttab - ne->ne_imptab))) || (!(ReadFile(hFile, nametab, ne->ne_enttab - ne->ne_imptab, &Read, NULL))) || (Read != (DWORD)ne->ne_enttab - ne->ne_imptab)) @@ -100,7 +100,7 @@ InternalGetBinaryType(HANDLE hFile) char magic[4]; DWORD Read; - if((SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == (DWORD)-1) || + if((SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) || (!ReadFile(hFile, &Header, sizeof(Header), &Read, NULL) || (Read != sizeof(Header)))) { @@ -143,7 +143,7 @@ InternalGetBinaryType(HANDLE hFile) * This will tell us if there is more header information * to read or not. */ - if((SetFilePointer(hFile, Header.mz.e_lfanew, NULL, FILE_BEGIN) == (DWORD)-1) || + if((SetFilePointer(hFile, Header.mz.e_lfanew, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) || (!ReadFile(hFile, magic, sizeof(magic), &Read, NULL) || (Read != sizeof(magic)))) { diff --git a/reactos/dll/win32/kernel32/file/file.c b/reactos/dll/win32/kernel32/file/file.c index b19b2ac4cbc..86ef5ad7730 100644 --- a/reactos/dll/win32/kernel32/file/file.c +++ b/reactos/dll/win32/kernel32/file/file.c @@ -534,7 +534,7 @@ SetFilePointer(HANDLE hFile, *lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart; } - if (FilePosition.CurrentByteOffset.u.LowPart == (DWORD)-1) + if (FilePosition.CurrentByteOffset.u.LowPart == MAXDWORD) { /* The value of -1 is valid here, especially when the new file position is greater than 4 GB. Since NtSetInformationFile diff --git a/reactos/dll/win32/kernel32/misc/error.c b/reactos/dll/win32/kernel32/misc/error.c index ce8eca6b592..91499530312 100644 --- a/reactos/dll/win32/kernel32/misc/error.c +++ b/reactos/dll/win32/kernel32/misc/error.c @@ -75,7 +75,7 @@ Beep (DWORD dwFreq, DWORD dwDuration) /* do an alertable wait if necessary */ if (NT_SUCCESS(Status) && - (dwFreq != 0x0 || dwDuration != 0x0) && dwDuration != (DWORD)-1) + (dwFreq != 0x0 || dwDuration != 0x0) && dwDuration != MAXDWORD) { SleepEx(dwDuration, TRUE); diff --git a/reactos/dll/win32/opengl32/opengl32.c b/reactos/dll/win32/opengl32/opengl32.c index 49f4cc501cf..2dd3312a9ff 100644 --- a/reactos/dll/win32/opengl32/opengl32.c +++ b/reactos/dll/win32/opengl32/opengl32.c @@ -20,8 +20,8 @@ static DWORD OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd ); /* global vars */ -/* Do not assume it have the free value -1 set, any value can be in here */ -DWORD OPENGL32_tls = -1; +/* Do not assume it have the free value MAXDWORD set, any value can be in here */ +DWORD OPENGL32_tls = MAXDWORD; GLPROCESSDATA OPENGL32_processdata; @@ -103,7 +103,7 @@ OPENGL32_ProcessAttach( void ) TRUE /* bInheritHandle */ }; OPENGL32_tls = TlsAlloc(); - if ((DWORD)-1 == OPENGL32_tls) + if (OPENGL32_tls == MAXDWORD) return FALSE; memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) ); @@ -179,7 +179,7 @@ OPENGL32_ProcessDetach( void ) CloseHandle( OPENGL32_processdata.dcdata_mutex ); /* free TLS */ - if (OPENGL32_tls != (DWORD)-1) + if (OPENGL32_tls != MAXDWORD) TlsFree(OPENGL32_tls); } diff --git a/reactos/drivers/bus/pci/pdo.c b/reactos/drivers/bus/pci/pdo.c index fb571c32a15..f19e45c1f4c 100644 --- a/reactos/drivers/bus/pci/pdo.c +++ b/reactos/drivers/bus/pci/pdo.c @@ -176,7 +176,7 @@ PdoQueryCapabilities( DeviceCapabilities->UniqueID = FALSE; DeviceCapabilities->Address = ((DeviceNumber << 16) & 0xFFFF0000) + (FunctionNumber & 0xFFFF); - DeviceCapabilities->UINumber = (ULONG)-1; /* FIXME */ + DeviceCapabilities->UINumber = MAXULONG; /* FIXME */ return STATUS_SUCCESS; } @@ -213,7 +213,7 @@ PdoGetRangeLength(PPDO_DEVICE_EXTENSION DeviceExtension, *Base = BaseValue; /* Set magic value */ - NewValue = (ULONG)-1; + NewValue = MAXULONG; Size= HalSetBusDataByOffset(PCIConfiguration, DeviceExtension->PciDevice->BusNumber, DeviceExtension->PciDevice->SlotNumber.u.AsULONG, diff --git a/reactos/drivers/filesystems/msfs/finfo.c b/reactos/drivers/filesystems/msfs/finfo.c index 751afdcc643..2084395b21c 100644 --- a/reactos/drivers/filesystems/msfs/finfo.c +++ b/reactos/drivers/filesystems/msfs/finfo.c @@ -16,8 +16,8 @@ #undef MAILSLOT_NO_MESSAGE #undef MAILSLOT_WAIT_FOREVER -#define MAILSLOT_NO_MESSAGE ((ULONG)-1) -#define MAILSLOT_WAIT_FOREVER ((ULONG)-1) +#define MAILSLOT_NO_MESSAGE MAXULONG +#define MAILSLOT_WAIT_FOREVER MAXULONG /* FUNCTIONS *****************************************************************/ diff --git a/reactos/drivers/ksfilter/ks/allocators.c b/reactos/drivers/ksfilter/ks/allocators.c index d8c4ef3009a..3040a041837 100644 --- a/reactos/drivers/ksfilter/ks/allocators.c +++ b/reactos/drivers/ksfilter/ks/allocators.c @@ -668,7 +668,7 @@ KsValidateAllocatorFramingEx( /* verify framing */ if ((Framing->FramingItem[0].Flags & KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT) && - Framing->OutputCompression.RatioNumerator != (ULONG)-1 && + Framing->OutputCompression.RatioNumerator != MAXULONG && Framing->OutputCompression.RatioDenominator != 0 && Framing->OutputCompression.RatioDenominator < Framing->OutputCompression.RatioNumerator) { diff --git a/reactos/drivers/ksfilter/ks/irp.c b/reactos/drivers/ksfilter/ks/irp.c index be844ba324d..8b975a2e4df 100644 --- a/reactos/drivers/ksfilter/ks/irp.c +++ b/reactos/drivers/ksfilter/ks/irp.c @@ -2078,6 +2078,6 @@ KsGetNodeIdFromIrp( IN PIRP Irp) { UNIMPLEMENTED - return (ULONG)-1; + return KSFILTER_NODE; } diff --git a/reactos/drivers/ksfilter/ks/topology.c b/reactos/drivers/ksfilter/ks/topology.c index 861413ac6ab..362465d2ed5 100644 --- a/reactos/drivers/ksfilter/ks/topology.c +++ b/reactos/drivers/ksfilter/ks/topology.c @@ -122,7 +122,7 @@ KsValidateTopologyNodeCreateRequest( if (!NT_SUCCESS(Status)) return Status; - if (NodeCreate->CreateFlags != 0 || (NodeCreate->Node >= Topology->TopologyNodesCount && NodeCreate->Node != (ULONG)-1)) + if (NodeCreate->CreateFlags != 0 || (NodeCreate->Node >= Topology->TopologyNodesCount && NodeCreate->Node != MAXULONG)) { /* invalid node create */ FreeItem(NodeCreate); diff --git a/reactos/drivers/serial/serial/serial.h b/reactos/drivers/serial/serial/serial.h index e9c6360fcaa..de94b291138 100644 --- a/reactos/drivers/serial/serial/serial.h +++ b/reactos/drivers/serial/serial/serial.h @@ -108,7 +108,7 @@ typedef struct _WORKITEM_DATA #define SERIAL_TAG 'lreS' -#define INFINITE ((ULONG)-1) +#define INFINITE MAXULONG /* Baud master clock */ #define BAUD_CLOCK 1843200 diff --git a/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp b/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp index 508522757e6..364e508cf2c 100644 --- a/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp +++ b/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp @@ -1226,7 +1226,7 @@ NTSTATUS NTAPI PropertyHandler_CpuResources(PPCPROPERTY_REQUEST PropertyRequest) NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; - if (PropertyRequest->Node == (ULONG)-1) { + if (PropertyRequest->Node == MAXULONG) { return ntStatus; } if (PropertyRequest->Node >= KSNODE_TOPO_INVALID) { diff --git a/reactos/drivers/wdm/audio/filters/splitter/splitter.c b/reactos/drivers/wdm/audio/filters/splitter/splitter.c index 7496815ad0c..0aed799b15e 100644 --- a/reactos/drivers/wdm/audio/filters/splitter/splitter.c +++ b/reactos/drivers/wdm/audio/filters/splitter/splitter.c @@ -133,7 +133,7 @@ AllocatorFraming = 0, { 0, - (ULONG)-1, + MAXULONG, 1 }, { @@ -173,7 +173,7 @@ PinDescriptors[] = }, KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING | KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL | KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING | KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE, - (ULONG)-1, + MAXULONG, 1, NULL, //&AllocatorFraming, PinIntersectHandler diff --git a/reactos/drivers/wdm/audio/legacy/stream/pnp.c b/reactos/drivers/wdm/audio/legacy/stream/pnp.c index 37c5a75caf2..2c9ae93a18f 100644 --- a/reactos/drivers/wdm/audio/legacy/stream/pnp.c +++ b/reactos/drivers/wdm/audio/legacy/stream/pnp.c @@ -315,7 +315,7 @@ StreamClassStartDevice( DeviceDesc.InterfaceType = Config->AdapterInterfaceType; DeviceDesc.DmaWidth = Width32Bits; DeviceDesc.DmaSpeed = Compatible; - DeviceDesc.MaximumLength = (ULONG)-1; + DeviceDesc.MaximumLength = MAXULONG; DeviceDesc.Dma32BitAddresses = DriverObjectExtension->Data.Dma24BitAddresses; Adapter = IoGetDmaAdapter(DeviceExtension->PhysicalDeviceObject, &DeviceDesc, &MapRegisters); diff --git a/reactos/drivers/wdm/audio/legacy/wdmaud/control.c b/reactos/drivers/wdm/audio/legacy/wdmaud/control.c index ada2f2d188f..b6f64745b03 100644 --- a/reactos/drivers/wdm/audio/legacy/wdmaud/control.c +++ b/reactos/drivers/wdm/audio/legacy/wdmaud/control.c @@ -173,7 +173,7 @@ WdmAudControlOpen( } /* close pin handle which uses same virtual audio device id and pin id */ - FreeIndex = (ULONG)-1; + FreeIndex = MAXULONG; for(Index = 0; Index < ClientInfo->NumPins; Index++) { if (ClientInfo->hPins[Index].FilterId == FilterId && ClientInfo->hPins[Index].PinId == PinId && ClientInfo->hPins[Index].Handle && ClientInfo->hPins[Index].Type == DeviceInfo->DeviceType) @@ -266,7 +266,7 @@ WdmAudControlOpen( { PWDMAUD_HANDLE Handels; - if (FreeIndex != (ULONG)-1) + if (FreeIndex != MAXULONG) { /* re-use a free index */ ClientInfo->hPins[Index].Handle = PinHandle; diff --git a/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c b/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c index 5d5953ff2fb..2c83c527460 100644 --- a/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c +++ b/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c @@ -210,7 +210,7 @@ GetNodeTypeIndex( } Guid++; } - return (ULONG)-1; + return MAXULONG; } ULONG diff --git a/reactos/hal/halppc/generic/dma.c b/reactos/hal/halppc/generic/dma.c index a886e13ab27..aaaef9117b4 100644 --- a/reactos/hal/halppc/generic/dma.c +++ b/reactos/hal/halppc/generic/dma.c @@ -1073,7 +1073,7 @@ HalAllocateAdapterChannel( { PADAPTER_OBJECT MasterAdapter; PGROW_WORK_ITEM WorkItem; - ULONG Index = ~0; + ULONG Index = MAXULONG; ULONG Result; KIRQL OldIrql; @@ -1129,7 +1129,7 @@ HalAllocateAdapterChannel( { Index = RtlFindClearBitsAndSet( MasterAdapter->MapRegisters, NumberOfMapRegisters, 0); - if (Index != ~0) + if (Index != MAXULONG) { AdapterObject->MapRegisterBase = MasterAdapter->MapRegisterBase + Index; @@ -1143,7 +1143,7 @@ HalAllocateAdapterChannel( } } - if (Index == ~0) + if (Index == MAXULONG) { WorkItem = ExAllocatePoolWithTag( NonPagedPool, sizeof(GROW_WORK_ITEM), TAG_DMA); @@ -1242,7 +1242,7 @@ IoFreeAdapterChannel( PADAPTER_OBJECT MasterAdapter; PKDEVICE_QUEUE_ENTRY DeviceQueueEntry; PWAIT_CONTEXT_BLOCK WaitContextBlock; - ULONG Index = ~0; + ULONG Index = MAXULONG; ULONG Result; KIRQL OldIrql; @@ -1287,7 +1287,7 @@ IoFreeAdapterChannel( Index = RtlFindClearBitsAndSet( MasterAdapter->MapRegisters, WaitContextBlock->NumberOfMapRegisters, 0); - if (Index != ~0) + if (Index != MAXULONG) { AdapterObject->MapRegisterBase = MasterAdapter->MapRegisterBase + Index; @@ -1301,7 +1301,7 @@ IoFreeAdapterChannel( } } - if (Index == ~0) + if (Index == MAXULONG) { InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue); KfReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql); @@ -1404,7 +1404,7 @@ IoFreeMapRegisters( MasterAdapter->MapRegisters, AdapterObject->NumberOfMapRegisters, MasterAdapter->NumberOfMapRegisters); - if (Index == ~0) + if (Index == MAXULONG) { InsertHeadList(&MasterAdapter->AdapterQueue, ListEntry); break; @@ -1600,7 +1600,7 @@ IoFlushAdapterBuffers( { if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG) { - if (RealMapRegisterBase->Counter != ~0) + if (RealMapRegisterBase->Counter != MAXULONG) { if (SlaveDma && !AdapterObject->IgnoreCount) Length -= HalReadDmaCounter(AdapterObject); @@ -1779,7 +1779,7 @@ IoMapTransfer( PhysicalAddress = RealMapRegisterBase->PhysicalAddress; PhysicalAddress.QuadPart += ByteOffset; TransferLength = *Length; - RealMapRegisterBase->Counter = ~0; + RealMapRegisterBase->Counter = MAXULONG; Counter = 0; } else @@ -1809,7 +1809,7 @@ IoMapTransfer( PhysicalAddress.QuadPart += ByteOffset; if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG) { - RealMapRegisterBase->Counter = ~0; + RealMapRegisterBase->Counter = MAXULONG; Counter = 0; } } @@ -1982,13 +1982,13 @@ HalAllocateCrashDumpRegisters(IN PADAPTER_OBJECT AdapterObject, } /* Try to find free map registers */ - MapRegisterNumber = -1; + MapRegisterNumber = MAXULONG; MapRegisterNumber = RtlFindClearBitsAndSet(MasterAdapter->MapRegisters, *NumberOfMapRegisters, 0); /* Check if nothing was found */ - if (MapRegisterNumber == -1) + if (MapRegisterNumber == MAXULONG) { /* No free registers found, so use the base registers */ RtlSetBits(MasterAdapter->MapRegisters, diff --git a/reactos/hal/halx86/generic/dma.c b/reactos/hal/halx86/generic/dma.c index 9dbc817a525..0f060f4c3a0 100644 --- a/reactos/hal/halx86/generic/dma.c +++ b/reactos/hal/halx86/generic/dma.c @@ -1075,7 +1075,7 @@ HalAllocateAdapterChannel( { PADAPTER_OBJECT MasterAdapter; PGROW_WORK_ITEM WorkItem; - ULONG Index = ~0U; + ULONG Index = MAXULONG; ULONG Result; KIRQL OldIrql; @@ -1131,7 +1131,7 @@ HalAllocateAdapterChannel( { Index = RtlFindClearBitsAndSet( MasterAdapter->MapRegisters, NumberOfMapRegisters, 0); - if (Index != ~0U) + if (Index != MAXULONG) { AdapterObject->MapRegisterBase = MasterAdapter->MapRegisterBase + Index; @@ -1145,7 +1145,7 @@ HalAllocateAdapterChannel( } } - if (Index == ~0U) + if (Index == MAXULONG) { WorkItem = ExAllocatePoolWithTag( NonPagedPool, sizeof(GROW_WORK_ITEM), TAG_DMA); @@ -1244,7 +1244,7 @@ IoFreeAdapterChannel( PADAPTER_OBJECT MasterAdapter; PKDEVICE_QUEUE_ENTRY DeviceQueueEntry; PWAIT_CONTEXT_BLOCK WaitContextBlock; - ULONG Index = ~0; + ULONG Index = MAXULONG; ULONG Result; KIRQL OldIrql; @@ -1289,7 +1289,7 @@ IoFreeAdapterChannel( Index = RtlFindClearBitsAndSet( MasterAdapter->MapRegisters, WaitContextBlock->NumberOfMapRegisters, 0); - if (Index != ~0U) + if (Index != MAXULONG) { AdapterObject->MapRegisterBase = MasterAdapter->MapRegisterBase + Index; @@ -1303,7 +1303,7 @@ IoFreeAdapterChannel( } } - if (Index == ~0U) + if (Index == MAXULONG) { InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue); KfReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql); @@ -1406,7 +1406,7 @@ IoFreeMapRegisters( MasterAdapter->MapRegisters, AdapterObject->NumberOfMapRegisters, MasterAdapter->NumberOfMapRegisters); - if (Index == ~0U) + if (Index == MAXULONG) { InsertHeadList(&MasterAdapter->AdapterQueue, ListEntry); break; @@ -1604,7 +1604,7 @@ IoFlushAdapterBuffers( { if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG) { - if (RealMapRegisterBase->Counter != ~0U) + if (RealMapRegisterBase->Counter != MAXULONG) { if (SlaveDma && !AdapterObject->IgnoreCount) Length -= HalReadDmaCounter(AdapterObject); @@ -1783,7 +1783,7 @@ IoMapTransfer( PhysicalAddress = RealMapRegisterBase->PhysicalAddress; PhysicalAddress.QuadPart += ByteOffset; TransferLength = *Length; - RealMapRegisterBase->Counter = ~0; + RealMapRegisterBase->Counter = MAXULONG; Counter = 0; } else @@ -1813,7 +1813,7 @@ IoMapTransfer( PhysicalAddress.QuadPart += ByteOffset; if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG) { - RealMapRegisterBase->Counter = ~0; + RealMapRegisterBase->Counter = MAXULONG; Counter = 0; } } @@ -1991,7 +1991,7 @@ HalAllocateCrashDumpRegisters(IN PADAPTER_OBJECT AdapterObject, 0); /* Check if nothing was found */ - if (MapRegisterNumber == (ULONG)-1) + if (MapRegisterNumber == MAXULONG) { /* No free registers found, so use the base registers */ RtlSetBits(MasterAdapter->MapRegisters, diff --git a/reactos/include/host/typedefs.h b/reactos/include/host/typedefs.h index a1feea86362..42f30ed2294 100644 --- a/reactos/include/host/typedefs.h +++ b/reactos/include/host/typedefs.h @@ -217,6 +217,8 @@ typedef const UNICODE_STRING *PCUNICODE_STRING; #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8))) #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16))) +#define MAXULONG 0xFFFFFFFF + #define NT_SUCCESS(x) ((x)>=0) #if !defined(__GNUC__) #define FIELD_OFFSET(t,f) ((LONG)(LONG_PTR)&(((t*) 0)->f)) diff --git a/reactos/include/psdk/basetsd.h b/reactos/include/psdk/basetsd.h index e3b89072c51..00b0eb8b00b 100644 --- a/reactos/include/psdk/basetsd.h +++ b/reactos/include/psdk/basetsd.h @@ -48,6 +48,10 @@ #define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1)) #define MINHALF_PTR (~MAXHALF_PTR) +#define MAXUINT ((UINT)~((UINT)0)) + +#define MAXULONGLONG ((ULONGLONG)~((ULONGLONG)0)) + #ifndef RC_INVOKED #ifdef __cplusplus extern "C" { diff --git a/reactos/lib/cmlib/hivedata.h b/reactos/lib/cmlib/hivedata.h index 34b992dc3c1..3501a8a684b 100644 --- a/reactos/lib/cmlib/hivedata.h +++ b/reactos/lib/cmlib/hivedata.h @@ -80,7 +80,7 @@ typedef ULONG HCELL_INDEX, *PHCELL_INDEX; // // Cell Magic Values // -#define HCELL_NIL (ULONG)-1 +#define HCELL_NIL MAXULONG #define HCELL_CACHED 1 #define HCELL_TYPE_MASK 0x80000000 diff --git a/reactos/lib/rtl/bitmap.c b/reactos/lib/rtl/bitmap.c index 69f06875ae4..f4606595e65 100644 --- a/reactos/lib/rtl/bitmap.c +++ b/reactos/lib/rtl/bitmap.c @@ -58,14 +58,14 @@ NTDLL_FindRuns(PRTL_BITMAP lpBits, ULONG ulPos = 0, ulRuns = 0; if (!ulCount) - return ~0U; + return MAXULONG; while (ulPos < lpBits->SizeOfBitMap) { /* Find next set/clear run */ ULONG ulSize, ulNextPos = fn(lpBits, ulPos, &ulSize); - if (ulNextPos == ~0U) + if (ulNextPos == MAXULONG) break; if (bLongest && ulRuns == ulCount) @@ -158,7 +158,7 @@ NTDLL_FindSetRun(PRTL_BITMAP lpBits, ulStart = (ulStart & ~7u) + 8; lpOut++; if (ulStart >= lpBits->SizeOfBitMap) - return ~0U; + return MAXULONG; } /* Count blocks of 8 set bits */ @@ -248,7 +248,7 @@ NTDLL_FindClearRun(PRTL_BITMAP lpBits, ulStart = (ulStart & ~7u) + 8; lpOut++; if (ulStart >= lpBits->SizeOfBitMap) - return ~0U; + return MAXULONG; } /* Count blocks of 8 clear bits */ @@ -513,7 +513,7 @@ RtlFindClearBits(PRTL_BITMAP BitMapHeader, ULONG ulPos, ulEnd; if (!BitMapHeader || !NumberToFind || NumberToFind > BitMapHeader->SizeOfBitMap) - return ~0U; + return MAXULONG; ulEnd = BitMapHeader->SizeOfBitMap; @@ -537,7 +537,7 @@ RtlFindClearBits(PRTL_BITMAP BitMapHeader, else ulPos++; } - return ~0U; + return MAXULONG; } /* @@ -596,7 +596,7 @@ RtlFindFirstRunSet(IN PRTL_BITMAP BitMapHeader, Size = BitMapHeader->SizeOfBitMap; if (*StartingIndex > Size) { - *StartingIndex = (ULONG)-1; + *StartingIndex = MAXULONG; return 0; } @@ -619,7 +619,7 @@ RtlFindFirstRunSet(IN PRTL_BITMAP BitMapHeader, /* Return index of first set bit */ if (Index >= Size) { - *StartingIndex = (ULONG)-1; + *StartingIndex = MAXULONG; return 0; } else @@ -695,7 +695,7 @@ RtlFindSetBits(PRTL_BITMAP BitMapHeader, ULONG ulPos, ulEnd; if (!BitMapHeader || !NumberToFind || NumberToFind > BitMapHeader->SizeOfBitMap) - return ~0U; + return MAXULONG; ulEnd = BitMapHeader->SizeOfBitMap; @@ -719,7 +719,7 @@ RtlFindSetBits(PRTL_BITMAP BitMapHeader, else ulPos++; } - return ~0U; + return MAXULONG; } @@ -734,7 +734,7 @@ RtlFindSetBitsAndClear(PRTL_BITMAP BitMapHeader, ULONG ulPos; ulPos = RtlFindSetBits(BitMapHeader, NumberToFind, HintIndex); - if (ulPos != ~0U) + if (ulPos != MAXULONG) RtlClearBits(BitMapHeader, ulPos, NumberToFind); return ulPos; } @@ -906,7 +906,7 @@ RtlFindClearBitsAndSet(PRTL_BITMAP BitMapHeader, ULONG ulPos; ulPos = RtlFindClearBits(BitMapHeader, NumberToFind, HintIndex); - if (ulPos != ~0U) + if (ulPos != MAXULONG) RtlSetBits(BitMapHeader, ulPos, NumberToFind); return ulPos; } diff --git a/reactos/lib/rtl/debug.c b/reactos/lib/rtl/debug.c index 630ca2edc55..49887587f73 100644 --- a/reactos/lib/rtl/debug.c +++ b/reactos/lib/rtl/debug.c @@ -61,7 +61,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix, EXCEPTION_RECORD ExceptionRecord; /* Check if we should print it or not */ - if ((ComponentId != (ULONG)-1) && + if ((ComponentId != MAXULONG) && !(NtQueryDebugFilterState(ComponentId, Level))) { /* This message is masked */ @@ -96,7 +96,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix, _SEH2_END; /* Check if we went past the buffer */ - if (Length == (ULONG)-1) + if (Length == MAXULONG) { /* Terminate it if we went over-board */ Buffer[sizeof(Buffer) - 1] = '\n'; diff --git a/reactos/lib/rtl/heap.c b/reactos/lib/rtl/heap.c index 72a5e32cc77..a9a08969243 100644 --- a/reactos/lib/rtl/heap.c +++ b/reactos/lib/rtl/heap.c @@ -110,7 +110,7 @@ typedef struct tagARENA_FREE /* Max size of the blocks on the free lists */ static const DWORD HEAP_freeListSizes[HEAP_NB_FREE_LISTS] = { - 0x10, 0x20, 0x80, 0x200, ~0UL + 0x10, 0x20, 0x80, 0x200, MAXULONG }; typedef struct @@ -1612,7 +1612,7 @@ RtlSizeHeap( if (!heapPtr) { RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE ); - return ~0UL; + return MAXULONG; } flags &= HEAP_NO_SERIALIZE; flags |= heapPtr->flags; @@ -1620,7 +1620,7 @@ RtlSizeHeap( if (!HEAP_IsRealArena( heapPtr, HEAP_NO_SERIALIZE, ptr, QUIET )) { RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER ); - ret = ~0UL; + ret = MAXULONG; } else { diff --git a/reactos/lib/rtl/rangelist.c b/reactos/lib/rtl/rangelist.c index 4730bbb8392..446c296c89a 100644 --- a/reactos/lib/rtl/rangelist.c +++ b/reactos/lib/rtl/rangelist.c @@ -608,11 +608,11 @@ RtlInvertRangeList (OUT PRTL_RANGE_LIST InvertedRangeList, } /* Add trailing range */ - if (Previous->Range.End + 1 != (ULONGLONG)-1) + if (Previous->Range.End + 1 != MAXULONGLONG) { Status = RtlAddRange (InvertedRangeList, Previous->Range.End + 1, - (ULONGLONG)-1, + MAXULONGLONG, 0, 0, NULL, diff --git a/reactos/lib/rtl/registry.c b/reactos/lib/rtl/registry.c index a5e2276c2a0..e302590ebcc 100644 --- a/reactos/lib/rtl/registry.c +++ b/reactos/lib/rtl/registry.c @@ -131,7 +131,7 @@ RtlpCallQueryRegistryRoutine(IN PRTL_QUERY_REGISTRY_TABLE QueryTable, *InfoSize = 0; /* Check if there's no data */ - if (KeyValueInfo->DataOffset == (ULONG)-1) + if (KeyValueInfo->DataOffset == MAXULONG) { /* Return proper status code */ return (QueryTable->Flags & RTL_QUERY_REGISTRY_REQUIRED) ? diff --git a/reactos/lib/rtl/unicode.c b/reactos/lib/rtl/unicode.c index fea55be9e4e..cd7927c5739 100644 --- a/reactos/lib/rtl/unicode.c +++ b/reactos/lib/rtl/unicode.c @@ -1065,7 +1065,7 @@ RtlIsTextUnicode( PVOID buf, INT len, INT *pf ) static const WCHAR byterev_control_chars[] = {0x0d00,0x0a00,0x0900,0x2000,0}; const WCHAR *s = buf; int i; - unsigned int flags = ~0U, out_flags = 0; + unsigned int flags = MAXULONG, out_flags = 0; if (len < sizeof(WCHAR)) { diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index 4cacaca64cd..e12b6823a5e 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -466,7 +466,7 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer, /* Make sure the buffer is a valid string which within the given length */ if ((NtInitialUserProcessBufferType != REG_SZ) || - ((NtInitialUserProcessBufferLength != (ULONG)-1) && + ((NtInitialUserProcessBufferLength != MAXULONG) && ((NtInitialUserProcessBufferLength < sizeof(WCHAR)) || (NtInitialUserProcessBufferLength > sizeof(NtInitialUserProcessBuffer) - sizeof(WCHAR))))) @@ -1429,7 +1429,7 @@ Phase1InitializationDiscard(IN PVOID Context) if (!ExpRealTimeIsUniversal) { /* Check if we don't have a valid bias */ - if (ExpLastTimeZoneBias == (ULONG)-1) + if (ExpLastTimeZoneBias == MAXULONG) { /* Reset */ ResetBias = TRUE; diff --git a/reactos/ntoskrnl/fstub/disksup.c b/reactos/ntoskrnl/fstub/disksup.c index d217122309f..f42bb014197 100644 --- a/reactos/ntoskrnl/fstub/disksup.c +++ b/reactos/ntoskrnl/fstub/disksup.c @@ -20,7 +20,7 @@ #if 1 const WCHAR DiskMountString[] = L"\\DosDevices\\%C:"; -#define AUTO_DRIVE ((ULONG)-1) +#define AUTO_DRIVE MAXULONG #define PARTITION_MAGIC 0xaa55 @@ -135,7 +135,7 @@ HalpAssignDrive(IN PUNICODE_STRING PartitionName, if (RtlCompareUnicodeString(PartitionName, BootDevice, FALSE) == 0) { /* Set NtSystemPath to that partition's disk letter */ - *NtSystemPath = 'A' + DriveNumber; + *NtSystemPath = (UCHAR)('A' + DriveNumber); } return TRUE; diff --git a/reactos/ntoskrnl/io/iomgr/drvrlist.c b/reactos/ntoskrnl/io/iomgr/drvrlist.c index 366cbab556f..07068452fb0 100644 --- a/reactos/ntoskrnl/io/iomgr/drvrlist.c +++ b/reactos/ntoskrnl/io/iomgr/drvrlist.c @@ -152,7 +152,7 @@ IopCreateServiceListEntry(PUNICODE_STRING ServiceName) RTL_QUERY_REGISTRY_TABLE QueryTable[7]; PSERVICE Service; NTSTATUS Status; - ULONG DefaultTag = ~0; + ULONG DefaultTag = MAXULONG; DPRINT("ServiceName: '%wZ'\n", ServiceName); diff --git a/reactos/ntoskrnl/kdbg/kdb.c b/reactos/ntoskrnl/kdbg/kdb.c index e18e1d21c69..f0d5d267c47 100644 --- a/reactos/ntoskrnl/kdbg/kdb.c +++ b/reactos/ntoskrnl/kdbg/kdb.c @@ -1008,7 +1008,7 @@ KdbpDisableBreakPoint( } } - if (i != (ULONG)-1) /* not found */ + if (i != MAXULONG) /* not found */ ASSERT(0); } else @@ -1033,7 +1033,7 @@ KdbpDisableBreakPoint( } } - if (i != (ULONG)-1) /* not found */ + if (i != MAXULONG) /* not found */ ASSERT(0); } diff --git a/reactos/ntoskrnl/kdbg/kdb_cli.c b/reactos/ntoskrnl/kdbg/kdb_cli.c index e61f2b60aea..a517f96de2a 100644 --- a/reactos/ntoskrnl/kdbg/kdb_cli.c +++ b/reactos/ntoskrnl/kdbg/kdb_cli.c @@ -447,9 +447,9 @@ KdbpCmdFilter( else { if (*p == '-') - clear = ~0; + clear = MAXULONG; else - set = ~0; + set = MAXULONG; } if (*p == '+' || *p == '-') p++; diff --git a/reactos/ntoskrnl/ke/i386/irqobj.c b/reactos/ntoskrnl/ke/i386/irqobj.c index 84a2529739a..b22c3814ad3 100644 --- a/reactos/ntoskrnl/ke/i386/irqobj.c +++ b/reactos/ntoskrnl/ke/i386/irqobj.c @@ -194,8 +194,8 @@ KeInitializeInterrupt(IN PKINTERRUPT Interrupt, Interrupt->ShareVector = ShareVector; Interrupt->Number = ProcessorNumber; Interrupt->FloatingSave = FloatingSave; - Interrupt->TickCount = (ULONG)-1; - Interrupt->DispatchCount = (ULONG)-1; + Interrupt->TickCount = MAXULONG; + Interrupt->DispatchCount = MAXULONG; /* Loop the template in memory */ for (i = 0; i < KINTERRUPT_DISPATCH_CODES; i++) diff --git a/reactos/ntoskrnl/mm/elf.inc.h b/reactos/ntoskrnl/mm/elf.inc.h index b5795d130b4..2360bffd1d2 100644 --- a/reactos/ntoskrnl/mm/elf.inc.h +++ b/reactos/ntoskrnl/mm/elf.inc.h @@ -7,10 +7,6 @@ #error __ELF_WORD_SIZE must be defined #endif -#ifndef MAXULONG -#define MAXULONG ((ULONG)(~1)) -#endif - #include /* TODO: Intsafe should be made into a library, as it's generally useful */ @@ -205,7 +201,7 @@ static __inline ULONG ElfFmtpReadULong } ASSERT(FALSE); - return (ULONG)-1; + return MAXULONG; } static __inline USHORT ElfFmtpReadUShort @@ -282,7 +278,7 @@ static __inline ULONG ElfFmtpSafeReadULong } ASSERT(FALSE); - return (ULONG)-1; + return MAXULONG; } static __inline BOOLEAN ElfFmtpIsPowerOf2(IN Elf_Addr Number) diff --git a/reactos/ntoskrnl/mm/i386/pagepae.c b/reactos/ntoskrnl/mm/i386/pagepae.c index 70744baef03..0a7be927dc9 100644 --- a/reactos/ntoskrnl/mm/i386/pagepae.c +++ b/reactos/ntoskrnl/mm/i386/pagepae.c @@ -78,11 +78,11 @@ ULONG_PTR NTAPI MiFlushTlbIpiRoutine(ULONG_PTR Address) { - if (Address == (ULONG_PTR)-1) + if (Address == MAXULONGLONG) { KeFlushCurrentTb(); } - else if (Address == (ULONG_PTR)-2) + else if (Address == MAXULONGLONG-1) { KeFlushCurrentTb(); } diff --git a/reactos/ntoskrnl/mm/pe.c b/reactos/ntoskrnl/mm/pe.c index 49b5b191df4..7b7e5d3298d 100644 --- a/reactos/ntoskrnl/mm/pe.c +++ b/reactos/ntoskrnl/mm/pe.c @@ -16,10 +16,6 @@ #include -#ifndef MAXULONG -#define MAXULONG ((ULONG)(~1)) -#endif - static ULONG SectionCharacteristicsToProtect[16] = { PAGE_NOACCESS, /* 0 = NONE */ @@ -453,7 +449,7 @@ l_ReadHeaderFromFile: if(pioh64OptHeader->ImageBase > MAXULONG_PTR) DIE(("ImageBase exceeds the address space\n")); - ImageSectionObject->ImageBase = pioh64OptHeader->ImageBase; + ImageSectionObject->ImageBase = (ULONG_PTR)pioh64OptHeader->ImageBase; } if(RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, SizeOfImage)) diff --git a/reactos/ntoskrnl/po/power.c b/reactos/ntoskrnl/po/power.c index 0d5d10d23b9..486b0fe0fe4 100644 --- a/reactos/ntoskrnl/po/power.c +++ b/reactos/ntoskrnl/po/power.c @@ -526,7 +526,7 @@ NtPowerInformation(IN POWER_INFORMATION_LEVEL PowerInformationLevel, /* Just zero the struct (and thus set BatteryState->BatteryPresent = FALSE) */ RtlZeroMemory(BatteryState, sizeof(SYSTEM_BATTERY_STATE)); - BatteryState->EstimatedTime = (ULONG)-1; + BatteryState->EstimatedTime = MAXULONG; Status = STATUS_SUCCESS; break; diff --git a/reactos/ntoskrnl/ps/psmgr.c b/reactos/ntoskrnl/ps/psmgr.c index b04284dca32..224cd12494f 100644 --- a/reactos/ntoskrnl/ps/psmgr.c +++ b/reactos/ntoskrnl/ps/psmgr.c @@ -443,7 +443,7 @@ PspInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Now multiply limits by 1MB */ PspDefaultPagedLimit <<= 20; PspDefaultNonPagedLimit <<= 20; - if (PspDefaultPagefileLimit != (ULONG)-1) PspDefaultPagefileLimit <<= 20; + if (PspDefaultPagefileLimit != MAXULONG) PspDefaultPagefileLimit <<= 20; /* Initialize the Active Process List */ InitializeListHead(&PsActiveProcessHead); diff --git a/reactos/ntoskrnl/ps/query.c b/reactos/ntoskrnl/ps/query.c index 6a340df0206..f9d70a93590 100644 --- a/reactos/ntoskrnl/ps/query.c +++ b/reactos/ntoskrnl/ps/query.c @@ -193,8 +193,8 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle, Process->Vm.MinimumWorkingSetSize << PAGE_SHIFT; /* Set default time limits */ - QuotaLimits->TimeLimit.LowPart = (ULONG)-1; - QuotaLimits->TimeLimit.HighPart = (ULONG)-1; + QuotaLimits->TimeLimit.LowPart = MAXULONG; + QuotaLimits->TimeLimit.HighPart = MAXULONG; /* Is quota block a default one? */ if (Process->QuotaBlock == &PspDefaultQuotaBlock) -- 2.17.1