]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/Clipboard.c
ShellPkg: Clean up source files
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / Clipboard.c
CommitLineData
632820d1 1/** @file\r
2 Functions to deal with Clip Board\r
ba0014b9
LG
3\r
4 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. <BR>\r
632820d1 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "HexEditor.h"\r
16\r
a1d4bfcc 17typedef struct {\r
18 UINT8 *Buffer;\r
19 UINTN Size;\r
20} HEFI_EDITOR_CLIPBOARD;\r
21\r
632820d1 22HEFI_EDITOR_CLIPBOARD HClipBoard;\r
23\r
24//\r
25// for basic initialization of HClipBoard\r
26//\r
27HEFI_EDITOR_CLIPBOARD HClipBoardConst = {\r
28 NULL,\r
29 0\r
30};\r
31\r
a1d4bfcc 32/**\r
33 Initialization function for HDiskImage.\r
34\r
35 @param[in] EFI_SUCCESS The operation was successful.\r
36 @param[in] EFI_LOAD_ERROR A load error occured.\r
37**/\r
632820d1 38EFI_STATUS\r
39HClipBoardInit (\r
40 VOID\r
41 )\r
632820d1 42{\r
43 //\r
44 // basiclly initialize the HDiskImage\r
45 //\r
46 CopyMem (&HClipBoard, &HClipBoardConst, sizeof (HClipBoard));\r
47\r
48 return EFI_SUCCESS;\r
49}\r
50\r
a1d4bfcc 51/**\r
52 Initialization function for HDiskImage.\r
53\r
54 @param[in] EFI_SUCCESS The operation was successful.\r
55 @param[in] EFI_LOAD_ERROR A load error occured.\r
56**/\r
632820d1 57EFI_STATUS\r
58HClipBoardCleanup (\r
59 VOID\r
60 )\r
632820d1 61{\r
62\r
63 SHELL_FREE_NON_NULL (HClipBoard.Buffer);\r
64\r
65 return EFI_SUCCESS;\r
66}\r
67\r
a1d4bfcc 68/**\r
69 Set a buffer into the clipboard.\r
70\r
71 @param[in] Buffer The buffer to add to the clipboard.\r
72 @param[in] Size The size of Buffer in bytes.\r
73\r
74 @retval EFI_SUCCESS The operation was successful.\r
75**/\r
632820d1 76EFI_STATUS\r
77HClipBoardSet (\r
78 IN UINT8 *Buffer,\r
79 IN UINTN Size\r
80 )\r
81{\r
82 //\r
83 // free the old clipboard buffer\r
84 // and set new clipboard buffer\r
85 //\r
86 SHELL_FREE_NON_NULL (HClipBoard.Buffer);\r
87 HClipBoard.Buffer = Buffer;\r
88\r
89 HClipBoard.Size = Size;\r
90\r
91 return EFI_SUCCESS;\r
92}\r
93\r
a1d4bfcc 94/**\r
95 Get a buffer from the clipboard.\r
96\r
97 @param[out] Buffer The pointer to the buffer to add to the clipboard.\r
98\r
99 @return the size of the buffer.\r
100**/\r
632820d1 101UINTN\r
102HClipBoardGet (\r
103 OUT UINT8 **Buffer\r
104 )\r
105{\r
106 //\r
107 // return the clipboard buffer\r
108 //\r
109 *Buffer = HClipBoard.Buffer;\r
110\r
111 return HClipBoard.Size;\r
112}\r