> ## 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.

# XAsyncGetResultSize

> XAsyncGetResultSize

# XAsyncGetResultSize

返回要传递给 [XAsyncGetResult](/reference/system/xasyncprovider/functions/xasyncgetresult) 的缓冲区所需的大小。

## Syntax

```cpp theme={null}
HRESULT XAsyncGetResultSize(  
         XAsyncBlock* asyncBlock,  
         size_t* bufferSize  
)  
```

### Parameters

*asyncBlock*   \_Inout\_\
类型：[XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

指向传递给异步调用的 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 的指针。

*bufferSize*   \_Out\_\
类型：size\_t\*

用于保存结果所需的缓冲区大小（以字节为单位）。

### Return value

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

成功时返回 `S_OK`；否则，返回错误代码。有关错误代码列表，请参阅[错误代码](/reference/errorcodes)。

## Remarks

如果异步调用返回结果，请在调用 [XAsyncGetResult](/reference/system/xasyncprovider/functions/xasyncgetresult) 之前调用此函数，以指定用于保存结果的缓冲区所需大小。返回结果的每个异步调用都必须具有一个对应函数，可调用该函数来返回该异步调用的结果。

有关带对应结果返回函数的异步调用示例，请参阅 [XGameSaveGetRemainingQuotaAsync](/reference/system/xgamesave/functions/xgamesavegetremainingquotaasync) 和 [XGameSaveGetRemainingQuotaResult](/reference/system/xgamesave/functions/xgamesavegetremainingquotaresult)。

## Requirements

**头文件：** XAsync.h

**库：** xgameruntime.lib

**受支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## Conceptual documentation

* [异步编程模型](/build/core-features/common/async/async-programming-model)
* [调试游戏保存](/build/core-features/common/game-save/game-saves-debugging)

## See also

[XAsync Members](/reference/system/xasync/xasync_members)\
[XAsyncGetStatus](/reference/system/xasync/functions/xasyncgetstatus)\
[异步编程模型](/build/core-features/common/async/async-programming-model)


## Related topics

- [XAsync](/zh-CN/reference/system/xasync/xasync_members.md)
- [游戏存档调试](/zh-CN/build/core-features/common/game-save/game-saves-debugging.md)
- [异步编程模型](/zh-CN/build/core-features/common/async/async-programming-model.md)
- [XAsyncCancel](/zh-CN/reference/system/xasync/functions/xasynccancel.md)
- [XAsyncBlock](/zh-CN/reference/system/xasync/structs/xasyncblock.md)
