Fixed update file time error problem.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10913 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2010-10-09 02:46:37 +00:00
parent e0919a5856
commit f515069c19
3 changed files with 37 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/**@file
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -676,6 +676,15 @@ BOOL
CONST SYSTEMTIME *SystemTime
);
typedef
WINBASEAPI
BOOL
(WINAPI *WinNtLocalFileTimeToFileTime) (
CONST FILETIME *LocalFileTime,
LPFILETIME FileTime
);
typedef
WINBASEAPI
BOOL
@ -1197,6 +1206,7 @@ typedef struct {
//
// Win32 Time APIs
//
WinNtLocalFileTimeToFileTime LocalFileTimeToFileTime;
WinNtFileTimeToLocalFileTime FileTimeToLocalFileTime;
WinNtFileTimeToSystemTime FileTimeToSystemTime;
WinNtGetSystemTime GetSystemTime;

View File

@ -1,6 +1,6 @@
/**@file
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -124,6 +124,7 @@ EFI_WIN_NT_THUNK_PROTOCOL mWinNtThunkTable = {
MoveFile,
SetFileTime,
SystemTimeToFileTime,
LocalFileTimeToFileTime,
FileTimeToLocalFileTime,
FileTimeToSystemTime,
GetSystemTime,

View File

@ -1995,6 +1995,7 @@ 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;
@ -2003,6 +2004,7 @@ Returns:
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;
@ -2011,6 +2013,7 @@ Returns:
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;
@ -2730,6 +2733,13 @@ Reopen: ;
goto Done;
}
if (!PrivateFile->WinNtThunk->LocalFileTimeToFileTime (
&NewCreationFileTime,
&NewCreationFileTime
)) {
goto Done;
}
NewLastAccessSystemTime.wYear = NewFileInfo->LastAccessTime.Year;
NewLastAccessSystemTime.wMonth = NewFileInfo->LastAccessTime.Month;
NewLastAccessSystemTime.wDay = NewFileInfo->LastAccessTime.Day;
@ -2745,6 +2755,13 @@ Reopen: ;
goto Done;
}
if (!PrivateFile->WinNtThunk->LocalFileTimeToFileTime (
&NewLastAccessFileTime,
&NewLastAccessFileTime
)) {
goto Done;
}
NewLastWriteSystemTime.wYear = NewFileInfo->ModificationTime.Year;
NewLastWriteSystemTime.wMonth = NewFileInfo->ModificationTime.Month;
NewLastWriteSystemTime.wDay = NewFileInfo->ModificationTime.Day;
@ -2760,6 +2777,13 @@ Reopen: ;
goto Done;
}
if (!PrivateFile->WinNtThunk->LocalFileTimeToFileTime (
&NewLastWriteFileTime,
&NewLastWriteFileTime
)) {
goto Done;
}
if (!PrivateFile->WinNtThunk->SetFileTime (
PrivateFile->IsDirectoryPath ? PrivateFile->DirHandle : PrivateFile->LHandle,
&NewCreationFileTime,