/**@file\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
WIN_NT_EFI_FILE_PRIVATE *PrivateFile;\r
EFI_TPL OldTpl;\r
CHAR16 *TempFileName;\r
+ UINTN Size;\r
\r
if (This == NULL || Root == NULL) {\r
return EFI_INVALID_PARAMETER;\r
//\r
// Find the first file under it\r
//\r
+ Size = StrSize (PrivateFile->FilePath);\r
+ Size += StrSize (L"\\*");\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
- StrSize (PrivateFile->FilePath) + StrSize (L"\\*"),\r
- &TempFileName\r
+ Size,\r
+ (VOID **)&TempFileName\r
);\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
Info->FileSize = FileInfo.nFileSizeLow;\r
Info->PhysicalSize = Info->FileSize;\r
\r
+ PrivateFile->WinNtThunk->FileTimeToLocalFileTime(&FileInfo.ftCreationTime, &FileInfo.ftCreationTime);\r
PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftCreationTime, &SystemTime);\r
Info->CreateTime.Year = SystemTime.wYear;\r
Info->CreateTime.Month = (UINT8) SystemTime.wMonth;\r
Info->CreateTime.Minute = (UINT8) SystemTime.wMinute;\r
Info->CreateTime.Second = (UINT8) SystemTime.wSecond;\r
\r
+ PrivateFile->WinNtThunk->FileTimeToLocalFileTime(&FileInfo.ftLastAccessTime, &FileInfo.ftLastAccessTime);\r
PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastAccessTime, &SystemTime);\r
Info->LastAccessTime.Year = SystemTime.wYear;\r
Info->LastAccessTime.Month = (UINT8) SystemTime.wMonth;\r
Info->LastAccessTime.Minute = (UINT8) SystemTime.wMinute;\r
Info->LastAccessTime.Second = (UINT8) SystemTime.wSecond;\r
\r
+ PrivateFile->WinNtThunk->FileTimeToLocalFileTime(&FileInfo.ftLastWriteTime, &FileInfo.ftLastWriteTime);\r
PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastWriteTime, &SystemTime);\r
Info->ModificationTime.Year = SystemTime.wYear;\r
Info->ModificationTime.Month = (UINT8) SystemTime.wMonth;\r
// Set file system information.\r
//\r
if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {\r
- if (BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel)) {\r
+ NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer;\r
+ if (BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (NewFileSystemInfo->VolumeLabel)) {\r
Status = EFI_BAD_BUFFER_SIZE;\r
goto Done;\r
}\r
\r
- NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer;\r
\r
FreePool (PrivateRoot->VolumeLabel);\r
PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel));\r
FreePool (TempFileName);\r
}\r
} else {\r
+ Status = EFI_ACCESS_DENIED;\r
Reopen: ;\r
- Status = EFI_DEVICE_ERROR;\r
\r
NtStatus = PrivateFile->WinNtThunk->SetFileAttributes (OldFileName, OldAttr);\r
\r
goto Done;\r
}\r
\r
+ if (!PrivateFile->WinNtThunk->LocalFileTimeToFileTime (\r
+ &NewCreationFileTime,\r
+ &NewCreationFileTime\r
+ )) {\r
+ goto Done;\r
+ }\r
+\r
NewLastAccessSystemTime.wYear = NewFileInfo->LastAccessTime.Year;\r
NewLastAccessSystemTime.wMonth = NewFileInfo->LastAccessTime.Month;\r
NewLastAccessSystemTime.wDay = NewFileInfo->LastAccessTime.Day;\r
goto Done;\r
}\r
\r
+ if (!PrivateFile->WinNtThunk->LocalFileTimeToFileTime (\r
+ &NewLastAccessFileTime,\r
+ &NewLastAccessFileTime\r
+ )) {\r
+ goto Done;\r
+ }\r
+\r
NewLastWriteSystemTime.wYear = NewFileInfo->ModificationTime.Year;\r
NewLastWriteSystemTime.wMonth = NewFileInfo->ModificationTime.Month;\r
NewLastWriteSystemTime.wDay = NewFileInfo->ModificationTime.Day;\r
goto Done;\r
}\r
\r
+ if (!PrivateFile->WinNtThunk->LocalFileTimeToFileTime (\r
+ &NewLastWriteFileTime,\r
+ &NewLastWriteFileTime\r
+ )) {\r
+ goto Done;\r
+ }\r
+\r
if (!PrivateFile->WinNtThunk->SetFileTime (\r
PrivateFile->IsDirectoryPath ? PrivateFile->DirHandle : PrivateFile->LHandle,\r
&NewCreationFileTime,\r
NtStatus = PrivateFile->WinNtThunk->SetFileAttributes (NewFileName, NewAttr);\r
\r
if (!NtStatus) {\r
+ Status = EFI_DEVICE_ERROR;\r
goto Reopen;\r
}\r
\r