[FREELDR] Use RTL copy/zero-memory helper functions.

This commit is contained in:
Hermès Bélusca-Maïto 2020-01-26 18:41:03 +01:00
parent 228eeb7d79
commit f4fdc957c5
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 13 additions and 13 deletions

View file

@ -872,7 +872,7 @@ BOOLEAN Ext2ReadPartialBlock(PEXT2_VOLUME_INFO Volume, ULONG BlockNumber, ULONG
return FALSE;
}
memcpy(Buffer, ((PUCHAR)TempBuffer + StartingOffset), Length);
RtlCopyMemory(Buffer, ((PUCHAR)TempBuffer + StartingOffset), Length);
FrLdrTempFree(TempBuffer, TAG_EXT_BUFFER);

View file

@ -519,8 +519,8 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
TRACE("FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName);
memset(ShortNameBuffer, 0, 13 * sizeof(CHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(CHAR));
RtlZeroMemory(ShortNameBuffer, 13 * sizeof(CHAR));
RtlZeroMemory(LfnNameBuffer, 261 * sizeof(CHAR));
for (CurrentEntry=0; CurrentEntry<EntryCount; CurrentEntry++, DirectoryBuffer = ((PDIRENTRY)DirectoryBuffer)+1)
{
@ -548,8 +548,8 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
//
if (DirEntry->FileName[0] == '\xE5')
{
memset(ShortNameBuffer, 0, 13 * sizeof(CHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(CHAR));
RtlZeroMemory(ShortNameBuffer, 13 * sizeof(CHAR));
RtlZeroMemory(LfnNameBuffer, 261 * sizeof(CHAR));
continue;
}
@ -642,8 +642,8 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
//
if (DirEntry->Attr & ATTR_VOLUMENAME)
{
memset(ShortNameBuffer, 0, 13 * sizeof(UCHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(UCHAR));
RtlZeroMemory(ShortNameBuffer, 13 * sizeof(UCHAR));
RtlZeroMemory(LfnNameBuffer, 261 * sizeof(UCHAR));
continue;
}
@ -700,8 +700,8 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
//
// Nope, no match - zero buffers and continue looking
//
memset(ShortNameBuffer, 0, 13 * sizeof(UCHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(UCHAR));
RtlZeroMemory(ShortNameBuffer, 13 * sizeof(UCHAR));
RtlZeroMemory(LfnNameBuffer, 261 * sizeof(UCHAR));
continue;
}
@ -783,7 +783,7 @@ ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, PFAT_FILE_INFO
TRACE("FatLookupFile() FileName = %s\n", FileName);
memset(FatFileInfoPointer, 0, sizeof(FAT_FILE_INFO));
RtlZeroMemory(FatFileInfoPointer, sizeof(FAT_FILE_INFO));
//
// Figure out how many sub-directories we are nested in
@ -852,7 +852,7 @@ ARC_STATUS FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, PFAT_FILE_INFO
}
}
memcpy(FatFileInfoPointer, &FatFileInfo, sizeof(FAT_FILE_INFO));
RtlCopyMemory(FatFileInfoPointer, &FatFileInfo, sizeof(FAT_FILE_INFO));
return ESUCCESS;
}
@ -1178,7 +1178,7 @@ BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULON
if (FatReadVolumeSectors(Volume, ClusterStartSector + SectorOffset, SectorCount, ReadBuffer))
{
memcpy(Buffer, ReadBuffer + StartingOffset, Length);
RtlCopyMemory(Buffer, ReadBuffer + StartingOffset, Length);
Success = TRUE;
}

View file

@ -394,7 +394,7 @@ VOID FsRegisterDevice(CHAR* Prefix, const DEVVTBL* FuncTable)
pNewEntry->FuncTable = FuncTable;
pNewEntry->ReferenceCount = 0;
pNewEntry->Prefix = (CHAR*)(pNewEntry + 1);
memcpy(pNewEntry->Prefix, Prefix, Length);
RtlCopyMemory(pNewEntry->Prefix, Prefix, Length);
InsertHeadList(&DeviceListHead, &pNewEntry->ListEntry);
}