From b38214553992b85a6c8029b89cb8922759a88e28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 30 Jul 2019 00:57:22 +0200 Subject: [PATCH] [FREELDR] Improve some *GetFileInformation() traces. --- boot/freeldr/freeldr/arch/i386/hwdisk.c | 2 +- boot/freeldr/freeldr/disk/ramdisk.c | 2 +- boot/freeldr/freeldr/disk/scsiport.c | 2 +- boot/freeldr/freeldr/lib/fs/btrfs.c | 10 +++------- boot/freeldr/freeldr/lib/fs/ext2.c | 8 +++----- boot/freeldr/freeldr/lib/fs/fat.c | 8 +++----- boot/freeldr/freeldr/lib/fs/iso.c | 8 ++++---- boot/freeldr/freeldr/lib/fs/ntfs.c | 8 +++----- boot/freeldr/freeldr/lib/fs/pxe.c | 3 +++ 9 files changed, 22 insertions(+), 29 deletions(-) diff --git a/boot/freeldr/freeldr/arch/i386/hwdisk.c b/boot/freeldr/freeldr/arch/i386/hwdisk.c index bae615b0a09..853d37f0981 100644 --- a/boot/freeldr/freeldr/arch/i386/hwdisk.c +++ b/boot/freeldr/freeldr/arch/i386/hwdisk.c @@ -64,7 +64,7 @@ DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) { DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize; Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize; diff --git a/boot/freeldr/freeldr/disk/ramdisk.c b/boot/freeldr/freeldr/disk/ramdisk.c index 4b2677a7951..b1a6f09dfd1 100644 --- a/boot/freeldr/freeldr/disk/ramdisk.c +++ b/boot/freeldr/freeldr/disk/ramdisk.c @@ -34,7 +34,7 @@ static ARC_STATUS RamDiskGetFileInformation(ULONG FileId, FILEINFORMATION* Infor // // Give current seek offset and ram disk size to caller // - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.LowPart = gRamDiskSize; Information->CurrentAddress.LowPart = gRamDiskOffset; diff --git a/boot/freeldr/freeldr/disk/scsiport.c b/boot/freeldr/freeldr/disk/scsiport.c index 0c0a0fa66cc..8fc967d85ab 100644 --- a/boot/freeldr/freeldr/disk/scsiport.c +++ b/boot/freeldr/freeldr/disk/scsiport.c @@ -179,7 +179,7 @@ static ARC_STATUS DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Informat { DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize; Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize; diff --git a/boot/freeldr/freeldr/lib/fs/btrfs.c b/boot/freeldr/freeldr/lib/fs/btrfs.c index f3a8619262b..1258454db60 100644 --- a/boot/freeldr/freeldr/lib/fs/btrfs.c +++ b/boot/freeldr/freeldr/lib/fs/btrfs.c @@ -1123,16 +1123,12 @@ ARC_STATUS BtrFsGetFileInformation(ULONG FileId, FILEINFORMATION *Information) { pbtrfs_file_info phandle = FsGetDeviceSpecific(FileId); - TRACE("BtrFsGetFileInformation %lu\n", FileId); - - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.QuadPart = phandle->inode.size; Information->CurrentAddress.QuadPart = phandle->position; - TRACE("BtrFsGetFileInformation() FileSize = %llu\n", - Information->EndingAddress.QuadPart); - TRACE("BtrFsGetFileInformation() FilePointer = %llu\n", - Information->CurrentAddress.QuadPart); + TRACE("BtrFsGetFileInformation(%lu) -> FileSize = %llu, FilePointer = 0x%llx\n", + FileId, Information->EndingAddress.QuadPart, Information->CurrentAddress.QuadPart); return ESUCCESS; } diff --git a/boot/freeldr/freeldr/lib/fs/ext2.c b/boot/freeldr/freeldr/lib/fs/ext2.c index 3428bd42d97..30ec019508e 100644 --- a/boot/freeldr/freeldr/lib/fs/ext2.c +++ b/boot/freeldr/freeldr/lib/fs/ext2.c @@ -1207,14 +1207,12 @@ ARC_STATUS Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information) { PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.QuadPart = FileHandle->FileSize; Information->CurrentAddress.QuadPart = FileHandle->FilePointer; - TRACE("Ext2GetFileInformation() FileSize = %d\n", - Information->EndingAddress.LowPart); - TRACE("Ext2GetFileInformation() FilePointer = %d\n", - Information->CurrentAddress.LowPart); + TRACE("Ext2GetFileInformation(%lu) -> FileSize = %llu, FilePointer = 0x%llx\n", + FileId, Information->EndingAddress.QuadPart, Information->CurrentAddress.QuadPart); return ESUCCESS; } diff --git a/boot/freeldr/freeldr/lib/fs/fat.c b/boot/freeldr/freeldr/lib/fs/fat.c index 6daa1a0b4fa..17f341c87ec 100644 --- a/boot/freeldr/freeldr/lib/fs/fat.c +++ b/boot/freeldr/freeldr/lib/fs/fat.c @@ -1411,14 +1411,12 @@ ARC_STATUS FatGetFileInformation(ULONG FileId, FILEINFORMATION* Information) { PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.LowPart = FileHandle->FileSize; Information->CurrentAddress.LowPart = FileHandle->FilePointer; - TRACE("FatGetFileInformation() FileSize = %d\n", - Information->EndingAddress.LowPart); - TRACE("FatGetFileInformation() FilePointer = %d\n", - Information->CurrentAddress.LowPart); + TRACE("FatGetFileInformation(%lu) -> FileSize = %lu, FilePointer = 0x%lx\n", + FileId, Information->EndingAddress.LowPart, Information->CurrentAddress.LowPart); return ESUCCESS; } diff --git a/boot/freeldr/freeldr/lib/fs/iso.c b/boot/freeldr/freeldr/lib/fs/iso.c index cc5a980e009..cdf0281a563 100644 --- a/boot/freeldr/freeldr/lib/fs/iso.c +++ b/boot/freeldr/freeldr/lib/fs/iso.c @@ -253,13 +253,13 @@ ARC_STATUS IsoGetFileInformation(ULONG FileId, FILEINFORMATION* Information) { PISO_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); - TRACE("IsoGetFileInformation() FileSize = %d\n", FileHandle->FileSize); - TRACE("IsoGetFileInformation() FilePointer = %d\n", FileHandle->FilePointer); - - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.LowPart = FileHandle->FileSize; Information->CurrentAddress.LowPart = FileHandle->FilePointer; + TRACE("IsoGetFileInformation(%lu) -> FileSize = %lu, FilePointer = 0x%lx\n", + FileId, Information->EndingAddress.LowPart, Information->CurrentAddress.LowPart); + return ESUCCESS; } diff --git a/boot/freeldr/freeldr/lib/fs/ntfs.c b/boot/freeldr/freeldr/lib/fs/ntfs.c index 5b0b510ac64..359bebc2ea4 100644 --- a/boot/freeldr/freeldr/lib/fs/ntfs.c +++ b/boot/freeldr/freeldr/lib/fs/ntfs.c @@ -766,14 +766,12 @@ ARC_STATUS NtfsGetFileInformation(ULONG FileId, FILEINFORMATION* Information) { PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); - RtlZeroMemory(Information, sizeof(FILEINFORMATION)); + RtlZeroMemory(Information, sizeof(*Information)); Information->EndingAddress.QuadPart = NtfsGetAttributeSize(&FileHandle->DataContext->Record); Information->CurrentAddress.QuadPart = FileHandle->Offset; - TRACE("NtfsGetFileInformation() FileSize = %d\n", - Information->EndingAddress.LowPart); - TRACE("NtfsGetFileInformation() FilePointer = %d\n", - Information->CurrentAddress.LowPart); + TRACE("NtfsGetFileInformation(%lu) -> FileSize = %llu, FilePointer = 0x%llx\n", + FileId, Information->EndingAddress.QuadPart, Information->CurrentAddress.QuadPart); return ESUCCESS; } diff --git a/boot/freeldr/freeldr/lib/fs/pxe.c b/boot/freeldr/freeldr/lib/fs/pxe.c index 4b5aac91520..dedc3157faa 100644 --- a/boot/freeldr/freeldr/lib/fs/pxe.c +++ b/boot/freeldr/freeldr/lib/fs/pxe.c @@ -145,6 +145,9 @@ static ARC_STATUS PxeGetFileInformation(ULONG FileId, FILEINFORMATION* Informati Information->EndingAddress.LowPart = _FileSize; Information->CurrentAddress.LowPart = _FilePosition; + TRACE("PxeGetFileInformation(%lu) -> FileSize = %lu, FilePointer = 0x%lx\n", + FileId, Information->EndingAddress.LowPart, Information->CurrentAddress.LowPart); + return ESUCCESS; } -- 2.17.1