Ejemplo n.º 1
0
VOID
EFIAPI
SEnvBusSpecificDriverOverride (
  IN EFI_HANDLE       h,
  IN VOID             *Interface
  )
/*++

Routine Description:

Arguments:

  h         - An EFI handle
  Interface - The interface

Returns:

--*/
{
  EFI_STATUS                                Status;
  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
  EFI_HANDLE                                ImageHandle;
  EFI_LOADED_IMAGE_PROTOCOL                 *Image;

  Print (L"\n");
  BusSpecificDriverOverride = Interface;
  do {
    Status = BusSpecificDriverOverride->GetDriver (
                                          BusSpecificDriverOverride,
                                          &ImageHandle
                                          );
    if (!EFI_ERROR (Status)) {
      Status = BS->HandleProtocol (
                    ImageHandle,
                    &gEfiLoadedImageProtocolGuid,
                    (VOID **) &Image
                    );
      if (!EFI_ERROR (Status)) {
        PrintToken (
          STRING_TOKEN (STR_SHELLENV_DPROT_DRV_FILE),
          HiiEnvHandle,
          SEnvHandleToNumber (ImageHandle),
          LibDevicePathToStr (Image->FilePath)
          );
      }
    }
  } while (!EFI_ERROR (Status));
}
Ejemplo n.º 2
0
VOID
EFIAPI
SEnvImageDPathTok (
  IN EFI_HANDLE   h,
  IN VOID         *Interface
  )
/*++

Routine Description:

Arguments:

  h         - An EFI handle
  Interface - The interface

Returns:

--*/
{
  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
  CHAR16                    *Str;
  CHAR16                    *Disp;
  UINTN                     Len;

  DevicePath  = Interface;
  Str         = LibDevicePathToStr (DevicePath);
  Disp        = L"";

  //
  // Print device path token
  //
  if (Str) {
    Len   = StrLen (Str);
    Disp  = Str;
    if (Len > 30) {
      Disp    = Str + Len - 30;
      Disp[0] = '.';
      Disp[1] = '.';
    }
  }

  PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_IMAGE_DEVPATH), HiiEnvHandle, Disp);

  if (Str) {
    FreePool (Str);
  }
}
Ejemplo n.º 3
0
VOID
EFIAPI
SEnvDPath (
  IN EFI_HANDLE           h,
  IN VOID                 *Interface
  )
/*++

Routine Description:

Arguments:

  h         - An EFI handle
  Interface - The interface

Returns:

--*/
{
  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
  EFI_DEVICE_PATH_PROTOCOL  *DevicePathNode;
  CHAR16                    *Str;

  DevicePath  = Interface;
  Str         = LibDevicePathToStr (DevicePath);
  DevicePath  = UnpackDevicePath (DevicePath);

  //
  // Print device path entry
  //
  DevicePathNode = DevicePath;
  while (!IsDevicePathEnd (DevicePathNode)) {
    SEnvPrintDevicePathEntry (DevicePathNode, TRUE);
    DevicePathNode = NextDevicePathNode (DevicePathNode);
  }

  PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_ASSTR), HiiEnvHandle, Str);
  FreePool (Str);
  FreePool (DevicePath);
}
Ejemplo n.º 4
0
VOID
EFIAPI
SEnvImageTok (
  IN EFI_HANDLE       h,
  IN VOID             *Interface
  )
/*++

Routine Description:

Arguments:

  h         - An EFI handle
  Interface - The interface

Returns:

--*/
{
  EFI_LOADED_IMAGE_PROTOCOL *Image;
  CHAR16                    *ImageName;

  CHAR16                    *Tok;

  Image     = Interface;
  ImageName = LibGetImageName (Image);
  if (ImageName != NULL) {
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_IMAGE_2), HiiEnvHandle);
    Print (ImageName);
    Print (L") ");
    FreePool (ImageName);
  } else {
    Tok = LibDevicePathToStr (Image->FilePath);
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_IMAGE), HiiEnvHandle, Tok);
    FreePool (Tok);
  }
}
Ejemplo n.º 5
0
/**
  This function build the FsOptionMenu list which records all
  available file system in the system. They includes all instances
  of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM.


  @retval  EFI_SUCCESS             Success find the file system
  @retval  EFI_OUT_OF_RESOURCES    Can not create menu entry

**/
EFI_STATUS
LibFindFileSystem (
  VOID
  )
{
  UINTN                        NoSimpleFsHandles;
  EFI_HANDLE                   *SimpleFsHandle;
  UINT16                       *VolumeLabel;
  UINTN                        Index;
  EFI_STATUS                   Status;
  MENU_ENTRY                   *MenuEntry;
  FILE_CONTEXT                 *FileContext;
  UINTN                        OptionNumber;
  EFI_FILE_SYSTEM_VOLUME_LABEL *Info;

  NoSimpleFsHandles = 0;
  OptionNumber      = 0;

  //
  // Locate Handles that support Simple File System protocol
  //
  Status = gBS->LocateHandleBuffer (
                  ByProtocol,
                  &gEfiSimpleFileSystemProtocolGuid,
                  NULL,
                  &NoSimpleFsHandles,
                  &SimpleFsHandle
                  );
  if (!EFI_ERROR (Status)) {
    //
    // Find all the instances of the File System prototocol
    //
    for (Index = 0; Index < NoSimpleFsHandles; Index++) {
      //
      // Allocate pool for this load option
      //
      MenuEntry = LibCreateMenuEntry ();
      if (NULL == MenuEntry) {
        FreePool (SimpleFsHandle);
        return EFI_OUT_OF_RESOURCES;
      }

      FileContext = (FILE_CONTEXT *) MenuEntry->VariableContext;
      FileContext->DeviceHandle = SimpleFsHandle[Index];
      FileContext->FileHandle = LibOpenRoot (FileContext->DeviceHandle);
      if (FileContext->FileHandle == NULL) {
        LibDestroyMenuEntry (MenuEntry);
        continue;
      }

      MenuEntry->HelpString = LibDevicePathToStr (DevicePathFromHandle (FileContext->DeviceHandle));
      FileContext->FileName = LibStrDuplicate (L"\\");
      FileContext->DevicePath = FileDevicePath (FileContext->DeviceHandle, FileContext->FileName);
      FileContext->IsDir = TRUE;
      FileContext->IsRoot = TRUE;

      //
      // Get current file system's Volume Label
      //
      Info = (EFI_FILE_SYSTEM_VOLUME_LABEL *) LibFileInfo (FileContext->FileHandle, &gEfiFileSystemVolumeLabelInfoIdGuid);
      if (Info == NULL) {
        VolumeLabel = L"NO FILE SYSTEM INFO";
      } else {
        if (Info->VolumeLabel == NULL) {
          VolumeLabel = L"NULL VOLUME LABEL";
        } else {
          VolumeLabel = Info->VolumeLabel;
          if (*VolumeLabel == 0x0000) {
            VolumeLabel = L"NO VOLUME LABEL";
          }
        }
      }
      MenuEntry->DisplayString  = AllocateZeroPool (MAX_CHAR);
      ASSERT (MenuEntry->DisplayString != NULL);
      UnicodeSPrint (
        MenuEntry->DisplayString,
        MAX_CHAR,
        L"%s, [%s]",
        VolumeLabel,
        MenuEntry->HelpString
        );
  	  MenuEntry->DisplayStringToken = HiiSetString (
                                             gFileExplorerPrivate.FeHiiHandle,
                                             0,
                                             MenuEntry->DisplayString,
                                             NULL
                                             );

      if (Info != NULL)
        FreePool (Info);

      OptionNumber++;
      InsertTailList (&gFileExplorerPrivate.FsOptionMenu->Head, &MenuEntry->Link);
    }
  }

  if (NoSimpleFsHandles != 0) {
    FreePool (SimpleFsHandle);
  }

  gFileExplorerPrivate.FsOptionMenu->MenuNumber = OptionNumber;

  return EFI_SUCCESS;
}
Ejemplo n.º 6
0
VOID
EFIAPI
SEnvImage (
  IN EFI_HANDLE       h,
  IN VOID             *Interface
  )
/*++

Routine Description:

Arguments:

  h         - An EFI handle
  Interface - The interface

Returns:

--*/
{
  EFI_LOADED_IMAGE_PROTOCOL *Image;
  CHAR16                    *FilePath;
  CHAR8                     *PdbFileName;
  CHAR16                    *ImageName;

  Image       = Interface;

  FilePath    = LibDevicePathToStr (Image->FilePath);
  PdbFileName = GetPdbPath (Image->ImageBase);
  ImageName   = LibGetImageName (Image);

  if (ImageName != NULL) {
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_FILE_3), HiiEnvHandle);
    Print (ImageName);
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_ONE_VAR_N_NEW), HiiEnvHandle);
    FreePool (ImageName);
  } else {
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_FILE_2), HiiEnvHandle, FilePath);
  }
  //
  // Dump Image Info
  //
  if (!Image->ImageBase) {
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_INTERNAL_IMAGE), HiiEnvHandle, FilePath);
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_CODETYPE), HiiEnvHandle, MemoryTypeStr (Image->ImageCodeType));
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_DATATYPE_NEWLINE), HiiEnvHandle, MemoryTypeStr (Image->ImageDataType));
  } else {
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_PARENTHANDLE), HiiEnvHandle, Image->ParentHandle);
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_SYSTEMTABLE), HiiEnvHandle, Image->SystemTable);
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_DEVICEHANDLE), HiiEnvHandle, Image->DeviceHandle);
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_FILEPATH), HiiEnvHandle, FilePath);
    if (PdbFileName != NULL) {
      PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_PDBFILENAME), HiiEnvHandle, PdbFileName);
    }

    PrintToken (
      STRING_TOKEN (STR_SHELLENV_DPROT_IMAGEBASE),
      HiiEnvHandle,
      Image->ImageBase,
      (CHAR8 *) Image->ImageBase + Image->ImageSize
      );
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_IMAGESIZE), HiiEnvHandle, Image->ImageSize);
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_CODETYPE), HiiEnvHandle, MemoryTypeStr (Image->ImageCodeType));
    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_DATATYPE), HiiEnvHandle, MemoryTypeStr (Image->ImageDataType));
  }

  if (FilePath) {
    FreePool (FilePath);
  }
}