diff --git a/reactos/ntoskrnl/cm/cm.h b/reactos/ntoskrnl/cm/cm.h index a87fd49c8f5..0cf9ccaa714 100644 --- a/reactos/ntoskrnl/cm/cm.h +++ b/reactos/ntoskrnl/cm/cm.h @@ -641,13 +641,13 @@ CmiGetPackedNameLength(IN PUNICODE_STRING Name, BOOLEAN CmiComparePackedNames(IN PUNICODE_STRING Name, - IN PCHAR NameBuffer, + IN PUCHAR NameBuffer, IN USHORT NameBufferSize, IN BOOLEAN NamePacked); VOID CmiCopyPackedName(PWCHAR NameBuffer, - PCHAR PackedNameBuffer, + PUCHAR PackedNameBuffer, ULONG PackedNameSize); BOOLEAN diff --git a/reactos/ntoskrnl/cm/regfile.c b/reactos/ntoskrnl/cm/regfile.c index db8eec921c2..800961a9c76 100644 --- a/reactos/ntoskrnl/cm/regfile.c +++ b/reactos/ntoskrnl/cm/regfile.c @@ -3825,7 +3825,7 @@ CmiGetPackedNameLength(IN PUNICODE_STRING Name, BOOLEAN CmiComparePackedNames(IN PUNICODE_STRING Name, - IN PCHAR NameBuffer, + IN PUCHAR NameBuffer, IN USHORT NameBufferSize, IN BOOLEAN NamePacked) { @@ -3863,7 +3863,7 @@ CmiComparePackedNames(IN PUNICODE_STRING Name, VOID CmiCopyPackedName(PWCHAR NameBuffer, - PCHAR PackedNameBuffer, + PUCHAR PackedNameBuffer, ULONG PackedNameSize) { ULONG i; diff --git a/reactos/ntoskrnl/dbg/kdb.c b/reactos/ntoskrnl/dbg/kdb.c index 82a008d9d44..22cb946a868 100644 --- a/reactos/ntoskrnl/dbg/kdb.c +++ b/reactos/ntoskrnl/dbg/kdb.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: kdb.c,v 1.36 2004/12/18 19:22:10 blight Exp $ +/* $Id: kdb.c,v 1.37 2004/12/24 17:06:58 navaraf Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/dbg/kdb.c @@ -323,7 +323,7 @@ KdbGetCommand(PCH Buffer) { CHAR Key; PCH Orig = Buffer; - static UCHAR LastCommand[256] = ""; + static CHAR LastCommand[256] = ""; ULONG ScanCode = 0; static CHAR LastKey = '\0'; @@ -404,7 +404,7 @@ KdbGetCommand(PCH Buffer) } BOOLEAN STATIC -KdbDecodeAddress(PUCHAR Buffer, PULONG Address) +KdbDecodeAddress(PCHAR Buffer, PULONG Address) { while (isspace(*Buffer)) { @@ -412,8 +412,8 @@ KdbDecodeAddress(PUCHAR Buffer, PULONG Address) } if (Buffer[0] == '<') { - PUCHAR ModuleName = Buffer + 1; - PUCHAR AddressString = strpbrk(Buffer, ":"); + PCHAR ModuleName = Buffer + 1; + PCHAR AddressString = strpbrk(Buffer, ":"); extern LIST_ENTRY ModuleTextListHead; PLIST_ENTRY current_entry; MODULE_TEXT_SECTION* current = NULL; diff --git a/reactos/ntoskrnl/ex/fmutex.c b/reactos/ntoskrnl/ex/fmutex.c index 8091d382a30..66c1e2318e6 100644 --- a/reactos/ntoskrnl/ex/fmutex.c +++ b/reactos/ntoskrnl/ex/fmutex.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: fmutex.c,v 1.22 2004/10/22 20:18:35 ekohl Exp $ +/* $Id: fmutex.c,v 1.23 2004/12/24 17:06:58 navaraf Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/ex/fmutex.c @@ -41,7 +41,7 @@ VOID FASTCALL ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex) { ASSERT(FastMutex->Owner != KeGetCurrentThread()); - InterlockedIncrement((LONG *)&FastMutex->Contention); + InterlockedIncrementUL(&FastMutex->Contention); while (InterlockedExchange(&FastMutex->Count, 0) == 0) { KeWaitForSingleObject(&FastMutex->Event, @@ -50,7 +50,7 @@ ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex) FALSE, NULL); } - InterlockedDecrement((LONG *)&FastMutex->Contention); + InterlockedDecrementUL(&FastMutex->Contention); FastMutex->Owner = KeGetCurrentThread(); } diff --git a/reactos/ntoskrnl/include/internal/ex.h b/reactos/ntoskrnl/include/internal/ex.h index 051bbf3887f..44e5a5aeeac 100644 --- a/reactos/ntoskrnl/include/internal/ex.h +++ b/reactos/ntoskrnl/include/internal/ex.h @@ -120,5 +120,25 @@ ExfpInterlockedExchange64(LONGLONG volatile * Destination, NTSTATUS ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation); +#define InterlockedDecrementUL(Addend) \ + (ULONG)InterlockedDecrement((PLONG)(Addend)) + +#define InterlockedIncrementUL(Addend) \ + (ULONG)InterlockedIncrement((PLONG)(Addend)) + +#define InterlockedExchangeUL(Target, Value) \ + (ULONG)InterlockedExchange((PLONG)(Target), (LONG)(Value)) + +#define InterlockedExchangeAddUL(Addend, Value) \ + (ULONG)InterlockedExchangeAdd((PLONG)(Addend), (LONG)(Value)) + +#define InterlockedCompareExchangeUL(Destination, Exchange, Comperand) \ + (ULONG)InterlockedCompareExchange((PLONG)(Destination), (LONG)(Exchange), (LONG)(Comperand)) + +#define ExfInterlockedCompareExchange64UL(Destination, Exchange, Comperand) \ + (ULONGLONG)ExfInterlockedCompareExchange64((PLONGLONG)(Destination), (PLONGLONG)(Exchange), (PLONGLONG)(Comperand)) + +#define ExfpInterlockedExchange64UL(Target, Value) \ + (ULONGLONG)ExfpInterlockedExchange64((PLONGLONG)(Target), (PLONGLONG)(Value)) #endif /* __NTOSKRNL_INCLUDE_INTERNAL_EXECUTIVE_H */ diff --git a/reactos/ntoskrnl/io/device.c b/reactos/ntoskrnl/io/device.c index 757493134d8..713a3667609 100644 --- a/reactos/ntoskrnl/io/device.c +++ b/reactos/ntoskrnl/io/device.c @@ -1,4 +1,4 @@ -/* $Id: device.c,v 1.85 2004/11/18 11:46:07 ekohl Exp $ +/* $Id: device.c,v 1.86 2004/12/24 17:06:58 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -557,7 +557,7 @@ IoCreateDevice( { swprintf(AutoNameBuffer, L"\\Device\\%08lx", - InterlockedIncrement(&IopDeviceObjectNumber)); + InterlockedIncrementUL(&IopDeviceObjectNumber)); RtlInitUnicodeString(&AutoName, AutoNameBuffer); DeviceName = &AutoName; diff --git a/reactos/ntoskrnl/kd/gdbstub.c b/reactos/ntoskrnl/kd/gdbstub.c index bc7258f1377..26b2064a782 100644 --- a/reactos/ntoskrnl/kd/gdbstub.c +++ b/reactos/ntoskrnl/kd/gdbstub.c @@ -1428,7 +1428,7 @@ GspBreakIn(PKINTERRUPT Interrupt, BOOLEAN DoBreakIn; CONTEXT Context; KIRQL OldIrql; - CHAR Value; + UCHAR Value; DPRINT ("Break In\n"); diff --git a/reactos/ntoskrnl/ke/dpc.c b/reactos/ntoskrnl/ke/dpc.c index a6e4a7e9dc7..c54d1f07dbd 100644 --- a/reactos/ntoskrnl/ke/dpc.c +++ b/reactos/ntoskrnl/ke/dpc.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: dpc.c,v 1.49 2004/11/27 19:27:31 hbirr Exp $ +/* $Id: dpc.c,v 1.50 2004/12/24 17:06:58 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -209,7 +209,7 @@ KeInsertQueueDpc (PKDPC Dpc, #endif /* Get the DPC Data */ - if (InterlockedCompareExchange((LONG*)&Dpc->DpcData, (LONG)&Pcr->PrcbData.DpcData[0].DpcLock, 0)) { + if (InterlockedCompareExchangeUL(&Dpc->DpcData, &Pcr->PrcbData.DpcData[0].DpcLock, 0)) { DPRINT("DPC Already Inserted"); #ifdef MP KiReleaseSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock); diff --git a/reactos/ntoskrnl/ke/i386/kernel.c b/reactos/ntoskrnl/ke/i386/kernel.c index fb5f258e32e..4931e8ae1ec 100644 --- a/reactos/ntoskrnl/ke/i386/kernel.c +++ b/reactos/ntoskrnl/ke/i386/kernel.c @@ -175,7 +175,7 @@ KeApplicationProcessorInit(VOID) } - Offset = InterlockedIncrement(&PcrsAllocated) - 1; + Offset = InterlockedIncrementUL(&PcrsAllocated) - 1; Pcr = (PKPCR)((ULONG_PTR)KPCR_BASE + Offset * PAGE_SIZE); /* @@ -296,7 +296,7 @@ KeInit1(PCHAR CommandLine, PULONG LastKernelAddress) * Make the detection of the noexecute feature more portable. */ if(KPCR->PrcbData.CpuType == 0xf && - 0 == strcmp("AuthenticAMD", KPCR->PrcbData.VendorString)) + 0 == memcpy("AuthenticAMD", KPCR->PrcbData.VendorString, 12)) { if (NoExecute) { diff --git a/reactos/ntoskrnl/ke/ipi.c b/reactos/ntoskrnl/ke/ipi.c index 82ba893015d..9772d929b38 100644 --- a/reactos/ntoskrnl/ke/ipi.c +++ b/reactos/ntoskrnl/ke/ipi.c @@ -1,4 +1,4 @@ -/* $Id: ipi.c,v 1.4 2004/11/27 16:32:10 hbirr Exp $ +/* $Id: ipi.c,v 1.5 2004/12/24 17:06:58 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -76,13 +76,13 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame, if (Pcr->PrcbData.IpiFrozen & IPI_REQUEST_FUNCTIONCALL) { - InterlockedDecrement((PLONG)&Pcr->PrcbData.SignalDone->CurrentPacket[1]); + InterlockedDecrementUL(&Pcr->PrcbData.SignalDone->CurrentPacket[1]); if (Pcr->PrcbData.SignalDone->CurrentPacket[2]) { #ifdef DBG StartTime = KeQueryPerformanceCounter(&Frequency); #endif - while (0 != InterlockedCompareExchange((PLONG)&Pcr->PrcbData.SignalDone->CurrentPacket[1], 0, 0)) + while (0 != InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone->CurrentPacket[1], 0, 0)) { #ifdef DBG CurrentTime = KeQueryPerformanceCounter(NULL); @@ -99,13 +99,13 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame, { Processor = 1 << KeGetCurrentProcessorNumber(); TargetSet = Pcr->PrcbData.SignalDone->TargetSet; - } while (Processor & InterlockedCompareExchange(&Pcr->PrcbData.SignalDone->TargetSet, TargetSet & ~Processor, TargetSet)); + } while (Processor & InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone->TargetSet, TargetSet & ~Processor, TargetSet)); if (Pcr->PrcbData.SignalDone->CurrentPacket[2]) { #ifdef DBG StartTime = KeQueryPerformanceCounter(&Frequency); #endif - while (0 != InterlockedCompareExchange(&Pcr->PrcbData.SignalDone->TargetSet, 0, 0)) + while (0 != InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone->TargetSet, 0, 0)) { #ifdef DBG CurrentTime = KeQueryPerformanceCounter(NULL); @@ -149,7 +149,7 @@ KiIpiSendPacket(ULONG TargetSet, VOID STDCALL (*WorkerRoutine)(PVOID), PVOID Arg if (TargetSet & Processor) { Pcr = (PKPCR)(KPCR_BASE + i * PAGE_SIZE); - while(0 != InterlockedCompareExchange((PLONG)&Pcr->PrcbData.SignalDone, (LONG)&CurrentPcr->PrcbData, 0)); + while(0 != InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone, (LONG)&CurrentPcr->PrcbData, 0)); Pcr->PrcbData.IpiFrozen |= IPI_REQUEST_FUNCTIONCALL; if (Processor != CurrentProcessor) { diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index 728352b02ea..62f95c35740 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: main.c,v 1.211 2004/12/12 20:14:01 hbirr Exp $ +/* $Id: main.c,v 1.212 2004/12/24 17:06:58 navaraf Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/ke/main.c @@ -73,8 +73,8 @@ EXPORTED ULONG InitSafeBootMode = 0; /* KB83764 */ #endif /* __GNUC__ */ static LOADER_MODULE KeLoaderModules[64]; -static UCHAR KeLoaderModuleStrings[64][256]; -static UCHAR KeLoaderCommandLine[256]; +static CHAR KeLoaderModuleStrings[64][256]; +static CHAR KeLoaderCommandLine[256]; static ADDRESS_RANGE KeMemoryMap[64]; static ULONG KeMemoryMapRangeCount; static ULONG FirstKrnlPhysAddr; @@ -696,8 +696,8 @@ ExpInitializeExecutive(VOID) IoCreateArcNames(); /* Create the SystemRoot symbolic link */ - CPRINT("CommandLine: %s\n", (PUCHAR)KeLoaderBlock.CommandLine); - Status = IoCreateSystemRootLink((PUCHAR)KeLoaderBlock.CommandLine); + CPRINT("CommandLine: %s\n", (PCHAR)KeLoaderBlock.CommandLine); + Status = IoCreateSystemRootLink((PCHAR)KeLoaderBlock.CommandLine); if (!NT_SUCCESS(Status)) { DbgPrint ( "IoCreateSystemRootLink FAILED: (0x%x) - ", Status ); @@ -745,7 +745,7 @@ ExpInitializeExecutive(VOID) * Initialize shared user page: * - set dos system path, dos device map, etc. */ - InitSystemSharedUserPage ((PUCHAR)KeLoaderBlock.CommandLine); + InitSystemSharedUserPage ((PCHAR)KeLoaderBlock.CommandLine); /* Create 'ReactOSInitDone' event */ RtlInitUnicodeString(&Name, L"\\ReactOSInitDone"); @@ -917,10 +917,10 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock) if (((PUCHAR)_LoaderBlock->CommandLine)[1] == 'h' && ((PUCHAR)_LoaderBlock->CommandLine)[2] == 'd') { - DiskNumber = ((PUCHAR)_LoaderBlock->CommandLine)[3] - '0'; - PartNumber = ((PUCHAR)_LoaderBlock->CommandLine)[5] - '0'; + DiskNumber = ((PCHAR)_LoaderBlock->CommandLine)[3] - '0'; + PartNumber = ((PCHAR)_LoaderBlock->CommandLine)[5] - '0'; } - strcpy(Temp, &((PUCHAR)_LoaderBlock->CommandLine)[7]); + strcpy(Temp, &((PCHAR)_LoaderBlock->CommandLine)[7]); if ((options = strchr(Temp, ' ')) != NULL) { *options = 0; @@ -955,7 +955,7 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock) } else { - strcpy(KeLoaderCommandLine, (PUCHAR)_LoaderBlock->CommandLine); + strcpy(KeLoaderCommandLine, (PCHAR)_LoaderBlock->CommandLine); } KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine; @@ -976,13 +976,13 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock) for (i = 1; i < KeLoaderBlock.ModsCount; i++) { CHAR* s; - if ((s = strrchr((PUCHAR)KeLoaderModules[i].String, '/')) != 0) + if ((s = strrchr((PCHAR)KeLoaderModules[i].String, '/')) != 0) { strcpy(KeLoaderModuleStrings[i], s + 1); } else { - strcpy(KeLoaderModuleStrings[i], (PUCHAR)KeLoaderModules[i].String); + strcpy(KeLoaderModuleStrings[i], (PCHAR)KeLoaderModules[i].String); } /* TODO: Fix this hardcoded load address stuff... */ KeLoaderModules[i].ModStart -= 0x200000; diff --git a/reactos/ntoskrnl/ke/spinlock.c b/reactos/ntoskrnl/ke/spinlock.c index a5a0338b2f3..a123af00605 100644 --- a/reactos/ntoskrnl/ke/spinlock.c +++ b/reactos/ntoskrnl/ke/spinlock.c @@ -1,4 +1,4 @@ -/* $Id: spinlock.c,v 1.24 2004/10/22 20:30:48 ekohl Exp $ +/* $Id: spinlock.c,v 1.25 2004/12/24 17:06:58 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -183,7 +183,7 @@ KiAcquireSpinLock(PKSPIN_LOCK SpinLock) KEBUGCHECK(0); } - while ((i = InterlockedExchange((LONG *)SpinLock, 1)) == 1) + while ((i = InterlockedExchangeUL(SpinLock, 1)) == 1) { #ifndef MP DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock, i); @@ -218,7 +218,7 @@ KiReleaseSpinLock(PKSPIN_LOCK SpinLock) DbgPrint("Releasing unacquired spinlock %x\n", SpinLock); KEBUGCHECK(0); } - (void)InterlockedExchange((LONG *)SpinLock, 0); + (void)InterlockedExchangeUL(SpinLock, 0); } /* EOF */ diff --git a/reactos/ntoskrnl/ke/timer.c b/reactos/ntoskrnl/ke/timer.c index 5911f931891..206d17da0da 100644 --- a/reactos/ntoskrnl/ke/timer.c +++ b/reactos/ntoskrnl/ke/timer.c @@ -1,4 +1,4 @@ -/* $Id: timer.c,v 1.92 2004/11/28 12:59:00 ekohl Exp $ +/* $Id: timer.c,v 1.93 2004/12/24 17:06:58 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -712,8 +712,8 @@ KeUpdateRunTime( if (TrapFrame->Cs & 0x1 || TrapFrame->Eflags & X86_EFLAGS_VM) { - InterlockedIncrement((PLONG)&CurrentThread->UserTime); - InterlockedIncrement((PLONG)&CurrentProcess->UserTime); + InterlockedIncrementUL(&CurrentThread->UserTime); + InterlockedIncrementUL(&CurrentProcess->UserTime); Pcr->PrcbData.UserTime++; } else @@ -728,8 +728,8 @@ KeUpdateRunTime( } else { - InterlockedIncrement((PLONG)&CurrentThread->KernelTime); - InterlockedIncrement((PLONG)&CurrentProcess->KernelTime); + InterlockedIncrementUL(&CurrentThread->KernelTime); + InterlockedIncrementUL(&CurrentProcess->KernelTime); Pcr->PrcbData.KernelTime++; } } diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index c0f421715c7..8fa49d4d1f6 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -1,4 +1,4 @@ -/* $Id: loader.c,v 1.151 2004/11/13 13:09:07 weiden Exp $ +/* $Id: loader.c,v 1.152 2004/12/24 17:06:59 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1157,7 +1157,7 @@ LdrPEFixupForward(PCHAR ForwardName) CPRINT("LdrPEFixupForward: failed to find module %s\n", NameBuffer); return NULL; } - return LdrPEGetExportByName(ModuleObject->Base, p+1, 0xffff); + return LdrPEGetExportByName(ModuleObject->Base, (PUCHAR)(p+1), 0xffff); } static NTSTATUS @@ -1377,7 +1377,7 @@ LdrPEGetExportByName(PVOID BaseAddress, if (Hint < ExportDir->NumberOfNames) { ExName = RVA(BaseAddress, ExNames[Hint]); - if (strcmp(ExName, SymbolName) == 0) + if (strcmp(ExName, (PCHAR)SymbolName) == 0) { Ordinal = ExOrdinals[Hint]; Function = RVA(BaseAddress, ExFunctions[Ordinal]); @@ -1412,7 +1412,7 @@ LdrPEGetExportByName(PVOID BaseAddress, mid = (minn + maxn) / 2; ExName = RVA(BaseAddress, ExNames[mid]); - res = strcmp(ExName, SymbolName); + res = strcmp(ExName, (PCHAR)SymbolName); if (res == 0) { Ordinal = ExOrdinals[mid]; @@ -1455,7 +1455,7 @@ LdrPEGetExportByName(PVOID BaseAddress, for (i = 0; i < ExportDir->NumberOfNames; i++) { ExName = RVA(BaseAddress, ExNames[i]); - if (strcmp(ExName,SymbolName) == 0) + if (strcmp(ExName, (PCHAR)SymbolName) == 0) { Ordinal = ExOrdinals[i]; Function = RVA(BaseAddress, ExFunctions[Ordinal]); diff --git a/reactos/ntoskrnl/lpc/reply.c b/reactos/ntoskrnl/lpc/reply.c index abfdf5c6383..b3c2010b37b 100644 --- a/reactos/ntoskrnl/lpc/reply.c +++ b/reactos/ntoskrnl/lpc/reply.c @@ -1,4 +1,4 @@ -/* $Id: reply.c,v 1.23 2004/10/31 20:27:08 ea Exp $ +/* $Id: reply.c,v 1.24 2004/12/24 17:06:59 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -56,7 +56,7 @@ EiReplyOrRequestPort (IN PEPORT Port, MessageReply->Message.ClientId.UniqueProcess = PsGetCurrentProcessId(); MessageReply->Message.ClientId.UniqueThread = PsGetCurrentThreadId(); MessageReply->Message.MessageType = MessageType; - MessageReply->Message.MessageId = InterlockedIncrement((LONG *)&LpcpNextMessageId); + MessageReply->Message.MessageId = InterlockedIncrementUL(&LpcpNextMessageId); KeAcquireSpinLock(&Port->Lock, &oldIrql); EiEnqueueMessagePort(Port, MessageReply); diff --git a/reactos/ntoskrnl/mm/RPoolMgr.h b/reactos/ntoskrnl/mm/RPoolMgr.h index 379f13a33de..17477fd8ef0 100644 --- a/reactos/ntoskrnl/mm/RPoolMgr.h +++ b/reactos/ntoskrnl/mm/RPoolMgr.h @@ -1,4 +1,4 @@ -/* $Id: RPoolMgr.h,v 1.3 2004/12/21 04:05:18 royce Exp $ +/* $Id: RPoolMgr.h,v 1.4 2004/12/24 17:06:59 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -354,8 +354,8 @@ RiBadBlock ( PR_USED pUsed, char* Addr, const char* violation, const char* file, if ( printzone ) { - unsigned char* HiZone = Addr + pUsed->UserSize; - unsigned char* LoZone = Addr - R_RZ; // this is to simplify indexing below... + unsigned char* HiZone = (unsigned char*)Addr + pUsed->UserSize; + unsigned char* LoZone = (unsigned char*)Addr - R_RZ; // this is to simplify indexing below... R_DEBUG ( ", LoZone " ); for ( i = 0; i < R_RZ; i++ ) R_DEBUG ( "%02x", LoZone[i] ); @@ -414,8 +414,8 @@ RUsedRedZoneCheck ( PR_POOL pool, PR_USED pUsed, char* Addr, const char* file, i { RiBadBlock ( pUsed, Addr, "invalid user size", file, line, 0 ); } - HiZone = Addr + pUsed->UserSize; - LoZone = Addr - R_RZ; // this is to simplify indexing below... + HiZone = (unsigned char*)Addr + pUsed->UserSize; + LoZone = (unsigned char*)Addr - R_RZ; // this is to simplify indexing below... for ( i = 0; i < R_RZ && bLow && bHigh; i++ ) { bLow = bLow && ( LoZone[i] == R_RZ_LOVALUE ); diff --git a/reactos/ntoskrnl/mm/balance.c b/reactos/ntoskrnl/mm/balance.c index 8330e9acec1..aafd2df1178 100644 --- a/reactos/ntoskrnl/mm/balance.c +++ b/reactos/ntoskrnl/mm/balance.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: balance.c,v 1.33 2004/08/15 16:39:06 chorns Exp $ +/* $Id: balance.c,v 1.34 2004/12/24 17:06:59 navaraf Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/balance.c @@ -110,7 +110,7 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PFN_TYPE Page) KeAcquireSpinLock(&AllocationListLock, &oldIrql); if (MmGetReferenceCountPage(Page) == 1) { - InterlockedDecrement((LONG *)&MiMemoryConsumers[Consumer].PagesUsed); + InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed); if (IsListEmpty(&AllocationListHead) || MmStats.NrFreePages < MiMinimumAvailablePages) { KeReleaseSpinLock(&AllocationListLock, oldIrql); @@ -196,13 +196,13 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, /* * Make sure we don't exceed our individual target. */ - OldUsed = InterlockedIncrement((LONG *)&MiMemoryConsumers[Consumer].PagesUsed); + OldUsed = InterlockedIncrementUL(&MiMemoryConsumers[Consumer].PagesUsed); if (OldUsed >= (MiMemoryConsumers[Consumer].PagesTarget - 1) && !MiIsBalancerThread()) { if (!CanWait) { - InterlockedDecrement((LONG *)&MiMemoryConsumers[Consumer].PagesUsed); + InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed); return(STATUS_NO_MEMORY); } MiTrimMemoryConsumer(Consumer); @@ -236,7 +236,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, if (!CanWait) { - InterlockedDecrement((LONG *)&MiMemoryConsumers[Consumer].PagesUsed); + InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed); return(STATUS_NO_MEMORY); } @@ -244,7 +244,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, Request.Page = 0; KeInitializeEvent(&Request.Event, NotificationEvent, FALSE); - InterlockedIncrement((LONG *)&MiPagesRequired); + InterlockedIncrementUL(&MiPagesRequired); KeAcquireSpinLock(&AllocationListLock, &oldIrql); @@ -268,7 +268,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait, } MmTransferOwnershipPage(Page, Consumer); *AllocatedPage = Page; - InterlockedDecrement((LONG *)&MiPagesRequired); + InterlockedDecrementUL(&MiPagesRequired); return(STATUS_SUCCESS); } diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index e5e0ff6e2b8..7cc2ffd9989 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: page.c,v 1.78 2004/11/27 16:37:52 hbirr Exp $ +/* $Id: page.c,v 1.79 2004/12/24 17:07:00 navaraf Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/i386/page.c @@ -426,7 +426,7 @@ VOID MmDeletePageTable(PEPROCESS Process, PVOID Address) if (Ke386Pae) { ULONGLONG ZeroPde = 0LL; - ExfpInterlockedExchange64(PAE_ADDR_TO_PDE(Address), &ZeroPde); + ExfpInterlockedExchange64UL(PAE_ADDR_TO_PDE(Address), &ZeroPde); } else { @@ -470,7 +470,7 @@ VOID MmFreePageTable(PEPROCESS Process, PVOID Address) } } Pfn = PAE_PTE_TO_PFN(*(PAE_ADDR_TO_PDE(Address))); - ExfpInterlockedExchange64(PAE_ADDR_TO_PDE(Address), &ZeroPte); + ExfpInterlockedExchange64UL(PAE_ADDR_TO_PDE(Address), &ZeroPte); } else { @@ -536,7 +536,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create) KEBUGCHECK(0); } PageDir += PAE_ADDR_TO_PDE_PAGE_OFFSET(Address); - Entry = ExfInterlockedCompareExchange64(PageDir, &ZeroEntry, &ZeroEntry); + Entry = ExfInterlockedCompareExchange64UL(PageDir, &ZeroEntry, &ZeroEntry); if (Entry == 0LL) { if (Create == FALSE) @@ -550,7 +550,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create) KEBUGCHECK(0); } Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER; - Entry = ExfInterlockedCompareExchange64(PageDir, &Entry, &ZeroEntry); + Entry = ExfInterlockedCompareExchange64UL(PageDir, &Entry, &ZeroEntry); if (Entry != 0LL) { MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); @@ -570,7 +570,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create) return Pt + PAE_ADDR_TO_PTE_OFFSET(Address); } PageDir = PAE_ADDR_TO_PDE(Address); - if (0LL == ExfInterlockedCompareExchange64(PageDir, &ZeroEntry, &ZeroEntry)) + if (0LL == ExfInterlockedCompareExchange64UL(PageDir, &ZeroEntry, &ZeroEntry)) { if (Address >= (PVOID)KERNEL_BASE) { @@ -590,12 +590,12 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create) { Entry |= PA_GLOBAL; } - if (0LL != ExfInterlockedCompareExchange64(&MmGlobalKernelPageDirectoryForPAE[PAE_ADDR_TO_PDE_OFFSET(Address)], &Entry, &ZeroEntry)) + if (0LL != ExfInterlockedCompareExchange64UL(&MmGlobalKernelPageDirectoryForPAE[PAE_ADDR_TO_PDE_OFFSET(Address)], &Entry, &ZeroEntry)) { MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); } } - ExfInterlockedCompareExchange64(PageDir, &MmGlobalKernelPageDirectoryForPAE[PAE_ADDR_TO_PDE_OFFSET(Address)], &ZeroEntry); + ExfInterlockedCompareExchange64UL(PageDir, &MmGlobalKernelPageDirectoryForPAE[PAE_ADDR_TO_PDE_OFFSET(Address)], &ZeroEntry); } else { @@ -609,7 +609,7 @@ MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create) KEBUGCHECK(0); } Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER; - Entry = ExfInterlockedCompareExchange64(PageDir, &Entry, &ZeroEntry); + Entry = ExfInterlockedCompareExchange64UL(PageDir, &Entry, &ZeroEntry); if (Entry != 0LL) { MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); @@ -647,7 +647,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) { KEBUGCHECK(0); } - Entry = InterlockedCompareExchange(&PageDir[PdeOffset], PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); + Entry = InterlockedCompareExchangeUL(&PageDir[PdeOffset], PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); if (Entry != 0) { MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); @@ -687,7 +687,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) { Entry |= PA_GLOBAL; } - if(0 != InterlockedCompareExchange(&MmGlobalKernelPageDirectory[PdeOffset], Entry, 0)) + if(0 != InterlockedCompareExchangeUL(&MmGlobalKernelPageDirectory[PdeOffset], Entry, 0)) { MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); } @@ -705,7 +705,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) { KEBUGCHECK(0); } - Entry = InterlockedCompareExchange(PageDir, PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); + Entry = InterlockedCompareExchangeUL(PageDir, PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); if (Entry != 0) { MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn); @@ -820,7 +820,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOL* WasDirty, PPFN_T { Pte = *Pt; tmpPte = Pte & ~PA_PRESENT; - } while (Pte != ExfInterlockedCompareExchange64(Pt, &tmpPte, &Pte)); + } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); MiFlushTlb((PULONG)Pt, Address); WasValid = PAE_PAGE_MASK(Pte) != 0LL ? TRUE : FALSE; @@ -857,7 +857,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOL* WasDirty, PPFN_T do { Pte = *Pt; - } while (Pte != InterlockedCompareExchange(Pt, Pte & ~PA_PRESENT, Pte)); + } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_PRESENT, Pte)); MiFlushTlb(Pt, Address); WasValid = (PAGE_MASK(Pte) != 0); @@ -893,7 +893,7 @@ MmRawDeleteVirtualMapping(PVOID Address) /* * Set the entry to zero */ - ExfpInterlockedExchange64(Pt, &ZeroPte); + ExfpInterlockedExchange64UL(Pt, &ZeroPte); MiFlushTlb((PULONG)Pt, Address); } } @@ -948,7 +948,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage, * Atomically set the entry to zero and get the old value. */ Pte = 0LL; - Pte = ExfpInterlockedExchange64(Pt, &Pte); + Pte = ExfpInterlockedExchange64UL(Pt, &Pte); MiFlushTlb((PULONG)Pt, Address); @@ -1003,7 +1003,7 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage, /* * Atomically set the entry to zero and get the old value. */ - Pte = InterlockedExchange(Pt, 0); + Pte = InterlockedExchangeUL(Pt, 0); MiFlushTlb(Pt, Address); @@ -1079,7 +1079,7 @@ MmDeletePageFileMapping(PEPROCESS Process, PVOID Address, * Atomically set the entry to zero and get the old value. */ Pte = 0LL; - Pte = ExfpInterlockedExchange64(Pt, &Pte); + Pte = ExfpInterlockedExchange64UL(Pt, &Pte); MiFlushTlb((PULONG)Pt, Address); @@ -1123,7 +1123,7 @@ MmDeletePageFileMapping(PEPROCESS Process, PVOID Address, /* * Atomically set the entry to zero and get the old value. */ - Pte = InterlockedExchange(Pt, 0); + Pte = InterlockedExchangeUL(Pt, 0); MiFlushTlb(Pt, Address); @@ -1230,7 +1230,7 @@ MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address) { Pte = *Pt; tmpPte = Pte & ~PA_ACCESSED; - } while (Pte != ExfInterlockedCompareExchange64(Pt, &tmpPte, &Pte)); + } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); if (Pte & PA_ACCESSED) { @@ -1257,7 +1257,7 @@ MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address) do { Pte = *Pt; - } while (Pte != InterlockedCompareExchange(Pt, Pte & ~PA_ACCESSED, Pte)); + } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_ACCESSED, Pte)); if (Pte & PA_ACCESSED) { @@ -1296,7 +1296,7 @@ VOID MmSetCleanPage(PEPROCESS Process, PVOID Address) { Pte = *Pt; tmpPte = Pte & ~PA_DIRTY; - } while (Pte != ExfInterlockedCompareExchange64(Pt, &tmpPte, &Pte)); + } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); if (Pte & PA_DIRTY) { @@ -1322,7 +1322,7 @@ VOID MmSetCleanPage(PEPROCESS Process, PVOID Address) do { Pte = *Pt; - } while (Pte != InterlockedCompareExchange(Pt, Pte & ~PA_DIRTY, Pte)); + } while (Pte != InterlockedCompareExchangeUL(Pt, Pte & ~PA_DIRTY, Pte)); if (Pte & PA_DIRTY) { @@ -1358,7 +1358,7 @@ VOID MmSetDirtyPage(PEPROCESS Process, PVOID Address) { Pte = *Pt; tmpPte = Pte | PA_DIRTY; - } while (Pte != ExfInterlockedCompareExchange64(Pt, &tmpPte, &Pte)); + } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); if (!(Pte & PA_DIRTY)) { MiFlushTlb((PULONG)Pt, Address); @@ -1382,7 +1382,7 @@ VOID MmSetDirtyPage(PEPROCESS Process, PVOID Address) do { Pte = *Pt; - } while (Pte != InterlockedCompareExchange(Pt, Pte | PA_DIRTY, Pte)); + } while (Pte != InterlockedCompareExchangeUL(Pt, Pte | PA_DIRTY, Pte)); if (!(Pte & PA_DIRTY)) { MiFlushTlb(Pt, Address); @@ -1412,7 +1412,7 @@ VOID MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) { Pte = *Pt; tmpPte = Pte | PA_PRESENT; - } while (Pte != ExfInterlockedCompareExchange64(Pt, &tmpPte, &Pte)); + } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); if (!(Pte & PA_PRESENT)) { MiFlushTlb((PULONG)Pt, Address); @@ -1436,7 +1436,7 @@ VOID MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) do { Pte = *Pt; - } while (Pte != InterlockedCompareExchange(Pt, Pte | PA_PRESENT, Pte)); + } while (Pte != InterlockedCompareExchangeUL(Pt, Pte | PA_PRESENT, Pte)); if (!(Pte & PA_PRESENT)) { MiFlushTlb(Pt, Address); @@ -1546,7 +1546,7 @@ MmCreateVirtualMappingForKernel(PVOID Address, { Pte |= 0x8000000000000000LL; } - Pte = ExfpInterlockedExchange64(Pt, &Pte); + Pte = ExfpInterlockedExchange64UL(Pt, &Pte); if (Pte != 0LL) { KEBUGCHECK(0); @@ -1635,7 +1635,7 @@ MmCreatePageFileMapping(PEPROCESS Process, KEBUGCHECK(0); } tmpPte = SwapEntry << 1; - Pte = ExfpInterlockedExchange64(Pt, &tmpPte); + Pte = ExfpInterlockedExchange64UL(Pt, &tmpPte); if (PAE_PAGE_MASK((Pte)) != 0) { MmMarkPageUnmapped(PAE_PTE_TO_PFN((Pte))); @@ -1793,7 +1793,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, { tmpPte |= 0x8000000000000000LL; } - Pte = ExfpInterlockedExchange64(Pt, &tmpPte); + Pte = ExfpInterlockedExchange64UL(Pt, &tmpPte); if (PAE_PAGE_MASK((Pte)) != 0LL && !((Pte) & PA_PRESENT)) { KEBUGCHECK(0); @@ -2014,7 +2014,7 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect) { tmpPte &= ~0x8000000000000000LL; } - } while (Pte != ExfInterlockedCompareExchange64(Pt, &tmpPte, &Pte)); + } while (Pte != ExfInterlockedCompareExchange64UL(Pt, &tmpPte, &Pte)); MiFlushTlb((PULONG)Pt, Address); } @@ -2124,7 +2124,7 @@ VOID MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) { if (i * 512 + Offset < PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) || i * 512 + Offset >= PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP)+4) { - ExfInterlockedCompareExchange64(&Pde[Offset], &MmGlobalKernelPageDirectoryForPAE[i*512 + Offset], &ZeroPde); + ExfInterlockedCompareExchange64UL(&Pde[Offset], &MmGlobalKernelPageDirectoryForPAE[i*512 + Offset], &ZeroPde); } } MmUnmapPageTable((PULONG)Pde); @@ -2148,7 +2148,7 @@ VOID MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) { if (Offset != ADDR_TO_PDE_OFFSET(PAGETABLE_MAP)) { - InterlockedCompareExchange(&Pde[Offset], MmGlobalKernelPageDirectory[Offset], 0); + InterlockedCompareExchangeUL(&Pde[Offset], MmGlobalKernelPageDirectory[Offset], 0); } } if (Pde != (PULONG)PAGEDIRECTORY_MAP) @@ -2170,7 +2170,7 @@ MmInitGlobalKernelPageDirectory(VOID) if ((i < PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) || i >= PAE_ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) + 4) && 0LL == MmGlobalKernelPageDirectoryForPAE[i] && 0LL != CurrentPageDirectory[i]) { - ExfpInterlockedExchange64(&MmGlobalKernelPageDirectoryForPAE[i], &CurrentPageDirectory[i]); + ExfpInterlockedExchange64UL(&MmGlobalKernelPageDirectoryForPAE[i], &CurrentPageDirectory[i]); if (Ke386GlobalPagesEnabled) { MmGlobalKernelPageDirectoryForPAE[i] |= PA_GLOBAL; diff --git a/reactos/ntoskrnl/mm/pageop.c b/reactos/ntoskrnl/mm/pageop.c index 3eaa7b85173..3fb820607b1 100644 --- a/reactos/ntoskrnl/mm/pageop.c +++ b/reactos/ntoskrnl/mm/pageop.c @@ -1,4 +1,4 @@ -/* $Id: pageop.c,v 1.21 2004/08/15 16:39:08 chorns Exp $ +/* $Id: pageop.c,v 1.22 2004/12/24 17:06:59 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -42,7 +42,7 @@ MmReleasePageOp(PMM_PAGEOP PageOp) KeReleaseSpinLock(&MmPageOpHashTableLock, oldIrql); return; } - InterlockedDecrement((LONG *)&PageOp->MArea->PageOpCount); + InterlockedDecrementUL(&PageOp->MArea->PageOpCount); PrevPageOp = MmPageOpHashTable[PageOp->Hash]; if (PrevPageOp == PageOp) { @@ -230,7 +230,7 @@ MmGetPageOp(PMEMORY_AREA MArea, ULONG Pid, PVOID Address, PageOp->MArea = MArea; KeInitializeEvent(&PageOp->CompletionEvent, NotificationEvent, FALSE); MmPageOpHashTable[Hash] = PageOp; - InterlockedIncrement((LONG *)&MArea->PageOpCount); + InterlockedIncrementUL(&MArea->PageOpCount); KeReleaseSpinLock(&MmPageOpHashTableLock, oldIrql); return(PageOp); diff --git a/reactos/ntoskrnl/mm/rmap.c b/reactos/ntoskrnl/mm/rmap.c index c4a21df1966..2084ba50f3b 100644 --- a/reactos/ntoskrnl/mm/rmap.c +++ b/reactos/ntoskrnl/mm/rmap.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: rmap.c,v 1.31 2004/10/02 10:16:10 hbirr Exp $ +/* $Id: rmap.c,v 1.32 2004/12/24 17:06:59 navaraf Exp $ * * COPYRIGHT: See COPYING in the top directory * PROJECT: ReactOS kernel @@ -423,7 +423,7 @@ MmInsertRmap(PFN_TYPE Page, PEPROCESS Process, } if (Process) { - PrevSize = InterlockedExchangeAdd(&Process->Vm.WorkingSetSize, PAGE_SIZE); + PrevSize = InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, PAGE_SIZE); if (PrevSize >= Process->Vm.PeakWorkingSetSize) { Process->Vm.PeakWorkingSetSize = PrevSize + PAGE_SIZE; @@ -465,7 +465,7 @@ MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context, } if (Process) { - InterlockedExchangeAdd(&Process->Vm.WorkingSetSize, -PAGE_SIZE); + InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, -PAGE_SIZE); } } ExReleaseFastMutex(&RmapListLock); @@ -501,7 +501,7 @@ MmDeleteRmap(PFN_TYPE Page, PEPROCESS Process, } if (Process) { - InterlockedExchangeAdd(&Process->Vm.WorkingSetSize, -PAGE_SIZE); + InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, -PAGE_SIZE); } return; } diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 6736942b241..05148de1701 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: section.c,v 1.167 2004/12/19 16:16:58 navaraf Exp $ +/* $Id: section.c,v 1.168 2004/12/24 17:06:59 navaraf Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/section.c @@ -2026,7 +2026,7 @@ MmpDeleteSection(PVOID ObjectBody) { MmLockSectionSegment(&SectionSegments[i]); } - RefCount = InterlockedDecrement((LONG *)&SectionSegments[i].ReferenceCount); + RefCount = InterlockedDecrementUL(&SectionSegments[i].ReferenceCount); if (SectionSegments[i].Characteristics & IMAGE_SECTION_CHAR_SHARED) { if (RefCount == 0) @@ -2055,7 +2055,7 @@ MmpDeleteSection(PVOID ObjectBody) } else { - InterlockedDecrement((LONG *)&Section->Segment->ReferenceCount); + InterlockedDecrementUL(&Section->Segment->ReferenceCount); } } if (Section->FileObject != NULL) @@ -2468,7 +2468,7 @@ MmCreateDataFileSection(PSECTION_OBJECT *SectionObject, (PMM_SECTION_SEGMENT)FileObject->SectionObjectPointer-> DataSectionObject; Section->Segment = Segment; - InterlockedIncrement((PLONG)&Segment->ReferenceCount); + InterlockedIncrementUL(&Segment->ReferenceCount); MmLockSectionSegment(Segment); if (MaximumSize.u.LowPart > Segment->RawLength && @@ -2818,8 +2818,8 @@ MmCreateImageSection(PSECTION_OBJECT *SectionObject, ExInitializeFastMutex(&SectionSegments[i].Lock); RtlZeroMemory(&SectionSegments[i].PageDirectory, sizeof(SECTION_PAGE_DIRECTORY)); } - if (0 != InterlockedCompareExchange((PLONG)&FileObject->SectionObjectPointer->ImageSectionObject, - (LONG)ImageSectionObject, 0)) + if (0 != InterlockedCompareExchangeUL(&FileObject->SectionObjectPointer->ImageSectionObject, + ImageSectionObject, 0)) { /* * An other thread has initialized the some image in the background @@ -2831,7 +2831,7 @@ MmCreateImageSection(PSECTION_OBJECT *SectionObject, for (i = 0; i < NrSegments; i++) { - InterlockedIncrement((LONG *)&SectionSegments[i].ReferenceCount); + InterlockedIncrementUL(&SectionSegments[i].ReferenceCount); } } ExFreePool(ImageSections); @@ -2897,7 +2897,7 @@ MmCreateImageSection(PSECTION_OBJECT *SectionObject, */ for (i = 0; i < NrSegments; i++) { - InterlockedIncrement((LONG *)&SectionSegments[i].ReferenceCount); + InterlockedIncrementUL(&SectionSegments[i].ReferenceCount); } } diff --git a/reactos/ntoskrnl/ps/job.c b/reactos/ntoskrnl/ps/job.c index 109c64c567a..6401ce4e2f0 100644 --- a/reactos/ntoskrnl/ps/job.c +++ b/reactos/ntoskrnl/ps/job.c @@ -265,7 +265,7 @@ PsSetJobUIRestrictionsClass(PEJOB Job, ULONG UIRestrictionsClass) { ASSERT(Job); - InterlockedExchange((LONG*)&Job->UIRestrictionsClass, (LONG)UIRestrictionsClass); + InterlockedExchangeUL(&Job->UIRestrictionsClass, UIRestrictionsClass); /* FIXME - walk through the job process list and update the restrictions? */ } diff --git a/reactos/ntoskrnl/ps/kill.c b/reactos/ntoskrnl/ps/kill.c index 984ed780227..33b0209cb66 100644 --- a/reactos/ntoskrnl/ps/kill.c +++ b/reactos/ntoskrnl/ps/kill.c @@ -1,4 +1,4 @@ -/* $Id: kill.c,v 1.90 2004/12/12 17:25:52 hbirr Exp $ +/* $Id: kill.c,v 1.91 2004/12/24 17:07:00 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -300,8 +300,8 @@ PiTerminateProcess(PEPROCESS Process, ObGetObjectHandleCount(Process)); ObReferenceObject(Process); - if (InterlockedExchange((PLONG)&Process->Pcb.State, - PROCESS_STATE_TERMINATED) == + if (InterlockedExchangeUL(&Process->Pcb.State, + PROCESS_STATE_TERMINATED) == PROCESS_STATE_TERMINATED) { ObDereferenceObject(Process); diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 727bf63e84f..04b49d3291c 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.159 2004/12/18 21:06:25 gvg Exp $ +/* $Id: process.c,v 1.160 2004/12/24 17:07:00 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -333,7 +333,7 @@ PsInitProcessManagment(VOID) #endif PsInitialSystemProcess->UniqueProcessId = - InterlockedIncrement((LONG *)&PiNextProcessUniqueId); /* TODO */ + InterlockedIncrementUL(&PiNextProcessUniqueId); /* TODO */ PsInitialSystemProcess->Win32WindowStation = (HANDLE)0; KeAcquireSpinLock(&PsProcessListLock, &oldIrql); @@ -714,7 +714,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, KProcess->AutoAlignment = 0; MmInitializeAddressSpace(Process, &Process->AddressSpace); - Process->UniqueProcessId = InterlockedIncrement((LONG *)&PiNextProcessUniqueId); /* TODO */ + Process->UniqueProcessId = InterlockedIncrementUL(&PiNextProcessUniqueId); /* TODO */ Process->InheritedFromUniqueProcessId = (HANDLE)pParentProcess->UniqueProcessId; ObCreateHandleTable(pParentProcess, @@ -2251,12 +2251,12 @@ PsLockProcess(PEPROCESS Process, BOOL Timeout) return STATUS_PROCESS_IS_TERMINATING; } - /* FIXME - why don't we have InterlockedCompareExchangePointer in ntoskrnl?! */ - PrevLockOwner = (PKTHREAD)InterlockedCompareExchange((LONG*)&Process->LockOwner, (LONG)CallingThread, (LONG)NULL); + PrevLockOwner = (PKTHREAD)InterlockedCompareExchangePointer( + &Process->LockOwner, CallingThread, NULL); if(PrevLockOwner == NULL || PrevLockOwner == CallingThread) { /* we got the lock or already locked it */ - if(InterlockedIncrement((LONG*)&Process->LockCount) == 1) + if(InterlockedIncrementUL(&Process->LockCount) == 1) { KeClearEvent(&Process->LockEvent); } @@ -2293,10 +2293,9 @@ PsUnlockProcess(PEPROCESS Process) { ASSERT(Process->LockOwner == KeGetCurrentThread()); - if(InterlockedDecrement((LONG*)&Process->LockCount) == 0) + if(InterlockedDecrementUL(&Process->LockCount) == 0) { - /* FIXME - why don't we have InterlockedExchangePointer in ntoskrnl?! */ - InterlockedExchange((LONG*)&Process->LockOwner, (LONG)NULL); + InterlockedExchangePointer(&Process->LockOwner, NULL); KeSetEvent(&Process->LockEvent, IO_NO_INCREMENT, FALSE); }