- 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
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;
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';
{
CurrentOffset += DataRunLength * Volume->ClusterSize;
DataRun = NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength);
- if (DataRunLength != (ULONGLONG)-1)
+ if (DataRunLength != MAXULONGLONG)
{
DataRunStartLCN = LastLCN + DataRunOffset;
LastLCN = DataRunStartLCN;
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;
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);
break;
}
- if (red == (DWORD)-1)
+ if (red == MAXDWORD)
{
red = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0);
if (HIWORD(red))
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))
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))
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);
GetSysColor(COLOR_WINDOWTEXT));
}
- if (lpdis->itemID != (UINT)-1)
+ if (lpdis->itemID != MAXUINT)
{
CopyRect(&rc, &lpdis->rcItem);
rc.left += 5;
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;
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)))
}
/* 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))
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))))
{
* 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))))
{
*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
/* 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);
/* 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;
TRUE /* bInheritHandle */ };
OPENGL32_tls = TlsAlloc();
- if ((DWORD)-1 == OPENGL32_tls)
+ if (OPENGL32_tls == MAXDWORD)
return FALSE;
memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) );
CloseHandle( OPENGL32_processdata.dcdata_mutex );
/* free TLS */
- if (OPENGL32_tls != (DWORD)-1)
+ if (OPENGL32_tls != MAXDWORD)
TlsFree(OPENGL32_tls);
}
DeviceCapabilities->UniqueID = FALSE;
DeviceCapabilities->Address = ((DeviceNumber << 16) & 0xFFFF0000) + (FunctionNumber & 0xFFFF);
- DeviceCapabilities->UINumber = (ULONG)-1; /* FIXME */
+ DeviceCapabilities->UINumber = MAXULONG; /* FIXME */
return STATUS_SUCCESS;
}
*Base = BaseValue;
/* Set magic value */
- NewValue = (ULONG)-1;
+ NewValue = MAXULONG;
Size= HalSetBusDataByOffset(PCIConfiguration,
DeviceExtension->PciDevice->BusNumber,
DeviceExtension->PciDevice->SlotNumber.u.AsULONG,
#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 *****************************************************************/
/* 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)
{
IN PIRP Irp)
{
UNIMPLEMENTED
- return (ULONG)-1;
+ return KSFILTER_NODE;
}
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);
#define SERIAL_TAG 'lreS'
-#define INFINITE ((ULONG)-1)
+#define INFINITE MAXULONG
/* Baud master clock */
#define BAUD_CLOCK 1843200
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
- if (PropertyRequest->Node == (ULONG)-1) {
+ if (PropertyRequest->Node == MAXULONG) {
return ntStatus;
}
if (PropertyRequest->Node >= KSNODE_TOPO_INVALID) {
0,
{
0,
- (ULONG)-1,
+ MAXULONG,
1
},
{
},
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
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);
}
/* 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)
{
PWDMAUD_HANDLE Handels;
- if (FreeIndex != (ULONG)-1)
+ if (FreeIndex != MAXULONG)
{
/* re-use a free index */
ClientInfo->hPins[Index].Handle = PinHandle;
}
Guid++;
}
- return (ULONG)-1;
+ return MAXULONG;
}
ULONG
{
PADAPTER_OBJECT MasterAdapter;
PGROW_WORK_ITEM WorkItem;
- ULONG Index = ~0;
+ ULONG Index = MAXULONG;
ULONG Result;
KIRQL OldIrql;
{
Index = RtlFindClearBitsAndSet(
MasterAdapter->MapRegisters, NumberOfMapRegisters, 0);
- if (Index != ~0)
+ if (Index != MAXULONG)
{
AdapterObject->MapRegisterBase =
MasterAdapter->MapRegisterBase + Index;
}
}
- if (Index == ~0)
+ if (Index == MAXULONG)
{
WorkItem = ExAllocatePoolWithTag(
NonPagedPool, sizeof(GROW_WORK_ITEM), TAG_DMA);
PADAPTER_OBJECT MasterAdapter;
PKDEVICE_QUEUE_ENTRY DeviceQueueEntry;
PWAIT_CONTEXT_BLOCK WaitContextBlock;
- ULONG Index = ~0;
+ ULONG Index = MAXULONG;
ULONG Result;
KIRQL OldIrql;
Index = RtlFindClearBitsAndSet(
MasterAdapter->MapRegisters,
WaitContextBlock->NumberOfMapRegisters, 0);
- if (Index != ~0)
+ if (Index != MAXULONG)
{
AdapterObject->MapRegisterBase =
MasterAdapter->MapRegisterBase + Index;
}
}
- if (Index == ~0)
+ if (Index == MAXULONG)
{
InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue);
KfReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql);
MasterAdapter->MapRegisters,
AdapterObject->NumberOfMapRegisters,
MasterAdapter->NumberOfMapRegisters);
- if (Index == ~0)
+ if (Index == MAXULONG)
{
InsertHeadList(&MasterAdapter->AdapterQueue, ListEntry);
break;
{
if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
{
- if (RealMapRegisterBase->Counter != ~0)
+ if (RealMapRegisterBase->Counter != MAXULONG)
{
if (SlaveDma && !AdapterObject->IgnoreCount)
Length -= HalReadDmaCounter(AdapterObject);
PhysicalAddress = RealMapRegisterBase->PhysicalAddress;
PhysicalAddress.QuadPart += ByteOffset;
TransferLength = *Length;
- RealMapRegisterBase->Counter = ~0;
+ RealMapRegisterBase->Counter = MAXULONG;
Counter = 0;
}
else
PhysicalAddress.QuadPart += ByteOffset;
if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
{
- RealMapRegisterBase->Counter = ~0;
+ RealMapRegisterBase->Counter = MAXULONG;
Counter = 0;
}
}
}
/* 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,
{
PADAPTER_OBJECT MasterAdapter;
PGROW_WORK_ITEM WorkItem;
- ULONG Index = ~0U;
+ ULONG Index = MAXULONG;
ULONG Result;
KIRQL OldIrql;
{
Index = RtlFindClearBitsAndSet(
MasterAdapter->MapRegisters, NumberOfMapRegisters, 0);
- if (Index != ~0U)
+ if (Index != MAXULONG)
{
AdapterObject->MapRegisterBase =
MasterAdapter->MapRegisterBase + Index;
}
}
- if (Index == ~0U)
+ if (Index == MAXULONG)
{
WorkItem = ExAllocatePoolWithTag(
NonPagedPool, sizeof(GROW_WORK_ITEM), TAG_DMA);
PADAPTER_OBJECT MasterAdapter;
PKDEVICE_QUEUE_ENTRY DeviceQueueEntry;
PWAIT_CONTEXT_BLOCK WaitContextBlock;
- ULONG Index = ~0;
+ ULONG Index = MAXULONG;
ULONG Result;
KIRQL OldIrql;
Index = RtlFindClearBitsAndSet(
MasterAdapter->MapRegisters,
WaitContextBlock->NumberOfMapRegisters, 0);
- if (Index != ~0U)
+ if (Index != MAXULONG)
{
AdapterObject->MapRegisterBase =
MasterAdapter->MapRegisterBase + Index;
}
}
- if (Index == ~0U)
+ if (Index == MAXULONG)
{
InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue);
KfReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql);
MasterAdapter->MapRegisters,
AdapterObject->NumberOfMapRegisters,
MasterAdapter->NumberOfMapRegisters);
- if (Index == ~0U)
+ if (Index == MAXULONG)
{
InsertHeadList(&MasterAdapter->AdapterQueue, ListEntry);
break;
{
if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
{
- if (RealMapRegisterBase->Counter != ~0U)
+ if (RealMapRegisterBase->Counter != MAXULONG)
{
if (SlaveDma && !AdapterObject->IgnoreCount)
Length -= HalReadDmaCounter(AdapterObject);
PhysicalAddress = RealMapRegisterBase->PhysicalAddress;
PhysicalAddress.QuadPart += ByteOffset;
TransferLength = *Length;
- RealMapRegisterBase->Counter = ~0;
+ RealMapRegisterBase->Counter = MAXULONG;
Counter = 0;
}
else
PhysicalAddress.QuadPart += ByteOffset;
if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
{
- RealMapRegisterBase->Counter = ~0;
+ RealMapRegisterBase->Counter = MAXULONG;
Counter = 0;
}
}
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,
#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))
#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" {
//
// Cell Magic Values
//
-#define HCELL_NIL (ULONG)-1
+#define HCELL_NIL MAXULONG
#define HCELL_CACHED 1
#define HCELL_TYPE_MASK 0x80000000
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)
ulStart = (ulStart & ~7u) + 8;
lpOut++;
if (ulStart >= lpBits->SizeOfBitMap)
- return ~0U;
+ return MAXULONG;
}
/* Count blocks of 8 set bits */
ulStart = (ulStart & ~7u) + 8;
lpOut++;
if (ulStart >= lpBits->SizeOfBitMap)
- return ~0U;
+ return MAXULONG;
}
/* Count blocks of 8 clear bits */
ULONG ulPos, ulEnd;
if (!BitMapHeader || !NumberToFind || NumberToFind > BitMapHeader->SizeOfBitMap)
- return ~0U;
+ return MAXULONG;
ulEnd = BitMapHeader->SizeOfBitMap;
else
ulPos++;
}
- return ~0U;
+ return MAXULONG;
}
/*
Size = BitMapHeader->SizeOfBitMap;
if (*StartingIndex > Size)
{
- *StartingIndex = (ULONG)-1;
+ *StartingIndex = MAXULONG;
return 0;
}
/* Return index of first set bit */
if (Index >= Size)
{
- *StartingIndex = (ULONG)-1;
+ *StartingIndex = MAXULONG;
return 0;
}
else
ULONG ulPos, ulEnd;
if (!BitMapHeader || !NumberToFind || NumberToFind > BitMapHeader->SizeOfBitMap)
- return ~0U;
+ return MAXULONG;
ulEnd = BitMapHeader->SizeOfBitMap;
else
ulPos++;
}
- return ~0U;
+ return MAXULONG;
}
ULONG ulPos;
ulPos = RtlFindSetBits(BitMapHeader, NumberToFind, HintIndex);
- if (ulPos != ~0U)
+ if (ulPos != MAXULONG)
RtlClearBits(BitMapHeader, ulPos, NumberToFind);
return ulPos;
}
ULONG ulPos;
ulPos = RtlFindClearBits(BitMapHeader, NumberToFind, HintIndex);
- if (ulPos != ~0U)
+ if (ulPos != MAXULONG)
RtlSetBits(BitMapHeader, ulPos, NumberToFind);
return ulPos;
}
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 */
_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';
/* 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
if (!heapPtr)
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE );
- return ~0UL;
+ return MAXULONG;
}
flags &= HEAP_NO_SERIALIZE;
flags |= heapPtr->flags;
if (!HEAP_IsRealArena( heapPtr, HEAP_NO_SERIALIZE, ptr, QUIET ))
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
- ret = ~0UL;
+ ret = MAXULONG;
}
else
{
}
/* 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,
*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) ?
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))
{
/* 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)))))
if (!ExpRealTimeIsUniversal)
{
/* Check if we don't have a valid bias */
- if (ExpLastTimeZoneBias == (ULONG)-1)
+ if (ExpLastTimeZoneBias == MAXULONG)
{
/* Reset */
ResetBias = TRUE;
#if 1
const WCHAR DiskMountString[] = L"\\DosDevices\\%C:";
-#define AUTO_DRIVE ((ULONG)-1)
+#define AUTO_DRIVE MAXULONG
#define PARTITION_MAGIC 0xaa55
if (RtlCompareUnicodeString(PartitionName, BootDevice, FALSE) == 0)
{
/* Set NtSystemPath to that partition's disk letter */
- *NtSystemPath = 'A' + DriveNumber;
+ *NtSystemPath = (UCHAR)('A' + DriveNumber);
}
return TRUE;
RTL_QUERY_REGISTRY_TABLE QueryTable[7];
PSERVICE Service;
NTSTATUS Status;
- ULONG DefaultTag = ~0;
+ ULONG DefaultTag = MAXULONG;
DPRINT("ServiceName: '%wZ'\n", ServiceName);
}
}
- if (i != (ULONG)-1) /* not found */
+ if (i != MAXULONG) /* not found */
ASSERT(0);
}
else
}
}
- if (i != (ULONG)-1) /* not found */
+ if (i != MAXULONG) /* not found */
ASSERT(0);
}
else
{
if (*p == '-')
- clear = ~0;
+ clear = MAXULONG;
else
- set = ~0;
+ set = MAXULONG;
}
if (*p == '+' || *p == '-')
p++;
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++)
#error __ELF_WORD_SIZE must be defined
#endif
-#ifndef MAXULONG
-#define MAXULONG ((ULONG)(~1))
-#endif
-
#include <elf/elf.h>
/* TODO: Intsafe should be made into a library, as it's generally useful */
}
ASSERT(FALSE);
- return (ULONG)-1;
+ return MAXULONG;
}
static __inline USHORT ElfFmtpReadUShort
}
ASSERT(FALSE);
- return (ULONG)-1;
+ return MAXULONG;
}
static __inline BOOLEAN ElfFmtpIsPowerOf2(IN Elf_Addr Number)
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();
}
#include <reactos/exeformat.h>
-#ifndef MAXULONG
-#define MAXULONG ((ULONG)(~1))
-#endif
-
static ULONG SectionCharacteristicsToProtect[16] =
{
PAGE_NOACCESS, /* 0 = NONE */
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))
/* 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;
/* 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);
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)