diff options
author | Hess Chen <hesheng.chen@intel.com> | 2014-08-15 03:06:48 +0000 |
---|---|---|
committer | hchen30 <hchen30@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-15 03:06:48 +0000 |
commit | 1be2ed90a20618d71ddf34b8a07d038da0b36854 (patch) | |
tree | 468f6ad18b924e3a58c180403f96d5afcd47a4f9 /BaseTools/Source/C | |
parent | b8a13d736961faff0d11241a0428abc44a084d6e (diff) | |
download | edk2-platforms-1be2ed90a20618d71ddf34b8a07d038da0b36854.tar.xz |
There is a limitation on WINDOWS OS for the length of entire file path can’t be larger than 255. There is an OS API provided by Microsoft to add “\\?\” before the path header to support the long file path. Enable this feature on basetools.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15809 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C')
25 files changed, 297 insertions, 152 deletions
diff --git a/BaseTools/Source/C/BootSectImage/bootsectimage.c b/BaseTools/Source/C/BootSectImage/bootsectimage.c index 36e896e5c4..fd367c28b3 100644 --- a/BaseTools/Source/C/BootSectImage/bootsectimage.c +++ b/BaseTools/Source/C/BootSectImage/bootsectimage.c @@ -4,7 +4,7 @@ Abstract: Patch the BPB information in boot sector image file.
Patch the MBR code in MBR image file.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, 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
@@ -116,7 +116,7 @@ Return: FILE *FileHandle;
int result;
- FileHandle = fopen (FileName, "r+b");
+ FileHandle = fopen (LongFilePath (FileName), "r+b");
if (FileHandle == NULL) {
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "Open file: %s", FileName);
return 0;
@@ -154,7 +154,7 @@ Return: FILE *FileHandle;
int result;
- FileHandle = fopen (FileName, "rb");
+ FileHandle = fopen (LongFilePath (FileName), "rb");
if (FileHandle == NULL) {
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E0001: Error opening file: %s", FileName);
return 0;
diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c index cb72e2723f..981c04f34b 100644 --- a/BaseTools/Source/C/Common/CommonLib.c +++ b/BaseTools/Source/C/Common/CommonLib.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -23,6 +23,11 @@ Abstract: #include <string.h>
#include <stdlib.h>
#include <ctype.h>
+#ifdef __GNUC__
+#include <unistd.h>
+#else
+#include <direct.h>
+#endif
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
@@ -196,7 +201,7 @@ Returns: //
// Open the file
//
- InputFile = fopen (InputFileName, "rb");
+ InputFile = fopen (LongFilePath (InputFileName), "rb");
if (InputFile == NULL) {
Error (NULL, 0, 0001, "Error opening the input file", InputFileName);
return EFI_ABORTED;
@@ -297,7 +302,7 @@ Returns: //
// Open the file
//
- OutputFile = fopen (OutputFileName, "wb");
+ OutputFile = fopen (LongFilePath (OutputFileName), "wb");
if (OutputFile == NULL) {
Error (NULL, 0, 0001, "Error opening the output file", OutputFileName);
return EFI_ABORTED;
@@ -582,3 +587,124 @@ char *strlwr(char *s) }
#endif
#endif
+
+#define WINDOWS_EXTENSION_PATH "\\\\?\\"
+#define WINDOWS_UNC_EXTENSION_PATH "\\\\?\\UNC"
+
+//
+// Global data to store full file path. It is not required to be free.
+//
+CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
+
+CHAR8 *
+LongFilePath (
+ IN CHAR8 *FileName
+ )
+/*++
+
+Routine Description:
+ Convert FileName to the long file path, which can support larger than 260 length.
+
+Arguments:
+ FileName - FileName.
+
+Returns:
+ LongFilePath A pointer to the converted long file path.
+
+--*/
+{
+#ifdef __GNUC__
+ //
+ // __GNUC__ may not be good way to differentiate unix and windows. Need more investigation here.
+ // unix has no limitation on file path. Just return FileName.
+ //
+ return FileName;
+#else
+ CHAR8 *RootPath;
+ CHAR8 *PathPointer;
+ CHAR8 *NextPointer;
+
+ PathPointer = (CHAR8 *) FileName;
+
+ if (FileName != NULL) {
+ //
+ // Add the extension string first to support long file path.
+ //
+ mCommonLibFullPath[0] = 0;
+ strcpy (mCommonLibFullPath, WINDOWS_EXTENSION_PATH);
+
+ if (strlen (FileName) > 1 && FileName[0] == '\\' && FileName[1] == '\\') {
+ //
+ // network path like \\server\share to \\?\UNC\server\share
+ //
+ strcpy (mCommonLibFullPath, WINDOWS_UNC_EXTENSION_PATH);
+ FileName ++;
+ } else if (strlen (FileName) < 3 || FileName[1] != ':' || (FileName[2] != '\\' && FileName[2] != '/')) {
+ //
+ // Relative file path. Convert it to absolute path.
+ //
+ RootPath = getcwd (NULL, 0);
+ if (RootPath != NULL) {
+ strcat (mCommonLibFullPath, RootPath);
+ if (FileName[0] != '\\' && FileName[0] != '/') {
+ //
+ // Attach directory separator
+ //
+ strcat (mCommonLibFullPath, "\\");
+ }
+ free (RootPath);
+ }
+ }
+
+ //
+ // Construct the full file path
+ //
+ strcat (mCommonLibFullPath, FileName);
+
+ //
+ // Convert directory separator '/' to '\\'
+ //
+ PathPointer = (CHAR8 *) mCommonLibFullPath;
+ do {
+ if (*PathPointer == '/') {
+ *PathPointer = '\\';
+ }
+ } while (*PathPointer ++ != '\0');
+
+ //
+ // Convert "\\.\\" to "\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
+ //
+ while ((PathPointer = strstr (mCommonLibFullPath, "\\.\\")) != NULL) {
+ *PathPointer = '\0';
+ strcat (mCommonLibFullPath, PathPointer + 2);
+ }
+
+ //
+ // Convert "\\..\\" to last directory, because it doesn't work with WINDOWS_EXTENSION_PATH.
+ //
+ while ((PathPointer = strstr (mCommonLibFullPath, "\\..\\")) != NULL) {
+ NextPointer = PathPointer + 3;
+ do {
+ PathPointer --;
+ } while (PathPointer > mCommonLibFullPath && *PathPointer != ':' && *PathPointer != '\\');
+
+ if (*PathPointer == '\\') {
+ //
+ // Skip one directory
+ //
+ *PathPointer = '\0';
+ strcat (mCommonLibFullPath, NextPointer);
+ } else {
+ //
+ // No directory is found. Just break.
+ //
+ break;
+ }
+ }
+
+ PathPointer = mCommonLibFullPath;
+ }
+
+ return PathPointer;
+#endif
+}
diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h index 0610b21ed0..2c1db759b0 100644 --- a/BaseTools/Source/C/Common/CommonLib.h +++ b/BaseTools/Source/C/Common/CommonLib.h @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -25,6 +25,12 @@ Abstract: #include <Common/UefiBaseTypes.h>
#include <Common/BuildVersion.h>
#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
+
+#define MAX_LONG_FILE_PATH 500
+
+#ifdef __cplusplus
+extern "C" {
+#endif
//
// Function declarations
//
@@ -145,6 +151,27 @@ PrintGuidToBuffer ( )
;
+CHAR8 *
+LongFilePath (
+ IN CHAR8 *FileName
+);
+/*++
+
+Routine Description:
+ Convert FileName to the long file path, which can support larger than 260 length.
+
+Arguments:
+ FileName - FileName.
+
+Returns:
+ LongFilePath A pointer to the converted long file path.
+
+--*/
+
+#ifdef __cplusplus
+}
+#endif
+
#define ASSERT(x) assert(x)
#ifdef __GNUC__
diff --git a/BaseTools/Source/C/Common/MemoryFile.h b/BaseTools/Source/C/Common/MemoryFile.h index baab40baa2..0568fed5f2 100644 --- a/BaseTools/Source/C/Common/MemoryFile.h +++ b/BaseTools/Source/C/Common/MemoryFile.h @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -26,10 +26,6 @@ Abstract: #include <stdlib.h>
#include <Common/UefiBaseTypes.h>
-#ifndef _MAX_PATH
-#define _MAX_PATH 500
-#endif
-
//
// Common data structures
//
diff --git a/BaseTools/Source/C/Common/OsPath.c b/BaseTools/Source/C/Common/OsPath.c index 419c8f8b8c..07b47f09b4 100644 --- a/BaseTools/Source/C/Common/OsPath.c +++ b/BaseTools/Source/C/Common/OsPath.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2014, 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
@@ -22,6 +22,7 @@ Abstract: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "CommonLib.h"
#include "OsPath.h"
//
@@ -294,7 +295,7 @@ Returns: --*/
{
FILE *InputFile;
- InputFile = fopen (InputFileName, "rb");
+ InputFile = fopen (LongFilePath (InputFileName), "rb");
if (InputFile == NULL) {
return FALSE;
} else {
diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c index 385758f836..00ae0e65a1 100644 --- a/BaseTools/Source/C/Common/ParseInf.c +++ b/BaseTools/Source/C/Common/ParseInf.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -25,6 +25,7 @@ Abstract: #include <stdlib.h>
#include "EfiUtilityMsgs.h"
#include "ParseInf.h"
+#include "CommonLib.h"
CHAR8 *
ReadLine (
@@ -46,7 +47,7 @@ Routine Description: Arguments:
InputFile Memory file image.
- InputBuffer Buffer to read into, must be _MAX_PATH size.
+ InputBuffer Buffer to read into, must be MaxLength size.
MaxLength The maximum size of the input buffer.
Returns:
@@ -165,7 +166,7 @@ Returns: --*/
{
- CHAR8 InputBuffer[_MAX_PATH];
+ CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
CHAR8 *CurrentToken;
//
@@ -188,7 +189,7 @@ Returns: //
// Read a line
//
- ReadLine (InputFile, InputBuffer, _MAX_PATH);
+ ReadLine (InputFile, InputBuffer, MAX_LONG_FILE_PATH);
//
// Check if the section is found
@@ -222,7 +223,7 @@ Arguments: Section The section to search for, a string within [].
Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
Instance The instance of the token to search for. Zero is the first instance.
- Value The string that holds the value following the =. Must be _MAX_PATH in size.
+ Value The string that holds the value following the =. Must be MAX_LONG_FILE_PATH in size.
Returns:
@@ -234,7 +235,7 @@ Returns: --*/
{
- CHAR8 InputBuffer[_MAX_PATH];
+ CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
CHAR8 *CurrentToken;
CHAR8 *Delimiter;
BOOLEAN ParseError;
@@ -274,7 +275,7 @@ Returns: //
// Read a line from the file
//
- if (ReadLine (InputFile, InputBuffer, _MAX_PATH) == NULL) {
+ if (ReadLine (InputFile, InputBuffer, MAX_LONG_FILE_PATH) == NULL) {
//
// Error reading from input file
//
@@ -604,7 +605,7 @@ Routine Description: Arguments:
InputFile Stream pointer.
- InputBuffer Buffer to read into, must be _MAX_PATH size.
+ InputBuffer Buffer to read into, must be MAX_LONG_FILE_PATH size.
Returns:
@@ -624,7 +625,7 @@ Returns: //
// Read a line
//
- if (fgets (InputBuffer, _MAX_PATH, InputFile) == NULL) {
+ if (fgets (InputBuffer, MAX_LONG_FILE_PATH, InputFile) == NULL) {
return NULL;
}
//
@@ -670,7 +671,7 @@ Returns: --*/
{
- CHAR8 InputBuffer[_MAX_PATH];
+ CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
CHAR8 *CurrentToken;
//
diff --git a/BaseTools/Source/C/Common/ParseInf.h b/BaseTools/Source/C/Common/ParseInf.h index dfd180db74..6215ea2e78 100644 --- a/BaseTools/Source/C/Common/ParseInf.h +++ b/BaseTools/Source/C/Common/ParseInf.h @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -27,10 +27,6 @@ Abstract: #include <Common/UefiBaseTypes.h>
#include <MemoryFile.h>
-#ifndef _MAX_PATH
-#define _MAX_PATH 500
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -59,7 +55,7 @@ Routine Description: Arguments:
InputFile Memory file image.
- InputBuffer Buffer to read into, must be _MAX_PATH size.
+ InputBuffer Buffer to read into, must be MaxLength size.
MaxLength The maximum size of the input buffer.
Returns:
@@ -115,7 +111,7 @@ Arguments: Section The section to search for, a string within [].
Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
Instance The instance of the token to search for. Zero is the first instance.
- Value The string that holds the value following the =. Must be _MAX_PATH in size.
+ Value The string that holds the value following the =. Must be MAX_LONG_FILE_PATH in size.
Returns:
@@ -196,7 +192,7 @@ Routine Description: Arguments:
InputFile Stream pointer.
- InputBuffer Buffer to read into, must be _MAX_PATH size.
+ InputBuffer Buffer to read into, must be MAX_LONG_FILE_PATH size.
Returns:
diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.c b/BaseTools/Source/C/Common/SimpleFileParsing.c index 0f6151819c..3978e6ed3c 100644 --- a/BaseTools/Source/C/Common/SimpleFileParsing.c +++ b/BaseTools/Source/C/Common/SimpleFileParsing.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -24,6 +24,7 @@ Abstract: #include <stdlib.h>
#include <ctype.h>
+#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
#include "SimpleFileParsing.h"
@@ -650,7 +651,7 @@ Returns: // Try to open the file locally, and if that fails try along our include paths.
//
strcpy (FoundFileName, SourceFile->FileName);
- if ((SourceFile->Fptr = fopen (FoundFileName, "rb")) == NULL) {
+ if ((SourceFile->Fptr = fopen (LongFilePath (FoundFileName), "rb")) == NULL) {
return STATUS_ERROR;
}
//
diff --git a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c index f83c532b25..a76102cbb3 100644 --- a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c +++ b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, 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
@@ -84,7 +84,7 @@ Returns: --*/
{
printf ("%s v%d.%d %s -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
- printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 1999-2014 Intel Corporation. All rights reserved.\n");
}
VOID
@@ -270,7 +270,7 @@ Returns: return STATUS_ERROR;
}
- fpOut = fopen(OutputFileName, "w+b");
+ fpOut = fopen (LongFilePath (OutputFileName), "w+b");
if (!fpOut) {
Error (NULL, 0, 0001, "Could not open output file", OutputFileName);
return STATUS_ERROR;
@@ -294,7 +294,7 @@ Returns: //
// Copy the content of PeImage file to output file
//
- fpIn = fopen (InputFileNames[i], "rb");
+ fpIn = fopen (LongFilePath (InputFileNames[i]), "rb");
if (!fpIn) {
Error (NULL, 0, 0001, "Could not open input file", InputFileNames[i]);
fclose (fpOut);
diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c index 9f7da8017c..838ee25cba 100644 --- a/BaseTools/Source/C/EfiRom/EfiRom.c +++ b/BaseTools/Source/C/EfiRom/EfiRom.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 1999 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, 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
@@ -135,7 +135,7 @@ Returns: //
// Now open our output file
//
- if ((FptrOut = fopen (mOptions.OutFileName, "wb")) == NULL) {
+ if ((FptrOut = fopen (LongFilePath (mOptions.OutFileName), "wb")) == NULL) {
Error (NULL, 0, 0001, "Error opening file", "Error opening file %s", mOptions.OutFileName);
goto BailOut;
}
@@ -246,7 +246,7 @@ Returns: //
// Try to open the input file
//
- if ((InFptr = fopen (InFile->FileName, "rb")) == NULL) {
+ if ((InFptr = fopen (LongFilePath (InFile->FileName), "rb")) == NULL) {
Error (NULL, 0, 0001, "Error opening file", InFile->FileName);
return STATUS_ERROR;
}
@@ -460,7 +460,7 @@ Returns: //
// Try to open the input file
//
- if ((InFptr = fopen (InFile->FileName, "rb")) == NULL) {
+ if ((InFptr = fopen (LongFilePath (InFile->FileName), "rb")) == NULL) {
Error (NULL, 0, 0001, "Open file error", "Error opening file: %s", InFile->FileName);
return STATUS_ERROR;
}
@@ -1230,7 +1230,7 @@ Returns: //
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
@@ -1300,7 +1300,7 @@ Returns: //
// Open the input file
//
- if ((InFptr = fopen (InFile->FileName, "rb")) == NULL) {
+ if ((InFptr = fopen (LongFilePath (InFile->FileName), "rb")) == NULL) {
Error (NULL, 0, 0001, "Error opening file", InFile->FileName);
return ;
}
diff --git a/BaseTools/Source/C/GenBootSector/GenBootSector.c b/BaseTools/Source/C/GenBootSector/GenBootSector.c index f102ee139a..6ca86ae555 100644 --- a/BaseTools/Source/C/GenBootSector/GenBootSector.c +++ b/BaseTools/Source/C/GenBootSector/GenBootSector.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, 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
@@ -632,7 +632,7 @@ GetPathInfo ( //
// If path is file path, check whether file is valid.
//
- f = fopen (PathInfo->Path, "r");
+ f = fopen (LongFilePath (PathInfo->Path), "r");
if (f == NULL) {
fprintf (stderr, "error E2003: File was not provided!\n");
return ErrorPath;
diff --git a/BaseTools/Source/C/GenCrc32/GenCrc32.c b/BaseTools/Source/C/GenCrc32/GenCrc32.c index 8ece9a8412..a2ff5880d5 100644 --- a/BaseTools/Source/C/GenCrc32/GenCrc32.c +++ b/BaseTools/Source/C/GenCrc32/GenCrc32.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2014, 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
@@ -282,7 +282,7 @@ Returns: //
// Open Input file and read file data.
//
- InFile = fopen (InputFileName, "rb");
+ InFile = fopen (LongFilePath (InputFileName), "rb");
if (InFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName);
return STATUS_ERROR;
@@ -305,7 +305,7 @@ Returns: //
// Open output file
//
- OutFile = fopen (OutputFileName, "wb");
+ OutFile = fopen (LongFilePath (OutputFileName), "wb");
if (OutFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", OutputFileName);
goto Finish;
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index 6f4804e90a..765c0b27da 100644 --- a/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/BaseTools/Source/C/GenFfs/GenFfs.c @@ -1,6 +1,6 @@ /**
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -119,7 +119,7 @@ Returns: //
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
@@ -317,7 +317,7 @@ Returns: //
// Open file and read contents
//
- InFile = fopen (InputFileName[Index], "rb");
+ InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
if (InFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName[Index]);
return EFI_ABORTED;
diff --git a/BaseTools/Source/C/GenFv/GenFv.c b/BaseTools/Source/C/GenFv/GenFv.c index 8f837d2695..56c52b850f 100644 --- a/BaseTools/Source/C/GenFv/GenFv.c +++ b/BaseTools/Source/C/GenFv/GenFv.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2014, 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
@@ -97,7 +97,7 @@ Returns: //
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
@@ -603,7 +603,7 @@ Returns: if (OutFileName == NULL) {
FpFile = stdout;
} else {
- FpFile = fopen (OutFileName, "w");
+ FpFile = fopen (LongFilePath (OutFileName), "w");
if (FpFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", OutFileName);
return STATUS_ERROR;
@@ -672,7 +672,7 @@ Returns: // update boot driver address and runtime driver address in address file
//
if (Status == EFI_SUCCESS && AddrFileName != NULL && mFvBaseAddressNumber > 0) {
- FpFile = fopen (AddrFileName, "w");
+ FpFile = fopen (LongFilePath (AddrFileName), "w");
if (FpFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", AddrFileName);
return STATUS_ERROR;
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c index 0522cf4254..6ac542d6c0 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -187,7 +187,7 @@ Returns: EFI_NOT_FOUND A required string was not found in the INF file.
--*/
{
- CHAR8 Value[_MAX_PATH];
+ CHAR8 Value[MAX_LONG_FILE_PATH];
UINT64 Value64;
UINTN Index;
UINTN Number;
@@ -730,7 +730,7 @@ Returns: --*/
{
- CHAR8 PeMapFileName [_MAX_PATH];
+ CHAR8 PeMapFileName [MAX_LONG_FILE_PATH];
CHAR8 *Cptr, *Cptr2;
CHAR8 FileGuidName [MAX_LINE_LEN];
FILE *PeMapFile;
@@ -866,7 +866,7 @@ Returns: //
// Open PeMapFile
//
- PeMapFile = fopen (PeMapFileName, "r");
+ PeMapFile = fopen (LongFilePath (PeMapFileName), "r");
if (PeMapFile == NULL) {
// fprintf (stdout, "can't open %s file to reading\n", PeMapFileName);
return EFI_ABORTED;
@@ -992,7 +992,7 @@ Returns: //
// Read the file to add
//
- NewFile = fopen (FvInfo->FvFiles[Index], "rb");
+ NewFile = fopen (LongFilePath (FvInfo->FvFiles[Index]), "rb");
if (NewFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", FvInfo->FvFiles[Index]);
@@ -2077,12 +2077,12 @@ Returns: UINT8 *FvImage;
UINTN FvImageSize;
FILE *FvFile;
- CHAR8 FvMapName [_MAX_PATH];
+ CHAR8 FvMapName [MAX_LONG_FILE_PATH];
FILE *FvMapFile;
EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader;
FILE *FvExtHeaderFile;
UINTN FileSize;
- CHAR8 FvReportName[_MAX_PATH];
+ CHAR8 FvReportName[MAX_LONG_FILE_PATH];
FILE *FvReportFile;
FvBufferHeader = NULL;
@@ -2152,7 +2152,7 @@ Returns: //
// Open the FV Extension Header file
//
- FvExtHeaderFile = fopen (mFvDataInfo.FvExtHeaderFile, "rb");
+ FvExtHeaderFile = fopen (LongFilePath (mFvDataInfo.FvExtHeaderFile), "rb");
//
// Get the file size
@@ -2343,7 +2343,7 @@ Returns: //
// Open FvMap file
//
- FvMapFile = fopen (FvMapName, "w");
+ FvMapFile = fopen (LongFilePath (FvMapName), "w");
if (FvMapFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", FvMapName);
return EFI_ABORTED;
@@ -2352,7 +2352,7 @@ Returns: //
// Open FvReport file
//
- FvReportFile = fopen(FvReportName, "w");
+ FvReportFile = fopen (LongFilePath (FvReportName), "w");
if (FvReportFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", FvReportName);
return EFI_ABORTED;
@@ -2484,7 +2484,7 @@ WriteFile: //
// Write fv file
//
- FvFile = fopen (FvFileName, "wb");
+ FvFile = fopen (LongFilePath (FvFileName), "wb");
if (FvFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", FvFileName);
Status = EFI_ABORTED;
@@ -2651,7 +2651,7 @@ Returns: // Calculate PI extension header
//
if (mFvDataInfo.FvExtHeaderFile[0] != '\0') {
- fpin = fopen (mFvDataInfo.FvExtHeaderFile, "rb");
+ fpin = fopen (LongFilePath (mFvDataInfo.FvExtHeaderFile), "rb");
if (fpin == NULL) {
Error (NULL, 0, 0001, "Error opening file", mFvDataInfo.FvExtHeaderFile);
return EFI_ABORTED;
@@ -2678,7 +2678,7 @@ Returns: // Open FFS file
//
fpin = NULL;
- fpin = fopen (FvInfoPtr->FvFiles[Index], "rb");
+ fpin = fopen (LongFilePath (FvInfoPtr->FvFiles[Index]), "rb");
if (fpin == NULL) {
Error (NULL, 0, 0001, "Error opening file", FvInfoPtr->FvFiles[Index]);
return EFI_ABORTED;
@@ -2915,7 +2915,7 @@ Returns: EFI_TE_IMAGE_HEADER *TEImageHeader;
UINT8 *MemoryImagePointer;
EFI_IMAGE_SECTION_HEADER *SectionHeader;
- CHAR8 PeFileName [_MAX_PATH];
+ CHAR8 PeFileName [MAX_LONG_FILE_PATH];
CHAR8 *Cptr;
FILE *PeFile;
UINT8 *PeFileBuffer;
@@ -3066,7 +3066,7 @@ Returns: *(Cptr + 3) = 'i';
*(Cptr + 4) = '\0';
}
- PeFile = fopen (PeFileName, "rb");
+ PeFile = fopen (LongFilePath (PeFileName), "rb");
if (PeFile == NULL) {
Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
//Error (NULL, 0, 3000, "Invalid", "The file %s has no .reloc section.", FileName);
@@ -3322,7 +3322,7 @@ Returns: *(Cptr + 4) = '\0';
}
- PeFile = fopen (PeFileName, "rb");
+ PeFile = fopen (LongFilePath (PeFileName), "rb");
if (PeFile == NULL) {
Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
//Error (NULL, 0, 3000, "Invalid", "The file %s has no .reloc section.", FileName);
@@ -3567,7 +3567,7 @@ Returns: EFI_NOT_FOUND A required string was not found in the INF file.
--*/
{
- CHAR8 Value[_MAX_PATH];
+ CHAR8 Value[MAX_LONG_FILE_PATH];
UINT64 Value64;
UINTN Index, Number;
EFI_STATUS Status;
@@ -3773,7 +3773,7 @@ Returns: FileSize = 0;
CapSize = mCapDataInfo.HeaderSize;
while (mCapDataInfo.CapFiles [Index][0] != '\0') {
- fpin = fopen (mCapDataInfo.CapFiles[Index], "rb");
+ fpin = fopen (LongFilePath (mCapDataInfo.CapFiles[Index]), "rb");
if (fpin == NULL) {
Error (NULL, 0, 0001, "Error opening file", mCapDataInfo.CapFiles[Index]);
return EFI_ABORTED;
@@ -3811,7 +3811,7 @@ Returns: FileSize = 0;
CapSize = CapsuleHeader->HeaderSize;
while (mCapDataInfo.CapFiles [Index][0] != '\0') {
- fpin = fopen (mCapDataInfo.CapFiles[Index], "rb");
+ fpin = fopen (LongFilePath (mCapDataInfo.CapFiles[Index]), "rb");
if (fpin == NULL) {
Error (NULL, 0, 0001, "Error opening file", mCapDataInfo.CapFiles[Index]);
free (CapBuffer);
@@ -3827,7 +3827,7 @@ Returns: //
// write capsule data into the output file
//
- fpout = fopen (CapFileName, "wb");
+ fpout = fopen (LongFilePath (CapFileName), "wb");
if (fpout == NULL) {
Error (NULL, 0, 0001, "Error opening file", CapFileName);
free (CapBuffer);
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.h b/BaseTools/Source/C/GenFv/GenFvInternalLib.h index a9a00ec028..f8eecbade1 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.h +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.h @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -214,7 +214,7 @@ Abstract: //
typedef struct {
UINTN Size;
- CHAR8 ComponentName[_MAX_PATH];
+ CHAR8 ComponentName[MAX_LONG_FILE_PATH];
} COMPONENT_INFO;
//
@@ -227,12 +227,12 @@ typedef struct { BOOLEAN FvFileSystemGuidSet;
EFI_GUID FvNameGuid;
BOOLEAN FvNameGuidSet;
- CHAR8 FvExtHeaderFile[_MAX_PATH];
+ CHAR8 FvExtHeaderFile[MAX_LONG_FILE_PATH];
UINTN Size;
EFI_FVB_ATTRIBUTES_2 FvAttributes;
- CHAR8 FvName[_MAX_PATH];
+ CHAR8 FvName[MAX_LONG_FILE_PATH];
EFI_FV_BLOCK_MAP_ENTRY FvBlocks[MAX_NUMBER_OF_FV_BLOCKS];
- CHAR8 FvFiles[MAX_NUMBER_OF_FILES_IN_FV][_MAX_PATH];
+ CHAR8 FvFiles[MAX_NUMBER_OF_FILES_IN_FV][MAX_LONG_FILE_PATH];
UINT32 SizeofFvFiles[MAX_NUMBER_OF_FILES_IN_FV];
BOOLEAN IsPiFvImage;
INT8 ForceRebase;
@@ -242,8 +242,8 @@ typedef struct { EFI_GUID CapGuid;
UINT32 HeaderSize;
UINT32 Flags;
- CHAR8 CapName[_MAX_PATH];
- CHAR8 CapFiles[MAX_NUMBER_OF_FILES_IN_CAP][_MAX_PATH];
+ CHAR8 CapName[MAX_LONG_FILE_PATH];
+ CHAR8 CapFiles[MAX_NUMBER_OF_FILES_IN_CAP][MAX_LONG_FILE_PATH];
} CAP_INFO;
#pragma pack(1)
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index d511834fc0..56543b411b 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -66,10 +66,6 @@ Abstract: #define DEFAULT_MC_PAD_BYTE_VALUE 0xFF
#define DEFAULT_MC_ALIGNMENT 16
-#ifndef _MAX_PATH
-#define _MAX_PATH 500
-#endif
-
#define STATUS_IGNORE 0xA
//
// Structure definition for a microcode header
@@ -179,7 +175,7 @@ Returns: //
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
@@ -1559,7 +1555,7 @@ Returns: // Open output file and Write image into the output file.
//
if (OutImageName != NULL) {
- fpOut = fopen (OutImageName, "rb");
+ fpOut = fopen (LongFilePath (OutImageName), "rb");
if (fpOut != NULL) {
//
// Get Output file time stamp
@@ -1590,7 +1586,7 @@ Returns: //
// Open input file and read file data into file buffer.
//
- fpIn = fopen (mInImageName, "rb");
+ fpIn = fopen (LongFilePath (mInImageName), "rb");
if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
@@ -1621,7 +1617,7 @@ Returns: //
// Open output file handle.
//
- fpOut = fopen (OutImageName, "wb");
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
if (!fpOut) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
@@ -1631,7 +1627,7 @@ Returns: //
HiiPackageListHeader.PackageLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
for (Index = 0; Index < InputFileNum; Index ++) {
- fpIn = fopen (InputFileName [Index], "rb");
+ fpIn = fopen (LongFilePath (InputFileName [Index]), "rb");
if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
goto Finish;
@@ -1677,7 +1673,7 @@ Returns: memcpy (HiiPackageListBuffer, &HiiPackageListHeader, sizeof (HiiPackageListHeader));
HiiPackageDataPointer = HiiPackageListBuffer + sizeof (HiiPackageListHeader);
for (Index = 0; Index < InputFileNum; Index ++) {
- fpIn = fopen (InputFileName [Index], "rb");
+ fpIn = fopen (LongFilePath (InputFileName [Index]), "rb");
if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
free (HiiPackageListBuffer);
@@ -1757,13 +1753,13 @@ Returns: //
// Open output file handle.
//
- fpOut = fopen (OutImageName, "wb");
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
if (!fpOut) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
}
for (Index = 0; Index < InputFileNum; Index ++) {
- fpIn = fopen (InputFileName [Index], "rb");
+ fpIn = fopen (LongFilePath (InputFileName [Index]), "rb");
if (!fpIn) {
Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
goto Finish;
@@ -1805,7 +1801,7 @@ Returns: // Convert MicroCode.txt file to MicroCode.bin file
//
if (mOutImageType == FW_MCI_IMAGE) {
- fpIn = fopen (mInImageName, "r");
+ fpIn = fopen (LongFilePath (mInImageName), "r");
if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
@@ -1928,14 +1924,14 @@ Returns: // Open the output file handle.
//
if (ReplaceFlag) {
- fpInOut = fopen (mInImageName, "wb");
+ fpInOut = fopen (LongFilePath (mInImageName), "wb");
if (fpInOut == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
}
} else {
if (OutImageName != NULL) {
- fpOut = fopen (OutImageName, "wb");
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
} else {
fpOut = stdout;
}
@@ -2641,7 +2637,7 @@ WriteFile: //
// Update File when File is changed.
//
- fpInOut = fopen (mInImageName, "wb");
+ fpInOut = fopen (LongFilePath (mInImageName), "wb");
if (fpInOut == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
@@ -2654,7 +2650,7 @@ WriteFile: //
// Update File when File is changed or File is old.
//
- fpOut = fopen (OutImageName, "wb");
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
if (fpOut == NULL) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
@@ -2696,7 +2692,7 @@ Finish: if (OutputFileBuffer == NULL) {
remove (OutImageName);
} else {
- fpOut = fopen (OutImageName, "wb");
+ fpOut = fopen (LongFilePath (OutImageName), "wb");
fwrite (OutputFileBuffer, 1, OutputFileLength, fpOut);
fclose (fpOut);
}
@@ -2722,7 +2718,7 @@ Finish: if (ReportFileName != NULL) {
strcpy (ReportFileName, OutImageName);
strcpy (ReportFileName + (FileLen - 4), ".txt");
- ReportFile = fopen (ReportFileName, "w+");
+ ReportFile = fopen (LongFilePath (ReportFileName), "w+");
if (ReportFile != NULL) {
fprintf (ReportFile, "MODULE_SIZE = %u\n", (unsigned) mImageSize);
fprintf (ReportFile, "TIME_STAMP = %u\n", (unsigned) mImageTimeStamp);
diff --git a/BaseTools/Source/C/GenPage/GenPage.c b/BaseTools/Source/C/GenPage/GenPage.c index 78047ba9be..b6a5d01e3e 100644 --- a/BaseTools/Source/C/GenPage/GenPage.c +++ b/BaseTools/Source/C/GenPage/GenPage.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, 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
@@ -243,13 +243,13 @@ return: //
// Open files
//
- PageFile = fopen (PageFileName, "w+b");
+ PageFile = fopen (LongFilePath (PageFileName), "w+b");
if (PageFile == NULL) {
Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Output File %s open failure", PageFileName);
return -1;
}
- NoPageFile = fopen (NoPageFileName, "r+b");
+ NoPageFile = fopen (LongFilePath (NoPageFileName), "r+b");
if (NoPageFile == NULL) {
Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Input File %s open failure", NoPageFileName);
fclose (PageFile);
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c index 63e8e13e8f..f9370d3564 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -153,7 +153,7 @@ Returns: //
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
@@ -283,7 +283,7 @@ Returns: //
// Open the input file
//
- InFile = fopen (InputFileName[0], "rb");
+ InFile = fopen (LongFilePath (InputFileName[0]), "rb");
if (InFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName[0]);
return STATUS_ERROR;
@@ -473,7 +473,7 @@ Returns: //
// Open file and read contents
//
- InFile = fopen (InputFileName[Index], "rb");
+ InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
if (InFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName[Index]);
return EFI_ABORTED;
@@ -1553,7 +1553,7 @@ Returns: //
// Write the output file
//
- OutFile = fopen (OutputFileName, "wb");
+ OutFile = fopen (LongFilePath (OutputFileName), "wb");
if (OutFile == NULL) {
Error (NULL, 0, 0001, "Error opening file for writing", OutputFileName);
goto Finish;
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c index eaf2f56fed..60df34906e 100644 --- a/BaseTools/Source/C/GenVtf/GenVtf.c +++ b/BaseTools/Source/C/GenVtf/GenVtf.c @@ -1,6 +1,6 @@ /**
-Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, 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
@@ -1070,7 +1070,7 @@ Returns: CHAR8 Buff5[10];
CHAR8 Token[50];
- Fp = fopen (VtfInfo->CompSymName, "rb");
+ Fp = fopen (LongFilePath (VtfInfo->CompSymName), "rb");
if (Fp == NULL) {
Error (NULL, 0, 0001, "Error opening file", VtfInfo->CompSymName);
@@ -1152,7 +1152,7 @@ Returns: return EFI_SUCCESS;
}
- Fp = fopen (VtfInfo->CompBinName, "rb");
+ Fp = fopen (LongFilePath (VtfInfo->CompBinName), "rb");
if (Fp == NULL) {
Error (NULL, 0, 0001, "Error opening file", VtfInfo->CompBinName);
@@ -1332,7 +1332,7 @@ Returns: FILE *Fp;
FIT_TABLE *PalFitPtr;
- Fp = fopen (VtfInfo->CompBinName, "rb");
+ Fp = fopen (LongFilePath (VtfInfo->CompBinName), "rb");
if (Fp == NULL) {
Error (NULL, 0, 0001, "Error opening file", VtfInfo->CompBinName);
@@ -1551,7 +1551,7 @@ Returns: VtfBuffer = (VOID *) RelativeAddress;
}
- Fp = fopen (FileName, "wb");
+ Fp = fopen (LongFilePath (FileName), "wb");
if (Fp == NULL) {
Error (NULL, 0, 0001, "Error opening file", FileName);
return EFI_ABORTED;
@@ -1763,7 +1763,7 @@ Returns: return EFI_INVALID_PARAMETER;
}
- Fp = fopen (FileName, "rb");
+ Fp = fopen (LongFilePath (FileName), "rb");
if (Fp == NULL) {
Error (NULL, 0, 0001, "Error opening file", FileName);
@@ -2125,7 +2125,7 @@ Returns: }
*StartAddressPtr = StartAddress;
- Fp = fopen (OutFileName1, "rb");
+ Fp = fopen (LongFilePath (OutFileName1), "rb");
if (Fp == NULL) {
Error (NULL, 0, 0001, "Error opening file", OutFileName1);
@@ -2183,12 +2183,12 @@ Returns: {
FILE *SourceFile;
FILE *DestFile;
- CHAR8 Buffer[_MAX_PATH];
- CHAR8 Type[_MAX_PATH];
- CHAR8 Address[_MAX_PATH];
- CHAR8 Section[_MAX_PATH];
- CHAR8 Token[_MAX_PATH];
- CHAR8 BaseToken[_MAX_PATH];
+ CHAR8 Buffer[MAX_LONG_FILE_PATH];
+ CHAR8 Type[MAX_LONG_FILE_PATH];
+ CHAR8 Address[MAX_LONG_FILE_PATH];
+ CHAR8 Section[MAX_LONG_FILE_PATH];
+ CHAR8 Token[MAX_LONG_FILE_PATH];
+ CHAR8 BaseToken[MAX_LONG_FILE_PATH];
UINT64 TokenAddress;
long StartLocation;
@@ -2202,7 +2202,7 @@ Returns: //
// Open the source file
//
- SourceFile = fopen (SourceFileName, "r");
+ SourceFile = fopen (LongFilePath (SourceFileName), "r");
if (SourceFile == NULL) {
//
@@ -2221,7 +2221,7 @@ Returns: //
// Open the destination file
//
- DestFile = fopen (DestFileName, "a+");
+ DestFile = fopen (LongFilePath (DestFileName), "a+");
if (DestFile == NULL) {
fclose (SourceFile);
Error (NULL, 0, 0001, "Error opening file", DestFileName);
@@ -2252,7 +2252,7 @@ Returns: //
// Read the first line
//
- if (fgets (Buffer, _MAX_PATH, SourceFile) == NULL) {
+ if (fgets (Buffer, MAX_LONG_FILE_PATH, SourceFile) == NULL) {
Buffer[0] = 0;
}
@@ -2410,7 +2410,7 @@ Returns: //
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
//
@@ -2546,7 +2546,7 @@ Returns: // Get the input VTF file name
//
VtfFileName = argv[Index+1];
- VtfFP = fopen(VtfFileName, "rb");
+ VtfFP = fopen (LongFilePath (VtfFileName), "rb");
if (VtfFP == NULL) {
Error (NULL, 0, 0001, "Error opening file", VtfFileName);
goto ERROR;
diff --git a/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c b/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c index b0ec271b05..f9869c4441 100644 --- a/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c +++ b/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, 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
@@ -153,7 +153,7 @@ GetPathInfo ( }
// Try to open the device.
- f = fopen(PathInfo->Path,"r");
+ f = fopen (LongFilePath (PathInfo->Path),"r");
if (f == NULL) {
printf ("error :open device failed!\n");
return ErrorPath;
@@ -167,7 +167,7 @@ GetPathInfo ( if (PathInfo->Input) {
// If path is file path, check whether file is valid.
printf("Path = %s\n",PathInfo->Path);
- f = fopen (PathInfo->Path, "r");
+ f = fopen (LongFilePath (PathInfo->Path), "r");
if (f == NULL) {
fprintf (stderr, "Test error E2003: File was not provided!\n");
return ErrorPath;
@@ -211,7 +211,7 @@ ProcessBsOrMbr ( FILE *OutputFile;
- InputFile = fopen(InputInfo->PhysicalPath, "r");
+ InputFile = fopen (LongFilePath (InputInfo->PhysicalPath), "r");
if (InputFile == NULL) {
return ErrorFileReadWrite;
}
@@ -235,9 +235,9 @@ ProcessBsOrMbr ( }
//Process Floppy Disk
- OutputFile = fopen(OutputInfo->PhysicalPath, "r+");
+ OutputFile = fopen (LongFilePath (OutputInfo->PhysicalPath), "r+");
if (OutputFile == NULL) {
- OutputFile = fopen(OutputInfo->PhysicalPath, "w");
+ OutputFile = fopen (LongFilePath (OutputInfo->PhysicalPath), "w");
if (OutputFile == NULL) {
return ErrorFileReadWrite;
}
@@ -276,7 +276,7 @@ Version ( )
{
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);
- printf ("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 2007-2014 Intel Corporation. All rights reserved.\n");
}
diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c index 544da91f4b..e8fea63510 100644 --- a/BaseTools/Source/C/Split/Split.c +++ b/BaseTools/Source/C/Split/Split.c @@ -2,7 +2,7 @@ Split a file into two pieces at the request offset.
-Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, 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
@@ -58,7 +58,7 @@ Returns: --*/
{
printf ("%s v%d.%d %s -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
- printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 1999-2014 Intel Corporation. All rights reserved.\n");
}
void
@@ -348,7 +348,7 @@ Returns: return STATUS_ERROR;
}
- In = fopen (InputFileName, "rb");
+ In = fopen (LongFilePath (InputFileName), "rb");
if (In == NULL) {
// ("Unable to open file \"%s\"\n", InputFileName);
Error (InputFileName, 0, 1, "File open failure", NULL);
@@ -400,14 +400,14 @@ Returns: chdir(CurrentDir);
free(CurrentDir);
- Out1 = fopen (OutFileName1, "wb");
+ Out1 = fopen (LongFilePath (OutFileName1), "wb");
if (Out1 == NULL) {
// ("Unable to open file \"%s\"\n", OutFileName1);
Error (OutFileName1, 0, 1, "File open failure", NULL);
return STATUS_ERROR;
}
- Out2 = fopen (OutFileName2, "wb");
+ Out2 = fopen (LongFilePath (OutFileName2), "wb");
if (Out2 == NULL) {
// ("Unable to open file \"%s\"\n", OutFileName2);
Error (OutFileName2, 0, 1, "File open failure", NULL);
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp index bb2df3ed39..063266a91f 100644 --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp @@ -2,7 +2,7 @@ VfrCompiler main class and main function.
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -413,7 +413,7 @@ CVfrCompiler::Usage ( CONST CHAR8 *Help[] = {
" ",
"VfrCompile version " VFR_COMPILER_VERSION __BUILD_VERSION,
- "Copyright (c) 2004-2013 Intel Corporation. All rights reserved.",
+ "Copyright (c) 2004-2014 Intel Corporation. All rights reserved.",
" ",
"Usage: VfrCompile [options] VfrFile",
" ",
@@ -476,7 +476,7 @@ CVfrCompiler::PreProcess ( goto Out;
}
- if ((pVfrFile = fopen (mOptions.VfrFileName, "r")) == NULL) {
+ if ((pVfrFile = fopen (LongFilePath (mOptions.VfrFileName), "r")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening the input VFR file", mOptions.VfrFileName);
goto Fail;
}
@@ -545,7 +545,7 @@ CVfrCompiler::Compile ( gCVfrErrorHandle.SetInputFile (InFileName);
gCVfrErrorHandle.SetWarningAsError(mOptions.WarningAsError);
- if ((pInFile = fopen (InFileName, "r")) == NULL) {
+ if ((pInFile = fopen (LongFilePath (InFileName), "r")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening the input file", InFileName);
goto Fail;
}
@@ -699,7 +699,7 @@ CVfrCompiler::GenBinary ( }
if (mOptions.CreateIfrPkgFile == TRUE) {
- if ((pFile = fopen (mOptions.PkgOutputFileName, "wb")) == NULL) {
+ if ((pFile = fopen (LongFilePath (mOptions.PkgOutputFileName), "wb")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening file", mOptions.PkgOutputFileName);
goto Fail;
}
@@ -742,7 +742,7 @@ CVfrCompiler::GenCFile ( }
if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
- if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) {
+ if ((pFile = fopen (LongFilePath (mOptions.COutputFileName), "w")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);
goto Fail;
}
@@ -789,12 +789,12 @@ CVfrCompiler::GenRecordListFile ( return;
}
- if ((pInFile = fopen (InFileName, "r")) == NULL) {
+ if ((pInFile = fopen (LongFilePath (InFileName), "r")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", InFileName);
return;
}
- if ((pOutFile = fopen (mOptions.RecordListFile, "w")) == NULL) {
+ if ((pOutFile = fopen (LongFilePath (mOptions.RecordListFile), "w")) == NULL) {
DebugError (NULL, 0, 0001, "Error opening the record list file", mOptions.RecordListFile);
goto Err1;
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp index 7c1383eb7a..246820a08a 100644 --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp @@ -2,7 +2,7 @@ Vfr common library functions.
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "stdio.h"
#include "stdlib.h"
+#include "CommonLib.h"
#include "VfrUtilityLib.h"
#include "VfrFormPkg.h"
@@ -3283,7 +3284,7 @@ CVfrStringDB::GetVarStoreNameFormStringId ( return NULL;
}
- if ((pInFile = fopen (mStringFileName, "rb")) == NULL) {
+ if ((pInFile = fopen (LongFilePath (mStringFileName), "rb")) == NULL) {
return NULL;
}
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c index 21d70199cb..537cea3cfe 100644 --- a/BaseTools/Source/C/VolInfo/VolInfo.c +++ b/BaseTools/Source/C/VolInfo/VolInfo.c @@ -249,7 +249,7 @@ Returns: //
// Open the file containing the FV
//
- InputFile = fopen (argv[0], "rb");
+ InputFile = fopen (LongFilePath (argv[0]), "rb");
if (InputFile == NULL) {
Error (NULL, 0, 0001, "Error opening the input file", argv[0]);
return GetUtilityStatus ();
|