]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c
MdeModulePkg: Provide EfiBootManagerRegisterBootDescriptionHandler
[mirror_edk2.git] / Nt32Pkg / WinNtSimpleFileSystemDxe / WinNtSimpleFileSystem.c
index fd925b931244404156fd608a1dc9be52a1d86a5c..1c300b6930f2568262d2eb628978b36bb4fcb562 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, 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
@@ -1593,7 +1593,7 @@ Returns:
     Status = PrivateFile->WinNtThunk->ReadFile (\r
                                         PrivateFile->LHandle,\r
                                         Buffer,\r
-                                        *BufferSize,\r
+                                        (DWORD)*BufferSize,\r
                                         (LPDWORD)BufferSize,\r
                                         NULL\r
                                         ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;\r
@@ -1764,7 +1764,7 @@ Returns:
   Status = PrivateFile->WinNtThunk->WriteFile (\r
                                       PrivateFile->LHandle,\r
                                       Buffer,\r
-                                      *BufferSize,\r
+                                      (DWORD)*BufferSize,\r
                                       (LPDWORD)BufferSize,\r
                                       NULL\r
                                       ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;\r
@@ -2350,12 +2350,12 @@ Returns:
   // 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
@@ -2404,7 +2404,7 @@ Returns:
   //\r
   NewFileInfo = (EFI_FILE_INFO *) Buffer;\r
 \r
-  if (NewFileInfo->Size <= sizeof (EFI_FILE_INFO) ||\r
+  if ((NewFileInfo->Size <= SIZE_OF_EFI_FILE_INFO) ||\r
       (NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||\r
       (sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)\r
       ) {\r
@@ -2631,8 +2631,8 @@ Returns:
         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
@@ -2829,6 +2829,7 @@ Reopen: ;
   NtStatus = PrivateFile->WinNtThunk->SetFileAttributes (NewFileName, NewAttr);\r
 \r
   if (!NtStatus) {\r
+    Status    = EFI_DEVICE_ERROR;\r
     goto Reopen;\r
   }\r
 \r