]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c
Nt32Pkg WinNtSimpleFileSystemDxe: Correct file length.
[mirror_edk2.git] / Nt32Pkg / WinNtSimpleFileSystemDxe / WinNtSimpleFileSystem.c
index feef184edb2b02d3d5a45811147093e75c9b160e..6cff2df0530ec0cfcc09c63a4d8a73f981439030 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, 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
@@ -1987,8 +1987,19 @@ Returns:
   CHAR16                      *TempPointer;\r
 \r
   Size        = SIZE_OF_EFI_FILE_INFO;\r
-  NameSize    = StrSize (PrivateFile->FileName);\r
-  ResultSize  = Size + NameSize;\r
+\r
+  RealFileName  = PrivateFile->FileName;\r
+  TempPointer   = RealFileName;\r
+  while (*TempPointer) {\r
+    if (*TempPointer == '\\') {\r
+      RealFileName = TempPointer + 1;\r
+    }\r
+\r
+    TempPointer++;\r
+  }\r
+  NameSize = StrSize (RealFileName);\r
+\r
+  ResultSize = Size + NameSize; \r
 \r
   Status      = EFI_BUFFER_TOO_SMALL;\r
   if (*BufferSize >= ResultSize) {\r
@@ -2056,17 +2067,6 @@ Returns:
       Info->Attribute |= EFI_FILE_DIRECTORY;\r
     }\r
 \r
-    RealFileName  = PrivateFile->FileName;\r
-    TempPointer   = RealFileName;\r
-\r
-    while (*TempPointer) {\r
-      if (*TempPointer == '\\') {\r
-        RealFileName = TempPointer + 1;\r
-      }\r
-\r
-      TempPointer++;\r
-    }\r
-\r
     if (PrivateFile->IsRootDirectory) {\r
       *((CHAR8 *) Buffer + Size) = 0;\r
     } else {\r