EfiLib/driver_support.c
BOOLEAN
LoadDrivers(
    VOID
) {
    CHAR16  *Directory;
    CHAR16  *SelfDirectory;
    UINTN   Length;
    UINTN   i        = 0;
    UINTN   NumFound = 0;
    UINTN   CurFound = 0;

    // load drivers from the subdirectories of RefindPlus' home directory
    // specified in the DRIVER_DIRS constant.
    #if REFIT_DEBUG > 0
    MsgLog ("Load EFI Drivers from Default Folder...");
    #endif
    while ((Directory = FindCommaDelimited(DRIVER_DIRS, i++)) != NULL) {
        CleanUpPathNameSlashes(Directory);

        if (SelfDirPath) {
            SelfDirectory = StrDuplicate(SelfDirPath);
            CleanUpPathNameSlashes(SelfDirectory);
        }
        else {
            SelfDirectory = NULL;
        }
        MergeStrings(&SelfDirectory, Directory, L'\\');

        CurFound = ScanDriverDir(SelfDirectory);
        if (CurFound > 0) {
            MyFreePool(Directory);
            MyFreePool(SelfDirectory);

            NumFound = NumFound + CurFound;
            break;
        }
        else {
            #if REFIT_DEBUG > 0
            MsgLog ("  - Not Found or Empty");
            #endif
        }

        MyFreePool(SelfDirectory);
        MyFreePool(Directory);
    } // while

    // Scan additional user-specified driver directories....
    if (GlobalConfig.DriverDirs != NULL) {
        #if REFIT_DEBUG > 0
        MsgLog ("\n\n");
        MsgLog ("Load EFI Drivers from User Defined Folders...");
        #endif

        i = 0;
        while ((Directory = FindCommaDelimited(GlobalConfig.DriverDirs, i++)) != NULL) {
            CleanUpPathNameSlashes(Directory);

            Length = StrLen(Directory);
            if (Length > 0) {
                if (SelfDirPath) {
                    SelfDirectory = StrDuplicate(SelfDirPath);
                    CleanUpPathNameSlashes(SelfDirectory);
                }
                else {
                    SelfDirectory = NULL;
                }
                MergeStrings(&SelfDirectory, Directory, L'\\');

                if (MyStrStr (SelfDirectory, L"EFI\\BOOT\\EFI") != NULL) {
                    ReplaceSubstring(&SelfDirectory, L"EFI\\BOOT\\EFI", L"EFI");
                    ReplaceSubstring(&SelfDirectory, L"System\\Library\\CoreServices\\System", L"System");
                }

                CurFound = ScanDriverDir(SelfDirectory);
                if (CurFound > 0) {
                    MyFreePool(Directory);
                    MyFreePool(SelfDirectory);

                    NumFound = NumFound + CurFound;
                    break;
                }
                else {
                    #if REFIT_DEBUG > 0
                    MsgLog ("  - Not Found or Empty");
                    #endif
                }
            } // if

            MyFreePool(SelfDirectory);
            MyFreePool(Directory);
        } // while
    }

    #if REFIT_DEBUG > 0
    MsgLog ("\n\n");
    #endif

    // connect all devices
    // DA-TAG: Always run this
    ConnectAllDriversToAllControllers(TRUE);

    return (NumFound > 0);
}
// Load all EFI drivers from RefindPlus' "drivers" subdirectory and from the
// directories specified by the user in the "scan_driver_dirs" configuration
// file line.
// Originally from rEFIt's main.c (BSD), but modified since then (GPLv3).
// Returns TRUE if any drivers are loaded, FALSE otherwise.
Load all EFI drivers from RefindPlus' "drivers" subdirectory and from the
directories specified by the user in the "scan_driver_dirs" configuration
file line.
Originally from rEFIt's main.c (BSD), but modified since then (GPLv3).
Returns TRUE if any drivers are loaded, FALSE otherwise.
Load all EFI drivers from RefindPlus ' " drivers " subdirectory and from the directories specified by the user in the " scan_driver_dirs " configuration file line . Originally from rEFIt ' s main . c ( BSD ) but modified since then ( GPLv3 ) . Returns TRUE if any drivers are loaded FALSE otherwise .
BOOLEAN
LoadDrivers(
    VOID
) {
    CHAR16  *Directory;
    CHAR16  *SelfDirectory;
    UINTN   Length;
    UINTN   i        = 0;
    UINTN   NumFound = 0;
    UINTN   CurFound = 0;
    #if REFIT_DEBUG > 0
    MsgLog ("Load EFI Drivers from Default Folder...");
    #endif
    while ((Directory = FindCommaDelimited(DRIVER_DIRS, i++)) != NULL) {
        CleanUpPathNameSlashes(Directory);
        if (SelfDirPath) {
            SelfDirectory = StrDuplicate(SelfDirPath);
            CleanUpPathNameSlashes(SelfDirectory);
        }
        else {
            SelfDirectory = NULL;
        }
        MergeStrings(&SelfDirectory, Directory, L'\\');
        CurFound = ScanDriverDir(SelfDirectory);
        if (CurFound > 0) {
            MyFreePool(Directory);
            MyFreePool(SelfDirectory);
            NumFound = NumFound + CurFound;
            break;
        }
        else {
            #if REFIT_DEBUG > 0
            MsgLog ("  - Not Found or Empty");
            #endif
        }
        MyFreePool(SelfDirectory);
        MyFreePool(Directory);
    } 
    if (GlobalConfig.DriverDirs != NULL) {
        #if REFIT_DEBUG > 0
        MsgLog ("\n\n");
        MsgLog ("Load EFI Drivers from User Defined Folders...");
        #endif
        i = 0;
        while ((Directory = FindCommaDelimited(GlobalConfig.DriverDirs, i++)) != NULL) {
            CleanUpPathNameSlashes(Directory);
            Length = StrLen(Directory);
            if (Length > 0) {
                if (SelfDirPath) {
                    SelfDirectory = StrDuplicate(SelfDirPath);
                    CleanUpPathNameSlashes(SelfDirectory);
                }
                else {
                    SelfDirectory = NULL;
                }
                MergeStrings(&SelfDirectory, Directory, L'\\');
                if (MyStrStr (SelfDirectory, L"EFI\\BOOT\\EFI") != NULL) {
                    ReplaceSubstring(&SelfDirectory, L"EFI\\BOOT\\EFI", L"EFI");
                    ReplaceSubstring(&SelfDirectory, L"System\\Library\\CoreServices\\System", L"System");
                }
                CurFound = ScanDriverDir(SelfDirectory);
                if (CurFound > 0) {
                    MyFreePool(Directory);
                    MyFreePool(SelfDirectory);
                    NumFound = NumFound + CurFound;
                    break;
                }
                else {
                    #if REFIT_DEBUG > 0
                    MsgLog ("  - Not Found or Empty");
                    #endif
                }
            } 
            MyFreePool(SelfDirectory);
            MyFreePool(Directory);
        } 
    }
    #if REFIT_DEBUG > 0
    MsgLog ("\n\n");
    #endif
    ConnectAllDriversToAllControllers(TRUE);
    return (NumFound > 0);
}
BOOLEAN LoadDrivers ( VOID ) { CHAR16 * Directory ; CHAR16 * SelfDirectory ; UINTN Length ; UINTN i = 0 ; UINTN NumFound = 0 ; UINTN CurFound = 0 ; #if REFIT_DEBUG > 0 MsgLog ( " " ) ; #endif while ( ( Directory = FindCommaDelimited ( DRIVER_DIRS , i ++ ) ) != NULL ) { CleanUpPathNameSlashes ( Directory ) ; if ( SelfDirPath ) { SelfDirectory = StrDuplicate ( SelfDirPath ) ; CleanUpPathNameSlashes ( SelfDirectory ) ; } else { SelfDirectory = NULL ; } MergeStrings ( & SelfDirectory , Directory , L' \\ ' ) ; CurFound = ScanDriverDir ( SelfDirectory ) ; if ( CurFound > 0 ) { MyFreePool ( Directory ) ; MyFreePool ( SelfDirectory ) ; NumFound = NumFound + CurFound ; break ; } else { #if REFIT_DEBUG > 0 MsgLog ( " " ) ; #endif } MyFreePool ( SelfDirectory ) ; MyFreePool ( Directory ) ; } if ( GlobalConfig . DriverDirs != NULL ) { #if REFIT_DEBUG > 0 MsgLog ( " \n \n " ) ; MsgLog ( " " ) ; #endif i = 0 ; while ( ( Directory = FindCommaDelimited ( GlobalConfig . DriverDirs , i ++ ) ) != NULL ) { CleanUpPathNameSlashes ( Directory ) ; Length = StrLen ( Directory ) ; if ( Length > 0 ) { if ( SelfDirPath ) { SelfDirectory = StrDuplicate ( SelfDirPath ) ; CleanUpPathNameSlashes ( SelfDirectory ) ; } else { SelfDirectory = NULL ; } MergeStrings ( & SelfDirectory , Directory , L' \\ ' ) ; if ( MyStrStr ( SelfDirectory , L" \\ \\ " ) != NULL ) { ReplaceSubstring ( & SelfDirectory , L" \\ \\ " , L" " ) ; ReplaceSubstring ( & SelfDirectory , L" \\ \\ \\ " , L" " ) ; } CurFound = ScanDriverDir ( SelfDirectory ) ; if ( CurFound > 0 ) { MyFreePool ( Directory ) ; MyFreePool ( SelfDirectory ) ; NumFound = NumFound + CurFound ; break ; } else { #if REFIT_DEBUG > 0 MsgLog ( " " ) ; #endif } } MyFreePool ( SelfDirectory ) ; MyFreePool ( Directory ) ; } } #if REFIT_DEBUG > 0 MsgLog ( " \n \n " ) ; #endif ConnectAllDriversToAllControllers ( TRUE ) ; return ( NumFound > 0 ) ; }
Load all EFI drivers from RefindPlus' "drivers" subdirectory and from the
directories specified by the user in the "scan_driver_dirs" configuration
file line.
Load all EFI drivers from RefindPlus ' " drivers " subdirectory and from the directories specified by the user in the " scan_driver_dirs " configuration file line .
// load drivers from the subdirectories of RefindPlus' home directory // specified in the DRIVER_DIRS constant. // while // Scan additional user-specified driver directories.... // if // while // connect all devices // DA-TAG: Always run this