Created
March 19, 2023 03:18
-
-
Save un4ckn0wl3z/18f68421a843163b3a80578adbb22d7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <Windows.h> | |
int main() | |
{ | |
STARTUPINFO si; | |
si.cb = sizeof(si); | |
ZeroMemory(&si, sizeof(si)); | |
PROCESS_INFORMATION pi; | |
ZeroMemory(&pi, sizeof(pi)); | |
BOOL success = CreateProcess( | |
L"C:\\Windows\\System32\\notepad.exe", | |
NULL, | |
0, | |
0, | |
FALSE, | |
0, | |
NULL, | |
L"C:\\Windows\\System32", | |
&si, | |
&pi); | |
if (success) | |
{ | |
printf("Process created with PID: %d.\n", pi.dwProcessId); | |
return 0; | |
} | |
else | |
{ | |
printf("Failed to create process. Error code: %d.\n", GetLastError()); | |
return 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment