VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c

Last change on this file was 99404, checked in by vboxsync, 21 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/** @file
2 Functions to deal with Clip Board
3
4 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. <BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "HexEditor.h"
10
11typedef struct {
12 UINT8 *Buffer;
13 UINTN Size;
14} HEFI_EDITOR_CLIPBOARD;
15
16HEFI_EDITOR_CLIPBOARD HClipBoard;
17
18//
19// for basic initialization of HClipBoard
20//
21HEFI_EDITOR_CLIPBOARD HClipBoardConst = {
22 NULL,
23 0
24};
25
26/**
27 Initialization function for HDiskImage.
28
29 @param[in] EFI_SUCCESS The operation was successful.
30 @param[in] EFI_LOAD_ERROR A load error occurred.
31**/
32EFI_STATUS
33HClipBoardInit (
34 VOID
35 )
36{
37 //
38 // basiclly initialize the HDiskImage
39 //
40 CopyMem (&HClipBoard, &HClipBoardConst, sizeof (HClipBoard));
41
42 return EFI_SUCCESS;
43}
44
45/**
46 Initialization function for HDiskImage.
47
48 @param[in] EFI_SUCCESS The operation was successful.
49 @param[in] EFI_LOAD_ERROR A load error occurred.
50**/
51EFI_STATUS
52HClipBoardCleanup (
53 VOID
54 )
55{
56 SHELL_FREE_NON_NULL (HClipBoard.Buffer);
57
58 return EFI_SUCCESS;
59}
60
61/**
62 Set a buffer into the clipboard.
63
64 @param[in] Buffer The buffer to add to the clipboard.
65 @param[in] Size The size of Buffer in bytes.
66
67 @retval EFI_SUCCESS The operation was successful.
68**/
69EFI_STATUS
70HClipBoardSet (
71 IN UINT8 *Buffer,
72 IN UINTN Size
73 )
74{
75 //
76 // free the old clipboard buffer
77 // and set new clipboard buffer
78 //
79 SHELL_FREE_NON_NULL (HClipBoard.Buffer);
80 HClipBoard.Buffer = Buffer;
81
82 HClipBoard.Size = Size;
83
84 return EFI_SUCCESS;
85}
86
87/**
88 Get a buffer from the clipboard.
89
90 @param[out] Buffer The pointer to the buffer to add to the clipboard.
91
92 @return the size of the buffer.
93**/
94UINTN
95HClipBoardGet (
96 OUT UINT8 **Buffer
97 )
98{
99 //
100 // return the clipboard buffer
101 //
102 *Buffer = HClipBoard.Buffer;
103
104 return HClipBoard.Size;
105}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette