]>
Commit | Line | Data |
---|---|---|
03e6b4b2 | 1 | /** @file\r |
2 | Module produce UC2 on top of UC.\r | |
3 | \r | |
4 | UEFI 2.1 specification supersedes Inte's EFI Specification 1.10.\r | |
5 | EFI_UNICODE_COLLATION_PROTOCOL defined in Inte's EFI Specification 1.10 is replaced by\r | |
6 | EFI_UNICODE_COLLATION_PROTOCOL in UEFI 2.1.\r | |
7 | This module produces UC2 on top of UC. This module is used on platform when both of\r | |
8 | these two conditions are true:\r | |
9 | 1) EFI 1.10 module producing UC present\r | |
10 | 2) And the rest of modules on the platform consume UC2\r | |
11 | \r | |
12 | Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r | |
13 | All rights reserved. This program and the accompanying materials\r | |
14 | are licensed and made available under the terms and conditions of the BSD License\r | |
15 | which accompanies this distribution. The full text of the license may be found at\r | |
16 | http://opensource.org/licenses/bsd-license.php\r | |
17 | \r | |
18 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
19 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
20 | Module Name:\r | |
21 | \r | |
22 | **/\r | |
23 | \r | |
24 | #include <PiDxe.h>\r | |
25 | #include <Protocol/UnicodeCollation.h>\r | |
26 | #include <Library/BaseLib.h>\r | |
27 | #include <Library/DebugLib.h>\r | |
28 | #include <Library/UefiBootServicesTableLib.h>\r | |
29 | #include <Library/UefiDriverEntryPoint.h>\r | |
30 | #include <Library/UefiLib.h>\r | |
31 | #include <Library/MemoryAllocationLib.h>\r | |
32 | #include <Library/HiiLib.h>\r | |
ad5a96ab | 33 | #include <Library/BaseMemoryLib.h>\r |
03e6b4b2 | 34 | \r |
35 | \r | |
974a0271 | 36 | ///\r |
37 | /// The size of a 3 character ISO639 language code.\r | |
38 | ///\r | |
39 | #define ISO_639_2_ENTRY_SIZE 3\r | |
03e6b4b2 | 40 | \r |
ad5a96ab | 41 | //\r |
42 | // Lookup table of ISO639-2 3 character language codes to ISO 639-1 2 character language codes\r | |
43 | // Each entry is 5 CHAR8 values long. The first 3 CHAR8 values are the ISO 639-2 code.\r | |
44 | // The last 2 CHAR8 values are the ISO 639-1 code.\r | |
45 | //\r | |
46 | GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 Iso639ToRfc3066ConversionTable[] =\r | |
47 | "\\r | |
48 | aaraa\\r | |
49 | abkab\\r | |
50 | afraf\\r | |
51 | amham\\r | |
52 | araar\\r | |
53 | asmas\\r | |
54 | aymay\\r | |
55 | azeaz\\r | |
56 | bakba\\r | |
57 | belbe\\r | |
58 | benbn\\r | |
59 | bihbh\\r | |
60 | bisbi\\r | |
61 | bodbo\\r | |
62 | brebr\\r | |
63 | bulbg\\r | |
64 | catca\\r | |
65 | cescs\\r | |
66 | corkw\\r | |
67 | cosco\\r | |
68 | cymcy\\r | |
69 | danda\\r | |
70 | deude\\r | |
71 | dzodz\\r | |
72 | ellel\\r | |
73 | engen\\r | |
74 | epoeo\\r | |
75 | estet\\r | |
76 | euseu\\r | |
77 | faofo\\r | |
78 | fasfa\\r | |
79 | fijfj\\r | |
80 | finfi\\r | |
81 | frafr\\r | |
82 | fryfy\\r | |
83 | gaiga\\r | |
84 | gdhgd\\r | |
85 | glggl\\r | |
86 | grngn\\r | |
87 | gujgu\\r | |
88 | hauha\\r | |
89 | hebhe\\r | |
90 | hinhi\\r | |
91 | hrvhr\\r | |
92 | hunhu\\r | |
93 | hyehy\\r | |
94 | ikuiu\\r | |
95 | ileie\\r | |
96 | inaia\\r | |
97 | indid\\r | |
98 | ipkik\\r | |
99 | islis\\r | |
100 | itait\\r | |
101 | jawjw\\r | |
102 | jpnja\\r | |
103 | kalkl\\r | |
104 | kankn\\r | |
105 | kasks\\r | |
106 | katka\\r | |
107 | kazkk\\r | |
108 | khmkm\\r | |
109 | kinrw\\r | |
110 | kirky\\r | |
111 | korko\\r | |
112 | kurku\\r | |
113 | laolo\\r | |
114 | latla\\r | |
115 | lavlv\\r | |
116 | linln\\r | |
117 | litlt\\r | |
118 | ltzlb\\r | |
119 | malml\\r | |
120 | marmr\\r | |
121 | mkdmk\\r | |
122 | mlgmg\\r | |
123 | mltmt\\r | |
124 | molmo\\r | |
125 | monmn\\r | |
126 | mrimi\\r | |
127 | msams\\r | |
128 | myamy\\r | |
129 | nauna\\r | |
130 | nepne\\r | |
131 | nldnl\\r | |
132 | norno\\r | |
133 | ocioc\\r | |
134 | ormom\\r | |
135 | panpa\\r | |
136 | polpl\\r | |
137 | porpt\\r | |
138 | pusps\\r | |
139 | quequ\\r | |
140 | rohrm\\r | |
141 | ronro\\r | |
142 | runrn\\r | |
143 | rusru\\r | |
144 | sagsg\\r | |
145 | sansa\\r | |
146 | sinsi\\r | |
147 | slksk\\r | |
148 | slvsl\\r | |
149 | smise\\r | |
150 | smosm\\r | |
151 | snasn\\r | |
152 | sndsd\\r | |
153 | somso\\r | |
154 | sotst\\r | |
155 | spaes\\r | |
156 | sqisq\\r | |
157 | srpsr\\r | |
158 | sswss\\r | |
159 | sunsu\\r | |
160 | swasw\\r | |
161 | swesv\\r | |
162 | tamta\\r | |
163 | tattt\\r | |
164 | telte\\r | |
165 | tgktg\\r | |
166 | tgltl\\r | |
167 | thath\\r | |
168 | tsnts\\r | |
169 | tuktk\\r | |
170 | twitw\\r | |
171 | uigug\\r | |
172 | ukruk\\r | |
173 | urdur\\r | |
174 | uzbuz\\r | |
175 | vievi\\r | |
176 | volvo\\r | |
177 | wolwo\\r | |
178 | xhoxh\\r | |
179 | yidyi\\r | |
180 | zhaza\\r | |
181 | zhozh\\r | |
182 | zulzu\\r | |
183 | ";\r | |
184 | \r | |
185 | /**\r | |
186 | Convert language code from ISO639-2 to RFC3066 and return the converted language.\r | |
187 | Caller is responsible for freeing the allocated buffer.\r | |
188 | \r | |
189 | LanguageIso639 contain a single ISO639-2 code such as\r | |
190 | "eng" or "fra".\r | |
191 | \r | |
192 | If LanguageIso639 is NULL, then ASSERT.\r | |
193 | If LanguageRfc3066 is NULL, then ASSERT.\r | |
194 | \r | |
195 | @param LanguageIso639 ISO639-2 language code.\r | |
196 | \r | |
197 | @return the allocated buffer or NULL, if the language is not found.\r | |
198 | \r | |
199 | **/\r | |
200 | CHAR8*\r | |
201 | EFIAPI\r | |
202 | ConvertIso639LanguageToRfc3066Language (\r | |
203 | IN CONST CHAR8 *LanguageIso639\r | |
204 | )\r | |
205 | {\r | |
206 | UINTN Index;\r | |
207 | CHAR8 *Rfc3066Language;\r | |
208 | \r | |
209 | for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) {\r | |
210 | if (CompareMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3) == 0) {\r | |
211 | Rfc3066Language = AllocateZeroPool (3);\r | |
212 | if (Rfc3066Language != NULL) {\r | |
213 | Rfc3066Language = CopyMem (Rfc3066Language, &Iso639ToRfc3066ConversionTable[Index + 3], 2);\r | |
214 | }\r | |
215 | return Rfc3066Language;\r | |
216 | }\r | |
217 | }\r | |
218 | \r | |
219 | return NULL;\r | |
220 | }\r | |
221 | \r | |
03e6b4b2 | 222 | /**\r |
223 | Performs a case-insensitive comparison of two Null-terminated Unicode \r | |
224 | strings.\r | |
225 | \r | |
226 | @param This Protocol instance pointer.\r | |
227 | @param Str1 A pointer to a Null-terminated Unicode string.\r | |
228 | @param Str2 A pointer to a Null-terminated Unicode string.\r | |
229 | \r | |
230 | @retval 0 Str1 is equivalent to Str2\r | |
231 | @retval > 0 Str1 is lexically greater than Str2\r | |
232 | @retval < 0 Str1 is lexically less than Str2\r | |
233 | \r | |
234 | **/\r | |
235 | INTN\r | |
236 | EFIAPI\r | |
237 | StriColl (\r | |
238 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
239 | IN CHAR16 *Str1,\r | |
240 | IN CHAR16 *Str2\r | |
e00e1d46 | 241 | );\r |
03e6b4b2 | 242 | \r |
243 | /**\r | |
244 | Converts all the Unicode characters in a Null-terminated Unicode string to \r | |
245 | lower case Unicode characters.\r | |
246 | \r | |
247 | @param This Protocol instance pointer.\r | |
248 | @param Str A pointer to a Null-terminated Unicode string.\r | |
249 | \r | |
250 | **/\r | |
251 | VOID\r | |
252 | EFIAPI\r | |
253 | StrLwr (\r | |
254 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
255 | IN OUT CHAR16 *Str\r | |
e00e1d46 | 256 | );\r |
03e6b4b2 | 257 | \r |
258 | /**\r | |
259 | Converts all the Unicode characters in a Null-terminated Unicode string to upper\r | |
260 | case Unicode characters.\r | |
261 | \r | |
262 | @param This Protocol instance pointer.\r | |
263 | @param Str A pointer to a Null-terminated Unicode string.\r | |
264 | \r | |
265 | **/\r | |
266 | VOID\r | |
267 | EFIAPI\r | |
268 | StrUpr (\r | |
269 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
270 | IN OUT CHAR16 *Str\r | |
e00e1d46 | 271 | );\r |
03e6b4b2 | 272 | \r |
273 | /**\r | |
274 | Performs a case-insensitive comparison of a Null-terminated Unicode \r | |
275 | pattern string and a Null-terminated Unicode string.\r | |
276 | \r | |
277 | @param This Protocol instance pointer.\r | |
278 | @param String A pointer to a Null-terminated Unicode string.\r | |
279 | @param Pattern A pointer to a Null-terminated Unicode pattern string.\r | |
280 | \r | |
281 | @retval TRUE Pattern was found in String.\r | |
282 | @retval FALSE Pattern was not found in String.\r | |
283 | \r | |
284 | **/\r | |
285 | BOOLEAN\r | |
286 | EFIAPI\r | |
287 | MetaiMatch (\r | |
288 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
289 | IN CHAR16 *String,\r | |
290 | IN CHAR16 *Pattern\r | |
e00e1d46 | 291 | );\r |
03e6b4b2 | 292 | \r |
293 | /**\r | |
294 | Converts an 8.3 FAT file name in an OEM character set to a Null-terminated \r | |
295 | Unicode string.\r | |
296 | \r | |
297 | @param This Protocol instance pointer.\r | |
298 | @param FatSize The size of the string Fat in bytes.\r | |
299 | @param Fat A pointer to a Null-terminated string that contains an 8.3 file\r | |
300 | name using an OEM character set.\r | |
301 | @param String A pointer to a Null-terminated Unicode string. The string must\r | |
302 | be preallocated to hold FatSize Unicode characters.\r | |
303 | \r | |
304 | **/\r | |
305 | VOID\r | |
306 | EFIAPI\r | |
307 | FatToStr (\r | |
308 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
309 | IN UINTN FatSize,\r | |
310 | IN CHAR8 *Fat,\r | |
311 | OUT CHAR16 *String\r | |
e00e1d46 | 312 | );\r |
03e6b4b2 | 313 | \r |
314 | /**\r | |
315 | Converts a Null-terminated Unicode string to legal characters in a FAT \r | |
316 | filename using an OEM character set. \r | |
317 | \r | |
318 | @param This Protocol instance pointer.\r | |
319 | @param String A pointer to a Null-terminated Unicode string. The string must\r | |
320 | be preallocated to hold FatSize Unicode characters.\r | |
321 | @param FatSize The size of the string Fat in bytes.\r | |
322 | @param Fat A pointer to a Null-terminated string that contains an 8.3 file\r | |
323 | name using an OEM character set.\r | |
324 | \r | |
325 | @retval TRUE Fat is a Long File Name\r | |
326 | @retval FALSE Fat is an 8.3 file name\r | |
327 | \r | |
328 | **/\r | |
329 | BOOLEAN\r | |
330 | EFIAPI\r | |
331 | StrToFat (\r | |
332 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
333 | IN CHAR16 *String,\r | |
334 | IN UINTN FatSize,\r | |
335 | OUT CHAR8 *Fat\r | |
e00e1d46 | 336 | );\r |
03e6b4b2 | 337 | \r |
a3a83173 | 338 | #define UC2_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('_', 'U', 'C', '2')\r |
03e6b4b2 | 339 | \r |
340 | typedef struct {\r | |
341 | UINT32 Signature;\r | |
342 | EFI_UNICODE_COLLATION_PROTOCOL UC2;\r | |
343 | EFI_UNICODE_COLLATION_PROTOCOL *UC;\r | |
344 | } UC2_PRIVATE_DATA;\r | |
345 | \r | |
29ec49a5 | 346 | #define UC2_PRIVATE_DATA_FROM_THIS(a) CR (a, UC2_PRIVATE_DATA, UC2, UC2_PRIVATE_DATA_SIGNATURE)\r |
03e6b4b2 | 347 | \r |
348 | //\r | |
349 | // Firmware Volume Protocol template\r | |
350 | //\r | |
351 | EFI_EVENT mUc2Registration;\r | |
352 | \r | |
353 | UC2_PRIVATE_DATA gUC2PrivateDataTemplate = {\r | |
354 | UC2_PRIVATE_DATA_SIGNATURE,\r | |
355 | {\r | |
356 | StriColl,\r | |
357 | MetaiMatch,\r | |
358 | StrLwr,\r | |
359 | StrUpr,\r | |
360 | FatToStr,\r | |
361 | StrToFat,\r | |
362 | NULL\r | |
363 | },\r | |
364 | NULL\r | |
365 | };\r | |
366 | \r | |
367 | //\r | |
368 | // Module globals\r | |
369 | //\r | |
370 | \r | |
371 | VOID\r | |
372 | EFIAPI\r | |
cd289975 | 373 | UcNotificationEvent (\r |
03e6b4b2 | 374 | IN EFI_EVENT Event,\r |
375 | IN VOID *Context\r | |
376 | )\r | |
377 | {\r | |
378 | EFI_STATUS Status;\r | |
379 | UINTN BufferSize;\r | |
380 | EFI_HANDLE Handle;\r | |
381 | UC2_PRIVATE_DATA *Private;\r | |
382 | EFI_UNICODE_COLLATION_PROTOCOL *Uc2;\r | |
383 | \r | |
384 | while (TRUE) {\r | |
385 | BufferSize = sizeof (Handle);\r | |
386 | Status = gBS->LocateHandle (\r | |
387 | ByRegisterNotify,\r | |
388 | &gEfiUnicodeCollationProtocolGuid,\r | |
389 | mUc2Registration,\r | |
390 | &BufferSize,\r | |
391 | &Handle\r | |
392 | );\r | |
393 | if (EFI_ERROR (Status)) {\r | |
394 | //\r | |
395 | // Exit Path of While Loop....\r | |
396 | //\r | |
397 | break;\r | |
398 | }\r | |
399 | \r | |
400 | //\r | |
401 | // Skip this handle if the Firmware Volume Protocol is already installed\r | |
402 | //\r | |
403 | Status = gBS->HandleProtocol (\r | |
404 | Handle,\r | |
405 | &gEfiUnicodeCollation2ProtocolGuid,\r | |
406 | (VOID **)&Uc2\r | |
407 | );\r | |
408 | if (!EFI_ERROR (Status)) {\r | |
409 | continue;\r | |
410 | }\r | |
411 | \r | |
412 | //\r | |
413 | // Allocate private data structure\r | |
414 | //\r | |
415 | Private = AllocateCopyPool (sizeof (UC2_PRIVATE_DATA), &gUC2PrivateDataTemplate);\r | |
416 | if (Private == NULL) {\r | |
417 | continue;\r | |
418 | }\r | |
419 | \r | |
420 | //\r | |
421 | // Retrieve the UC Protocol\r | |
422 | //\r | |
423 | Status = gBS->HandleProtocol (\r | |
424 | Handle,\r | |
425 | &gEfiUnicodeCollationProtocolGuid,\r | |
426 | (VOID **)&Private->UC\r | |
427 | );\r | |
428 | ASSERT_EFI_ERROR (Status);\r | |
429 | \r | |
430 | //\r | |
431 | // Fill in rest of private data structure\r | |
432 | //\r | |
0b09813f | 433 | Private->UC2.SupportedLanguages = ConvertIso639LanguageToRfc3066Language (Private->UC->SupportedLanguages);\r |
434 | if (Private->UC2.SupportedLanguages != NULL) {\r | |
03e6b4b2 | 435 | \r |
436 | //\r | |
437 | // Install Firmware Volume Protocol onto same handle\r | |
438 | //\r | |
439 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
440 | &Handle,\r | |
441 | &gEfiUnicodeCollation2ProtocolGuid,\r | |
442 | &Private->UC2,\r | |
443 | NULL\r | |
444 | );\r | |
445 | ASSERT_EFI_ERROR (Status);\r | |
446 | }\r | |
447 | }\r | |
448 | }\r | |
449 | \r | |
450 | \r | |
451 | /**\r | |
452 | The user Entry Point for DXE driver. The user code starts with this function\r | |
453 | as the real entry point for the image goes into a library that calls this \r | |
454 | function.\r | |
455 | \r | |
456 | @param[in] ImageHandle The firmware allocated handle for the EFI image. \r | |
457 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
458 | \r | |
459 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
460 | @retval other Some error occurs when executing this entry point.\r | |
461 | \r | |
462 | **/\r | |
463 | EFI_STATUS\r | |
464 | EFIAPI\r | |
465 | InitializeUC2 (\r | |
466 | IN EFI_HANDLE ImageHandle,\r | |
467 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
468 | )\r | |
469 | {\r | |
470 | EfiCreateProtocolNotifyEvent (\r | |
471 | &gEfiUnicodeCollationProtocolGuid,\r | |
472 | TPL_CALLBACK,\r | |
cd289975 | 473 | UcNotificationEvent,\r |
03e6b4b2 | 474 | NULL,\r |
475 | &mUc2Registration\r | |
476 | );\r | |
477 | return EFI_SUCCESS;\r | |
478 | }\r | |
479 | \r | |
480 | \r | |
481 | /**\r | |
482 | Performs a case-insensitive comparison of two Null-terminated Unicode \r | |
483 | strings.\r | |
484 | \r | |
485 | @param This Protocol instance pointer.\r | |
486 | @param Str1 A pointer to a Null-terminated Unicode string.\r | |
487 | @param Str2 A pointer to a Null-terminated Unicode string.\r | |
488 | \r | |
489 | @retval 0 Str1 is equivalent to Str2\r | |
490 | @retval > 0 Str1 is lexically greater than Str2\r | |
491 | @retval < 0 Str1 is lexically less than Str2\r | |
492 | \r | |
493 | **/\r | |
494 | INTN\r | |
495 | EFIAPI\r | |
496 | StriColl (\r | |
497 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
498 | IN CHAR16 *Str1,\r | |
499 | IN CHAR16 *Str2\r | |
500 | )\r | |
501 | {\r | |
502 | UC2_PRIVATE_DATA *Private;\r | |
503 | \r | |
504 | Private = UC2_PRIVATE_DATA_FROM_THIS (This);\r | |
505 | \r | |
506 | return Private->UC->StriColl (Private->UC, Str1, Str2);\r | |
507 | }\r | |
508 | \r | |
509 | \r | |
510 | /**\r | |
511 | Converts all the Unicode characters in a Null-terminated Unicode string to \r | |
512 | lower case Unicode characters.\r | |
513 | \r | |
514 | @param This Protocol instance pointer.\r | |
515 | @param Str A pointer to a Null-terminated Unicode string.\r | |
516 | \r | |
517 | **/\r | |
518 | VOID\r | |
519 | EFIAPI\r | |
520 | StrLwr (\r | |
521 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
522 | IN OUT CHAR16 *Str\r | |
523 | )\r | |
524 | {\r | |
525 | UC2_PRIVATE_DATA *Private;\r | |
526 | \r | |
527 | Private = UC2_PRIVATE_DATA_FROM_THIS (This);\r | |
528 | \r | |
529 | Private->UC->StrLwr (Private->UC, Str);\r | |
530 | }\r | |
531 | \r | |
532 | \r | |
533 | /**\r | |
534 | Converts all the Unicode characters in a Null-terminated Unicode string to upper\r | |
535 | case Unicode characters.\r | |
536 | \r | |
537 | @param This Protocol instance pointer.\r | |
538 | @param Str A pointer to a Null-terminated Unicode string.\r | |
539 | \r | |
540 | **/\r | |
541 | VOID\r | |
542 | EFIAPI\r | |
543 | StrUpr (\r | |
544 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
545 | IN OUT CHAR16 *Str\r | |
546 | )\r | |
547 | {\r | |
548 | UC2_PRIVATE_DATA *Private;\r | |
549 | \r | |
550 | Private = UC2_PRIVATE_DATA_FROM_THIS (This);\r | |
551 | \r | |
552 | Private->UC->StrUpr (Private->UC, Str);\r | |
553 | }\r | |
554 | \r | |
555 | /**\r | |
556 | Performs a case-insensitive comparison of a Null-terminated Unicode \r | |
557 | pattern string and a Null-terminated Unicode string.\r | |
558 | \r | |
559 | @param This Protocol instance pointer.\r | |
560 | @param String A pointer to a Null-terminated Unicode string.\r | |
561 | @param Pattern A pointer to a Null-terminated Unicode pattern string.\r | |
562 | \r | |
563 | @retval TRUE Pattern was found in String.\r | |
564 | @retval FALSE Pattern was not found in String.\r | |
565 | \r | |
566 | **/\r | |
567 | BOOLEAN\r | |
568 | EFIAPI\r | |
569 | MetaiMatch (\r | |
570 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
571 | IN CHAR16 *String,\r | |
572 | IN CHAR16 *Pattern\r | |
573 | )\r | |
574 | {\r | |
575 | UC2_PRIVATE_DATA *Private;\r | |
576 | \r | |
577 | Private = UC2_PRIVATE_DATA_FROM_THIS (This);\r | |
578 | \r | |
579 | return Private->UC->MetaiMatch (Private->UC, String, Pattern);\r | |
580 | }\r | |
581 | \r | |
582 | \r | |
583 | /**\r | |
584 | Converts an 8.3 FAT file name in an OEM character set to a Null-terminated \r | |
585 | Unicode string.\r | |
586 | \r | |
587 | @param This Protocol instance pointer.\r | |
588 | @param FatSize The size of the string Fat in bytes.\r | |
589 | @param Fat A pointer to a Null-terminated string that contains an 8.3 file\r | |
590 | name using an OEM character set.\r | |
591 | @param String A pointer to a Null-terminated Unicode string. The string must\r | |
592 | be preallocated to hold FatSize Unicode characters.\r | |
593 | \r | |
594 | **/\r | |
595 | VOID\r | |
596 | EFIAPI\r | |
597 | FatToStr (\r | |
598 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
599 | IN UINTN FatSize,\r | |
600 | IN CHAR8 *Fat,\r | |
601 | OUT CHAR16 *String\r | |
602 | )\r | |
603 | {\r | |
604 | UC2_PRIVATE_DATA *Private;\r | |
605 | \r | |
606 | Private = UC2_PRIVATE_DATA_FROM_THIS (This);\r | |
607 | \r | |
608 | Private->UC->FatToStr (Private->UC, FatSize, Fat, String);\r | |
609 | }\r | |
610 | \r | |
611 | \r | |
612 | /**\r | |
613 | Converts a Null-terminated Unicode string to legal characters in a FAT \r | |
614 | filename using an OEM character set. \r | |
615 | \r | |
616 | @param This Protocol instance pointer.\r | |
617 | @param String A pointer to a Null-terminated Unicode string. The string must\r | |
618 | be preallocated to hold FatSize Unicode characters.\r | |
619 | @param FatSize The size of the string Fat in bytes.\r | |
620 | @param Fat A pointer to a Null-terminated string that contains an 8.3 file\r | |
621 | name using an OEM character set.\r | |
622 | \r | |
623 | @retval TRUE Fat is a Long File Name\r | |
624 | @retval FALSE Fat is an 8.3 file name\r | |
625 | \r | |
626 | **/\r | |
627 | BOOLEAN\r | |
628 | EFIAPI\r | |
629 | StrToFat (\r | |
630 | IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r | |
631 | IN CHAR16 *String,\r | |
632 | IN UINTN FatSize,\r | |
633 | OUT CHAR8 *Fat\r | |
634 | )\r | |
635 | {\r | |
636 | UC2_PRIVATE_DATA *Private;\r | |
637 | \r | |
638 | Private = UC2_PRIVATE_DATA_FROM_THIS (This);\r | |
639 | \r | |
640 | return Private->UC->StrToFat (Private->UC, String, FatSize, Fat);\r | |
641 | }\r | |
642 | \r |