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