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

# IDStorageFactoryX::OpenFile

> IDStorageFactoryX::OpenFile

# IDStorageFactoryX::OpenFile

DirectStorage アクセス用にファイルを開きます。

## 構文

```cpp theme={null}
HRESULT OpenFile(  
         const WCHAR *path,  
         REFIID riid,  
         void **ppv  
)  
```

### パラメーター

*path*   \_In\_z\_\
Type: WCHAR \*

開くファイルのパス。

*riid*\
Type: REFIID

`__uuidof(IDStorageFileX)` などの DirectStorage ファイル インターフェイスを指定します。

*ppv*   \_COM\_Outptr\_\
Type: void \*\*

開かれたファイルを表すオブジェクトを受け取ります。

### 戻り値

Type: HRESULT

標準の HRESULT エラー コード。

## 解説

指定されたファイルは、DirectStorage でサポートされている NVM Express (NVMe) デバイスに格納されている必要があります。

一致する `IDStorageFileX` オブジェクトへの最後の参照が解放されたとき、ファイルは暗黙的に閉じられます。ファイルを明示的に閉じるには、[IDStorageFileX::Close](/reference/system/dstorage/interfaces/IDStorageFileX/methods/idstoragefilex_close) を呼び出します。

詳細については、[DirectStorage の概要](/build/console-features/storage/directstorage/directstorage-overview) の「IDStorageFileX」セクションを参照してください。

## 要件

**ヘッダー:** dstorage\_xs.h

**ライブラリ:** dstorage\_xs.lib

**サポートされているプラットフォーム:** XBOX Series 本体

## 関連項目

[IDStorageFactoryX](/reference/system/dstorage/interfaces/IDStorageFactoryX/idstoragefactoryx)\
[DStorage](/reference/system/dstorage/dstorage_members)


## Related topics

- [IDStorageFileX](/ja-jp/reference/system/dstorage/interfaces/IDStorageFileX/idstoragefilex.md)
- [IDStorageFileX::Close](/ja-jp/reference/system/dstorage/interfaces/IDStorageFileX/methods/idstoragefilex_close.md)
- [IDStorageFileX::GetHandle](/ja-jp/reference/system/dstorage/interfaces/IDStorageFileX/methods/idstoragefilex_gethandle.md)
- [DirectStorage の概要](/ja-jp/build/console-features/storage/directstorage/directstorage-overview.md)
- [IDStorageFactoryX](/ja-jp/reference/system/dstorage/interfaces/IDStorageFactoryX/idstoragefactoryx.md)
