本文整理汇总了C++中EFI_FILE_HANDLE::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ EFI_FILE_HANDLE::Delete方法的具体用法?C++ EFI_FILE_HANDLE::Delete怎么用?C++ EFI_FILE_HANDLE::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EFI_FILE_HANDLE
的用法示例。
在下文中一共展示了EFI_FILE_HANDLE::Delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AllocateZeroPool
EFI_STATUS
EFIAPI
RemoveFileLock(
IN EFI_FILE_HANDLE CurDir,
IN CHAR16 * FileNameUser
)
{
EFI_STATUS Status = EFI_SUCCESS;
EFI_FILE_HANDLE FileHandle;
CHAR16* FileNameElite;
FileNameElite = AllocateZeroPool(260*sizeof(CHAR16));
StrCpy(FileNameElite,FileNameUser);
StrCat(FileNameElite,FILE_NAME_ELITE);
StrCat(FileNameElite,g_NAME_ELITE);
Status = CurDir->Open (CurDir, &FileHandle, FileNameElite, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
FreePool(FileNameElite);
if (EFI_ERROR(Status))
{
#ifdef FORCE_DEBUG
Print(L"Error Open File RemoveFileLock\n");
#endif
return Status;
}
else
{
#ifdef FORCE_DEBUG
Print(L"RemoveFileLock OK\n");
#endif
}
Status=FileHandle->Delete(FileHandle);
if( Status != EFI_SUCCESS )
{
#ifdef FORCE_DEBUG
Print(L"Write RemoveFileLock File Failed\n");
#endif
return Status;
}
return EFI_SUCCESS;
}
示例2: while
//.........这里部分代码省略.........
//
// The file not exist, create it
//
Status = SctCreateFile (RootDir, FileName, &Handle);
if (EFI_ERROR (Status)) {
RootDir->Close (RootDir);
return Status;
}
//
// Write the head of Unicode text file
//
Buffer[0] = 0xff;
Buffer[1] = 0xfe;
BufSize = 2;
Status = Handle->Write (Handle, &BufSize, Buffer);
if (EFI_ERROR (Status)) {
Handle->Close (Handle);
return Status;
}
} else if (EFI_ERROR (Status)) {
RootDir->Close(RootDir);
return Status;
}
if (OverwriteFile) {
//
// Overwrite the file
//
//
// Delete the file
//
Status = Handle->Delete (Handle);
//
// EFI_FILE.Delete() return a warning status
//
if (Status != EFI_SUCCESS) {
RootDir->Close (RootDir);
return EFI_UNSUPPORTED;
}
//
// Recreate the file
//
Status = RootDir->Open (
RootDir,
&Handle,
FileName,
EFI_FILE_MODE_CREATE|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ,
0
);
if (EFI_ERROR (Status)) {
RootDir->Close (RootDir);
return Status;
}
//
// Write the head of Unicode text file
//
Buffer[0] = 0xff;
Buffer[1] = 0xfe;
BufSize = 2;
Status = Handle->Write (Handle, &BufSize, Buffer);
if (EFI_ERROR (Status)) {
示例3: if
EFI_STATUS
EFIAPI
TrlWriteResetRecord (
IN EFI_TEST_RECOVERY_LIBRARY_PROTOCOL *This,
IN UINTN Size,
IN VOID *Buffer
)
/*++
Routine Description:
One interface function of the TestRecoveryLibrary to write reset record.
Arguments:
This - the protocol instance structure.
Size - the bytes to be write, it can't bigger than 1024Bytes.
Buffer - buffer contain the record to be written.
Returns:
EFI_SUCCESS - write the record successfully.
EFI_INVALID_PARAMETER - invalid parameters.
--*/
{
EFI_STATUS Status;
EFI_HANDLE DeviceHandle;
EFI_FILE_HANDLE RootDir;
EFI_FILE_HANDLE Handle;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
TEST_RECOVERY_PRIVATE_DATA *Private;
EFI_DEVICE_PATH_PROTOCOL *PreDevicePath;
Private = TEST_RECOVERY_PRIVATE_DATA_FROM_TRL (This);
//
// Determine device handle for fs protocol on specified device path
//
PreDevicePath = Private->DevicePath;
Status = gBS->LocateDevicePath (
&gEfiSimpleFileSystemProtocolGuid,
&PreDevicePath,
&DeviceHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Determine volume for file system on device handle
//
Status = gBS->HandleProtocol (
DeviceHandle,
&gEfiSimpleFileSystemProtocolGuid,
(VOID*)&Vol
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open volume for file system on device path
//
Status = Vol->OpenVolume (Vol, &RootDir);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open file for read
//
Status = RootDir->Open (
RootDir,
&Handle,
Private->FileName,
EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE,
0
);
if (Status == EFI_NOT_FOUND) {
//
// The file not exist, create it
//
Status = RootDir->Open (
RootDir,
&Handle,
Private->FileName,
EFI_FILE_MODE_CREATE|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ,
0
);
if (EFI_ERROR (Status)) {
RootDir->Close (RootDir);
return Status;
}
} else if (Status == EFI_SUCCESS) {
//
// The file exist, delete it
//
Status = Handle->Delete (Handle);
//
//.........这里部分代码省略.........
示例4: GetMyVol
/**
Write a file.
@param[in] FileName The file to be written.
@param[in] BufferSize The file buffer size
@param[in] Buffer The file buffer
@retval EFI_SUCCESS Write file successfully
**/
EFI_STATUS
WriteFileFromBuffer (
IN CHAR16 *FileName,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
EFI_STATUS Status;
EFI_FILE_HANDLE RootDir;
EFI_FILE_HANDLE Handle;
UINTN TempBufferSize;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
Vol = GetMyVol();
if (Vol == NULL) {
return EFI_NOT_FOUND;
}
//
// Open the root directory
//
Status = Vol->OpenVolume (Vol, &RootDir);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open the file
//
Status = RootDir->Open (
RootDir,
&Handle,
FileName,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE| EFI_FILE_MODE_CREATE,
0
);
if (EFI_ERROR (Status)) {
RootDir->Close (RootDir);
return Status;
}
//
// Delete file
//
Status = Handle->Delete(Handle);
if (EFI_ERROR(Status)) {
return Status;
}
//
// Open the file again
//
Status = RootDir->Open (
RootDir,
&Handle,
FileName,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE| EFI_FILE_MODE_CREATE,
0
);
if (EFI_ERROR (Status)) {
RootDir->Close (RootDir);
return Status;
}
RootDir->Close (RootDir);
//
// Write the file data from the buffer
//
TempBufferSize = BufferSize;
Status = Handle->Write (
Handle,
&TempBufferSize,
Buffer
);
if (EFI_ERROR (Status)) {
Handle->Close (Handle);
return Status;
}
Handle->Close (Handle);
return EFI_SUCCESS;
}
示例5: GetFloppyDevicePath
/**
* Write a file to floppy disk.
*/
EFI_STATUS
WriteFloppyFile (
IN CHAR16 *FileName,
IN OUT UINT32 Length,
IN VOID *Buffer
)
{
EFI_STATUS Status;
EFI_HANDLE DeviceHandle;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
EFI_FILE_HANDLE RootDir;
EFI_FILE_HANDLE Handle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN BufLen;
//
// Get floppy device path
//
Status = GetFloppyDevicePath (&DevicePath);
if (EFI_ERROR(Status)) {
return Status;
}
//
// Determine device handle for fs protocol on floppy device path
//
Status = gtBS->LocateDevicePath (
&gEfiSimpleFileSystemProtocolGuid,
&DevicePath,
&DeviceHandle
);
if (EFI_ERROR(Status) ) {
return Status;
}
//
// Determine volume for file system on device handle
//
Status = gtBS->HandleProtocol (
DeviceHandle,
&gEfiSimpleFileSystemProtocolGuid,
(VOID*)&Vol
);
if (EFI_ERROR(Status) ) {
return Status;
}
//
// Open volume for file system on device path
//
Status = Vol->OpenVolume (Vol, &RootDir);
if (Status == EFI_MEDIA_CHANGED) {
//
// Reopen the volume
//
Status = gtBS->HandleProtocol (
DeviceHandle,
&gEfiSimpleFileSystemProtocolGuid,
(VOID*)&Vol
);
if (EFI_ERROR(Status) ) {
return Status;
}
Status = Vol->OpenVolume (Vol, &RootDir);
}
if (EFI_ERROR(Status) ) {
return Status;
}
//
// Determine the existence of the file
//
Status = RootDir->Open (
RootDir,
&Handle,
FileName,
EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE,
0
);
if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_FOUND)) {
RootDir->Close (RootDir);
return Status;
}
if (Status == EFI_SUCCESS) {
//
// Delete the existent file
//
Status = Handle->Delete (Handle);
if (Status != EFI_SUCCESS) {
Handle->Close (Handle);
RootDir->Close (RootDir);
return Status;
}
}
//
//.........这里部分代码省略.........