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

# WdEnumRemoteDirectory

> WdEnumRemoteDirectory

リモートの Windows デバイス上で一致するファイルとディレクトリを列挙します。

**導入バージョン:** [RIT 0.0.14-preview](https://docs.xbox.com/ja-jp/reference/remoting/release-versions.md#release-versions)。

## 構文

```cpp theme={null}
HRESULT WD_REMOTE_ITERATION_CALL WdEnumRemoteDirectory(
    _In_z_ const char* remoteDevice,
    _In_opt_z_ const char* remoteFolderPath,
    _In_opt_ const WdRemoteDirectoryOptions* directoryOptions,
    _In_opt_ const WdRemoteDirectorySearchOptions* searchOptions,
    _In_ WdRemoteDirectoryCallback callback,
    _In_opt_ void* context,
    _In_opt_ WdCancellationHandle cancellationHandle
);
```

### パラメーター

`remoteDevice`\
Type: **const char\***

接続先のデバイス名または IP アドレス (UTF-8)。この関数を呼び出す前に、保存済みの既定のデバイスを解決してください。

`remoteFolderPath`\
Type: **const char\***

省略可能。リモート デバイス上のディレクトリ パス (UTF-8)。null、空の文字列、または `.` を指定すると、共通ルートが選択されます。

`directoryOptions`\
Type: **const WdRemoteDirectoryOptions\***

省略可能。共通ルート、再帰、メタデータの設定。既定値を使用するには `nullptr` を渡します。

`searchOptions`\
Type: **const WdRemoteDirectorySearchOptions\***

省略可能。ファイルとディレクトリの名前/属性のフィルター。フィルター処理を行わない場合は `nullptr` を渡します。

`callback`\
Type: **WdRemoteDirectoryCallback**

必須の結果コールバックまたは列挙コールバック。継続と有効期間の規則については、「解説」を参照してください。

`context`\
Type: **void\***

省略可能。コールバックにそのまま渡される、呼び出し元が所有するコンテキスト。

`cancellationHandle`\
Type: **WdCancellationHandle**

`WdCreateCancellationHandle` で作成されたキャンセル ハンドル。省略可能な場合、キャンセルが不要であれば `nullptr` を渡します。

### 戻り値

Type: **HRESULT**

成功した場合は `S_OK` を返します。それ以外の場合は、エラーを示す HRESULT を返します。「[XBOX PC Remote Iteration API エラー コード](https://docs.xbox.com/ja-jp/reference/remoting/error-codes.md)」を参照してください。

## 解説

エントリは走査順のバッチで配信され、パスは `remoteFolderPath` を基準とする相対パス (UTF-8) です。ルート自体は報告されませんが、空のディレクトリは報告されます。エントリのデータが後で必要な場合は、コールバックが戻る前にコピーしてください。コールバックがエラーを返すと処理は停止し、エラーとして返されます。

この呼び出しは同期的です。リモート パスに null、空の文字列、または `.` を指定すると、既定の共通ルートまたは名前付きの共通ルートが選択されます。絶対パスではルート エイリアスは無視されます。`${remoteEnv:NAME}` 参照には、エンドポイント プロセスの環境が使用されます。オプションが null の場合、再帰は無効になり、メタデータは要求されません。

キャンセルを要求するには、別のスレッドから `WdCancelRemoteDirectoryEnumeration` を使用します。列挙が戻るまでハンドルを開いたままにしてください。処理の開始前にキャンセルした場合は `S_OK` が返されます。処理の開始後は、キャンセルが成功するとエンドポイントの確認を待機します。既に受信したエントリは、部分的な一覧になります。必要なディレクトリ プロトコルを備えていないエンドポイントは、`WD_E_SERVERTOOOLD` を返します。

## 要件

| 要件 | 値 |
| - | - |
| **ヘッダー** | WdRemoteIteration.h |
| **ライブラリ** | wdremoteapi.lib |
| **NuGet パッケージ** | [Microsoft.GDK.RemoteIterationClientApi](https://aka.ms/GameDevRemoteAPI) |

## 関連項目

* [XBOX PC Remote Iteration API](https://docs.xbox.com/ja-jp/reference/remoting/remoteiteration_members.md)


## Related topics

- [WdCancelRemoteDirectoryEnumeration](https://docs.xbox.com/ja-jp/reference/remoting/functions/wdcancelremotedirectoryenumeration.md)
- [XBOX PC Remote Iteration API](https://docs.xbox.com/ja-jp/reference/remoting/remoteiteration_members.md)
- [XBOX PC Remote Tools: 2026 年 11 月 (2611) リリース ノート](https://docs.xbox.com/ja-jp/tools/tools-pc/xbox-pc-remote-tools/release-notes/2611.md)
- [WdCancellationHandle](https://docs.xbox.com/ja-jp/reference/remoting/structs/wdcancellationhandle.md)
- [WdRemoteDirectoryEntryType](https://docs.xbox.com/ja-jp/reference/remoting/enums/wdremotedirectoryentrytype.md)
