Malware Development – Create A Process

Create a Notepad Process

Code

#include <windows.h>

int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) {
    STARTUPINFOW si{};
    PROCESS_INFORMATION pi{};
    si.cb = sizeof(si);

    if (!CreateProcessW(L"C:\\Windows\\System32\\notepad.exe",
        nullptr, nullptr, nullptr, FALSE, 0,
        nullptr, nullptr, &si, &pi)) {
        MessageBoxW(nullptr, L"CreateProcess failed", L"Error",
            MB_OK | MB_ICONERROR);
        return 1;
    }

    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);
    return 0;
}

Output