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

# IXtfFileIOClient::SetFileAttributes Method

> IXtfFileIOClient::SetFileAttributes Method

# IXtfFileIOClient::SetFileAttributes Method

设置开发主机上文件的属性。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
public:
HRESULT SetFileAttributes(
         LPCWSTR pszSearchPattern,
         DWORD dwIncludeAttributes,
         DWORD dwExcludeAttributes,
         DWORD dwRecursionLevels,
         DWORD dwAddAttributes,
         DWORD dwRemoveAttributes,
         IXtfFindFileCallback *pCallback
)  
```

<a id="parametersSection" />

### 参数

*pszSearchPattern*\
类型：LPCWSTR

指向搜索模式的指针，该模式定义要设置属性的文件的文件名。此参数接受通配符，以匹配符合指定模式的字符串。

*dwIncludeAttributes*\
类型：DWORD

要包含在操作中的文件属性的按位或组合。有关可能属性的列表，请参阅 [File Attribute Constants](https://msdn.microsoft.com/library/windows/desktop/gg258117\(v=vs.85\).aspx)。

*dwExcludeAttributes*\
类型：DWORD

要从操作中排除的文件属性的按位或组合。有关可能属性的列表，请参阅 [File Attribute Constants](https://msdn.microsoft.com/library/windows/desktop/gg258117\(v=vs.85\).aspx)。

*dwRecursionLevels*\
类型：DWORD

要为操作递归的目录级别数。

*dwAddAttributes*\
类型：DWORD

要添加到文件的文件属性的按位或组合。

*dwRemoveAttributes*\
类型：DWORD

要从文件中移除的文件属性的按位或组合。

*pCallback*\
类型：IXtfFindFileCallback\*

指向 [IXtfFindFileCallback](/reference/tools/xtf/xtffileio/classes/IXtfFindFileCallback/ixtffindfilecallback-xtffileio-xbox-microsoft-t) 回调的指针，用于在找到要设置属性的文件时调用。

<a id="retvalSection" />

### 返回值

类型：HRESULT

如果成功，则返回 `S_OK`；否则返回 HRESULT 错误代码。

<a id="remarksSection" />

## 备注

此函数设置开发主机上指定文件的文件属性。如果发生错误，此函数将返回 HRESULT 错误代码。有关特定于 XBOX 工具框架 (XTF) API 的 HRESULT 错误代码的详细信息，请参阅 [XTF 传输错误 (NDA 主题)](/tools/tools-console/commandlinetools/xtf-transport-errors)。

使用 [IXtfFileIOClient::GetFileAttributes](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/setfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m) 方法获取开发主机上指定文件的文件属性。

<a id="requirementsSection" />

## 要求

**头文件：** xtffileio.h

**库：** xtffileio.lib

**支持的平台：** Windows（用于 XBOX 主机工具）

<a id="seealsoSection" />

## 另请参阅

[IXtfFileIOClient Interface](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/ixtffileioclient-xtffileio-xbox-microsoft-t)\
[XtfFileIO](/reference/tools/xtf/xtffileio/xtffileio-xbox-microsoft-n)


## Related topics

- [IXtfFileIOClient::GetFileAttributes Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/getfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::GetFileInfo Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/getfileinfo-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::FindFiles Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/findfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::DeleteFiles Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/deletefiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::CopyFiles Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
