# 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](https://www.pinvoke.dev/threading/create_process_logon_flags "mention")

[process\_creation\_flags](https://www.pinvoke.dev/threading/process_creation_flags "mention")

[startupinfow](https://www.pinvoke.dev/threading/startupinfow "mention")

[process\_information](https://www.pinvoke.dev/threading/process_information "mention")
