/* Routine to get the next Handle, when you are searching for a given protocol. */
IHANDLE* UnitTestGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
/* Routine to get the next Handle, when you are searching for a given protocol. */
IHANDLE* UnitTestGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
{
  IHANDLE             *Handle;
  LIST_ENTRY          *Link;
  PROTOCOL_INTERFACE  *Prot;
  Handle     = NULL;
  *Interface = NULL;
  for ( ; ;) {
    Link               = Position->Position->ForwardLink;
    Position->Position = Link;
    if (Link == &Position->ProtEntry->Protocols) {
      Handle = NULL;
      break;
    }
    Prot       = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
    Handle     = Prot->Handle;
    *Interface = Prot->Interface;
    if (Handle->LocateRequest != mEfiLocateHandleRequest) {
      Handle->LocateRequest = mEfiLocateHandleRequest;
      break;
    }
  }
  return Handle;
}