| 1 | # WslcCreateSessionVhdVolume |
| 2 | |
| 3 | ```c |
| 4 | STDAPI WslcCreateSessionVhdVolume(_In_ WslcSession session, _In_ const WslcVhdRequirements* options, _Outptr_opt_result_z_ PWSTR* errorMessage); |
| 5 | ``` |
| 6 | |
| 7 | | Parameter | Type | Direction | |
| 8 | |---|---|---| |
| 9 | | `session` | `WslcSession` | in | |
| 10 | | `options` | `const WslcVhdRequirements*` | in | |
| 11 | | `errorMessage` | `PWSTR*` | out, optional | |
| 12 | |
| 13 | Return value: `HRESULT`. |
| 14 | |
| 15 | Header notes: |
| 16 | |
| 17 | - `WSLC_VHD_TYPE_FIXED` is only honored by `WslcCreateSessionVhdVolume`. |
| 18 | - `uid` and `gid` are honored iff `flags & WSLC_VHD_REQ_FLAG_OWNER`. |
| 19 | |
| 20 | Example: |
| 21 | |
| 22 | ```c |
| 23 | WslcVhdRequirements options = { 0 }; |
| 24 | options.name = "cache"; |
| 25 | options.sizeBytes = (uint64_t)8 * 1024 * 1024 * 1024; |
| 26 | options.type = WSLC_VHD_TYPE_DYNAMIC; |
| 27 | options.flags = WSLC_VHD_REQ_FLAG_OWNER; |
| 28 | options.uid = (uint32_t)1000; |
| 29 | options.gid = (uint32_t)1000; |
| 30 | |
| 31 | HRESULT hr = WslcCreateSessionVhdVolume(session, &options, NULL); |
| 32 | ``` |