05-CreateProcessW

#include <windows.h>
#include <stdio.h>

int main() { 

// BOOL CreateProcessW(
//   [in, optional]      LPCWSTR               lpApplicationName,
//   [in, out, optional] LPWSTR                lpCommandLine,
//   [in, optional]      LPSECURITY_ATTRIBUTES lpProcessAttributes,
//   [in, optional]      LPSECURITY_ATTRIBUTES lpThreadAttributes,
//   [in]                BOOL                  bInheritHandles,
//   [in]                DWORD                 dwCreationFlags,
//   [in, optional]      LPVOID                lpEnvironment,
//   [in, optional]      LPCWSTR               lpCurrentDirectory,
//   [in]                LPSTARTUPINFOW        lpStartupInfo,
//   [out]               LPPROCESS_INFORMATION lpProcessInformation
// );

STARTUPINFOW si = {0};
PROCESS_INFORMATION pi = {0};
if(!CreateProcessW(
    L"C:\\Windows\\System32\\cmd.exe",
    L" /c ping 192.168.29.65",
    NULL,
    NULL,
    FALSE,
    BELOW_NORMAL_PRIORITY_CLASS,
    NULL,
    NULL,
    &si,
    &pi)) { 
        printf("Falied To create a process %ld",GetLastError());
    }
    else {
    printf("Process Created - PID %ld", pi.dwProcessId);
    }
return 0;
}

lpStartupInfo and lpProcessInformation are both pointers click on the link
../Pasted image 20240726003441.png

And You ll see that STARTUPINFOW is already defined just use it and initialize it to {0}