]>
Commit | Line | Data |
---|---|---|
1 | /*++\r | |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | Forms.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | This file contains the form processing code to the HII database.\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | \r | |
23 | #include "HiiDatabase.h"\r | |
24 | \r | |
25 | CHAR16*\r | |
26 | Ascii2Unicode (\r | |
27 | OUT CHAR16 *UnicodeStr,\r | |
28 | IN CHAR8 *AsciiStr\r | |
29 | )\r | |
30 | /*++\r | |
31 | \r | |
32 | Routine Description:\r | |
33 | \r | |
34 | This function converts ASCII string to Unicode string.\r | |
35 | \r | |
36 | Arguments:\r | |
37 | \r | |
38 | UnicodeStr - NULL terminated Unicode output string.\r | |
39 | AsciieStr - NULL terminated ASCII input string.\r | |
40 | \r | |
41 | Returns: \r | |
42 | \r | |
43 | Start of the Unicode ouput string.\r | |
44 | \r | |
45 | --*/\r | |
46 | \r | |
47 | {\r | |
48 | CHAR16 *Str = UnicodeStr; \r | |
49 | while (TRUE) {\r | |
50 | *(UnicodeStr++) = (CHAR16) *AsciiStr;\r | |
51 | if (*(AsciiStr++) == '\0') {\r | |
52 | return Str;\r | |
53 | }\r | |
54 | }\r | |
55 | }\r | |
56 | \r | |
57 | CHAR8*\r | |
58 | Unicode2Ascii (\r | |
59 | OUT CHAR8 *AsciiStr,\r | |
60 | IN CHAR16 *UnicodeStr\r | |
61 | )\r | |
62 | /*++\r | |
63 | \r | |
64 | Routine Description:\r | |
65 | \r | |
66 | This function converts Unicode string to ASCII string.\r | |
67 | \r | |
68 | Arguments:\r | |
69 | \r | |
70 | AsciieStr - NULL terminated ASCII output string.\r | |
71 | UnicodeStr - NULL terminated Unicode input string.\r | |
72 | \r | |
73 | Returns: \r | |
74 | \r | |
75 | Start of the ASCII ouput string.\r | |
76 | \r | |
77 | --*/\r | |
78 | \r | |
79 | {\r | |
80 | CHAR8 *Str = AsciiStr; \r | |
81 | while (TRUE) {\r | |
82 | *(AsciiStr++) = (CHAR8) *UnicodeStr;\r | |
83 | if (*(UnicodeStr++) == '\0') {\r | |
84 | return Str;\r | |
85 | }\r | |
86 | }\r | |
87 | }\r | |
88 | \r | |
89 | VOID\r | |
90 | ExtractDevicePathData (\r | |
91 | IN EFI_HII_DATA_TABLE *DataTable,\r | |
92 | IN UINT8 *IfrData,\r | |
93 | IN OUT UINT8 **ExportBufferPtr\r | |
94 | )\r | |
95 | /*++\r | |
96 | \r | |
97 | Routine Description:\r | |
98 | \r | |
99 | Arguments:\r | |
100 | \r | |
101 | Returns: \r | |
102 | \r | |
103 | --*/\r | |
104 | {\r | |
105 | UINT8 *ExportBuffer;\r | |
106 | \r | |
107 | ExportBuffer = *ExportBufferPtr;\r | |
108 | \r | |
109 | //\r | |
110 | // BUGBUG - don't have devicepath data yet, setting dummy value\r | |
111 | //\r | |
112 | DataTable++;\r | |
113 | ExportBuffer = (UINT8 *) DataTable;\r | |
114 | ((EFI_HII_DEVICE_PATH_PACK *) ExportBuffer)->Header.Type = EFI_HII_DEVICE_PATH;\r | |
115 | ((EFI_HII_DEVICE_PATH_PACK *) ExportBuffer)->Header.Length = (UINT32) (sizeof (EFI_HII_DEVICE_PATH_PACK) + sizeof (EFI_DEVICE_PATH_PROTOCOL));\r | |
116 | \r | |
117 | //\r | |
118 | // BUGBUG - part of hack - skip the Device Path Pack.....place some data\r | |
119 | //\r | |
120 | ExportBuffer = ExportBuffer + sizeof (EFI_HII_DEVICE_PATH_PACK);\r | |
121 | \r | |
122 | ((EFI_DEVICE_PATH_PROTOCOL *) ExportBuffer)->Type = EFI_END_ENTIRE_DEVICE_PATH;\r | |
123 | ((EFI_DEVICE_PATH_PROTOCOL *) ExportBuffer)->SubType = EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;\r | |
124 | \r | |
125 | //\r | |
126 | // BUGBUG - still part of hack....\r | |
127 | //\r | |
128 | ExportBuffer = ExportBuffer + sizeof (EFI_DEVICE_PATH_PROTOCOL);\r | |
129 | *ExportBufferPtr = ExportBuffer;\r | |
130 | }\r | |
131 | \r | |
132 | VOID\r | |
133 | ExtractVariableData (\r | |
134 | IN OUT EFI_HII_DATA_TABLE *DataTable,\r | |
135 | IN UINT8 *IfrData,\r | |
136 | IN OUT UINT8 **ExportBufferPtr\r | |
137 | )\r | |
138 | /*++\r | |
139 | \r | |
140 | Routine Description:\r | |
141 | \r | |
142 | This function extract the EFI_HII_VARIABLE_PACK portion from the \r | |
143 | each of the EFI_HII_PACKAGE_INSTANCE in HII handle database.\r | |
144 | \r | |
145 | Arguments:\r | |
146 | \r | |
147 |