Skip to content

Latest commit

 

History

History
28 lines (25 loc) · 596 Bytes

createprocess-example-basic.md

File metadata and controls

28 lines (25 loc) · 596 Bytes

CreateProcess Example (Basic)

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

int main(void){    
STARTUPINFOW si = { 0 };
PROCESS_INFORMATION pi = { 0 };

    if (!CreateProcessW(
        L"C:\\Windows\\System32\\mspaint.exe",
        NULL,
        NULL,
        FALSE,
        NORMAL_PRIORITY_CLASS,
        NULL,
        NULL,
        &si;
        &pi;  
    )){
        printf("(-) failed to create process, error: %ld", GetLastError());
        return EXIT_FAILURE;
    }
    printf("(+) process started! pid: %ld", pi.dwProcessId);
    return EXIT_SUCCESS;    //same as return 0;
}