| 1 | # WslcInitSessionSettings |
| 2 | |
| 3 | ```c |
| 4 | STDAPI WslcInitSessionSettings(_In_ PCWSTR name, _In_ PCWSTR storagePath, _Out_ WslcSessionSettings* sessionSettings); |
| 5 | ``` |
| 6 | |
| 7 | | Parameter | Type | Direction | Comment | |
| 8 | |---|---|---|---| |
| 9 | | `name` | `PCWSTR` | in | The name of the session to be created. | |
| 10 | | `storagePath` | `PCWSTR` | in | Path to where the session storage should be written. If the path doesn't exist, it will be created. | |
| 11 | | `sessionSettings` | `WslcSessionSettings*` | out | Pointer to the `WslcSessionSettings` to write the settings to. | |
| 12 | |
| 13 | Return value: `HRESULT`. |
| 14 | |
| 15 | Session names serve both as display names and as machine-wide keys used to identify sessions. If a session with the same name already exists, session creation will fail with `ERROR_ALREADY_EXISTS`. |
| 16 | |
| 17 | Also note that the following information about a session is visible to all users on the machine: |
| 18 | |
| 19 | - The session's name |
| 20 | - The SID of the user that created the session |
| 21 | - The PID of the process that created the session |
| 22 | |
| 23 | |
| 24 | Do not put credentials or other sensitive information in the session's name. |
| 25 | |
| 26 | Example: |
| 27 | |
| 28 | ```c |
| 29 | WslcSessionSettings sessionSettings; |
| 30 | HRESULT hr = WslcInitSessionSettings( |
| 31 | L"demo-session", |
| 32 | L"C:\\WSLC\\demo-session", |
| 33 | &sessionSettings); |
| 34 | ``` |