> 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/advapi32/createprocesswithlogonw.md).

# CreateProcessWithLogonW

```csharp
[DllImport("ADVAPI32.dll", ExactSpelling = true, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
public static extern unsafe BOOL CreateProcessWithLogonW(
    PCWSTR lpUsername,
    PCWSTR lpDomain,
    PCWSTR lpPassword,
    CREATE_PROCESS_LOGON_FLAGS dwLogonFlags,
    PCWSTR lpApplicationName,
    PWSTR lpCommandLine,
    PROCESS_CREATION_FLAGS dwCreationFlags,
    [Optional] void* lpEnvironment,
    PCWSTR lpCurrentDirectory,
    STARTUPINFOW* lpStartupInfo,
    PROCESS_INFORMATION* lpProcessInformation);
```

[CREATE\_PROCESS\_LOGON\_FLAGS](/threading/create_process_logon_flags.md)

[PROCESS\_CREATION\_FLAGS](/threading/process_creation_flags.md)

[STARTUPINFOW](/threading/startupinfow.md)

[PROCESS\_INFORMATION](/threading/process_information.md)
