beautypg.com

Intel Extensible Firmware Interface User Manual

Page 170

background image

Extensible Firmware Interface Specification

5-72

12/01/02

Version 1.10

//
// Retrieve the list of all the protocols on each handle
//
Status = gBS->ProtocolsPerHandle (

HandleBuffer[HandleIndex],
&ProtocolGuidArray,
&ArrayCount
);

if (!EFI_ERROR (Status)) {

for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {

//
// Retrieve the protocol instance for each protocol
//
Status = gBS->OpenProtocol (

HandleBuffer[HandleIndex],
ProtocolGuidArray[ProtocolIndex],
&Instance,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);

//
// Retrieve the list of agents that have opened each protocol
//
Status = gBS->OpenProtocolInformation (

HandleBuffer[HandleIndex],
ProtocolGuidArray[ProtocolIndex],
&OpenInfo,
&OpenInfoCount
);

if (!EFI_ERROR (Status)) {

for (OpenInfoIndex=0;OpenInfoIndex

//
// HandleBuffer[HandleIndex] is the handle
// ProtocolGuidArray[ProtocolIndex] is the protocol GUID
// Instance is the protocol instance for the protocol
// OpenInfo[OpenInfoIndex] is an agent that has opened a protocol
//

}
if (OpenInfo != NULL) {

gBS->FreePool(OpenInfo);

}

}

}
if (ProtocolGuidArray != NULL) {

gBS->FreePool(ProtocolGuidArray);

}

}

}
if (HandleBuffer != NULL) {

gBS->FreePool (HandleBuffer);

}

}