]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c
BaseTools: Add Brotli algorithm tool
[mirror_edk2.git] / BaseTools / Source / C / GnuGenBootSector / GnuGenBootSector.c
index 6a25bee957c144cec08a974f310ef3d8c3f695fc..1804e683fb9114158d777609b06aa9d03953c547 100644 (file)
@@ -1,7 +1,11 @@
 /** @file\r
-\r
-Copyright 2006 - 2009, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Reading/writing MBR/DBR.\r
+  NOTE:\r
+    If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.\r
+    If we process DBR, we will patch MBR to set first partition active if no active partition exists.\r
+    \r
+Copyright (c) 2006 - 2014, 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
@@ -9,16 +13,6 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-Module Name:\r
-\r
-  GnuGenBootSector.c\r
-  \r
-Abstract:\r
-  Reading/writing MBR/DBR.\r
-  NOTE:\r
-    If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.\r
-    If we process DBR, we will patch MBR to set first partition active if no active partition exists.\r
-\r
 **/\r
 \r
 #include "CommonLib.h"\r
@@ -153,7 +147,7 @@ GetPathInfo (
     }  \r
      \r
     // Try to open the device.   \r
-    f = fopen(PathInfo->Path,"r");\r
+    f = fopen (LongFilePath (PathInfo->Path),"r");\r
     if (f == NULL) {\r
       printf ("error :open device failed!\n");\r
       return ErrorPath;\r
@@ -167,7 +161,7 @@ GetPathInfo (
   if (PathInfo->Input) {\r
     // If path is file path, check whether file is valid.\r
     printf("Path = %s\n",PathInfo->Path);\r
-    f = fopen (PathInfo->Path, "r");\r
+    f = fopen (LongFilePath (PathInfo->Path), "r");\r
     if (f == NULL) {\r
       fprintf (stderr, "Test error E2003: File was not provided!\n");\r
       return ErrorPath;\r
@@ -211,7 +205,7 @@ ProcessBsOrMbr (
   FILE *OutputFile;\r
   \r
   \r
-  InputFile = fopen(InputInfo->PhysicalPath, "r");\r
+  InputFile = fopen (LongFilePath (InputInfo->PhysicalPath), "r");\r
   if (InputFile == NULL) {\r
     return ErrorFileReadWrite;\r
   }\r
@@ -235,10 +229,13 @@ ProcessBsOrMbr (
   } \r
   \r
   //Process Floppy Disk\r
-  OutputFile = fopen(OutputInfo->PhysicalPath, "w");\r
+  OutputFile = fopen (LongFilePath (OutputInfo->PhysicalPath), "r+");\r
   if (OutputFile == NULL) {\r
-    return ErrorFileReadWrite;\r
-  }  \r
+    OutputFile = fopen (LongFilePath (OutputInfo->PhysicalPath), "w");\r
+    if (OutputFile == NULL) {\r
+      return ErrorFileReadWrite;\r
+    }\r
+  }\r
   \r
   if (OutputInfo->Type != PathFile) {\r
     if (ProcessMbr) {\r
@@ -272,8 +269,8 @@ Version (
   VOID\r
   )\r
 {\r
-  printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
-  printf ("Copyright (c) 2007-2009 Intel Corporation. All rights reserved.\n");\r
+  printf ("%s v%d.%d %s-Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);\r
+  printf ("Copyright (c) 2007-2014 Intel Corporation. All rights reserved.\n");\r
 }\r
 \r
 \r
@@ -302,7 +299,6 @@ main (
   char *argv[]\r
   )\r
 {\r
-  CHAR8          *AppName;\r
   INTN           Index;\r
   BOOLEAN        ProcessMbr;\r
   ERROR_STATUS   Status;\r
@@ -316,7 +312,6 @@ main (
   ZeroMem(&InputPathInfo, sizeof(PATH_INFO));\r
   ZeroMem(&OutputPathInfo, sizeof(PATH_INFO));\r
   \r
-  AppName = *argv;\r
   argv ++;\r
   argc --;\r
   \r