• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ InitializeLib函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中InitializeLib函数的典型用法代码示例。如果您正苦于以下问题:C++ InitializeLib函数的具体用法?C++ InitializeLib怎么用?C++ InitializeLib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了InitializeLib函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: efi_main

EFI_STATUS EFIAPI efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) {

	InitializeLib(image_handle, systab);
	EFI_STATUS Status;
	systab->ConOut->ClearScreen(systab->ConOut); // CLEAR!

    EFI_GUID simplefs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL; // a simple file system protocol in efi
	                      // (different from UEFI specification. In specification, this is called EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID )

	EFI_FILE_IO_INTERFACE *simplefs;                      // the simple file system's interface
	                      // (different from UEFI specification. In specification, this is called EFI_SIMPLE_FILE_SYSTEM_PROTOCOL)
	EFI_FILE *root;               //  root directory
	EFI_FILE *dir;
	CHAR16 *dirname=L"\\stories"; // name of the directory where bmp pictures are put

	status=systab->BootServices->LocateProtocol(&simplefs_guid, NULL, (VOID **)&simplefs);
	if(EFI_ERROR(status)) Print(L"locate protocol failed \n");

	status=simplefs->OpenVolume(simplefs, &root);
	if(EFI_ERROR(status)) Print(L"open volume failed\n");

	status=root->Open(root, &dir, dirname, EFI_FILE_MODE_READ, EFI_FILE_READ_ONLY);
	if(EFI_ERROR(status)) Print(L"open directory failed\n");

	VOID *buf;
	INT32 index=1;
	status = readFile(dir, index, systab, buf); // Put the contents of 1.story into buf
	Print(L"%s", buf);

    WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
	uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &Key);

    return Status;
}
开发者ID:NateBrune,项目名称:dEFIant,代码行数:34,代码来源:main.c


示例2: init

static void init(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE* system_table)
{
    InitializeLib(image_handle, system_table);

    IH = image_handle;

    EFI_STATUS status = EFI_SUCCESS;

    if ((NULL == ST->ConIn) || (EFI_SUCCESS != (status = ST->ConIn->Reset(ST->ConIn, 0)))){

        error_print(L"Input device unavailable.\n", ST->ConIn ? &status : NULL);
    }

    status = BS->OpenProtocol(
        image_handle, &LoadedImageProtocol, &loaded_image,
        image_handle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL
    );

    if (EFI_ERROR(status)){

        error_print(L"OpenProtocol() LoadedImageProtocol failed.\n", &status);
    }

    set_uefi_handle_if(image_handle, loaded_image);
}
开发者ID:tenpoku1000,项目名称:UEFI_Ver_CPUID,代码行数:25,代码来源:efi_main.c


示例3: fsw_efi_main

/**
 * Image entry point. Installs the Driver Binding and Component Name protocols
 * on the image's handle. Actually mounting a file system is initiated through
 * the Driver Binding protocol at the firmware's request.
 */
EFI_STATUS EFIAPI fsw_efi_main(IN EFI_HANDLE         ImageHandle,
                               IN EFI_SYSTEM_TABLE   *SystemTable)
{
    EFI_STATUS  Status;

#ifndef VBOX
    InitializeLib(ImageHandle, SystemTable);
#endif

    // complete Driver Binding protocol instance
    fsw_efi_DriverBinding_table.ImageHandle          = ImageHandle;
    fsw_efi_DriverBinding_table.DriverBindingHandle  = ImageHandle;
    // install Driver Binding protocol
    Status = BS->InstallProtocolInterface(&fsw_efi_DriverBinding_table.DriverBindingHandle,
                                          &PROTO_NAME(DriverBindingProtocol),
                                          EFI_NATIVE_INTERFACE,
                                          &fsw_efi_DriverBinding_table);
    if (EFI_ERROR (Status)) {
        return Status;
    }

    // install Component Name protocol
    Status = BS->InstallProtocolInterface(&fsw_efi_DriverBinding_table.DriverBindingHandle,
                                          &PROTO_NAME(ComponentNameProtocol),
                                          EFI_NATIVE_INTERFACE,
                                          &fsw_efi_ComponentName_table);
    if (EFI_ERROR (Status)) {
        return Status;
    }

    return EFI_SUCCESS;
}
开发者ID:bayasist,项目名称:vbox,代码行数:37,代码来源:fsw_efi.c


示例4: efi_main

; ןונגוירא� ןנמדנאללא הכ� UEFI
EFI_STATUS efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
	InitializeLib(image, systab);
	UINTN mms=65536;
	int i;
	int s;
	EFI_MEMORY_DESCRIPTOR *mm;
uefi_call_wrapper(systab->BootServices->AllocatePool,
				3,
				EfiLoaderData,
				sizeof(EFI_MEMORY_DESCRIPTOR)*65536,
				((void*)&mm));
	UINTN mk,ds,dv;
	
	uefi_call_wrapper(systab->BootServices->GetMemoryMap,
				5,
				&mms,
				mm,
				&mk,
				&ds,
				&dv);
	s=0;
	for (i=0;i<mms;i++)
		if((mm[i].Type == EfiBootServicesCode)
		||(mm[i].Type == EfiBootServicesData)
		||(mm[i].Type == EfiConventionalMemory)
		||(mm[i].Type == EfiACPIReclaimMemory)
		)s+=mm[i].NumberOfPages;
		
	Print(L"%d\r\n",s);
	
	return EFI_SUCCESS;
}
开发者ID:gangstatracer,项目名称:efi_memory,代码行数:34,代码来源:getmemmap.c


示例5: InitializeBBTestUgaDraw

/**
 *  UGA Draw Protocol Test Driver Entry point.
 *  @param ImageHandle the driver image handle.
 *  @param SystemTable the system table.
 *  @return EFI_SUCCESS the driver is loaded successfully.
 */
EFI_STATUS
InitializeBBTestUgaDraw (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_SYSTEM_TABLE     *SystemTable
  )
{
  EfiInitializeTestLib (ImageHandle, SystemTable);
  InitializeLib (ImageHandle, SystemTable);
  EfiInitializeDriverLib (ImageHandle, SystemTable);

  //
  // Initialize Demo Data
  //
  DemoResolutionMax  = sizeof (DemoResolution) / sizeof (DEMO_RESOLUTION_TYPE);
  DemoRefreshRateMax = sizeof (DemoRefreshRate) / sizeof (DEMO_REFRESH_RATE_TYPE);
  DemoColorDepthMax  = sizeof (DemoColorDepth) / sizeof (DEMO_COLOR_DEPTH_TYPE);

  gtBS->CreateEvent (EFI_EVENT_TIMER, 0, NULL, NULL, &TimerEvent);

  return EfiInitAndInstallBBTestInterface (
           &ImageHandle,
           &gBBTestProtocolField,
           gBBTestEntryField,
           BBTestUgaDrawProtocolUnload,
           &gBBTestProtocolInterface
           );
}
开发者ID:jljusten,项目名称:efi-sct,代码行数:33,代码来源:UgaDrawBBTestMain.c


示例6: InitializeGraphicsOutputBBTest

EFI_STATUS
InitializeGraphicsOutputBBTest (
    IN EFI_HANDLE             ImageHandle,
    IN EFI_SYSTEM_TABLE       *SystemTable
)
/*++

Routine Description:

   GraphicsOutput Protocol Test Driver Entry point.

Arguments:

  ImageHandle - The driver image handle
  SystemTable - The system table

Returns:

  EFI_SUCCESS - The driver is loaded successfully.

--*/
{
    EfiInitializeTestLib (ImageHandle, SystemTable);
    InitializeLib (ImageHandle, SystemTable);
    EfiInitializeDriverLib (ImageHandle, SystemTable);

    return EfiInitAndInstallIHVBBTestInterface (
               &ImageHandle,
               &gBBTestProtocolField,
               gBBTestEntryField,
               UnloadEfiGraphicsOutputBBTest,
               &gBBTestProtocolInterface
           );

}
开发者ID:sjtupt,项目名称:2ndProject,代码行数:35,代码来源:GraphicsOutputBBTestMain.c


示例7: efi_main

EFI_STATUS
efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
	EFI_STATUS rc;

	InitializeLib(image, systab);

	rc = uefi_call_wrapper(BS->HandleProtocol, 3, image, &LoadedImageProtocol, (void *)&this_image);
	if (EFI_ERROR(rc)) {
		Print(L"Error: could not find loaded image: %d\n", rc);
		return rc;
	}

	Print(L"System BootOrder not found.  Initializing defaults.\n");

	set_boot_order();

	rc = find_boot_options(this_image->DeviceHandle);
	if (EFI_ERROR(rc)) {
		Print(L"Error: could not find boot options: %d\n", rc);
		return rc;
	}

	try_start_first_option(image);

	Print(L"Reset System\n");
	uefi_call_wrapper(RT->ResetSystem, 4, EfiResetCold,
			  EFI_SUCCESS, 0, NULL);

	return EFI_SUCCESS;
}
开发者ID:PerditionC,项目名称:shim,代码行数:31,代码来源:fallback.c


示例8: InitializeBBTestDeviceIo

EFI_STATUS
InitializeBBTestDeviceIo (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_SYSTEM_TABLE     *SystemTable
  )
/*++

Routine Description:
  Creates/installs the BlackBox Interface and eminating Entry Point node list.

Arguments:
  ImageHandle:  NULL
  *SystemTable: Pointer to System Table

Returns:
  EFI_SUCCESS:              Indicates the interface was installed.
  EFI_OUT_OF_RESOURCES:     Indicates space for the new handle could not be allocated
  EFI_INVALID_PARAMETER:    One of the parameters has an invalid value.

--*/
{
  EfiInitializeTestLib (ImageHandle, SystemTable);
  InitializeLib (ImageHandle, SystemTable);
  GetSystemDevicePathAndFilePath (ImageHandle);

  return  EfiInitAndInstallIHVBBTestInterface (
            &ImageHandle,
            &gBBTestProtocolField,
            gBBTestEntryField,
            BBTestDeviceIoUnload,
            &gBBTestProtocolInterface
            );

}
开发者ID:JackNine,项目名称:2ndProject,代码行数:34,代码来源:DeviceIoBBTestMain.c


示例9: efi_main

EFI_STATUS
efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
	EFI_STATUS status;
	UINT64 MaximumVariableStorageSize,
		RemainingVariableStorageSize,
		MaximumVariableSize;

	InitializeLib(image_handle, systab);

	status = systab->RuntimeServices->QueryVariableInfo(
				EFI_VARIABLE_NON_VOLATILE |
				EFI_VARIABLE_BOOTSERVICE_ACCESS |
				EFI_VARIABLE_RUNTIME_ACCESS,
				&MaximumVariableStorageSize,
				&RemainingVariableStorageSize,
				&MaximumVariableSize);
	Print(L"Maximum Variable Storage Size: %lld\r\n",
		MaximumVariableStorageSize);
	Print(L"Remaining Variable Storage Size: %lld\r\n",
		RemainingVariableStorageSize);
	Print(L"Maximum Variable Size: %lld\r\n",
		MaximumVariableSize);

	return status;
}
开发者ID:vathpela,项目名称:efistress,代码行数:26,代码来源:qvi.c


示例10: efi_main

EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
	InitializeLib(image, systab);
	DebugHook();
	return EFI_SUCCESS;
}
开发者ID:GarethNelson,项目名称:Zoidberg,代码行数:7,代码来源:debughook.c


示例11: efi_main

EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
	EFI_STATUS status;
	CHAR16 name[256], *val, fmt[20];
	EFI_GUID vendor;
	UINTN size;

	InitializeLib(image, systab);

	name[0] = 0;
	vendor = NullGuid;

	Print(L"GUID                                Variable Name        Value\n");
	Print(L"=================================== ==================== ========\n");

	StrCpy(fmt, L"%.-35g %.-20s %s\n");
	while (1) {
		size = sizeof(name);
		status = uefi_call_wrapper(RT->GetNextVariableName, 3, &size, name, &vendor);
		if (status != EFI_SUCCESS)
			break;

		val = LibGetVariable(name, &vendor);
		Print(fmt, &vendor, name, val);
		FreePool(val);
	}
	return EFI_SUCCESS;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:29,代码来源:printenv.c


示例12: InitializeBBTestProtocolHandlerBootServices

/**
 *  Creates/installs the BlackBox Interface and eminating Entry Point
 *  node list.
 *  @param  ImageHandle The test driver image handle
 *  @param  SystemTable Pointer to System Table
 *  @return EFI_SUCCESS Indicates the interface was installed
 *  @return EFI_OUT_OF_RESOURCES Indicates space for the new handle could not be allocated
 *  @return EFI_INVALID_PARAMETER: One of the parameters has an invalid value.
 */
EFI_STATUS
InitializeBBTestProtocolHandlerBootServices (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_SYSTEM_TABLE     *SystemTable
  )
{
  EFI_STATUS              Status;

  EfiInitializeTestLib (ImageHandle, SystemTable);

  //
  // initialize test utility lib
  //
  InitializeLib (ImageHandle, SystemTable);

  mImageHandle = ImageHandle;

  Status = InitializeGlobalData ();
  if (EFI_ERROR (Status)) {
    return Status;
  }

  return EfiInitAndInstallBBTestInterface (
           &ImageHandle,
           &gBBTestProtocolField,
           gBBTestEntryField,
           BBTestProtocolHandlerBootServicesUnload,
           &gBBTestProtocolInterface
           );
}
开发者ID:JackNine,项目名称:2ndProject,代码行数:39,代码来源:ProtocolHandlerBBTestMain.c


示例13: efi_main

EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
    EFI_STATUS rc = EFI_SUCCESS;
    UINT32 Attr;
    UINT64 MaxStoreSize = 0;
    UINT64 RemainStoreSize = 0;
    UINT64 MaxSize = 0;

    InitializeLib(image, systab);

    Attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_HARDWARE_ERROR_RECORD;

    rc = uefi_call_wrapper(RT->QueryVariableInfo, 4, 
                           Attr, &MaxStoreSize, &RemainStoreSize, &MaxSize);

    if (rc != EFI_SUCCESS) {
        Print(L"ERROR: Failed to get store sizes: %d\n", rc);
    } else {
        Print(L"Max Storage Size: %ld\n", MaxStoreSize);
        Print(L"Remaining Storage Size: %ld\n", RemainStoreSize);
        Print(L"Max Variable Size: %ld\n", MaxSize);
    }

    return rc;
}
开发者ID:RafaelRMachado,项目名称:UEFI-Utilities,代码行数:26,代码来源:qv.c


示例14: efi_main

EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
	EFI_LOADED_IMAGE *loaded_image = NULL;
#if 0
	EFI_DEVICE_PATH *dev_path;
#endif
	EFI_STATUS status;

	InitializeLib(image, systab);
	status = uefi_call_wrapper(systab->BootServices->HandleProtocol,
				3,
				image, 
				&LoadedImageProtocol, 
				(void **) &loaded_image);
	if (EFI_ERROR(status)) {
		Print(L"handleprotocol: %r\n", status);
	}

#if 0
	BS->HandleProtocol(loaded_image->DeviceHandle, &DevicePathProtocol, (void **) &dev_path);

	Print(L"Image device      : %s\n", DevicePathToStr(dev_path));
	Print(L"Image file        : %s\n", DevicePathToStr(loaded_image->FilePath));
#endif
	Print(L"Image base        : %lx\n", loaded_image->ImageBase);
	Print(L"Image size        : %lx\n", loaded_image->ImageSize);
	Print(L"Load options size : %lx\n", loaded_image->LoadOptionsSize);
	Print(L"Load options      : %s\n", loaded_image->LoadOptions);

	return EFI_SUCCESS;
}
开发者ID:Celelibi,项目名称:gnu-efi,代码行数:32,代码来源:t6.c


示例15: InitializeBBTestPxeBCProtocol

/**
 *  Creates/installs the BlackBox Interface and eminating Entry Point node list.
 *  @param  ImageHandle The test driver image handle
 *  @param  SystemTable Pointer to System Table
 *  @return EFI_SUCCESS Indicates the interface was installed
 *  @return EFI_OUT_OF_RESOURCES Indicates space for the new handle could not be allocated
 *  @return EFI_INVALID_PARAMETER: One of the parameters has an invalid value.
 */
EFI_STATUS
InitializeBBTestPxeBCProtocol (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_SYSTEM_TABLE     *SystemTable
  )
{
  EFI_STATUS Status;

  EfiInitializeTestLib (ImageHandle, SystemTable);
  InitializeLib (ImageHandle, SystemTable);
  EfiInitializeDriverLib (ImageHandle, SystemTable);

  Status = gtBS->CreateEvent (EFI_EVENT_TIMER, 0, NULL, NULL, &TimerEvent);
  if (EFI_ERROR(Status)) {
    return Status;
  }

  Status = GetSystemDevicePathAndFilePath (ImageHandle);
  if (EFI_ERROR(Status)) {
    return Status;
  }

  return EfiInitAndInstallBBTestInterface (
           &ImageHandle,
           &gEfiPxeBcTestProtField,
           gPxeTestEntryField,
           BBTestPxeBcUnload,
           &gBBTestProtocolInterface
           );
}
开发者ID:jljusten,项目名称:efi-sct,代码行数:38,代码来源:PxeBaseCodeBBTestMain.c


示例16: efi_main

EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
	EFI_STATUS status;
	int argc, i;
	CHAR16 **ARGV;
	CHAR16 descr[64];

	InitializeLib(image, systab);

	status = argsplit(image, &argc, &ARGV);
	if (status != EFI_SUCCESS) {
		StatusToString (descr, status);
		Print (L"error %s\n", descr);
	}

	Print (L"argc %d\n", argc);

	for (i = 0; i < argc; i++)
		Print (L"argv[%d]: %s\n", i, ARGV[i]);

	Print (L"\nPress any key to continue\n");
	efi_pause();

	return EFI_SUCCESS;
}
开发者ID:lcp,项目名称:uefi-fun,代码行数:26,代码来源:ReadArgs.c


示例17: InitializeTapeTest

/*********************************************************************************
 *  Creates/installs the BlackBox Interface and eminating Entry Point node list.
 *  @param  ImageHandle The test driver image handle
 *  @param  SystemTable Pointer to System Table
 *  @return EFI_SUCCESS Indicates the interface was installed
 *  @return EFI_OUT_OF_RESOURCES Indicates space for the new handle could not be allocated
 *  @return EFI_INVALID_PARAMETER: One of the parameters has an invalid value.
 ********************************************************************************/
EFI_STATUS
InitializeTapeTest (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_SYSTEM_TABLE     *SystemTable
  )
{
  EFI_STATUS Status;
  
  
  EfiInitializeTestLib (ImageHandle, SystemTable);
  InitializeLib (ImageHandle, SystemTable);
  EfiInitializeDriverLib (ImageHandle, SystemTable);
  
  //
  // Make sure the Protocol is not already installed in the system
  //
  //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTapeIoProtocolGuid);  
  
  Status = gtBS->CreateEvent (EFI_EVENT_TIMER, 0, NULL, NULL, &TimerEvent);
  if (EFI_ERROR(Status)) {
    return Status;
  }

  Status = EfiInitAndInstallBBTestInterface (
           &ImageHandle,
           &gEfiTapeTestProtField,
           gTapeTestEntryField,
           UnloadTapeTest,
           &gTapeTestProtocol
           );  
  return Status;  
         
}
开发者ID:JackNine,项目名称:2ndProject,代码行数:41,代码来源:TapeBBTestMain.c


示例18: efi_main

EFI_STATUS
EFIAPI
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
    InitializeLib(ImageHandle, SystemTable);
    Print(L"Hello, world!\n");
    return EFI_SUCCESS;
}
开发者ID:dandart,项目名称:projects,代码行数:8,代码来源:efimain.c


示例19: efi_main

EFI_STATUS
efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
    InitializeLib(image, systab);

    print_memory_map();

    return EFI_SUCCESS;
}
开发者ID:RafaelRMachado,项目名称:UEFI-Utilities,代码行数:9,代码来源:efimemory.c


示例20: efi_main

EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
	InitializeLib(image, systab);
	Print(L"HelloLib application started\n");
	Print(L"\n\n\nHit any key to exit this image\n");
	WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
	uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n");
	return EFI_SUCCESS;
}
开发者ID:Celelibi,项目名称:gnu-efi,代码行数:10,代码来源:t5.c



注:本文中的InitializeLib函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ InitializeListHead函数代码示例发布时间:2022-05-30
下一篇:
C++ InitializeCriticalSectionAndSpinCount函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap