mirror of
https://github.com/reactos/reactos.git
synced 2025-05-02 04:05:56 +00:00
[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 svn path=/trunk/; revision=57518
This commit is contained in:
parent
6097ae49f8
commit
ce4ac4fb98
10 changed files with 34 additions and 28 deletions
|
@ -38,7 +38,7 @@ RtlAreAnyAccessesGranted(IN ACCESS_MASK GrantedAccess,
|
|||
PAGED_CODE_RTL();
|
||||
|
||||
/* Return if there's any leftover bits after granting all of them */
|
||||
return (GrantedAccess & DesiredAccess);
|
||||
return ((GrantedAccess & DesiredAccess) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -222,7 +222,7 @@ RtlEqualPrefixSid(IN PSID Sid1_,
|
|||
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])
|
||||
|
|
|
@ -194,7 +194,7 @@ _ui64tow_s( unsigned __int64 value, wchar_t *str,
|
|||
*--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;
|
||||
|
|
6
reactos/ntoskrnl/cache/section/sptab.c
vendored
6
reactos/ntoskrnl/cache/section/sptab.c
vendored
|
@ -196,7 +196,7 @@ _MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
|||
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 @@ _MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
|||
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 @@ _MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
|||
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
|
||||
|
|
|
@ -280,7 +280,7 @@ NtQuerySystemEnvironmentValue(IN PUNICODE_STRING VariableName,
|
|||
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);
|
||||
|
|
|
@ -27,6 +27,7 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
|
|||
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 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
|
|||
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 @@ FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
|
|||
*
|
||||
* @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 @@ FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
|
|||
*
|
||||
* @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
|
||||
*
|
||||
|
|
|
@ -43,7 +43,7 @@ KSPIN_LOCK ExpTaggedPoolLock;
|
|||
ULONG PoolHitTag;
|
||||
BOOLEAN ExStopBadTags;
|
||||
KSPIN_LOCK ExpLargePoolTableLock;
|
||||
LONG ExpPoolBigEntriesInUse;
|
||||
ULONG ExpPoolBigEntriesInUse;
|
||||
ULONG ExpPoolFlags;
|
||||
ULONG ExPoolFailures;
|
||||
|
||||
|
@ -1246,10 +1246,10 @@ ExpAddTagForBigPages(IN PVOID Va,
|
|||
// 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 @@ ExpFindAndRemoveTagBigPages(IN PVOID Va,
|
|||
// the lock and return the tag that was located
|
||||
//
|
||||
InterlockedIncrement((PLONG)&Entry->Va);
|
||||
InterlockedDecrement(&ExpPoolBigEntriesInUse);
|
||||
InterlockedDecrementUL(&ExpPoolBigEntriesInUse);
|
||||
KeReleaseSpinLock(&ExpLargePoolTableLock, OldIrql);
|
||||
return PoolTag;
|
||||
}
|
||||
|
|
|
@ -1049,7 +1049,7 @@ MiMapViewInSystemSpace(IN PVOID Section,
|
|||
MiDereferenceControlArea(ControlArea);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
/* What's the underlying session? */
|
||||
if (Session == &MmSession)
|
||||
{
|
||||
|
@ -2472,7 +2472,7 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
|
|||
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;
|
||||
|
|
|
@ -1385,7 +1385,7 @@ MiFreeInitializationCode(IN PVOID InitStart,
|
|||
|
||||
/* 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 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
|||
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 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
|||
/* 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 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
|||
{
|
||||
/* 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 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Move to the next section */
|
||||
SectionCount--;
|
||||
Section++;
|
||||
}
|
||||
|
||||
|
||||
/* Move to the next module */
|
||||
NextEntry = NextEntry->Flink;
|
||||
}
|
||||
|
@ -1546,7 +1546,7 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
|||
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 @@ LoaderScan:
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1744,7 +1744,7 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
|
|||
return Status;
|
||||
}
|
||||
|
||||
ULONG
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
MiIsEntireRangeCommitted(IN ULONG_PTR StartingAddress,
|
||||
IN ULONG_PTR EndingAddress,
|
||||
|
|
Loading…
Reference in a new issue