loader/apple.c
EFI_STATUS SetAppleOSInfo() {
    CHAR16 *AppleOSVersion = NULL;
    CHAR8 *AppleOSVersion8 = NULL;
    EFI_STATUS Status;
    EFI_GUID apple_set_os_guid = EFI_APPLE_SET_OS_PROTOCOL_GUID;
    EfiAppleSetOsInterface *SetOs = NULL;

    Status = refit_call3_wrapper(BS->LocateProtocol, &apple_set_os_guid, NULL, (VOID**) &SetOs);

    // If not a Mac, ignore the call....
    if ((Status != EFI_SUCCESS) || (!SetOs))
        return EFI_SUCCESS;

    if ((SetOs->Version != 0) && GlobalConfig.SpoofOSXVersion) {
        AppleOSVersion = StrDuplicate(L"Mac OS X");
        MergeStrings(&AppleOSVersion, GlobalConfig.SpoofOSXVersion, ' ');
        if (AppleOSVersion) {
            AppleOSVersion8 = AllocateZeroPool((StrLen(AppleOSVersion) + 1) * sizeof(CHAR8));
            UnicodeStrToAsciiStr(AppleOSVersion, AppleOSVersion8);
            if (AppleOSVersion8) {
                Status = refit_call1_wrapper (SetOs->SetOsVersion, AppleOSVersion8);
                if (!EFI_ERROR(Status))
                    Status = EFI_SUCCESS;
                MyFreePool(AppleOSVersion8);
            } else {
                Status = EFI_OUT_OF_RESOURCES;
                Print(L"Out of resources in SetAppleOSInfo!\n");
            }
            if ((Status == EFI_SUCCESS) && (SetOs->Version >= 2))
                Status = refit_call1_wrapper (SetOs->SetOsVendor, (CHAR8 *) "Apple Inc.");
            MyFreePool(AppleOSVersion);
        } // if (AppleOSVersion)
    } // if
    if (Status != EFI_SUCCESS)
        Print(L"Unable to set firmware boot type!\n");

    return (Status);
}
// Function to tell the firmware that OS X is being launched. This is
// required to work around problems on some Macs that don't fully
// initialize some hardware (especially video displays) when third-party
// OSes are launched in EFI mode.
Function to tell the firmware that OS X is being launched. This is
required to work around problems on some Macs that don't fully
initialize some hardware (especially video displays) when third-party
OSes are launched in EFI mode.
Function to tell the firmware that OS X is being launched . This is required to work around problems on some Macs that don ' t fully initialize some hardware ( especially video displays ) when third - party OSes are launched in EFI mode .
EFI_STATUS SetAppleOSInfo() {
    CHAR16 *AppleOSVersion = NULL;
    CHAR8 *AppleOSVersion8 = NULL;
    EFI_STATUS Status;
    EFI_GUID apple_set_os_guid = EFI_APPLE_SET_OS_PROTOCOL_GUID;
    EfiAppleSetOsInterface *SetOs = NULL;
    Status = refit_call3_wrapper(BS->LocateProtocol, &apple_set_os_guid, NULL, (VOID**) &SetOs);
    if ((Status != EFI_SUCCESS) || (!SetOs))
        return EFI_SUCCESS;
    if ((SetOs->Version != 0) && GlobalConfig.SpoofOSXVersion) {
        AppleOSVersion = StrDuplicate(L"Mac OS X");
        MergeStrings(&AppleOSVersion, GlobalConfig.SpoofOSXVersion, ' ');
        if (AppleOSVersion) {
            AppleOSVersion8 = AllocateZeroPool((StrLen(AppleOSVersion) + 1) * sizeof(CHAR8));
            UnicodeStrToAsciiStr(AppleOSVersion, AppleOSVersion8);
            if (AppleOSVersion8) {
                Status = refit_call1_wrapper (SetOs->SetOsVersion, AppleOSVersion8);
                if (!EFI_ERROR(Status))
                    Status = EFI_SUCCESS;
                MyFreePool(AppleOSVersion8);
            } else {
                Status = EFI_OUT_OF_RESOURCES;
                Print(L"Out of resources in SetAppleOSInfo!\n");
            }
            if ((Status == EFI_SUCCESS) && (SetOs->Version >= 2))
                Status = refit_call1_wrapper (SetOs->SetOsVendor, (CHAR8 *) "Apple Inc.");
            MyFreePool(AppleOSVersion);
        } 
    } 
    if (Status != EFI_SUCCESS)
        Print(L"Unable to set firmware boot type!\n");
    return (Status);
}
EFI_STATUS SetAppleOSInfo ( ) { CHAR16 * AppleOSVersion = NULL ; CHAR8 * AppleOSVersion8 = NULL ; EFI_STATUS Status ; EFI_GUID apple_set_os_guid = EFI_APPLE_SET_OS_PROTOCOL_GUID ; EfiAppleSetOsInterface * SetOs = NULL ; Status = refit_call3_wrapper ( BS -> LocateProtocol , & apple_set_os_guid , NULL , ( VOID * * ) & SetOs ) ; if ( ( Status != EFI_SUCCESS ) || ( ! SetOs ) ) return EFI_SUCCESS ; if ( ( SetOs -> Version != 0 ) && GlobalConfig . SpoofOSXVersion ) { AppleOSVersion = StrDuplicate ( L" " ) ; MergeStrings ( & AppleOSVersion , GlobalConfig . SpoofOSXVersion , ' ' ) ; if ( AppleOSVersion ) { AppleOSVersion8 = AllocateZeroPool ( ( StrLen ( AppleOSVersion ) + 1 ) * sizeof ( CHAR8 ) ) ; UnicodeStrToAsciiStr ( AppleOSVersion , AppleOSVersion8 ) ; if ( AppleOSVersion8 ) { Status = refit_call1_wrapper ( SetOs -> SetOsVersion , AppleOSVersion8 ) ; if ( ! EFI_ERROR ( Status ) ) Status = EFI_SUCCESS ; MyFreePool ( AppleOSVersion8 ) ; } else { Status = EFI_OUT_OF_RESOURCES ; Print ( L" \n " ) ; } if ( ( Status == EFI_SUCCESS ) && ( SetOs -> Version >= 2 ) ) Status = refit_call1_wrapper ( SetOs -> SetOsVendor , ( CHAR8 * ) " " ) ; MyFreePool ( AppleOSVersion ) ; } } if ( Status != EFI_SUCCESS ) Print ( L" \n " ) ; return ( Status ) ; }
Function to tell the firmware that OS X is being launched.
Function to tell the firmware that OS X is being launched .
// If not a Mac, ignore the call.... // if (AppleOSVersion) // if