mirror of https://github.com/acidanthera/audk.git
EmulatorPkg: Add -D DISABLE_NEW_DEPRECATED_INTERFACES
https://bugzilla.tianocore.org/show_bug.cgi?id=162 Update EmulatorPkg specific modules and libraries to use safe string functions in BaseLib and safe PcdSetxx() functions in PcdLib. With these updates, the define DISABLE_NEW_DEPRECATED_INTERFACES is enabled in the DSC file. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Acked-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Andrew Fish <afish@apple.com>
This commit is contained in:
parent
50509ec66c
commit
9e3ab94dc8
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Emu Bus driver
|
Emu Bus driver
|
||||||
|
|
||||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2011, Apple Inc. All rights reserved.
|
Portions copyright (c) 2011, Apple Inc. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
@ -256,7 +256,12 @@ EmuBusDriverBindingStart (
|
||||||
|
|
||||||
EmuDevice->ControllerNameTable = NULL;
|
EmuDevice->ControllerNameTable = NULL;
|
||||||
|
|
||||||
StrnCpy (ComponentName, EmuIoThunk->ConfigString, sizeof (ComponentName)/sizeof (CHAR16));
|
StrnCpyS (
|
||||||
|
ComponentName,
|
||||||
|
sizeof (ComponentName) / sizeof (CHAR16),
|
||||||
|
EmuIoThunk->ConfigString,
|
||||||
|
sizeof (ComponentName) / sizeof (CHAR16)
|
||||||
|
);
|
||||||
|
|
||||||
EmuDevice->DevicePath = EmuBusCreateDevicePath (
|
EmuDevice->DevicePath = EmuBusCreateDevicePath (
|
||||||
ParentDevicePath,
|
ParentDevicePath,
|
||||||
|
|
|
@ -408,10 +408,14 @@
|
||||||
!include NetworkPkg/Network.dsc.inc
|
!include NetworkPkg/Network.dsc.inc
|
||||||
|
|
||||||
[BuildOptions]
|
[BuildOptions]
|
||||||
|
#
|
||||||
|
# Disable deprecated APIs.
|
||||||
|
#
|
||||||
|
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
||||||
|
|
||||||
MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
|
MSFT:DEBUG_*_*_CC_FLAGS = /Od /Oy-
|
||||||
MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
|
MSFT:NOOPT_*_*_CC_FLAGS = /Od /Oy-
|
||||||
|
|
||||||
MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
|
MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
|
||||||
MSFT:DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
|
MSFT:DEBUG_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
|
||||||
MSFT:NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
|
MSFT:NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x10000
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*++ @file
|
/*++ @file
|
||||||
PEIM to build GUIDed HOBs for platform specific flash map
|
PEIM to build GUIDed HOBs for platform specific flash map
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2011, Apple Inc. All rights reserved.
|
Portions copyright (c) 2011, Apple Inc. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ Returns:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
PcdSet64 (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdEmuFlashNvStorageVariableBase) + FdFixUp);
|
PcdSet64S (PcdFlashNvStorageVariableBase64, PcdGet64 (PcdEmuFlashNvStorageVariableBase) + FdFixUp);
|
||||||
PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdEmuFlashNvStorageFtwWorkingBase) + FdFixUp);
|
PcdSet64S (PcdFlashNvStorageFtwWorkingBase64, PcdGet64 (PcdEmuFlashNvStorageFtwWorkingBase) + FdFixUp);
|
||||||
PcdSet64 (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdEmuFlashNvStorageFtwSpareBase) + FdFixUp);
|
PcdSet64S (PcdFlashNvStorageFtwSpareBase64, PcdGet64 (PcdEmuFlashNvStorageFtwSpareBase) + FdFixUp);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
|
||||||
Copyright (c) 2012, Apple Inc. All rights reserved.
|
Copyright (c) 2012, Apple Inc. All rights reserved.
|
||||||
Portitions Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
Portitions Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -223,7 +223,7 @@ SmbiosLibUpdateUnicodeString (
|
||||||
if (Ascii == NULL) {
|
if (Ascii == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
UnicodeStrToAsciiStr (String, Ascii);
|
UnicodeStrToAsciiStrS (String, Ascii, StrSize (String));
|
||||||
|
|
||||||
StringIndex = StringNumber;
|
StringIndex = StringNumber;
|
||||||
Status = gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, Ascii);
|
Status = gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, Ascii);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Emulator Thunk to abstract OS services from pure EFI code
|
Emulator Thunk to abstract OS services from pure EFI code
|
||||||
|
|
||||||
Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
|
Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
|
||||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ AddThunkProtocol (
|
||||||
IN BOOLEAN EmuBusDriver
|
IN BOOLEAN EmuBusDriver
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
UINTN Size;
|
||||||
CHAR16 *StartString;
|
CHAR16 *StartString;
|
||||||
CHAR16 *SubString;
|
CHAR16 *SubString;
|
||||||
UINTN Instance;
|
UINTN Instance;
|
||||||
|
@ -47,8 +48,12 @@ AddThunkProtocol (
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance = 0;
|
Instance = 0;
|
||||||
StartString = AllocatePool (StrSize (ConfigString));
|
Size = StrSize (ConfigString);
|
||||||
StrCpy (StartString, ConfigString);
|
StartString = AllocatePool (Size);
|
||||||
|
if (StartString == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
StrCpyS (StartString, Size / sizeof (CHAR16), ConfigString);
|
||||||
while (*StartString != '\0') {
|
while (*StartString != '\0') {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Tested on Mac OS X.
|
Tested on Mac OS X.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
Portitions copyright (c) 2011, Apple Inc. All rights reserved.
|
Portitions copyright (c) 2011, Apple Inc. All rights reserved.
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
@ -242,7 +242,7 @@ EmuSnpStart (
|
||||||
//
|
//
|
||||||
// Associate our interface with this BPF file descriptor.
|
// Associate our interface with this BPF file descriptor.
|
||||||
//
|
//
|
||||||
AsciiStrCpy (BoundIf.ifr_name, Private->InterfaceName);
|
AsciiStrCpyS (BoundIf.ifr_name, sizeof (BoundIf.ifr_name), Private->InterfaceName);
|
||||||
if (ioctl (Private->BpfFd, BIOCSETIF, &BoundIf) < 0) {
|
if (ioctl (Private->BpfFd, BIOCSETIF, &BoundIf) < 0) {
|
||||||
goto DeviceErrorExit;
|
goto DeviceErrorExit;
|
||||||
}
|
}
|
||||||
|
@ -1016,7 +1016,11 @@ GetInterfaceMacAddr (
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (Private->Thunk->ConfigString, Private->InterfaceName);
|
UnicodeStrToAsciiStrS (
|
||||||
|
Private->Thunk->ConfigString,
|
||||||
|
Private->InterfaceName,
|
||||||
|
StrSize (Private->Thunk->ConfigString)
|
||||||
|
);
|
||||||
|
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
If = IfAddrs;
|
If = IfAddrs;
|
||||||
|
|
|
@ -127,7 +127,11 @@ PosixOpenVolume (
|
||||||
if (PrivateFile->FileName == NULL) {
|
if (PrivateFile->FileName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrCpy (PrivateFile->FileName, Private->FilePath);
|
AsciiStrCpyS (
|
||||||
|
PrivateFile->FileName,
|
||||||
|
AsciiStrSize (Private->FilePath),
|
||||||
|
Private->FilePath
|
||||||
|
);
|
||||||
|
|
||||||
PrivateFile->Signature = EMU_EFI_FILE_PRIVATE_SIGNATURE;
|
PrivateFile->Signature = EMU_EFI_FILE_PRIVATE_SIGNATURE;
|
||||||
PrivateFile->Thunk = Private->Thunk;
|
PrivateFile->Thunk = Private->Thunk;
|
||||||
|
@ -377,7 +381,7 @@ PosixFileOpen (
|
||||||
EFI_FILE_INFO *Info;
|
EFI_FILE_INFO *Info;
|
||||||
struct stat finfo;
|
struct stat finfo;
|
||||||
int res;
|
int res;
|
||||||
|
UINTN Size;
|
||||||
|
|
||||||
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||||
PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
|
PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
|
||||||
|
@ -412,17 +416,18 @@ OpenRoot:
|
||||||
|
|
||||||
CopyMem (NewPrivateFile, PrivateFile, sizeof (EMU_EFI_FILE_PRIVATE));
|
CopyMem (NewPrivateFile, PrivateFile, sizeof (EMU_EFI_FILE_PRIVATE));
|
||||||
|
|
||||||
NewPrivateFile->FileName = malloc (AsciiStrSize (PrivateFile->FileName) + 1 + StrLen (FileName) + 1);
|
Size = AsciiStrSize (PrivateFile->FileName) + 1 + StrLen (FileName) + 1;
|
||||||
|
NewPrivateFile->FileName = malloc (Size);
|
||||||
if (NewPrivateFile->FileName == NULL) {
|
if (NewPrivateFile->FileName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*FileName == L'\\') {
|
if (*FileName == L'\\') {
|
||||||
AsciiStrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);
|
AsciiStrCpyS (NewPrivateFile->FileName, Size, PrivateRoot->FilePath);
|
||||||
// Skip first '\'.
|
// Skip first '\'.
|
||||||
Src = FileName + 1;
|
Src = FileName + 1;
|
||||||
} else {
|
} else {
|
||||||
AsciiStrCpy (NewPrivateFile->FileName, PrivateFile->FileName);
|
AsciiStrCpyS (NewPrivateFile->FileName, Size, PrivateFile->FileName);
|
||||||
Src = FileName;
|
Src = FileName;
|
||||||
}
|
}
|
||||||
Dst = NewPrivateFile->FileName + AsciiStrLen (NewPrivateFile->FileName);
|
Dst = NewPrivateFile->FileName + AsciiStrLen (NewPrivateFile->FileName);
|
||||||
|
@ -748,7 +753,7 @@ PosixFileRead (
|
||||||
UINTN NameSize;
|
UINTN NameSize;
|
||||||
UINTN ResultSize;
|
UINTN ResultSize;
|
||||||
CHAR8 *FullFileName;
|
CHAR8 *FullFileName;
|
||||||
|
UINTN FullFileNameSize;
|
||||||
|
|
||||||
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
|
@ -798,15 +803,16 @@ PosixFileRead (
|
||||||
|
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
|
|
||||||
FullFileName = malloc (AsciiStrLen(PrivateFile->FileName) + 1 + NameSize);
|
FullFileNameSize = AsciiStrLen(PrivateFile->FileName) + 1 + NameSize;
|
||||||
|
FullFileName = malloc (FullFileNameSize);
|
||||||
if (FullFileName == NULL) {
|
if (FullFileName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy (FullFileName, PrivateFile->FileName);
|
AsciiStrCpyS (FullFileName, FullFileNameSize, PrivateFile->FileName);
|
||||||
AsciiStrCat (FullFileName, "/");
|
AsciiStrCatS (FullFileName, FullFileNameSize, "/");
|
||||||
AsciiStrCat (FullFileName, PrivateFile->Dirent->d_name);
|
AsciiStrCatS (FullFileName, FullFileNameSize, PrivateFile->Dirent->d_name);
|
||||||
Status = UnixSimpleFileSystemFileInfo (
|
Status = UnixSimpleFileSystemFileInfo (
|
||||||
PrivateFile,
|
PrivateFile,
|
||||||
FullFileName,
|
FullFileName,
|
||||||
|
@ -1017,7 +1023,11 @@ PosixFileGetInfo (
|
||||||
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
FileSystemInfoBuffer->BlockSize = buf.f_bsize;
|
||||||
|
|
||||||
|
|
||||||
StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);
|
StrCpyS (
|
||||||
|
(CHAR16 *) FileSystemInfoBuffer->VolumeLabel,
|
||||||
|
(*BufferSize - SIZE_OF_EFI_FILE_SYSTEM_INFO) / sizeof (CHAR16),
|
||||||
|
PrivateRoot->VolumeLabel
|
||||||
|
);
|
||||||
*BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
||||||
|
|
||||||
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
|
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
|
||||||
|
@ -1026,7 +1036,11 @@ PosixFileGetInfo (
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy ((CHAR16 *) Buffer, PrivateRoot->VolumeLabel);
|
StrCpyS (
|
||||||
|
(CHAR16 *) Buffer,
|
||||||
|
*BufferSize / sizeof (CHAR16),
|
||||||
|
PrivateRoot->VolumeLabel
|
||||||
|
);
|
||||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1082,7 +1096,7 @@ PosixFileSetInfo (
|
||||||
CHAR16 *UnicodeFilePtr;
|
CHAR16 *UnicodeFilePtr;
|
||||||
int UnixStatus;
|
int UnixStatus;
|
||||||
struct utimbuf Utime;
|
struct utimbuf Utime;
|
||||||
|
UINTN Size;
|
||||||
|
|
||||||
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
|
||||||
PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
|
PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
|
||||||
|
@ -1110,7 +1124,11 @@ PosixFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (PrivateRoot->VolumeLabel, NewFileSystemInfo->VolumeLabel);
|
StrCpyS (
|
||||||
|
PrivateRoot->VolumeLabel,
|
||||||
|
StrSize (NewFileSystemInfo->VolumeLabel) / sizeof (CHAR16),
|
||||||
|
NewFileSystemInfo->VolumeLabel
|
||||||
|
);
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -1125,7 +1143,11 @@ PosixFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (PrivateRoot->VolumeLabel, (CHAR16 *) Buffer);
|
StrCpyS (
|
||||||
|
PrivateRoot->VolumeLabel,
|
||||||
|
StrSize (PrivateRoot->VolumeLabel) / sizeof (CHAR16),
|
||||||
|
(CHAR16 *) Buffer
|
||||||
|
);
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -1183,28 +1205,34 @@ PosixFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy (OldFileName, PrivateFile->FileName);
|
AsciiStrCpyS (
|
||||||
|
OldFileName,
|
||||||
|
AsciiStrSize (PrivateFile->FileName),
|
||||||
|
PrivateFile->FileName
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make full pathname from new filename and rootpath.
|
// Make full pathname from new filename and rootpath.
|
||||||
//
|
//
|
||||||
if (NewFileInfo->FileName[0] == '\\') {
|
if (NewFileInfo->FileName[0] == '\\') {
|
||||||
NewFileName = malloc (AsciiStrLen (PrivateRoot->FilePath) + 1 + StrLen (NewFileInfo->FileName) + 1);
|
Size = AsciiStrLen (PrivateRoot->FilePath) + 1 + StrLen (NewFileInfo->FileName) + 1;
|
||||||
|
NewFileName = malloc (Size);
|
||||||
if (NewFileName == NULL) {
|
if (NewFileName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
|
AsciiStrCpyS (NewFileName, Size, PrivateRoot->FilePath);
|
||||||
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
||||||
UnicodeFilePtr = NewFileInfo->FileName + 1;
|
UnicodeFilePtr = NewFileInfo->FileName + 1;
|
||||||
*AsciiFilePtr++ ='/';
|
*AsciiFilePtr++ ='/';
|
||||||
} else {
|
} else {
|
||||||
NewFileName = malloc (AsciiStrLen (PrivateFile->FileName) + 2 + StrLen (NewFileInfo->FileName) + 1);
|
Size = AsciiStrLen (PrivateFile->FileName) + 2 + StrLen (NewFileInfo->FileName) + 1;
|
||||||
|
NewFileName = malloc (Size);
|
||||||
if (NewFileName == NULL) {
|
if (NewFileName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
|
AsciiStrCpyS (NewFileName, Size, PrivateRoot->FilePath);
|
||||||
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
|
||||||
if ((AsciiFilePtr[-1] != '/') && (NewFileInfo->FileName[0] != '/')) {
|
if ((AsciiFilePtr[-1] != '/') && (NewFileInfo->FileName[0] != '/')) {
|
||||||
// make sure there is a / between Root FilePath and NewFileInfo Filename
|
// make sure there is a / between Root FilePath and NewFileInfo Filename
|
||||||
|
@ -1312,7 +1340,11 @@ PosixFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrCpy (PrivateFile->FileName, NewFileName);
|
AsciiStrCpyS (
|
||||||
|
PrivateFile->FileName,
|
||||||
|
AsciiStrSize (NewFileName),
|
||||||
|
NewFileName
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -1493,7 +1525,11 @@ PosixFileSystmeThunkOpen (
|
||||||
free (Private);
|
free (Private);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
StrCpy (Private->VolumeLabel, L"EFI_EMULATED");
|
StrCpyS (
|
||||||
|
Private->VolumeLabel,
|
||||||
|
StrSize (L"EFI_EMULATED") / sizeof (CHAR16),
|
||||||
|
L"EFI_EMULATED"
|
||||||
|
);
|
||||||
|
|
||||||
Private->Signature = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
|
Private->Signature = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
|
||||||
Private->Thunk = This;
|
Private->Thunk = This;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*++ @file
|
/*++ @file
|
||||||
|
|
||||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
|
Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
@ -957,7 +957,7 @@ X11GraphicsWindowOpen (
|
||||||
XDefineCursor (Drv->display, Drv->win, XCreateFontCursor (Drv->display, XC_pirate));
|
XDefineCursor (Drv->display, Drv->win, XCreateFontCursor (Drv->display, XC_pirate));
|
||||||
|
|
||||||
Drv->Title = malloc (StrSize (This->ConfigString));
|
Drv->Title = malloc (StrSize (This->ConfigString));
|
||||||
UnicodeStrToAsciiStr (This->ConfigString, Drv->Title);
|
UnicodeStrToAsciiStrS (This->ConfigString, Drv->Title, StrSize (This->ConfigString));
|
||||||
XStoreName (Drv->display, Drv->win, Drv->Title);
|
XStoreName (Drv->display, Drv->win, Drv->Title);
|
||||||
|
|
||||||
// XAutoRepeatOff (Drv->display);
|
// XAutoRepeatOff (Drv->display);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*++ @file
|
/*++ @file
|
||||||
Support OS native directory access.
|
Support OS native directory access.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,8 +205,14 @@ WinNtOpenVolume (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (PrivateFile->FilePath, Private->FilePath);
|
StrCpyS (PrivateFile->FilePath,
|
||||||
StrCpy (PrivateFile->FileName, PrivateFile->FilePath);
|
StrSize (Private->FilePath) / sizeof (CHAR16),
|
||||||
|
Private->FilePath
|
||||||
|
);
|
||||||
|
StrCpyS (PrivateFile->FileName,
|
||||||
|
StrSize (Private->FilePath) / sizeof (CHAR16),
|
||||||
|
PrivateFile->FilePath
|
||||||
|
);
|
||||||
PrivateFile->Signature = WIN_NT_EFI_FILE_PRIVATE_SIGNATURE;
|
PrivateFile->Signature = WIN_NT_EFI_FILE_PRIVATE_SIGNATURE;
|
||||||
PrivateFile->Thunk = Private->Thunk;
|
PrivateFile->Thunk = Private->Thunk;
|
||||||
PrivateFile->SimpleFileSystem = This;
|
PrivateFile->SimpleFileSystem = This;
|
||||||
|
@ -243,8 +249,8 @@ WinNtOpenVolume (
|
||||||
if (TempFileName == NULL) {
|
if (TempFileName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
StrCpy (TempFileName, PrivateFile->FilePath);
|
StrCpyS (TempFileName, Size / sizeof (CHAR16), PrivateFile->FilePath);
|
||||||
StrCat (TempFileName, L"\\*");
|
StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*");
|
||||||
|
|
||||||
PrivateFile->LHandle = FindFirstFile (TempFileName, &PrivateFile->FindBuf);
|
PrivateFile->LHandle = FindFirstFile (TempFileName, &PrivateFile->FindBuf);
|
||||||
FreePool (TempFileName);
|
FreePool (TempFileName);
|
||||||
|
@ -362,7 +368,7 @@ GetNextFileNameToken (
|
||||||
} else {
|
} else {
|
||||||
Offset = SlashPos - *FileName;
|
Offset = SlashPos - *FileName;
|
||||||
Token = AllocateZeroPool ((Offset + 1) * sizeof (CHAR16));
|
Token = AllocateZeroPool ((Offset + 1) * sizeof (CHAR16));
|
||||||
StrnCpy (Token, *FileName, Offset);
|
StrnCpyS (Token, Offset + 1, *FileName, Offset);
|
||||||
//
|
//
|
||||||
// Point *FileName to the next character after L'\'.
|
// Point *FileName to the next character after L'\'.
|
||||||
//
|
//
|
||||||
|
@ -496,7 +502,7 @@ WinNtFileOpen (
|
||||||
if (TempFileName == NULL) {
|
if (TempFileName == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
StrCpy (TempFileName, FileName);
|
StrCpyS (TempFileName, StrSize (FileName) / sizeof (CHAR16), FileName);
|
||||||
FileName = TempFileName;
|
FileName = TempFileName;
|
||||||
|
|
||||||
if (FileName[StrLen (FileName) - 1] == L'\\') {
|
if (FileName[StrLen (FileName) - 1] == L'\\') {
|
||||||
|
@ -548,9 +554,17 @@ WinNtFileOpen (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivateFile->IsDirectoryPath) {
|
if (PrivateFile->IsDirectoryPath) {
|
||||||
StrCpy (NewPrivateFile->FilePath, PrivateFile->FileName);
|
StrCpyS (
|
||||||
|
NewPrivateFile->FilePath,
|
||||||
|
StrSize (PrivateFile->FileName) / sizeof (CHAR16),
|
||||||
|
PrivateFile->FileName
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath);
|
StrCpyS (
|
||||||
|
NewPrivateFile->FilePath,
|
||||||
|
StrSize (PrivateFile->FileName) / sizeof (CHAR16),
|
||||||
|
PrivateFile->FilePath
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size = StrSize (NewPrivateFile->FilePath);
|
Size = StrSize (NewPrivateFile->FilePath);
|
||||||
|
@ -563,17 +577,17 @@ WinNtFileOpen (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*FileName == L'\\') {
|
if (*FileName == L'\\') {
|
||||||
StrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);
|
StrCpyS (NewPrivateFile->FileName, Size / sizeof (CHAR16), PrivateRoot->FilePath);
|
||||||
StrCat (NewPrivateFile->FileName, L"\\");
|
StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), L"\\");
|
||||||
StrCat (NewPrivateFile->FileName, FileName + 1);
|
StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), FileName + 1);
|
||||||
} else {
|
} else {
|
||||||
StrCpy (NewPrivateFile->FileName, NewPrivateFile->FilePath);
|
StrCpyS (NewPrivateFile->FileName, Size / sizeof (CHAR16), NewPrivateFile->FilePath);
|
||||||
if (StrCmp (FileName, L"") != 0) {
|
if (StrCmp (FileName, L"") != 0) {
|
||||||
//
|
//
|
||||||
// In case the filename becomes empty, especially after trimming dots and blanks
|
// In case the filename becomes empty, especially after trimming dots and blanks
|
||||||
//
|
//
|
||||||
StrCat (NewPrivateFile->FileName, L"\\");
|
StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), L"\\");
|
||||||
StrCat (NewPrivateFile->FileName, FileName);
|
StrCatS (NewPrivateFile->FileName, Size / sizeof (CHAR16), FileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,7 +671,11 @@ WinNtFileOpen (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (NewPrivateFile->FilePath, NewPrivateFile->FileName);
|
StrCpyS (
|
||||||
|
NewPrivateFile->FilePath,
|
||||||
|
StrSize (NewPrivateFile->FileName) / sizeof (CHAR16),
|
||||||
|
NewPrivateFile->FileName
|
||||||
|
);
|
||||||
if (TempChar != 0) {
|
if (TempChar != 0) {
|
||||||
*(RealFileName - 1) = TempChar;
|
*(RealFileName - 1) = TempChar;
|
||||||
}
|
}
|
||||||
|
@ -715,7 +733,7 @@ WinNtFileOpen (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (TempFileName, NewPrivateFile->FileName);
|
StrCpyS (TempFileName, Size / sizeof (CHAR16), NewPrivateFile->FileName);
|
||||||
|
|
||||||
if ((OpenMode & EFI_FILE_MODE_CREATE)) {
|
if ((OpenMode & EFI_FILE_MODE_CREATE)) {
|
||||||
//
|
//
|
||||||
|
@ -769,7 +787,7 @@ WinNtFileOpen (
|
||||||
//
|
//
|
||||||
// Find the first file under it
|
// Find the first file under it
|
||||||
//
|
//
|
||||||
StrCat (TempFileName, L"\\*");
|
StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*");
|
||||||
NewPrivateFile->LHandle = FindFirstFile (TempFileName, &NewPrivateFile->FindBuf);
|
NewPrivateFile->LHandle = FindFirstFile (TempFileName, &NewPrivateFile->FindBuf);
|
||||||
FreePool (TempFileName);
|
FreePool (TempFileName);
|
||||||
|
|
||||||
|
@ -1330,8 +1348,8 @@ WinNtFileSetPossition (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (FileName, PrivateFile->FileName);
|
StrCpyS (FileName, Size / sizeof (CHAR16), PrivateFile->FileName);
|
||||||
StrCat (FileName, L"\\*");
|
StrCatS (FileName, Size / sizeof (CHAR16), L"\\*");
|
||||||
|
|
||||||
if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {
|
if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {
|
||||||
FindClose (PrivateFile->LHandle);
|
FindClose (PrivateFile->LHandle);
|
||||||
|
@ -1599,7 +1617,11 @@ WinNtFileGetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (DriveName, PrivateFile->FilePath);
|
StrCpyS (
|
||||||
|
DriveName,
|
||||||
|
(StrSize (PrivateFile->FilePath) + 1) / sizeof (CHAR16),
|
||||||
|
PrivateFile->FilePath
|
||||||
|
);
|
||||||
for (Index = 0; DriveName[Index] != 0 && DriveName[Index] != ':'; Index++) {
|
for (Index = 0; DriveName[Index] != 0 && DriveName[Index] != ':'; Index++) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -1664,7 +1686,11 @@ WinNtFileGetInfo (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy ((CHAR16 *)FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);
|
StrCpyS (
|
||||||
|
(CHAR16 *)FileSystemInfoBuffer->VolumeLabel,
|
||||||
|
(*BufferSize - SIZE_OF_EFI_FILE_SYSTEM_INFO) / sizeof (CHAR16),
|
||||||
|
PrivateRoot->VolumeLabel
|
||||||
|
);
|
||||||
*BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1676,7 +1702,11 @@ WinNtFileGetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy ((CHAR16 *)Buffer, PrivateRoot->VolumeLabel);
|
StrCpyS (
|
||||||
|
(CHAR16 *)Buffer,
|
||||||
|
*BufferSize / sizeof (CHAR16),
|
||||||
|
PrivateRoot->VolumeLabel
|
||||||
|
);
|
||||||
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
*BufferSize = StrSize (PrivateRoot->VolumeLabel);
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1768,7 +1798,11 @@ WinNtFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (PrivateRoot->VolumeLabel, NewFileSystemInfo->VolumeLabel);
|
StrCpyS (
|
||||||
|
PrivateRoot->VolumeLabel,
|
||||||
|
StrSize (NewFileSystemInfo->VolumeLabel) / sizeof (CHAR16),
|
||||||
|
NewFileSystemInfo->VolumeLabel
|
||||||
|
);
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -1783,7 +1817,11 @@ WinNtFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (PrivateRoot->VolumeLabel, (CHAR16 *)Buffer);
|
StrCpyS (
|
||||||
|
PrivateRoot->VolumeLabel,
|
||||||
|
StrSize (PrivateRoot->VolumeLabel) / sizeof (CHAR16),
|
||||||
|
(CHAR16 *)Buffer
|
||||||
|
);
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -1852,7 +1890,11 @@ WinNtFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (OldFileName, PrivateFile->FileName);
|
StrCpyS (
|
||||||
|
OldFileName,
|
||||||
|
StrSize (PrivateFile->FileName) / sizeof (CHAR16),
|
||||||
|
PrivateFile->FileName
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make full pathname from new filename and rootpath.
|
// Make full pathname from new filename and rootpath.
|
||||||
|
@ -1867,9 +1909,9 @@ WinNtFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (NewFileName, PrivateRoot->FilePath);
|
StrCpyS (NewFileName, Size / sizeof (CHAR16), PrivateRoot->FilePath);
|
||||||
StrCat (NewFileName, L"\\");
|
StrCatS (NewFileName, Size / sizeof (CHAR16), L"\\");
|
||||||
StrCat (NewFileName, NewFileInfo->FileName + 1);
|
StrCatS (NewFileName, Size / sizeof (CHAR16), NewFileInfo->FileName + 1);
|
||||||
} else {
|
} else {
|
||||||
Size = StrSize (PrivateFile->FilePath);
|
Size = StrSize (PrivateFile->FilePath);
|
||||||
Size += StrSize (L"\\");
|
Size += StrSize (L"\\");
|
||||||
|
@ -1880,9 +1922,9 @@ WinNtFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (NewFileName, PrivateFile->FilePath);
|
StrCpyS (NewFileName, Size / sizeof (CHAR16), PrivateFile->FilePath);
|
||||||
StrCat (NewFileName, L"\\");
|
StrCatS (NewFileName, Size / sizeof (CHAR16), L"\\");
|
||||||
StrCat (NewFileName, NewFileInfo->FileName);
|
StrCatS (NewFileName, Size / sizeof (CHAR16), NewFileInfo->FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1990,13 +2032,13 @@ WinNtFileSetInfo (
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpy (PrivateFile->FileName, NewFileName);
|
StrCpyS (PrivateFile->FileName, StrSize (NewFileName) / sizeof (CHAR16), NewFileName);
|
||||||
|
|
||||||
Size = StrSize (NewFileName);
|
Size = StrSize (NewFileName);
|
||||||
Size += StrSize (L"\\*");
|
Size += StrSize (L"\\*");
|
||||||
TempFileName = AllocatePool (Size);
|
TempFileName = AllocatePool (Size);
|
||||||
|
|
||||||
StrCpy (TempFileName, NewFileName);
|
StrCpyS (TempFileName, Size / sizeof (CHAR16), NewFileName);
|
||||||
|
|
||||||
if (!PrivateFile->IsDirectoryPath) {
|
if (!PrivateFile->IsDirectoryPath) {
|
||||||
PrivateFile->LHandle = CreateFile (
|
PrivateFile->LHandle = CreateFile (
|
||||||
|
@ -2029,7 +2071,7 @@ WinNtFileSetInfo (
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
StrCat (TempFileName, L"\\*");
|
StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*");
|
||||||
PrivateFile->LHandle = FindFirstFile (TempFileName, &FindBuf);
|
PrivateFile->LHandle = FindFirstFile (TempFileName, &FindBuf);
|
||||||
|
|
||||||
FreePool (TempFileName);
|
FreePool (TempFileName);
|
||||||
|
@ -2048,7 +2090,7 @@ WinNtFileSetInfo (
|
||||||
Size += StrSize (L"\\*");
|
Size += StrSize (L"\\*");
|
||||||
TempFileName = AllocatePool (Size);
|
TempFileName = AllocatePool (Size);
|
||||||
|
|
||||||
StrCpy (TempFileName, OldFileName);
|
StrCpyS (TempFileName, Size / sizeof (CHAR16), OldFileName);
|
||||||
|
|
||||||
if (!PrivateFile->IsDirectoryPath) {
|
if (!PrivateFile->IsDirectoryPath) {
|
||||||
PrivateFile->LHandle = CreateFile (
|
PrivateFile->LHandle = CreateFile (
|
||||||
|
@ -2071,7 +2113,7 @@ WinNtFileSetInfo (
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
StrCat (TempFileName, L"\\*");
|
StrCatS (TempFileName, Size / sizeof (CHAR16), L"\\*");
|
||||||
PrivateFile->LHandle = FindFirstFile (TempFileName, &FindBuf);
|
PrivateFile->LHandle = FindFirstFile (TempFileName, &FindBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue