Author: tkreuzer
Date: Sun Oct 7 21:36:50 2012
New Revision: 57518
URL:
http://svn.reactos.org/svn/reactos?rev=57518&view=rev
Log:
[RTL]
- Fix a bug in RtlAreAnyAccessesGranted
- Fix an MSVC warning in RtlEqualPrefixSid
[CRT]
- Fix an MSVC warning in _ui64tow_s
[NTOSKRNL]
- DPRINT the filename when MmLoadSystemImage fails
- Fix a few MSVC warnings
Modified:
trunk/reactos/lib/rtl/access.c
trunk/reactos/lib/rtl/sid.c
trunk/reactos/lib/sdk/crt/string/itow.c
trunk/reactos/ntoskrnl/cache/section/sptab.c
trunk/reactos/ntoskrnl/ex/sysinfo.c
trunk/reactos/ntoskrnl/fsrtl/name.c
trunk/reactos/ntoskrnl/mm/ARM3/expool.c
trunk/reactos/ntoskrnl/mm/ARM3/section.c
trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
Modified: trunk/reactos/lib/rtl/access.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/access.c?rev=57518…
==============================================================================
--- trunk/reactos/lib/rtl/access.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/access.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -38,7 +38,7 @@
PAGED_CODE_RTL();
/* Return if there's any leftover bits after granting all of them */
- return (GrantedAccess & DesiredAccess);
+ return ((GrantedAccess & DesiredAccess) != 0);
}
/*
Modified: trunk/reactos/lib/rtl/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/sid.c?rev=57518&am…
==============================================================================
--- trunk/reactos/lib/rtl/sid.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/sid.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -222,7 +222,7 @@
if (!Sid1->SubAuthorityCount) return TRUE;
/* Now compare all the subauthority values BUT the last one */
- for (i = 0; i < (Sid1->SubAuthorityCount - 1); i++)
+ for (i = 0; (i + 1) < Sid1->SubAuthorityCount; i++)
{
/* Does any mismatch? */
if (Sid1->SubAuthority[i] != Sid2->SubAuthority[i])
Modified: trunk/reactos/lib/sdk/crt/string/itow.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/itow.c?…
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/itow.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/itow.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -194,7 +194,7 @@
*--pos = 'a' + digit - 10;
} while (value != 0);
- if(buffer-pos+65 > size) {
+ if((size_t)(buffer-pos+65) > size) {
MSVCRT_INVALID_PMT("str[size] is too small");
#ifndef _LIBCNT_
*_errno() = EINVAL;
Modified: trunk/reactos/ntoskrnl/cache/section/sptab.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/spt…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/sptab.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/sptab.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -196,7 +196,7 @@
ASSERT(MiSectionPageTableGet(&Segment->PageTable, Offset));
PageTable->Segment = Segment;
- PageIndex = (Offset->QuadPart - PageTable->FileOffset.QuadPart) / PAGE_SIZE;
+ PageIndex = (ULONG_PTR)((Offset->QuadPart - PageTable->FileOffset.QuadPart) /
PAGE_SIZE);
OldEntry = PageTable->PageEntries[PageIndex];
DPRINT("MiSetPageEntrySectionSegment(%p,%08x%08x,%x=>%x)\n",
@@ -215,7 +215,7 @@
ASSERT(!Entry || IS_SWAP_FROM_SSE(Entry));
MmDeleteSectionAssociation(PFN_FROM_SSE(OldEntry));
} else if (IS_SWAP_FROM_SSE(Entry)) {
- ASSERT(!IS_SWAP_FROM_SSE(OldEntry) ||
+ ASSERT(!IS_SWAP_FROM_SSE(OldEntry) ||
SWAPENTRY_FROM_SSE(OldEntry) == MM_WAIT_ENTRY);
if (OldEntry && SWAPENTRY_FROM_SSE(OldEntry) != MM_WAIT_ENTRY)
MmDeleteSectionAssociation(PFN_FROM_SSE(OldEntry));
@@ -247,7 +247,7 @@
ENTRIES_PER_ELEMENT * PAGE_SIZE);
PageTable = MiSectionPageTableGet(&Segment->PageTable, &FileOffset);
if (!PageTable) return 0;
- PageIndex = (Offset->QuadPart - PageTable->FileOffset.QuadPart) / PAGE_SIZE;
+ PageIndex = (ULONG_PTR)((Offset->QuadPart - PageTable->FileOffset.QuadPart) /
PAGE_SIZE);
Result = PageTable->PageEntries[PageIndex];
#if 0
DPRINTC
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -280,7 +280,7 @@
RtlInitAnsiString(&AValue, AnsiValueBuffer);
/* Initialize a UNICODE string from the callers buffer */
- RtlInitEmptyUnicodeString(&WValue, ValueBuffer, ValueBufferLength);
+ RtlInitEmptyUnicodeString(&WValue, ValueBuffer,
(USHORT)ValueBufferLength);
/* Convert the result to UNICODE */
Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, FALSE);
Modified: trunk/reactos/ntoskrnl/fsrtl/name.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/name.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -27,6 +27,7 @@
PUSHORT BackTracking = NULL;
UNICODE_STRING IntExpression;
USHORT ExpressionPosition = 0, NamePosition = 0, MatchingChars;
+ WCHAR CompareChar;
PAGED_CODE();
/* Check if we were given strings at all */
@@ -99,10 +100,13 @@
}
}
- while (NamePosition < Name->Length / sizeof(WCHAR) &&
ExpressionPosition < Expression->Length / sizeof(WCHAR))
+ while ((NamePosition < Name->Length / sizeof(WCHAR)) &&
+ (ExpressionPosition < Expression->Length / sizeof(WCHAR)))
{
/* Basic check to test if chars are equal */
- if (Expression->Buffer[ExpressionPosition] == (IgnoreCase ?
UpcaseTable[Name->Buffer[NamePosition]] : Name->Buffer[NamePosition]))
+ CompareChar = IgnoreCase ? UpcaseTable[Name->Buffer[NamePosition]] :
+ Name->Buffer[NamePosition];
+ if (Expression->Buffer[ExpressionPosition] == CompareChar)
{
NamePosition++;
ExpressionPosition++;
@@ -118,7 +122,8 @@
else if (Expression->Buffer[ExpressionPosition] == L'*')
{
/* Skip contigous stars */
- while (ExpressionPosition + 1 < Expression->Length / sizeof(WCHAR)
&& Expression->Buffer[ExpressionPosition + 1] == L'*')
+ while ((ExpressionPosition + 1 < (USHORT)(Expression->Length /
sizeof(WCHAR))) &&
+ (Expression->Buffer[ExpressionPosition + 1] == L'*'))
{
ExpressionPosition++;
}
@@ -409,7 +414,7 @@
*
* @param Expression
* The string in which we've to find Name. It can contain wildcards.
- * If IgnoreCase is set to TRUE, this string MUST BE uppercase.
+ * If IgnoreCase is set to TRUE, this string MUST BE uppercase.
*
* @param Name
* The string to find. It cannot contain wildcards
@@ -419,7 +424,7 @@
*
* @param UpcaseTable
* If not NULL, and if IgnoreCase is set to TRUE, it will be used to
- * upcase the both strings
+ * upcase the both strings
*
* @return TRUE if Name is in Expression, FALSE otherwise
*
Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -43,7 +43,7 @@
ULONG PoolHitTag;
BOOLEAN ExStopBadTags;
KSPIN_LOCK ExpLargePoolTableLock;
-LONG ExpPoolBigEntriesInUse;
+ULONG ExpPoolBigEntriesInUse;
ULONG ExpPoolFlags;
ULONG ExPoolFailures;
@@ -1246,10 +1246,10 @@
// keep losing the race or that we are not finding a free entry anymore,
// which implies a massive number of concurrent big pool allocations.
//
- InterlockedIncrement(&ExpPoolBigEntriesInUse);
+ InterlockedIncrementUL(&ExpPoolBigEntriesInUse);
if ((i >= 16) && (ExpPoolBigEntriesInUse > (TableSize / 4)))
{
- DPRINT1("Should attempt expansion since we now have %d
entries\n",
+ DPRINT1("Should attempt expansion since we now have %lu
entries\n",
ExpPoolBigEntriesInUse);
}
@@ -1348,7 +1348,7 @@
// the lock and return the tag that was located
//
InterlockedIncrement((PLONG)&Entry->Va);
- InterlockedDecrement(&ExpPoolBigEntriesInUse);
+ InterlockedDecrementUL(&ExpPoolBigEntriesInUse);
KeReleaseSpinLock(&ExpLargePoolTableLock, OldIrql);
return PoolTag;
}
Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -1049,7 +1049,7 @@
MiDereferenceControlArea(ControlArea);
return STATUS_NO_MEMORY;
}
-
+
/* What's the underlying session? */
if (Session == &MmSession)
{
@@ -2472,7 +2472,7 @@
ASSERT(ControlArea->u.Flags.WasPurged == FALSE);
/* Make sure the segment and the section are the same size, or the section is smaller
*/
- ASSERT(NewSection->SizeOfSection.QuadPart <=
NewSection->Segment->SizeOfSegment);
+ ASSERT((ULONG64)NewSection->SizeOfSection.QuadPart <=
NewSection->Segment->SizeOfSegment);
/* Return the object and the creation status */
*SectionObject = (PVOID)NewSection;
Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -1385,7 +1385,7 @@
/* Compute the number of pages we expect to free */
PagesFreed = (PFN_NUMBER)(MiAddressToPte(InitEnd) - PointerPte + 1);
-
+
/* Try to actually free them */
PagesFreed = MiDeleteSystemPageableVm(PointerPte,
PagesFreed,
@@ -1406,7 +1406,7 @@
PIMAGE_NT_HEADERS NtHeader;
PIMAGE_SECTION_HEADER Section, LastSection;
BOOLEAN InitFound;
-
+
/* So we don't free our own code yet */
InitCode = (ULONG_PTR)&MiFindInitializationCode;
@@ -1423,7 +1423,7 @@
/* Get the loader entry and its DLL base */
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
DllBase = (ULONG_PTR)LdrEntry->DllBase;
-
+
/* Get the NT header */
NtHeader = RtlImageNtHeader((PVOID)DllBase);
if (!NtHeader)
@@ -1454,13 +1454,13 @@
{
/* Pick the biggest size -- either raw or virtual */
Size = max(Section->SizeOfRawData, Section->Misc.VirtualSize);
-
+
/* Read the section alignment */
Alignment = NtHeader->OptionalHeader.SectionAlignment;
/* Align the start and end addresses appropriately */
InitStart = DllBase + Section->VirtualAddress;
- InitEnd = ((Alignment + InitStart + Size - 2) & 0xFFFFF000) - 1;
+ InitEnd = ((Alignment + InitStart + Size - 2) & 0xFFFFF000) - 1;
InitStart = (InitStart + (PAGE_SIZE - 1)) & 0xFFFFF000;
/* Have we reached the last section? */
@@ -1532,12 +1532,12 @@
}
}
}
-
+
/* Move to the next section */
SectionCount--;
Section++;
}
-
+
/* Move to the next module */
NextEntry = NextEntry->Flink;
}
@@ -1546,7 +1546,7 @@
KeLeaveCriticalRegion();
}
-/*
+/*
* Note: This function assumes that all discardable sections are at the end of
* the PE file. It searches backwards until it finds the non-discardable section
*/
@@ -2960,7 +2960,8 @@
0);
if (!NT_SUCCESS(Status))
{
- DPRINT1("ZwOpenFile failed with status 0x%x\n", Status);
+ DPRINT1("ZwOpenFile failed for '%wZ' with status 0x%x\n",
+ FileName, Status);
goto Quickie;
}
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Sun Oct 7 21:36:50 2012
@@ -1744,7 +1744,7 @@
return Status;
}
-ULONG
+BOOLEAN
NTAPI
MiIsEntireRangeCommitted(IN ULONG_PTR StartingAddress,
IN ULONG_PTR EndingAddress,