> For the complete documentation index, see [llms.txt](https://www.pinvoke.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pinvoke.dev/secur32/initializesecuritycontextw.md).

# InitializeSecurityContextW

```csharp
[DllImport("SECUR32.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
public static extern unsafe HRESULT InitializeSecurityContextW(
    [Optional] SecHandle* phCredential,
    [Optional] SecHandle* phContext,
    [Optional] ushort* pszTargetName,
    ISC_REQ_FLAGS fContextReq,
    uint Reserved1,
    uint TargetDataRep,
    [Optional] SecBufferDesc* pInput,
    uint Reserved2,
    [Optional] SecHandle* phNewContext,
    [Optional] SecBufferDesc* pOutput,
    uint* pfContextAttr,
    [Optional] long* ptsExpiry);
```

[ISC\_REQ\_FLAGS](/authentication/isc_req_flags.md)

[SecBufferDesc](/authentication/secbufferdesc.md)

[SecHandle](/security/sechandle.md)
