diff options
author | Li Huajing <huajing.li@intel.com> | 2017-07-24 15:31:42 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2017-07-26 13:31:16 +0800 |
commit | c46aeceaf69ce777606f4825d6412bba6c25f193 (patch) | |
tree | 86d36775167a61980a165094a638a8f72159cbbc /Nt32Pkg | |
parent | 688c7d21b97d8ed6bfba72299c43c22a7b707064 (diff) | |
download | edk2-c46aeceaf69ce777606f4825d6412bba6c25f193.zip edk2-c46aeceaf69ce777606f4825d6412bba6c25f193.tar.gz edk2-c46aeceaf69ce777606f4825d6412bba6c25f193.tar.bz2 |
Nt32Pkg/WinNtSimpleFileSystemDxe: Change GetInfo() to get TimeZone.
Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'Nt32Pkg')
-rw-r--r-- | Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c | 78 |
1 files changed, 32 insertions, 46 deletions
diff --git a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c index b687e9c..f598c8e 100644 --- a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c +++ b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c @@ -1492,6 +1492,30 @@ Returns: }
}
+/**
+ Convert the FileTime to EfiTime.
+
+ @param PrivateFile Pointer to WIN_NT_EFI_FILE_PRIVATE.
+ @param TimeZone Pointer to the current time zone.
+ @param FileTime Pointer to file time.
+ @param EfiTime Pointer to EFI time.
+**/
+VOID
+WinNtFileTimeToEfiTime (
+ IN CONST WIN_NT_EFI_FILE_PRIVATE *PrivateFile,
+ IN TIME_ZONE_INFORMATION *TimeZone,
+ IN CONST FILETIME *FileTime,
+ OUT EFI_TIME *EfiTime
+ )
+{
+ FILETIME TempFileTime;
+ SYSTEMTIME SystemTime;
+
+ PrivateFile->WinNtThunk->FileTimeToLocalFileTime (FileTime, &TempFileTime);
+ PrivateFile->WinNtThunk->FileTimeToSystemTime (&TempFileTime, &SystemTime);
+ WinNtSystemTimeToEfiTime (&SystemTime, TimeZone, EfiTime);
+}
+
EFI_STATUS
EFIAPI
WinNtSimpleFileSystemRead (
@@ -1535,7 +1559,6 @@ Returns: UINTN NameSize;
UINTN ResultSize;
UINTN Index;
- SYSTEMTIME SystemTime;
EFI_FILE_INFO *Info;
WCHAR *pw;
TIME_ZONE_INFORMATION TimeZone;
@@ -1642,24 +1665,9 @@ Returns: Info->Size = ResultSize;
PrivateFile->WinNtThunk->GetTimeZoneInformation (&TimeZone);
-
- PrivateFile->WinNtThunk->FileTimeToLocalFileTime (
- &PrivateFile->FindBuf.ftCreationTime,
- &PrivateFile->FindBuf.ftCreationTime
- );
-
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&PrivateFile->FindBuf.ftCreationTime, &SystemTime);
-
- WinNtSystemTimeToEfiTime (&SystemTime, &TimeZone, &Info->CreateTime);
-
- PrivateFile->WinNtThunk->FileTimeToLocalFileTime (
- &PrivateFile->FindBuf.ftLastWriteTime,
- &PrivateFile->FindBuf.ftLastWriteTime
- );
-
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&PrivateFile->FindBuf.ftLastWriteTime, &SystemTime);
-
- WinNtSystemTimeToEfiTime (&SystemTime, &TimeZone, &Info->ModificationTime);
+ WinNtFileTimeToEfiTime (PrivateFile, &TimeZone, &PrivateFile->FindBuf.ftCreationTime, &Info->CreateTime);
+ WinNtFileTimeToEfiTime (PrivateFile, &TimeZone, &PrivateFile->FindBuf.ftLastAccessTime, &Info->LastAccessTime);
+ WinNtFileTimeToEfiTime (PrivateFile, &TimeZone, &PrivateFile->FindBuf.ftLastWriteTime, &Info->ModificationTime);
Info->FileSize = PrivateFile->FindBuf.nFileSizeLow;
@@ -1988,9 +1996,9 @@ Returns: UINTN ResultSize;
EFI_FILE_INFO *Info;
BY_HANDLE_FILE_INFORMATION FileInfo;
- SYSTEMTIME SystemTime;
CHAR16 *RealFileName;
CHAR16 *TempPointer;
+ TIME_ZONE_INFORMATION TimeZone;
Size = SIZE_OF_EFI_FILE_INFO;
@@ -2022,32 +2030,10 @@ Returns: Info->FileSize = FileInfo.nFileSizeLow;
Info->PhysicalSize = Info->FileSize;
- PrivateFile->WinNtThunk->FileTimeToLocalFileTime(&FileInfo.ftCreationTime, &FileInfo.ftCreationTime);
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftCreationTime, &SystemTime);
- Info->CreateTime.Year = SystemTime.wYear;
- Info->CreateTime.Month = (UINT8) SystemTime.wMonth;
- Info->CreateTime.Day = (UINT8) SystemTime.wDay;
- Info->CreateTime.Hour = (UINT8) SystemTime.wHour;
- Info->CreateTime.Minute = (UINT8) SystemTime.wMinute;
- Info->CreateTime.Second = (UINT8) SystemTime.wSecond;
-
- PrivateFile->WinNtThunk->FileTimeToLocalFileTime(&FileInfo.ftLastAccessTime, &FileInfo.ftLastAccessTime);
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastAccessTime, &SystemTime);
- Info->LastAccessTime.Year = SystemTime.wYear;
- Info->LastAccessTime.Month = (UINT8) SystemTime.wMonth;
- Info->LastAccessTime.Day = (UINT8) SystemTime.wDay;
- Info->LastAccessTime.Hour = (UINT8) SystemTime.wHour;
- Info->LastAccessTime.Minute = (UINT8) SystemTime.wMinute;
- Info->LastAccessTime.Second = (UINT8) SystemTime.wSecond;
-
- PrivateFile->WinNtThunk->FileTimeToLocalFileTime(&FileInfo.ftLastWriteTime, &FileInfo.ftLastWriteTime);
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastWriteTime, &SystemTime);
- Info->ModificationTime.Year = SystemTime.wYear;
- Info->ModificationTime.Month = (UINT8) SystemTime.wMonth;
- Info->ModificationTime.Day = (UINT8) SystemTime.wDay;
- Info->ModificationTime.Hour = (UINT8) SystemTime.wHour;
- Info->ModificationTime.Minute = (UINT8) SystemTime.wMinute;
- Info->ModificationTime.Second = (UINT8) SystemTime.wSecond;
+ PrivateFile->WinNtThunk->GetTimeZoneInformation (&TimeZone);
+ WinNtFileTimeToEfiTime (PrivateFile, &TimeZone, &FileInfo.ftCreationTime, &Info->CreateTime);
+ WinNtFileTimeToEfiTime (PrivateFile, &TimeZone, &FileInfo.ftLastAccessTime, &Info->LastAccessTime);
+ WinNtFileTimeToEfiTime (PrivateFile, &TimeZone, &FileInfo.ftLastWriteTime, &Info->ModificationTime);
if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) {
Info->Attribute |= EFI_FILE_ARCHIVE;
|