> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XAsyncGetResult

> XAsyncGetResult

# XAsyncGetResult

Returns the results of an asynchronous call from an asynchronous provider.

## Syntax

```cpp theme={null}
HRESULT XAsyncGetResult(  
         XAsyncBlock* asyncBlock,  
         const void* identity,  
         size_t bufferSize,  
         void* buffer,  
         size_t* bufferUsed  
)  
```

### Parameters

*asyncBlock*   \_Inout\_\
Type: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

A pointer to the [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) that was passed to [XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin) for the asynchronous call.

*identity*   \_In\_opt\_\
Type: void\*

Optional. A pointer to an arbitrary token that can be used to identify the asynchronous call. If a value was specified for the *identity* parameter of the corresponding [XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin) call, the same pointer must be specified here.

*bufferSize*   \_In\_\
Type: size\_t

The size, in bytes, of the result buffer specified in *buffer*.

*buffer*   \_Out\_writes\_bytes\_to\_opt\_(bufferSize, \*bufferUsed)\
Type: void\*

A pointer to the result buffer.

*bufferUsed*   \_Out\_opt\_\
Type: size\_t\*

Optional. A pointer that contains the number of bytes written to the result buffer specified in *buffer*. This value is defined as the value of the *requiredResultSize* parameter, specified by the asynchronous provider when [XAsyncComplete](/reference/system/xasyncprovider/functions/xasynccomplete) was invoked.

### Return value

Type: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

Returns `S_OK` if successful; otherwise, returns an error code. For a list of error codes, see [Error Codes](/reference/errorcodes).

## Remarks

If the asynchronous call has a data payload, invoke this function to return the data payload. You don't need to invoke this function if the asynchronous call doesn't have a data payload. If this function is invoked for an asynchronous call that doesn't have a data payload, the function returns the error code `E_NOT_SUPPORTED`.

If a value was specified for the *identity* parameter of the [XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin) function for this asynchronous call, that same value must be provided for the *identity* parameter of this function, as well. Otherwise, a call mismatch occurs and the function returns the error code `E_INVALIDARG`.

After this function is completed and results are returned in the result buffer specified in *buffer*, the [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) specified in *asyncBlock* is completed and no longer associated with the asynchronous call.

## Requirements

**Header:** XAsyncProvider.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Set up custom provider](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider)
* [Set up return data](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-return-data)
* [Asynchronous Programming Model](/build/core-features/common/async/async-programming-model)

## See also

[XAsyncProvider Members](/reference/system/xasyncprovider/xasyncprovider_members)\
[XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin)\
[XAsyncComplete](/reference/system/xasyncprovider/functions/xasynccomplete)\
[Asynchronous Programming Model](/build/core-features/common/async/async-programming-model)


## Related topics

- [XAsyncGetResultSize](/reference/system/xasync/functions/xasyncgetresultsize.md)
- [XAsyncGetStatus](/reference/system/xasync/functions/xasyncgetstatus.md)
- [XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin.md)
- [XAsync](/reference/system/xasync/xasync_members.md)
- [XAsyncProvider](/reference/system/xasyncprovider/xasyncprovider_members.md)
