本文整理汇总了C++中EFI_SERVICE_BINDING_PROTOCOL::CreateChild方法的典型用法代码示例。如果您正苦于以下问题:C++ EFI_SERVICE_BINDING_PROTOCOL::CreateChild方法的具体用法?C++ EFI_SERVICE_BINDING_PROTOCOL::CreateChild怎么用?C++ EFI_SERVICE_BINDING_PROTOCOL::CreateChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EFI_SERVICE_BINDING_PROTOCOL
的用法示例。
在下文中一共展示了EFI_SERVICE_BINDING_PROTOCOL::CreateChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
@param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instance.
@param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
@return The child handle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
**/
EFI_HANDLE
EFIAPI
TlsCreateChild (
IN EFI_HANDLE ImageHandle,
OUT EFI_TLS_PROTOCOL **TlsProto,
OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration
)
{
EFI_STATUS Status;
EFI_SERVICE_BINDING_PROTOCOL *TlsSb;
EFI_HANDLE TlsChildHandle;
TlsSb = NULL;
TlsChildHandle = 0;
//
// Locate TlsServiceBinding protocol.
//
gBS->LocateProtocol (
&gEfiTlsServiceBindingProtocolGuid,
NULL,
(VOID **) &TlsSb
);
if (TlsSb == NULL) {
return NULL;
}
Status = TlsSb->CreateChild (TlsSb, &TlsChildHandle);
if (EFI_ERROR (Status)) {
return NULL;
}
Status = gBS->OpenProtocol (
TlsChildHandle,
&gEfiTlsProtocolGuid,
(VOID **) TlsProto,
ImageHandle,
TlsChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
TlsSb->DestroyChild (TlsSb, TlsChildHandle);
return NULL;
}
Status = gBS->OpenProtocol (
TlsChildHandle,
&gEfiTlsConfigurationProtocolGuid,
(VOID **) TlsConfiguration,
ImageHandle,
TlsChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
TlsSb->DestroyChild (TlsSb, TlsChildHandle);
return NULL;
}
return TlsChildHandle;
}
示例2:
BOOLEAN
EFIAPI
HSTestExistingShaImpl(BOOLEAN *ImplExists)
{
EFI_SERVICE_BINDING_PROTOCOL *BindingProto;
EFI_HASH_PROTOCOL *HashProto;
EFI_HASH_OUTPUT HashOut;
EFI_SHA1_HASH Sha1Hash;
EFI_STATUS Status;
EFI_HANDLE Child;
UINTN HashIter;
//
// Create binding.
//
Status = gBS->LocateProtocol(
&gEfiHashServiceBindingProtocolGuid,
NULL,
(VOID **)&BindingProto
);
if (EFI_ERROR(Status)) {
*ImplExists = FALSE;
return FALSE;
}
Child = NULL;
*ImplExists = TRUE;
Status = BindingProto->CreateChild(BindingProto, &Child);
if (EFI_ERROR(Status)) {
return FALSE;
}
//
// Obtain protocol.
//
HashProto = NULL;
Status = gBS->LocateProtocol(
&gEfiHashProtocolGuid,
NULL,
(VOID **)&HashProto
);
if (EFI_ERROR(Status)) {
BindingProto->DestroyChild(BindingProto, Child);
return FALSE;
}
//
// Do two iterations of test-hashing.
//
HashOut.Sha1Hash = &Sha1Hash;
for (HashIter = 0; HashIter < 2; ++HashIter) {
Status = HashProto->Hash(
HashProto,
&gEfiHashAlgorithmSha1Guid,
(BOOLEAN)HashIter,
(CONST UINT8 *)"ABCDEFGHIJKLMNOP",
16,
&HashOut
);
if (EFI_ERROR(Status)) {
BindingProto->DestroyChild(BindingProto, Child);
return FALSE;
}
}
BindingProto->DestroyChild(BindingProto, Child);
//
// Verify result.
//
if (CompareMem(
Sha1Hash,
"\x14\x80\x6E\x23\xB4\xCE\xB6\x5D\xDF\x01"
"\xE5\xEA\x7F\xBC\xDD\x03\xAA\xFA\xF5\xCD",
sizeof Sha1Hash
)) {
return FALSE;
}
return TRUE;
}