From 1be2ed90a20618d71ddf34b8a07d038da0b36854 Mon Sep 17 00:00:00 2001 From: Hess Chen Date: Fri, 15 Aug 2014 03:06:48 +0000 Subject: =?UTF-8?q?There=20is=20a=20limitation=20on=20WINDOWS=20OS=20for?= =?UTF-8?q?=20the=20length=20of=20entire=20file=20path=20can=E2=80=99t=20b?= =?UTF-8?q?e=20larger=20than=20255.=20There=20is=20an=20OS=20API=20provide?= =?UTF-8?q?d=20by=20Microsoft=20to=20add=20=E2=80=9C\\=3F\=E2=80=9D=20befo?= =?UTF-8?q?re=20the=20path=20header=20to=20support=20the=20long=20file=20p?= =?UTF-8?q?ath.=20Enable=20this=20feature=20on=20basetools.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen Reviewed-by: Yingke Liu git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15809 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/C/GenFv/GenFv.c | 8 +++--- BaseTools/Source/C/GenFv/GenFvInternalLib.c | 40 ++++++++++++++--------------- BaseTools/Source/C/GenFv/GenFvInternalLib.h | 14 +++++----- 3 files changed, 31 insertions(+), 31 deletions(-) (limited to 'BaseTools/Source/C/GenFv') 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.
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
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.
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
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.
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
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) -- cgit v1.2.3