Merge from amd64-branch:

34969 Some ULONG / SIZE_T fixes, handle amd64 in PspCreateThread
34986 Fix several 64 bit issues
35968 Fix Size parameter of CmpAllpcate (ULONG->SIZE_T).
35970 Fix pointer <-> ULONG cast
35971 Fix pointer <-> ULONG cast fixes
36332 fix 64 bit warnings
37435 Fix several ULONG/ULONG_PTR issues. Add a parameter to DefaultQueryInfoBufferCheck for ULONG_PTR/SIZE_T ResultLength
39522 ExInitializeSystemlookasideList: Use InitializeSListHead instead of directly accessing the members. ExpAllocateLocallyUniqueId: use InterlockedCompareExchange64 instead of non-portable ExfInterlockedCompareExchange64
37433 fix InterlockedExchangePointer usage
38105 Use KeGetCurrentPrcb() instead of KeGetPcr()->Prcb / KeGetPcr()->CurrentPrcb
39160 Use wbinvd instruction for amd64, too.

svn path=/trunk/; revision=45066
This commit is contained in:
Timo Kreuzer 2010-01-13 22:35:43 +00:00
parent 0206768d44
commit f9868fc771
35 changed files with 109 additions and 88 deletions

View file

@ -615,7 +615,7 @@ CcZeroData (IN PFILE_OBJECT FileObject,
{
CurrentLength = Length;
}
MmInitializeMdl(Mdl, (PVOID)WriteOffset.u.LowPart, CurrentLength);
MmInitializeMdl(Mdl, (PVOID)(ULONG_PTR)WriteOffset.QuadPart, CurrentLength);
Mdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
for (i = 0; i < ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG)); i++)
{

View file

@ -1054,7 +1054,7 @@ EnlistKeyBodyWithKCB(IN PCM_KEY_BODY KeyBody,
for (i = 0; i < 4; i++)
{
/* Add it into the list */
if (!InterlockedCompareExchangePointer(&KeyBody->KeyControlBlock->
if (!InterlockedCompareExchangePointer((PVOID*)&KeyBody->KeyControlBlock->
KeyBodyArray[i],
KeyBody,
NULL))
@ -1110,7 +1110,7 @@ DelistKeyBodyFromKCB(IN PCM_KEY_BODY KeyBody,
for (i = 0; i < 4; i++)
{
/* Add it into the list */
if (InterlockedCompareExchangePointer(&KeyBody->KeyControlBlock->
if (InterlockedCompareExchangePointer((VOID*)&KeyBody->KeyControlBlock->
KeyBodyArray[i],
NULL,
KeyBody) == KeyBody)

View file

@ -1079,7 +1079,7 @@ CmpLoadHiveThread(IN PVOID StartContext)
PAGED_CODE();
/* Get the hive index, make sure it makes sense */
i = (ULONG)StartContext;
i = PtrToUlong(StartContext);
ASSERT(CmpMachineHiveList[i].Name != NULL);
/* We were started */
@ -1274,7 +1274,7 @@ CmpInitializeHiveList(IN USHORT Flag)
0,
NULL,
CmpLoadHiveThread,
(PVOID)i);
UlongToPtr(i));
if (NT_SUCCESS(Status))
{
/* We don't care about the handle -- the thread self-terminates */

View file

@ -51,7 +51,7 @@ CmpCreateEvent(IN EVENT_TYPE EventType,
PVOID
NTAPI
CmpAllocate(IN ULONG Size,
CmpAllocate(IN SIZE_T Size,
IN BOOLEAN Paged,
IN ULONG Tag)
{

View file

@ -331,6 +331,7 @@ NtQueryEvent(IN HANDLE EventHandle,
EventInformation,
EventInformationLength,
ReturnLength,
NULL,
PreviousMode);
if(!NT_SUCCESS(Status))
{

View file

@ -515,7 +515,7 @@ ExpAllocateHandleTableEntrySlow(IN PHANDLE_TABLE HandleTable,
/* Write the new level and attempt to change the table code */
TableBase = ((ULONG_PTR)Mid) | 1;
Value = InterlockedExchangePointer(&HandleTable->TableCode, TableBase);
Value = InterlockedExchangePointer((PVOID*)&HandleTable->TableCode, (PVOID)TableBase);
}
else if (TableLevel == 1)
{
@ -532,7 +532,7 @@ ExpAllocateHandleTableEntrySlow(IN PHANDLE_TABLE HandleTable,
if (!Low) return FALSE;
/* Update the table */
Value = InterlockedExchangePointer(&SecondLevel[i], Low);
Value = InterlockedExchangePointer((PVOID*)&SecondLevel[i], Low);
ASSERT(Value == NULL);
}
else
@ -559,7 +559,7 @@ ExpAllocateHandleTableEntrySlow(IN PHANDLE_TABLE HandleTable,
/* Write the new table and change the table code */
TableBase = ((ULONG_PTR)High) | 2;
Value = InterlockedExchangePointer(&HandleTable->TableCode,
Value = InterlockedExchangePointer((PVOID*)&HandleTable->TableCode,
(PVOID)TableBase);
}
}
@ -580,7 +580,7 @@ ExpAllocateHandleTableEntrySlow(IN PHANDLE_TABLE HandleTable,
if (!Mid) return FALSE;
/* Update the table pointer */
Value = InterlockedExchangePointer(&ThirdLevel[i], Mid);
Value = InterlockedExchangePointer((PVOID*)&ThirdLevel[i], Mid);
ASSERT(Value == NULL);
}
else
@ -595,7 +595,7 @@ ExpAllocateHandleTableEntrySlow(IN PHANDLE_TABLE HandleTable,
if (!Low) return FALSE;
/* Update the table pointer */
Value = InterlockedExchangePointer(&ThirdLevel[i][j], Low);
Value = InterlockedExchangePointer((PVOID*)&ThirdLevel[i][j], Low);
ASSERT(Value == NULL);
}
}
@ -885,8 +885,8 @@ ExpLockHandleTableEntry(IN PHANDLE_TABLE HandleTable,
/* It's not locked, remove the lock bit to lock it */
NewValue = OldValue & ~EXHANDLE_TABLE_ENTRY_LOCK_BIT;
if (InterlockedCompareExchangePointer(&HandleTableEntry->Object,
NewValue,
OldValue) == (PVOID)OldValue)
(PVOID)NewValue,
(PVOID)OldValue) == (PVOID)OldValue)
{
/* We locked it, get out */
return TRUE;
@ -1009,7 +1009,7 @@ ExDestroyHandle(IN PHANDLE_TABLE HandleTable,
}
/* Clear the handle */
Object = InterlockedExchangePointer(&HandleTableEntry->Object, NULL);
Object = InterlockedExchangePointer((PVOID*)&HandleTableEntry->Object, NULL);
/* Sanity checks */
ASSERT(Object != NULL);

View file

@ -387,7 +387,7 @@ ExRaiseHardError(IN NTSTATUS ErrorStatus,
IN ULONG ValidResponseOptions,
OUT PULONG Response)
{
ULONG Size;
SIZE_T Size;
UNICODE_STRING CapturedParams[MAXIMUM_HARDERROR_PARAMETERS];
ULONG i;
PULONG_PTR UserData = NULL, ParameterBase;

View file

@ -68,7 +68,7 @@ PVOID ExpNlsTableBase;
ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
ULONG ExpUnicodeCaseTableDataOffset;
NLSTABLEINFO ExpNlsTableInfo;
ULONG ExpNlsTableSize;
SIZE_T ExpNlsTableSize;
PVOID ExpNlsSectionPointer;
/* CMOS Timer Sanity */
@ -196,7 +196,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
NTSTATUS Status;
HANDLE NlsSection;
PVOID SectionBase = NULL;
ULONG ViewSize = 0;
SIZE_T ViewSize = 0;
LARGE_INTEGER SectionOffset = {{0, 0}};
PLIST_ENTRY ListHead, NextEntry;
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
@ -369,7 +369,7 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
OUT PCHAR *ProcessEnvironment)
{
NTSTATUS Status;
ULONG Size;
SIZE_T Size;
PWSTR p;
UNICODE_STRING NullString = RTL_CONSTANT_STRING(L"");
UNICODE_STRING SmssName, Environment, SystemDriveString, DebugString;
@ -829,7 +829,7 @@ ExpInitializeExecutive(IN ULONG Cpu,
PLDR_DATA_TABLE_ENTRY NtosEntry;
PRTL_MESSAGE_RESOURCE_ENTRY MsgEntry;
ANSI_STRING CsdString;
ULONG Remaining = 0;
SIZE_T Remaining = 0;
PCHAR RcEnd = NULL;
CHAR VersionBuffer [65];
@ -1245,7 +1245,8 @@ Phase1InitializationDiscard(IN PVOID Context)
PCHAR StringBuffer, EndBuffer, BeginBuffer, MpString = "";
PINIT_BUFFER InitBuffer;
ANSI_STRING TempString;
ULONG LastTzBias, Size, Length, YearHack = 0, Disposition, MessageCode = 0;
ULONG LastTzBias, Length, YearHack = 0, Disposition, MessageCode = 0;
SIZE_T Size;
PRTL_USER_PROCESS_INFORMATION ProcessInfo;
KEY_VALUE_PARTIAL_INFORMATION KeyPartialInfo;
UNICODE_STRING KeyName, DebugString;
@ -1325,14 +1326,14 @@ Phase1InitializationDiscard(IN PVOID Context)
StringBuffer = InitBuffer->VersionBuffer;
BeginBuffer = StringBuffer;
EndBuffer = StringBuffer;
Length = 256;
Size = 256;
if (CmCSDVersionString.Length)
{
/* Print the version string */
Status = RtlStringCbPrintfExA(StringBuffer,
255,
&EndBuffer,
&Length,
&Size,
0,
": %wZ",
&CmCSDVersionString);
@ -1345,7 +1346,7 @@ Phase1InitializationDiscard(IN PVOID Context)
else
{
/* No version */
Length = 255;
Size = 255;
}
/* Null-terminate the string */
@ -1369,7 +1370,7 @@ Phase1InitializationDiscard(IN PVOID Context)
{
/* Create the banner message */
Status = RtlStringCbPrintfA(EndBuffer,
Length,
Size,
MsgEntry->Text,
StringBuffer,
NtBuildNumber & 0xFFFF,
@ -1383,7 +1384,7 @@ Phase1InitializationDiscard(IN PVOID Context)
else
{
/* Use hard-coded banner message */
Status = RtlStringCbCopyA(EndBuffer, Length, "REACTOS (R)\n");
Status = RtlStringCbCopyA(EndBuffer, Size, "REACTOS (R)\n");
if (!NT_SUCCESS(Status))
{
/* Bugcheck */

View file

@ -47,9 +47,7 @@ ExInitializeSystemLookasideList(IN PGENERAL_LOOKASIDE List,
List->Depth = 2;
List->Allocate = ExAllocatePoolWithTag;
List->Free = ExFreePool;
List->ListHead.Next.Next = NULL;
List->ListHead.Depth = 0;
List->ListHead.Sequence = 0;
InitializeSListHead(&List->ListHead);
List->TotalAllocates = 0;
List->AllocateHits = 0;
List->TotalFrees = 0;

View file

@ -242,6 +242,7 @@ NtQueryMutant(IN HANDLE MutantHandle,
MutantInformation,
MutantInformationLength,
ResultLength,
NULL,
PreviousMode);
if(!NT_SUCCESS(Status))
{

View file

@ -21,6 +21,12 @@ ULONG ExPushLockSpinCount = 0;
/* PRIVATE FUNCTIONS *********************************************************/
#ifdef _WIN64
#define InterlockedAndPointer(ptr,val) InterlockedAnd64((PLONGLONG)ptr,(LONGLONG)val)
#else
#define InterlockedAndPointer(ptr,val) InterlockedAnd((PLONG)ptr,(LONG)val)
#endif
/*++
* @name ExpInitializePushLocks
*
@ -91,7 +97,7 @@ ExfWakePushLock(PEX_PUSH_LOCK PushLock,
ASSERT(NewValue.Waiting);
/* Write the New Value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value == OldValue.Value) return;
@ -101,7 +107,7 @@ ExfWakePushLock(PEX_PUSH_LOCK PushLock,
}
/* Save the First Block */
FirstWaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)OldValue.Ptr &
FirstWaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)(OldValue.Value &
~EX_PUSH_LOCK_PTR_BITS);
WaitBlock = FirstWaitBlock;
@ -139,7 +145,7 @@ ExfWakePushLock(PEX_PUSH_LOCK PushLock,
ASSERT(!NewValue.Waking);
/* Write the New Value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value == OldValue.Value) break;
@ -158,7 +164,7 @@ ExfWakePushLock(PEX_PUSH_LOCK PushLock,
ASSERT(PushLock->Waiting);
/* Remove waking bit from pushlock */
InterlockedAnd((PLONG)PushLock, ~EX_PUSH_LOCK_WAKING);
InterlockedAndPointer(&PushLock->Value, ~EX_PUSH_LOCK_WAKING);
/* Leave the loop */
break;
@ -240,7 +246,7 @@ ExpOptimizePushLockList(PEX_PUSH_LOCK PushLock,
}
/* Get the wait block */
WaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)OldValue.Ptr &
WaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)(OldValue.Value &
~EX_PUSH_LOCK_PTR_BITS);
/* Loop the blocks */
@ -274,7 +280,7 @@ ExpOptimizePushLockList(PEX_PUSH_LOCK PushLock,
ASSERT(!NewValue.Waking);
/* Update the value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
@ -478,7 +484,7 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
ASSERT(NewValue.Locked);
/* Set the new value */
if (InterlockedCompareExchangePointer(PushLock,
if (InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr) != OldValue.Ptr)
{
@ -508,8 +514,8 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
WaitBlock->ShareCount = 0;
/* Set the current Wait Block pointer */
WaitBlock->Next = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)
OldValue.Ptr &~ EX_PUSH_LOCK_PTR_BITS);
WaitBlock->Next = (PEX_PUSH_LOCK_WAIT_BLOCK)(
OldValue.Value &~ EX_PUSH_LOCK_PTR_BITS);
/* Point to ours */
NewValue.Value = (OldValue.Value & EX_PUSH_LOCK_MULTIPLE_SHARED) |
@ -564,7 +570,7 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
/* Write the new value */
TempValue = NewValue;
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value != OldValue.Value)
@ -663,7 +669,7 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
ASSERT(NewValue.Locked);
/* Set the new value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value != OldValue.Value)
@ -688,8 +694,8 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
if (OldValue.Waiting)
{
/* Set the current Wait Block pointer */
WaitBlock->Next = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)
OldValue.Ptr &~ EX_PUSH_LOCK_PTR_BITS);
WaitBlock->Next = (PEX_PUSH_LOCK_WAIT_BLOCK)(
OldValue.Value &~ EX_PUSH_LOCK_PTR_BITS);
/* Nobody is the last waiter yet */
WaitBlock->Last = NULL;
@ -727,7 +733,7 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
#endif
/* Write the new value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Ptr != OldValue.Ptr)
@ -826,7 +832,7 @@ ExfReleasePushLock(PEX_PUSH_LOCK PushLock)
}
/* Write the New Value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value == OldValue.Value) return;
@ -840,7 +846,7 @@ ExfReleasePushLock(PEX_PUSH_LOCK PushLock)
if (OldValue.MultipleShared)
{
/* Get the wait block */
WaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)OldValue.Ptr &
WaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)(OldValue.Value &
~EX_PUSH_LOCK_PTR_BITS);
/* Loop until we find the last wait block */
@ -893,7 +899,7 @@ ExfReleasePushLock(PEX_PUSH_LOCK PushLock)
ASSERT(NewValue.Waking && !NewValue.Locked && !NewValue.MultipleShared);
/* Write the new value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value == OldValue.Value) return;
@ -913,7 +919,7 @@ ExfReleasePushLock(PEX_PUSH_LOCK PushLock)
/* Write the new value */
WakeValue = NewValue;
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value != OldValue.Value) continue;
@ -966,7 +972,7 @@ ExfReleasePushLockShared(PEX_PUSH_LOCK PushLock)
}
/* Write the New Value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value == OldValue.Value) return;
@ -979,7 +985,7 @@ ExfReleasePushLockShared(PEX_PUSH_LOCK PushLock)
if (OldValue.MultipleShared)
{
/* Get the wait block */
WaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)((ULONG_PTR)OldValue.Ptr &
WaitBlock = (PEX_PUSH_LOCK_WAIT_BLOCK)(OldValue.Value &
~EX_PUSH_LOCK_PTR_BITS);
/* Loop until we find the last wait block */
@ -1029,7 +1035,7 @@ ExfReleasePushLockShared(PEX_PUSH_LOCK PushLock)
ASSERT(NewValue.Waking && !NewValue.Locked && !NewValue.MultipleShared);
/* Write the new value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value == OldValue.Value) return;
@ -1049,7 +1055,7 @@ ExfReleasePushLockShared(PEX_PUSH_LOCK PushLock)
/* Write the new value */
WakeValue = NewValue;
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
if (NewValue.Value != OldValue.Value) continue;
@ -1103,7 +1109,7 @@ ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
/* Write the New Value. Save our original value for waking */
WakeValue = NewValue;
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
@ -1124,7 +1130,7 @@ ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
ASSERT(NewValue.Waking && !NewValue.Waiting);
/* Write the New Value */
NewValue.Ptr = InterlockedCompareExchangePointer(PushLock,
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr);
@ -1168,7 +1174,7 @@ ExfTryToWakePushLock(PEX_PUSH_LOCK PushLock)
NewValue.Waking = TRUE;
/* Write the New Value */
if (InterlockedCompareExchangePointer(PushLock,
if (InterlockedCompareExchangePointer(&PushLock->Ptr,
NewValue.Ptr,
OldValue.Ptr) == OldValue.Ptr)
{

View file

@ -214,7 +214,7 @@ ExpAllocateExclusiveWaiterEvent(IN PERESOURCE Resource,
KeInitializeEvent(Event, SynchronizationEvent, FALSE);
/* Set it */
if (InterlockedCompareExchangePointer(&Resource->ExclusiveWaiters,
if (InterlockedCompareExchangePointer((PVOID*)&Resource->ExclusiveWaiters,
Event,
NULL))
{
@ -274,7 +274,7 @@ ExpAllocateSharedWaiterSemaphore(IN PERESOURCE Resource,
KeInitializeSemaphore(Semaphore, 0, MAXLONG);
/* Set it */
if (InterlockedCompareExchangePointer(&Resource->SharedWaiters,
if (InterlockedCompareExchangePointer((PVOID*)&Resource->SharedWaiters,
Semaphore,
NULL))
{

View file

@ -235,6 +235,7 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
SemaphoreInformation,
SemaphoreInformationLength,
ReturnLength,
NULL,
PreviousMode);
if (!NT_SUCCESS(Status))
{

View file

@ -1113,7 +1113,7 @@ QSI_DEF(SystemHandleInformation)
for (Count = 0; HandleCount > 0 ; HandleCount--)
{
Shi->Handles[i].UniqueProcessId = (USHORT)(ULONG)pr->UniqueProcessId;
Shi->Handles[i].UniqueProcessId = (USHORT)(ULONG_PTR)pr->UniqueProcessId;
Count++;
i++;
}
@ -2023,7 +2023,7 @@ NtFlushInstructionCache(IN HANDLE ProcessHandle,
{
PAGED_CODE();
#if defined(_M_IX86)
#if defined(_M_IX86) || defined(_M_AMD64)
__wbinvd();
#elif defined(_M_PPC)
__asm__ __volatile__("tlbsync");

View file

@ -528,6 +528,7 @@ NtQueryTimer(IN HANDLE TimerHandle,
TimerInformation,
TimerInformationLength,
ReturnLength,
NULL,
PreviousMode);
if (!NT_SUCCESS(Status)) return Status;

View file

@ -147,7 +147,7 @@ ProcessLoop:
TimeoutPointer);
/* Check if we timed out and quit this loop in that case */
if ((NTSTATUS)QueueEntry == STATUS_TIMEOUT) break;
if ((NTSTATUS)(ULONG_PTR)QueueEntry == STATUS_TIMEOUT) break;
/* Increment Processed Work Items */
InterlockedIncrement((PLONG)&WorkQueue->WorkItemsProcessed);
@ -271,7 +271,7 @@ ExpCreateWorkerThread(WORK_QUEUE_TYPE WorkQueueType,
NULL,
NULL,
ExpWorkerThreadEntryPoint,
(PVOID)Context);
UlongToPtr(Context));
/* If the thread is dynamic */
if (Dynamic)

View file

@ -1301,7 +1301,7 @@ CmpCreateEvent(
PVOID
NTAPI
CmpAllocate(
IN ULONG Size,
IN SIZE_T Size,
IN BOOLEAN Paged,
IN ULONG Tag
);

View file

@ -257,7 +257,7 @@ WRMSR(
);
/* Finds a new thread to run */
NTSTATUS
LONG_PTR
FASTCALL
KiSwapThread(
IN PKTHREAD Thread,
@ -641,7 +641,7 @@ VOID
FASTCALL
KiUnwaitThread(
IN PKTHREAD Thread,
IN NTSTATUS WaitStatus,
IN LONG_PTR WaitStatus,
IN KPRIORITY Increment
);

View file

@ -63,6 +63,7 @@ DefaultQueryInfoBufferCheck(ULONG Class,
PVOID Buffer,
ULONG BufferLength,
PULONG ReturnLength,
PULONG_PTR ReturnLengthPtr,
KPROCESSOR_MODE PreviousMode)
{
NTSTATUS Status = STATUS_SUCCESS;
@ -99,6 +100,10 @@ DefaultQueryInfoBufferCheck(ULONG Class,
{
ProbeForWriteUlong(ReturnLength);
}
if (ReturnLengthPtr != NULL)
{
ProbeForWrite(ReturnLengthPtr, sizeof(ULONG_PTR), sizeof(ULONG_PTR));
}
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{

View file

@ -398,6 +398,7 @@ NtQueryIoCompletion(IN HANDLE IoCompletionHandle,
IoCompletionInformation,
IoCompletionInformationLength,
ResultLength,
NULL,
PreviousMode);
if (!NT_SUCCESS(Status)) return Status;
@ -497,11 +498,11 @@ NtRemoveIoCompletion(IN HANDLE IoCompletionHandle,
ListEntry = KeRemoveQueue(Queue, PreviousMode, Timeout);
/* If we got a timeout or user_apc back, return the status */
if (((NTSTATUS)ListEntry == STATUS_TIMEOUT) ||
((NTSTATUS)ListEntry == STATUS_USER_APC))
if (((NTSTATUS)(ULONG_PTR)ListEntry == STATUS_TIMEOUT) ||
((NTSTATUS)(ULONG_PTR)ListEntry == STATUS_USER_APC))
{
/* Set this as the status */
Status = (NTSTATUS)ListEntry;
Status = (NTSTATUS)(ULONG_PTR)ListEntry;
}
else
{

View file

@ -2451,7 +2451,7 @@ NtSetInformationFile(IN HANDLE FileHandle,
/* Set the Data */
Context->Key = CompletionInfo->Key;
Context->Port = Queue;
if (InterlockedCompareExchangePointer(&FileObject->
if (InterlockedCompareExchangePointer((PVOID*)&FileObject->
CompletionContext,
Context,
NULL))

View file

@ -1214,7 +1214,7 @@ IofCompleteRequest(IN PIRP Irp,
if (LastStackPtr->Control & SL_ERROR_RETURNED)
{
/* Get the error code */
ErrorCode = (NTSTATUS)LastStackPtr->Parameters.Others.Argument4;
ErrorCode = PtrToUlong(LastStackPtr->Parameters.Others.Argument4);
}
/* Get the Current Stack and skip it */
@ -1236,7 +1236,7 @@ IofCompleteRequest(IN PIRP Irp,
/* Update the error for the current stack */
ErrorCode = Irp->IoStatus.Status;
StackPtr->Control |= SL_ERROR_RETURNED;
LastStackPtr->Parameters.Others.Argument4 = (PVOID)ErrorCode;
LastStackPtr->Parameters.Others.Argument4 = UlongToPtr(ErrorCode);
LastStackPtr->Control |= SL_ERROR_RETURNED;
}
}
@ -1610,7 +1610,7 @@ NTAPI
IoGetRequestorProcessId(IN PIRP Irp)
{
/* Return the requestor process' id */
return (ULONG)(IoGetRequestorProcess(Irp)->UniqueProcessId);
return PtrToUlong(IoGetRequestorProcess(Irp)->UniqueProcessId);
}
/*
@ -1782,5 +1782,5 @@ NTAPI
IoSetTopLevelIrp(IN PIRP Irp)
{
/* Set the IRP */
PsGetCurrentThread()->TopLevelIrp = (ULONG)Irp;
PsGetCurrentThread()->TopLevelIrp = (ULONG_PTR)Irp;
}

View file

@ -54,7 +54,7 @@ KdpServiceDispatcher(ULONG Service,
#if DBG
case ' soR': /* ROS-INTERNAL */
{
switch ((ULONG)Buffer1)
switch ((ULONG_PTR)Buffer1)
{
case ManualBugCheck:
KeBugCheck(MANUALLY_INITIATED_CRASH);

View file

@ -45,7 +45,7 @@ KdpBochsInit(PKD_DISPATCH_TABLE DispatchTable,
if (BootPhase == 0)
{
Value = READ_PORT_UCHAR(BOCHS_LOGGER_PORT);
if (Value != (ULONG)BOCHS_LOGGER_PORT)
if (Value != (ULONG_PTR)BOCHS_LOGGER_PORT)
{
KdpDebugMode.Bochs = FALSE;
return;

View file

@ -209,6 +209,7 @@ KdbpKdbTrapFrameFromKernelStack(
RtlZeroMemory(KdbTrapFrame, sizeof(KDB_KTRAP_FRAME));
StackPtr = (ULONG_PTR *) KernelStack;
#if _M_X86_
KdbTrapFrame->Tf.Ebp = StackPtr[3];
KdbTrapFrame->Tf.Edi = StackPtr[4];
KdbTrapFrame->Tf.Esi = StackPtr[5];
@ -220,6 +221,7 @@ KdbpKdbTrapFrameFromKernelStack(
KdbTrapFrame->Tf.SegDs = KGDT_R0_DATA;
KdbTrapFrame->Tf.SegEs = KGDT_R0_DATA;
KdbTrapFrame->Tf.SegGs = KGDT_R0_DATA;
#endif
/* FIXME: what about the other registers??? */
}
@ -421,7 +423,7 @@ KdbpStepIntoInstruction(
}
/* Get the interrupt descriptor */
if (!NT_SUCCESS(KdbpSafeReadMemory(IntDesc, (PVOID)(Idtr.Base + (IntVect * 8)), sizeof (IntDesc))))
if (!NT_SUCCESS(KdbpSafeReadMemory(IntDesc, (PVOID)(ULONG_PTR)(Idtr.Base + (IntVect * 8)), sizeof (IntDesc))))
{
/*KdbpPrint("Couldn't access memory at 0x%p\n", (ULONG_PTR)Idtr.Base + (IntVect * 8));*/
return FALSE;
@ -1126,7 +1128,7 @@ KdbpAttachToThread(
/* Get a pointer to the thread */
if (!NT_SUCCESS(PsLookupThreadByThreadId(ThreadId, &Thread)))
{
KdbpPrint("Invalid thread id: 0x%08x\n", (ULONG)ThreadId);
KdbpPrint("Invalid thread id: 0x%08x\n", (ULONG_PTR)ThreadId);
return FALSE;
}
Process = Thread->ThreadsProcess;
@ -1208,7 +1210,7 @@ KdbpAttachToProcess(
/* Get a pointer to the process */
if (!NT_SUCCESS(PsLookupProcessByProcessId(ProcessId, &Process)))
{
KdbpPrint("Invalid process id: 0x%08x\n", (ULONG)ProcessId);
KdbpPrint("Invalid process id: 0x%08x\n", (ULONG_PTR)ProcessId);
return FALSE;
}
@ -1216,7 +1218,7 @@ KdbpAttachToProcess(
ObDereferenceObject(Process);
if (Entry == &KdbCurrentProcess->ThreadListHead)
{
KdbpPrint("No threads in process 0x%08x, cannot attach to process!\n", (ULONG)ProcessId);
KdbpPrint("No threads in process 0x%p, cannot attach to process!\n", ProcessId);
return FALSE;
}
@ -1257,7 +1259,7 @@ KdbpInternalEnter()
SavedStackLimit = Thread->Tcb.StackLimit;
SavedKernelStack = Thread->Tcb.KernelStack;
Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)KdbStack + KDB_STACK_SIZE;
Thread->Tcb.StackLimit = (ULONG)KdbStack;
Thread->Tcb.StackLimit = (ULONG_PTR)KdbStack;
Thread->Tcb.KernelStack = (char*)KdbStack + KDB_STACK_SIZE;
/*KdbpPrint("Switching to KDB stack 0x%08x-0x%08x (Current Stack is 0x%08x)\n", Thread->Tcb.StackLimit, Thread->Tcb.StackBase, Esp);*/

View file

@ -418,10 +418,10 @@ KdbSymProcessSymbols(
KdbpSymAddCachedFile(&LdrEntry->FullDllName, LdrEntry->PatchInformation);
}
DPRINT("Installed symbols: %wZ@%08x-%08x %p\n",
DPRINT("Installed symbols: %wZ@%p-%p %p\n",
&LdrEntry->BaseDllName,
LdrEntry->DllBase,
LdrEntry->SizeOfImage + (ULONG)LdrEntry->DllBase,
(PVOID)(LdrEntry->SizeOfImage + (ULONG_PTR)LdrEntry->DllBase),
LdrEntry->PatchInformation);
}

View file

@ -57,7 +57,7 @@ KiActivateWaiterQueue(IN PKQUEUE Queue)
KWAIT_BLOCK,
WaitListEntry);
Thread = WaitBlock->Thread;
KiUnwaitThread(Thread, (NTSTATUS)QueueEntry, IO_NO_INCREMENT);
KiUnwaitThread(Thread, (LONG_PTR)QueueEntry, IO_NO_INCREMENT);
}
}
}
@ -102,7 +102,7 @@ KiInsertQueue(IN PKQUEUE Queue,
Thread = WaitBlock->Thread;
/* Remove the queue from the thread's wait list */
Thread->WaitStatus = (NTSTATUS)Entry;
Thread->WaitStatus = (LONG_PTR)Entry;
if (Thread->WaitListEntry.Flink) RemoveEntryList(&Thread->WaitListEntry);
/* Increase the active threads and remove any wait reason */
@ -239,7 +239,7 @@ KeRemoveQueue(IN PKQUEUE Queue,
IN PLARGE_INTEGER Timeout OPTIONAL)
{
PLIST_ENTRY QueueEntry;
NTSTATUS Status;
LONG_PTR Status;
PKTHREAD Thread = KeGetCurrentThread();
PKQUEUE PreviousQueue;
PKWAIT_BLOCK WaitBlock = &Thread->WaitBlock[0];

View file

@ -1356,7 +1356,9 @@ KeTerminateThread(IN KPRIORITY Increment)
SavedEntry = Entry;
/* Now try to do the exchange */
Entry = InterlockedCompareExchangePointer(ListHead, ThreadAddr, Entry);
Entry = InterlockedCompareExchangePointer((PVOID*)ListHead,
ThreadAddr,
Entry);
/* Break out if the change was succesful */
} while (Entry != SavedEntry);

View file

@ -334,7 +334,7 @@ KiSelectNextThread(IN PKPRCB Prcb)
return Thread;
}
NTSTATUS
LONG_PTR
FASTCALL
KiSwapThread(IN PKTHREAD CurrentThread,
IN PKPRCB Prcb)

View file

@ -87,7 +87,7 @@ KiUnlinkThread(IN PKTHREAD Thread,
VOID
FASTCALL
KiUnwaitThread(IN PKTHREAD Thread,
IN NTSTATUS WaitStatus,
IN LONG_PTR WaitStatus,
IN KPRIORITY Increment)
{
/* Unlink the thread */

View file

@ -4311,6 +4311,7 @@ NtQuerySection(IN HANDLE SectionHandle,
sizeof(ExSectionInfoClass) / sizeof(ExSectionInfoClass[0]),
SectionInformation,
SectionInformationLength,
NULL,
ResultLength,
PreviousMode);

View file

@ -631,7 +631,7 @@ PsImpersonateClient(IN PETHREAD Thread,
if (!Impersonation) return STATUS_INSUFFICIENT_RESOURCES;
/* Update the pointer */
OldData = InterlockedCompareExchangePointer(&Thread->
OldData = InterlockedCompareExchangePointer((PVOID*)&Thread->
ImpersonationInfo,
Impersonation,
NULL);

View file

@ -138,7 +138,7 @@ SeLocateProcessImageName(IN PEPROCESS Process,
if (NT_SUCCESS(Status))
{
/* Set it */
if (InterlockedCompareExchangePointer(&Process->
if (InterlockedCompareExchangePointer((PVOID*)&Process->
SeAuditProcessCreationInfo.ImageFileName,
AuditName,
NULL))

View file

@ -49,7 +49,7 @@ NTSTATUS
NTAPI
LsaFreeReturnBuffer(PVOID Buffer)
{
ULONG Size = 0;
SIZE_T Size = 0;
return ZwFreeVirtualMemory(NtCurrentProcess(),
&Buffer,
&Size,

View file

@ -870,6 +870,7 @@ NtQueryInformationToken(IN HANDLE TokenHandle,
TokenInformation,
TokenInformationLength,
ReturnLength,
NULL,
PreviousMode);
if(!NT_SUCCESS(Status))