loader/config.c
VOID ScanUserConfigured(CHAR16 *FileName)
{
   EFI_STATUS        Status;
   REFIT_FILE        File;
   REFIT_VOLUME      *Volume;
   CHAR16            **TokenList;
   CHAR16            *Title = NULL;
   UINTN             TokenCount, size;
   LOADER_ENTRY      *Entry;

   if (FileExists(SelfDir, FileName)) {
      Status = ReadFile(SelfDir, FileName, &File, &size);
      if (EFI_ERROR(Status))
         return;

      Volume = SelfVolume;

      while ((TokenCount = ReadTokenLine(&File, &TokenList)) > 0) {
         if (MyStriCmp(TokenList[0], L"menuentry") && (TokenCount > 1)) {
            Title = StrDuplicate(TokenList[1]);
            Entry = AddStanzaEntries(&File, Volume, TokenList[1]);
            if (Entry->Enabled) {
               if (Entry->me.SubScreen == NULL)
                  GenerateSubScreen(Entry, Volume, TRUE);
               AddPreparedLoaderEntry(Entry);
            } else {
               MyFreePool(Entry);
            } // if/else
            MyFreePool(Title);

         } else if (MyStriCmp(TokenList[0], L"include") && (TokenCount == 2) &&
                    MyStriCmp(FileName, GlobalConfig.ConfigFilename)) {
            if (!MyStriCmp(TokenList[1], FileName)) {
               ScanUserConfigured(TokenList[1]);
            }

         } // if/else if...
         FreeTokenLine(&TokenList, &TokenCount);
      } // while()
   } // if()
}
// Read the user-configured menu entries from the configuration file and add or delete
// entries based on the contents of that file....
Read the user-configured menu entries from the configuration file and add or delete
entries based on the contents of that file
Read the user - configured menu entries from the configuration file and add or delete entries based on the contents of that file
VOID ScanUserConfigured(CHAR16 *FileName)
{
   EFI_STATUS        Status;
   REFIT_FILE        File;
   REFIT_VOLUME      *Volume;
   CHAR16            **TokenList;
   CHAR16            *Title = NULL;
   UINTN             TokenCount, size;
   LOADER_ENTRY      *Entry;
   if (FileExists(SelfDir, FileName)) {
      Status = ReadFile(SelfDir, FileName, &File, &size);
      if (EFI_ERROR(Status))
         return;
      Volume = SelfVolume;
      while ((TokenCount = ReadTokenLine(&File, &TokenList)) > 0) {
         if (MyStriCmp(TokenList[0], L"menuentry") && (TokenCount > 1)) {
            Title = StrDuplicate(TokenList[1]);
            Entry = AddStanzaEntries(&File, Volume, TokenList[1]);
            if (Entry->Enabled) {
               if (Entry->me.SubScreen == NULL)
                  GenerateSubScreen(Entry, Volume, TRUE);
               AddPreparedLoaderEntry(Entry);
            } else {
               MyFreePool(Entry);
            } 
            MyFreePool(Title);
         } else if (MyStriCmp(TokenList[0], L"include") && (TokenCount == 2) &&
                    MyStriCmp(FileName, GlobalConfig.ConfigFilename)) {
            if (!MyStriCmp(TokenList[1], FileName)) {
               ScanUserConfigured(TokenList[1]);
            }
         }  if...
         FreeTokenLine(&TokenList, &TokenCount);
      } 
   } 
}
VOID ScanUserConfigured ( CHAR16 * FileName ) { EFI_STATUS Status ; REFIT_FILE File ; REFIT_VOLUME * Volume ; CHAR16 * * TokenList ; CHAR16 * Title = NULL ; UINTN TokenCount , size ; LOADER_ENTRY * Entry ; if ( FileExists ( SelfDir , FileName ) ) { Status = ReadFile ( SelfDir , FileName , & File , & size ) ; if ( EFI_ERROR ( Status ) ) return ; Volume = SelfVolume ; while ( ( TokenCount = ReadTokenLine ( & File , & TokenList ) ) > 0 ) { if ( MyStriCmp ( TokenList [ 0 ] , L" " ) && ( TokenCount > 1 ) ) { Title = StrDuplicate ( TokenList [ 1 ] ) ; Entry = AddStanzaEntries ( & File , Volume , TokenList [ 1 ] ) ; if ( Entry -> Enabled ) { if ( Entry -> me . SubScreen == NULL ) GenerateSubScreen ( Entry , Volume , TRUE ) ; AddPreparedLoaderEntry ( Entry ) ; } else { MyFreePool ( Entry ) ; } MyFreePool ( Title ) ; } else if ( MyStriCmp ( TokenList [ 0 ] , L" " ) && ( TokenCount == 2 ) && MyStriCmp ( FileName , GlobalConfig . ConfigFilename ) ) { if ( ! MyStriCmp ( TokenList [ 1 ] , FileName ) ) { ScanUserConfigured ( TokenList [ 1 ] ) ; } } FreeTokenLine ( & TokenList , & TokenCount ) ; } } }
Read the user-configured menu entries from the configuration file and add or delete
entries based on the contents of that file....
Read the user - configured menu entries from the configuration file and add or delete entries based on the contents of that file ....
// if/else // if/else if... // while() // if()