Author: tkreuzer Date: Mon Sep 19 19:31:21 2011 New Revision: 53764
URL: http://svn.reactos.org/svn/reactos?rev=53764&view=rev Log: [RTL] - Fix a number of MSVC/64 bit warnings/problems - Fix return type of RtlpInitializeHeapSegment (by Roel)
Modified: trunk/reactos/lib/rtl/critical.c trunk/reactos/lib/rtl/heap.c trunk/reactos/lib/rtl/heap.h trunk/reactos/lib/rtl/heappage.c trunk/reactos/lib/rtl/registry.c trunk/reactos/lib/rtl/rtlp.h trunk/reactos/lib/rtl/srw.c trunk/reactos/lib/rtl/timerqueue.c trunk/reactos/lib/rtl/timezone.c
Modified: trunk/reactos/lib/rtl/critical.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/critical.c?rev=5376... ============================================================================== --- trunk/reactos/lib/rtl/critical.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/critical.c [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -299,7 +299,7 @@ NTAPI RtlpFreeDebugInfo(PRTL_CRITICAL_SECTION_DEBUG DebugInfo) { - ULONG EntryId; + SIZE_T EntryId;
/* Is it part of our cached entries? */ if ((DebugInfo >= RtlpStaticDebugInfo) && @@ -310,7 +310,7 @@
/* Mark as free */ EntryId = (DebugInfo - RtlpStaticDebugInfo); - DPRINT("Freeing from Buffer: %p. Entry: %lu inside Process: %p\n", + DPRINT("Freeing from Buffer: %p. Entry: %Iu inside Process: %p\n", DebugInfo, EntryId, NtCurrentTeb()->ClientId.UniqueProcess);
Modified: trunk/reactos/lib/rtl/heap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.c?rev=53764&am... ============================================================================== --- trunk/reactos/lib/rtl/heap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heap.c [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -126,7 +126,7 @@ ASSERT(HeaderSize <= PAGE_SIZE);
/* Initialise the Heap Entry header containing the Heap header */ - Heap->Entry.Size = HeaderSize >> HEAP_ENTRY_SHIFT; + Heap->Entry.Size = (USHORT)(HeaderSize >> HEAP_ENTRY_SHIFT); Heap->Entry.Flags = HEAP_ENTRY_BUSY; Heap->Entry.SmallTagIndex = LOBYTE(Heap->Entry.Size) ^ HIBYTE(Heap->Entry.Size) ^ Heap->Entry.Flags; Heap->Entry.PreviousSize = 0; @@ -157,7 +157,7 @@
/* Initialise the Heap validation info */ Heap->HeaderValidateCopy = NULL; - Heap->HeaderValidateLength = HeaderSize; + Heap->HeaderValidateLength = (USHORT)HeaderSize;
/* Initialise the Heap Lock */ if (!(Flags & HEAP_NO_SERIALIZE) && !(Flags & HEAP_LOCK_USER_ALLOCATED)) @@ -656,7 +656,7 @@ }
/* Update tracking numbers */ - Segment->NumberOfUnCommittedPages -= *Size / PAGE_SIZE; + Segment->NumberOfUnCommittedPages -= (ULONG)(*Size / PAGE_SIZE);
/* Calculate first and last entries */ FirstEntry = (PHEAP_ENTRY)Address; @@ -738,7 +738,7 @@ PHEAP_ENTRY PrecedingInUseEntry = NULL, NextInUseEntry = NULL; PHEAP_FREE_ENTRY NextFreeEntry; PHEAP_UCR_DESCRIPTOR UcrDescriptor; - ULONG PrecedingSize, NextSize, DecommitSize; + SIZE_T PrecedingSize, NextSize, DecommitSize; ULONG_PTR DecommitBase; NTSTATUS Status;
@@ -828,7 +828,7 @@
/* Insert uncommitted pages */ RtlpInsertUnCommittedPages(Segment, DecommitBase, DecommitSize); - Segment->NumberOfUnCommittedPages += (DecommitSize / PAGE_SIZE); + Segment->NumberOfUnCommittedPages += (ULONG)(DecommitSize / PAGE_SIZE);
if (PrecedingSize) { @@ -866,7 +866,8 @@ } }
-BOOLEAN NTAPI +NTSTATUS +NTAPI RtlpInitializeHeapSegment(IN OUT PHEAP Heap, OUT PHEAP_SEGMENT Segment, IN UCHAR SegmentIndex, @@ -908,7 +909,7 @@
/* Initialise the Heap Segment location information */ Segment->BaseAddress = Segment; - Segment->NumberOfPages = SegmentReserve >> PAGE_SHIFT; + Segment->NumberOfPages = (ULONG)(SegmentReserve >> PAGE_SHIFT);
/* Initialise the Heap Entries contained within the Heap Segment */ Segment->FirstEntry = &Segment->Entry + Segment->Entry.Size; @@ -928,7 +929,7 @@ }
/* Initialise the Heap Segment UnCommitted Range information */ - Segment->NumberOfUnCommittedPages = (SegmentReserve - SegmentCommit) >> PAGE_SHIFT; + Segment->NumberOfUnCommittedPages = (ULONG)((SegmentReserve - SegmentCommit) >> PAGE_SHIFT); Segment->NumberOfUnCommittedRanges = 0; InitializeListHead(&Segment->UCRSegmentList);
@@ -1162,7 +1163,7 @@ DPRINT("RtlpExtendHeap(%p %x)\n", Heap, Size);
/* Calculate amount in pages */ - Pages = (Size + PAGE_SIZE - 1) / PAGE_SIZE; + Pages = (ULONG)((Size + PAGE_SIZE - 1) / PAGE_SIZE); FreeSize = Pages * PAGE_SIZE; DPRINT("Pages %x, FreeSize %x. Going through segments...\n", Pages, FreeSize);
@@ -1998,11 +1999,10 @@ PULONG FreeListsInUse; ULONG FreeListsInUseUlong; SIZE_T AllocationSize; - SIZE_T Index; + SIZE_T Index, InUseIndex, i; PLIST_ENTRY FreeListHead; PHEAP_ENTRY InUseEntry; PHEAP_FREE_ENTRY FreeBlock; - ULONG InUseIndex, i; UCHAR FreeFlags; EXCEPTION_RECORD ExceptionRecord; BOOLEAN HeapLocked = FALSE; @@ -3390,7 +3390,7 @@ } else { - UnCommittedPages += (UcrDescriptor->Size / PAGE_SIZE); + UnCommittedPages += (ULONG)(UcrDescriptor->Size / PAGE_SIZE); UnCommittedRanges++;
CurrentEntry = (PHEAP_ENTRY)((PCHAR)UcrDescriptor->Address + UcrDescriptor->Size);
Modified: trunk/reactos/lib/rtl/heap.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.h?rev=53764&am... ============================================================================== --- trunk/reactos/lib/rtl/heap.h [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heap.h [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -151,15 +151,15 @@ { ULONG Allocs; ULONG Frees; - ULONG Size; + SIZE_T Size; } HEAP_PSEUDO_TAG_ENTRY, *PHEAP_PSEUDO_TAG_ENTRY;
typedef struct _HEAP_COUNTERS { - ULONG TotalMemoryReserved; - ULONG TotalMemoryCommitted; - ULONG TotalMemoryLargeUCR; - ULONG TotalSizeInVirtualBlocks; + SIZE_T TotalMemoryReserved; + SIZE_T TotalMemoryCommitted; + SIZE_T TotalMemoryLargeUCR; + SIZE_T TotalSizeInVirtualBlocks; ULONG TotalSegments; ULONG TotalUCRs; ULONG CommittOps; @@ -173,13 +173,13 @@ ULONG CompactHeapCalls; ULONG CompactedUCRs; ULONG InBlockDeccommits; - ULONG InBlockDeccomitSize; + SIZE_T InBlockDeccomitSize; } HEAP_COUNTERS, *PHEAP_COUNTERS;
typedef struct _HEAP_TUNING_PARAMETERS { ULONG CommittThresholdShift; - ULONG MaxPreCommittThreshold; + SIZE_T MaxPreCommittThreshold; } HEAP_TUNING_PARAMETERS, *PHEAP_TUNING_PARAMETERS;
typedef struct _HEAP_LIST_LOOKUP @@ -217,16 +217,16 @@ ULONG CompatibilityFlags; ULONG EncodeFlagMask; HEAP_ENTRY Encoding; - ULONG PointerKey; + ULONG_PTR PointerKey; ULONG Interceptor; ULONG VirtualMemoryThreshold; ULONG Signature; - ULONG SegmentReserve; - ULONG SegmentCommit; - ULONG DeCommitFreeBlockThreshold; - ULONG DeCommitTotalFreeThreshold; - ULONG TotalFreeSize; - ULONG MaximumAllocationSize; + SIZE_T SegmentReserve; + SIZE_T SegmentCommit; + SIZE_T DeCommitFreeBlockThreshold; + SIZE_T DeCommitTotalFreeThreshold; + SIZE_T TotalFreeSize; + SIZE_T MaximumAllocationSize; USHORT ProcessHeapsListIndex; USHORT HeaderValidateLength; PVOID HeaderValidateCopy; @@ -235,8 +235,8 @@ PHEAP_TAG_ENTRY TagEntries; LIST_ENTRY UCRList; LIST_ENTRY UCRSegments; // FIXME: non-Vista - ULONG AlignRound; - ULONG AlignMask; + ULONG_PTR AlignRound; + ULONG_PTR AlignMask; LIST_ENTRY VirtualAllocdBlocks; LIST_ENTRY SegmentList; struct _HEAP_SEGMENT *Segments[HEAP_SEGMENTS]; //FIXME: non-Vista @@ -284,7 +284,7 @@ LIST_ENTRY ListEntry; LIST_ENTRY SegmentEntry; PVOID Address; - ULONG Size; + SIZE_T Size; } HEAP_UCR_DESCRIPTOR, *PHEAP_UCR_DESCRIPTOR;
typedef struct _HEAP_UCR_SEGMENT @@ -314,8 +314,8 @@ { LIST_ENTRY Entry; HEAP_ENTRY_EXTRA ExtraStuff; - ULONG CommitSize; - ULONG ReserveSize; + SIZE_T CommitSize; + SIZE_T ReserveSize; HEAP_ENTRY BusyBlock; } HEAP_VIRTUAL_ALLOC_ENTRY, *PHEAP_VIRTUAL_ALLOC_ENTRY;
Modified: trunk/reactos/lib/rtl/heappage.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heappage.c?rev=5376... ============================================================================== --- trunk/reactos/lib/rtl/heappage.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heappage.c [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -24,8 +24,8 @@ { ULONG StartStamp; PVOID Heap; - ULONG RequestedSize; - ULONG ActualSize; + SIZE_T RequestedSize; + SIZE_T ActualSize; union { LIST_ENTRY FreeQueue; @@ -46,10 +46,10 @@ }; PUCHAR pUserAllocation; PUCHAR pVirtualBlock; - ULONG nVirtualBlockSize; - ULONG nVirtualAccessSize; - ULONG nUserRequestedSize; - ULONG nUserActualSize; + SIZE_T nVirtualBlockSize; + SIZE_T nVirtualAccessSize; + SIZE_T nUserRequestedSize; + SIZE_T nUserActualSize; PVOID UserValue; ULONG UserFlags; PRTL_TRACE_BLOCK StackTrace; @@ -67,30 +67,30 @@ PDPH_HEAP_BLOCK pVirtualStorageListHead; PDPH_HEAP_BLOCK pVirtualStorageListTail; ULONG nVirtualStorageRanges; - ULONG nVirtualStorageBytes; + SIZE_T nVirtualStorageBytes;
RTL_AVL_TABLE BusyNodesTable; PDPH_HEAP_BLOCK NodeToAllocate; ULONG nBusyAllocations; - ULONG nBusyAllocationBytesCommitted; + SIZE_T nBusyAllocationBytesCommitted;
PDPH_HEAP_BLOCK pFreeAllocationListHead; PDPH_HEAP_BLOCK pFreeAllocationListTail; ULONG nFreeAllocations; - ULONG nFreeAllocationBytesCommitted; + SIZE_T nFreeAllocationBytesCommitted;
LIST_ENTRY AvailableAllocationHead; ULONG nAvailableAllocations; - ULONG nAvailableAllocationBytesCommitted; + SIZE_T nAvailableAllocationBytesCommitted;
PDPH_HEAP_BLOCK pUnusedNodeListHead; PDPH_HEAP_BLOCK pUnusedNodeListTail; ULONG nUnusedNodes; - ULONG nBusyAllocationBytesAccessible; + SIZE_T nBusyAllocationBytesAccessible; PDPH_HEAP_BLOCK pNodePoolListHead; PDPH_HEAP_BLOCK pNodePoolListTail; ULONG nNodePools; - ULONG nNodePoolBytes; + SIZE_T nNodePoolBytes;
LIST_ENTRY NextHeap; ULONG ExtraFlags; @@ -117,7 +117,7 @@ RTL_CRITICAL_SECTION RtlpDphDelayedFreeQueueLock; LIST_ENTRY RtlpDphDelayedFreeQueue; SLIST_HEADER RtlpDphDelayedTemporaryPushList; -ULONG RtlpDphMemoryUsedByDelayedFreeBlocks; +SIZE_T RtlpDphMemoryUsedByDelayedFreeBlocks; ULONG RtlpDphNumberOfDelayedFreeBlocks;
/* Counters */ @@ -429,7 +429,7 @@ RtlFillMemory(FillPtr, ROUND_UP(FillPtr, PAGE_SIZE) - (ULONG_PTR)FillPtr, DPH_FILL_SUFFIX);
/* FIXME: Check if logging stack traces is turned on */ - //if (DphRoot->ExtraFlags & + //if (DphRoot->ExtraFlags &
return TRUE; } @@ -758,7 +758,7 @@ ULONG NodeCount, i;
//NodeCount = (Size >> 6) - 1; - NodeCount = (Size / sizeof(DPH_HEAP_BLOCK)); + NodeCount = (ULONG)(Size / sizeof(DPH_HEAP_BLOCK)); DphStartNode = Virtual;
/* Set pNextAlloc for all blocks */ @@ -1903,7 +1903,8 @@ PDPH_HEAP_ROOT DphRoot; PDPH_HEAP_BLOCK Node = NULL, AllocatedNode; BOOLEAN Biased = FALSE, UseNormalHeap = FALSE, OldBlockPageHeap = TRUE; - ULONG DataSize, ValidationInfo; + ULONG ValidationInfo; + SIZE_T DataSize; PVOID NewAlloc = NULL;
/* Check requested size */
Modified: trunk/reactos/lib/rtl/registry.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/registry.c?rev=5376... ============================================================================== --- trunk/reactos/lib/rtl/registry.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/registry.c [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -116,8 +116,9 @@ IN PVOID Context, IN PVOID Environment) { - ULONG InfoLength, Length, c; - LONG RequiredLength, SpareLength; + ULONG InfoLength; + SIZE_T Length, SpareLength, c; + LONG RequiredLength; PCHAR SpareData, DataEnd; ULONG Type; PWCHAR Name, p, ValueEnd; @@ -207,7 +208,7 @@ if (SpareLength < RequiredLength) { /* Fail and return the missing length */ - *InfoSize = SpareData - (PCHAR)KeyValueInfo + RequiredLength; + *InfoSize = (ULONG)(SpareData - (PCHAR)KeyValueInfo) + RequiredLength; return STATUS_BUFFER_TOO_SMALL; }
@@ -257,7 +258,7 @@ /* Do the query */ Status = RtlpQueryRegistryDirect(REG_SZ, Data, - Length, + (ULONG)Length, QueryTable->EntryContext); QueryTable->EntryContext = (PVOID)((ULONG_PTR)QueryTable-> EntryContext + @@ -269,7 +270,7 @@ Status = QueryTable->QueryRoutine(Name, REG_SZ, Data, - Length, + (ULONG)Length, Context, QueryTable->EntryContext); } @@ -311,7 +312,7 @@ if (FoundExpander) { /* Setup the source string */ - RtlInitEmptyUnicodeString(&Source, Data, Length); + RtlInitEmptyUnicodeString(&Source, Data, (USHORT)Length); Source.Length = Source.MaximumLength - sizeof(UNICODE_NULL);
/* Setup the desination string */ @@ -326,7 +327,7 @@ else if (SpareLength <= MAXUSHORT) { /* This is the good case, where we fit into a string */ - Destination.MaximumLength = SpareLength; + Destination.MaximumLength = (USHORT)SpareLength; Destination.Buffer[SpareLength / 2 - 1] = UNICODE_NULL; } else @@ -356,9 +357,8 @@ if (Status == STATUS_BUFFER_TOO_SMALL) { /* Set the required missing length */ - *InfoSize = SpareData - - (PCHAR)KeyValueInfo + - RequiredLength; + *InfoSize = (ULONG)(SpareData - (PCHAR)KeyValueInfo) + + RequiredLength;
/* Notify debugger */ DPRINT1("RTL: Expand variables for %wZ failed - " @@ -391,7 +391,7 @@ /* Return the data */ Status = RtlpQueryRegistryDirect(Type, Data, - Length, + (ULONG)Length, QueryTable->EntryContext); } else @@ -400,7 +400,7 @@ Status = QueryTable->QueryRoutine(Name, Type, Data, - Length, + (ULONG)Length, Context, QueryTable->EntryContext); } @@ -756,7 +756,7 @@ /* Initialize a string */ RtlInitEmptyUnicodeString(KeyPath, RtlpAllocateStringMemory(Length, TAG_USTR), - Length); + (USHORT)Length); if (!KeyPath->Buffer) { /* Free the string and fail */ @@ -840,7 +840,7 @@ if (KeyInfo->NameLength <= SubKeyName->MaximumLength) { /* Set the length */ - SubKeyName->Length = KeyInfo->NameLength; + SubKeyName->Length = (USHORT)KeyInfo->NameLength;
/* Copy it */ RtlMoveMemory(SubKeyName->Buffer, @@ -1094,7 +1094,7 @@ &KeyValueName, KeyValueFullInformation, KeyValueInfo, - InfoSize, + (ULONG)InfoSize, &ResultLength); if (Status == STATUS_BUFFER_OVERFLOW) { @@ -1111,7 +1111,7 @@ /* Setup a default */ KeyValueInfo->Type = REG_NONE; KeyValueInfo->DataLength = 0; - ResultLength = InfoSize; + ResultLength = (ULONG)InfoSize;
/* Call the query routine */ Status = RtlpCallQueryRegistryRoutine(QueryTable, @@ -1151,7 +1151,7 @@ }
/* Call the query routine */ - ResultLength = InfoSize; + ResultLength = (ULONG)InfoSize; Status = RtlpCallQueryRegistryRoutine(QueryTable, KeyValueInfo, &ResultLength, @@ -1212,7 +1212,7 @@ Value, KeyValueFullInformation, KeyValueInfo, - InfoSize, + (ULONG)InfoSize, &ResultLength); if (Status == STATUS_BUFFER_OVERFLOW) { @@ -1242,7 +1242,7 @@ if (NT_SUCCESS(Status)) { /* Call the query routine */ - ResultLength = InfoSize; + ResultLength = (ULONG)InfoSize; Status = RtlpCallQueryRegistryRoutine(QueryTable, KeyValueInfo, &ResultLength,
Modified: trunk/reactos/lib/rtl/rtlp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtlp.h?rev=53764&am... ============================================================================== --- trunk/reactos/lib/rtl/rtlp.h [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/rtlp.h [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -63,7 +63,7 @@ PVOID NTAPI RtlpAllocateMemory( - ULONG Bytes, + SIZE_T Bytes, ULONG Tag);
VOID
Modified: trunk/reactos/lib/rtl/srw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/srw.c?rev=53764&... ============================================================================== --- trunk/reactos/lib/rtl/srw.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/srw.c [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -630,7 +630,7 @@ /* There are no wait blocks so far, we need to add ourselves as the first wait block. We need to keep the shared count! */ StackWaitBlock.Exclusive = TRUE; - StackWaitBlock.SharedCount = CurrentValue >> RTL_SRWLOCK_BITS; + StackWaitBlock.SharedCount = (LONG)(CurrentValue >> RTL_SRWLOCK_BITS); StackWaitBlock.Next = NULL; StackWaitBlock.Last = &StackWaitBlock; StackWaitBlock.Wake = 0;
Modified: trunk/reactos/lib/rtl/timerqueue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/timerqueue.c?rev=53... ============================================================================== --- trunk/reactos/lib/rtl/timerqueue.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/timerqueue.c [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -193,7 +193,7 @@ if (t->expire != EXPIRE_NEVER) { ULONGLONG time = queue_current_time(); - timeout = t->expire < time ? 0 : t->expire - time; + timeout = t->expire < time ? 0 : (ULONG)(t->expire - time); } } RtlLeaveCriticalSection(&q->cs);
Modified: trunk/reactos/lib/rtl/timezone.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/timezone.c?rev=5376... ============================================================================== --- trunk/reactos/lib/rtl/timezone.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/timezone.c [iso-8859-1] Mon Sep 19 19:31:21 2011 @@ -85,7 +85,7 @@ NTSTATUS NTAPI RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation) { - ULONG Length; + SIZE_T Length; NTSTATUS Status;
DPRINT("RtlSetTimeZoneInformation()\n"); @@ -109,7 +109,7 @@ L"Standard Name", REG_SZ, TimeZoneInformation->StandardName, - Length); + (ULONG)Length); if (!NT_SUCCESS(Status)) { return Status; @@ -143,7 +143,7 @@ L"Daylight Name", REG_SZ, TimeZoneInformation->DaylightName, - Length); + (ULONG)Length); if (!NT_SUCCESS(Status)) { return Status;