/* Serach the EMU IO Thunk database for a matching EMU IO Thunk Protocol instance. */
EMU_IO_THUNK_PROTOCOL* EFIAPI GetIoThunkInstance(IN EFI_GUID *Protocol, IN UINTN Instance)
/* Serach the EMU IO Thunk database for a matching EMU IO Thunk Protocol instance. */
EMU_IO_THUNK_PROTOCOL* EFIAPI GetIoThunkInstance(IN EFI_GUID *Protocol, IN UINTN Instance)
{
  EFI_STATUS             Status;
  EMU_IO_THUNK_PROTOCOL  *EmuIoThunk;
  for (Status = EFI_SUCCESS, EmuIoThunk = NULL; !EFI_ERROR (Status); ) {
    Status = gEmuThunk->GetNextProtocol (FALSE, &EmuIoThunk);
    if (EFI_ERROR (Status)) {
      break;
    }
    if (EmuIoThunk->Instance == Instance) {
      if (CompareGuid (EmuIoThunk->Protocol, Protocol)) {
        return EmuIoThunk;
      }
    }
  }
  return NULL;
}