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

# WdCopyErrorCallback

> WdCopyErrorCallback

# WdCopyErrorCallback

在复制操作期间被调用以报告错误和警告消息。

## 语法

```cpp theme={null}
typedef HRESULT (*WdCopyErrorCallback)( 
    _In_ WdCopyErrorSeverity severity,
    _In_z_ const char* message,
    _In_ HRESULT error,
    _In_opt_ void* context
);
```

### 参数

`severity _In_`\
类型：**[WdCopyErrorSeverity](/reference/remoting/enums/wdcopyerrorseverity)**

消息的严重性（Warning 或 Error）。

`message _In_z_`\
类型：**const char\***

包含诊断消息的以 null 结尾的字符串。

`error _In_`\
类型：**HRESULT**

与该消息关联的 HRESULT 错误代码。对于警告消息，值为 `S_OK`。

`context _In_opt_`\
类型：**void\***

在 [WdCopyStatusCallbacks](/reference/remoting/structs/wdcopystatuscallbacks) 结构体中指定的用户自定义上下文指针。

### 返回值

类型：**HRESULT**

返回 `S_OK` 以继续复制操作。返回失败的 HRESULT 以中止复制。

## 备注

此回调由 [WdRemoteCopy](/reference/remoting/functions/wdremotecopy) 调用，用于在复制操作期间报告诊断消息，例如错误或警告。`error` 参数提供与错误消息相关联的 HRESULT；对于警告消息，`error` 为 `S_OK`。

该回调在与 `WdRemoteCopy` 调用相同的线程上被调用。`message` 字符串仅在回调调用期间有效。

## 要求

| 要求          | 值                   |
| ----------- | ------------------- |
| **头文件**     | WdRemoteIteration.h |
| **库**       | wdremoteapi.lib     |
| **支持的操作系统** | Windows 11 及更高版本    |
| **支持的体系结构** | x64、ARM64           |

## 另请参阅

* [WdRemoteCopy](/reference/remoting/functions/wdremotecopy)
* [WdCopyErrorSeverity](/reference/remoting/enums/wdcopyerrorseverity)
* [WdCopyStatusCallbacks](/reference/remoting/structs/wdcopystatuscallbacks)
* [XBOX PC 远程迭代 API](/reference/remoting/remoteiteration_members)


## Related topics

- [WdCopyErrorSeverity](/zh-CN/reference/remoting/enums/wdcopyerrorseverity.md)
- [WdCopyStatusCallbacks](/zh-CN/reference/remoting/structs/wdcopystatuscallbacks.md)
- [XBOX PC Remote Iteration API](/zh-CN/reference/remoting/remoteiteration_members.md)
- [WdCopyFilesStatusCallback](/zh-CN/reference/remoting/callbacks/wdcopyfilesstatuscallback.md)
- [WdRemoteCopy](/zh-CN/reference/remoting/functions/wdremotecopy.md)
