Exemplo n.º 1
0
Arquivo: file.c Projeto: tribals/efifs
/* Simple hook to populate the timestamp and directory flag when opening a file */
static INT32
InfoHook(const CHAR8 *name, const GRUB_DIRHOOK_INFO *Info, VOID *Data)
{
	EFI_GRUB_FILE *File = (EFI_GRUB_FILE *) Data;

	/* Look for a specific file */
	if (strcmpa(name, File->basename) != 0)
		return 0;

	File->IsDir = (Info->Dir);
	if (Info->MtimeSet)
		File->Mtime = Info->Mtime;

	return 0;
}
Exemplo n.º 2
0
CHAR16 *
LibGetUiString (
    IN  EFI_HANDLE      Handle,
    IN  UI_STRING_TYPE  StringType,
    IN  ISO_639_2       *LangCode,
    IN  BOOLEAN         ReturnDevicePathStrOnMismatch
    )
{
    UI_INTERFACE    *Ui;
    UI_STRING_TYPE  Index;
    UI_STRING_ENTRY *Array;
    EFI_STATUS      Status;
    
    Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handle, &UiProtocol, (VOID *)&Ui);
    if (EFI_ERROR(Status)) {
        return (ReturnDevicePathStrOnMismatch) ? DevicePathToStr(DevicePathFromHandle(Handle)) : NULL;
    }

    //
    // Skip the first strings
    //
    for (Index = UiDeviceString, Array = Ui->Entry; Index < StringType; Index++, Array++) {
        while (Array->LangCode) {
            Array++;
        }
    }

    //
    // Search for the match
    //
    while (Array->LangCode) {
        if (strcmpa (Array->LangCode, LangCode) == 0) {
            return Array->UiString; 
        }
    }
    return (ReturnDevicePathStrOnMismatch) ? DevicePathToStr(DevicePathFromHandle(Handle)) : NULL;
}
Exemplo n.º 3
0
int
strcmp (const char *str1, const char *str2)
{
	return strcmpa((CHAR8 *)str1,(CHAR8 *)str2);
}
Exemplo n.º 4
0
CHAR8 *
ConvertComponentName2SupportLanguage (
    IN EFI_COMPONENT_NAME2_PROTOCOL    *ComponentName,
    IN CHAR8                           *Language
)
/*++

  Routine Description:

    Do some convertion for the ComponentName2 supported language. It do
    the convertion just for english language code currently.

  Arguments:

    ComponentName         - Pointer to the ComponentName2 protocl pointer.
    Language              - The language string.

  Returns:

    Return the duplication of Language if it is not english otherwise return
    the supported english language code.

--*/
{
    CHAR8                              *SupportedLanguages;
    CHAR8                              *LangCode;
    UINTN                              Index;

    LangCode           = NULL;
    SupportedLanguages = NULL;

    //
    // treat all the english language code (en-xx or eng) equally
    //
    if ((strncmpa(Language, "en-", 3) == 0) || (strcmpa(Language, "eng") == 0)) {
        SupportedLanguages = strstra(ComponentName->SupportedLanguages, "en-");
        if (SupportedLanguages == NULL) {
            SupportedLanguages = strstra(ComponentName->SupportedLanguages, "eng");
        }
    }

    //
    // duplicate the Language if it is not english
    //
    if (SupportedLanguages == NULL) {
        SupportedLanguages = Language;
    }

    //
    // duplicate the returned language code.
    //
    if (strstra(SupportedLanguages, "-") != NULL) {
        LangCode = EfiLibAllocateZeroPool(32);
        for(Index = 0; (Index < 31) && (SupportedLanguages[Index] != '\0') && (SupportedLanguages[Index] != ';'); Index++) {
            LangCode[Index] = SupportedLanguages[Index];
        }
        LangCode[Index] = '\0';
    } else {
        LangCode = EfiLibAllocateZeroPool(4);
        for(Index = 0; (Index < 3) && (SupportedLanguages[Index] != '\0'); Index++) {
            LangCode[Index] = SupportedLanguages[Index];
        }
        LangCode[Index] = '\0';
    }
    return LangCode;
}