CreateProcess function kernel32
Win32Result<bool>
CreateProcess(
- PCWSTR? lpApplicationName,
- PWSTR? lpCommandLine,
- Pointer<
SECURITY_ATTRIBUTES> ? lpProcessAttributes, - Pointer<
SECURITY_ATTRIBUTES> ? lpThreadAttributes, - bool bInheritHandles,
- PROCESS_CREATION_FLAGS dwCreationFlags,
- Pointer<
NativeType> ? lpEnvironment, - PCWSTR? lpCurrentDirectory,
- Pointer<
STARTUPINFO> lpStartupInfo, - Pointer<
PROCESS_INFORMATION> lpProcessInformation,
Creates a new process and its primary thread.
The new process runs in the security context of the calling process.
To learn more, see learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw.
Implementation
Win32Result<bool> CreateProcess(
PCWSTR? lpApplicationName,
PWSTR? lpCommandLine,
Pointer<SECURITY_ATTRIBUTES>? lpProcessAttributes,
Pointer<SECURITY_ATTRIBUTES>? lpThreadAttributes,
bool bInheritHandles,
PROCESS_CREATION_FLAGS dwCreationFlags,
Pointer? lpEnvironment,
PCWSTR? lpCurrentDirectory,
Pointer<STARTUPINFO> lpStartupInfo,
Pointer<PROCESS_INFORMATION> lpProcessInformation,
) {
final result_ = CreateProcessW_Wrapper(
lpApplicationName ?? nullptr,
lpCommandLine ?? nullptr,
lpProcessAttributes ?? nullptr,
lpThreadAttributes ?? nullptr,
bInheritHandles ? TRUE : FALSE,
dwCreationFlags,
lpEnvironment ?? nullptr,
lpCurrentDirectory ?? nullptr,
lpStartupInfo,
lpProcessInformation,
);
return .new(value: result_.value.i32 != FALSE, error: result_.error);
}