---
title: SecHostSelectedGuest
framework: security
role: symbol
role_heading: Function
path: security/sechostselectedguest
---

# SecHostSelectedGuest

Retrieves the handle for the guest currently selected for the calling thread.

## Declaration

```occ
OSStatus SecHostSelectedGuest(SecCSFlags flags, SecGuestRef *guestRef);
```

## Parameters

- `flags`: Optional flags; see doc://com.apple.security/documentation/Security/SecCSFlags for possible values. Pass doc://com.apple.security/documentation/Security/SecCSFlags/kSecCSDefaultFlags for standard behavior.
- `guestRef`: On return, the guest code object of the current selected guest for the calling thread. If no guest is active on this thread (that is, the thread is acting for the host), the value returned is doc://com.apple.security/documentation/Security/kSecNoGuest.

## Return Value

Return Value A result code. See Code Signing Services Result Codes.

## Discussion

Discussion This function may be called in either dynamic hosting mode or proxy hosting mode. If the host has more than one guest, it can set a different selected guest for each thread.
