-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcreateprocess.c
41 lines (34 loc) · 1.06 KB
/
createprocess.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <windows.h>
#include "../../src/psxecute.h"
int start()
{
PSX_PRINT("Starting calc.exe\n");
const char *calcPath = "C:\\Windows\\System32\\calc.exe";
PROCESS_INFORMATION processInfo = {0};
STARTUPINFO startupInfo = {0};
startupInfo.cb = sizeof(startupInfo);
if (CreateProcess(
calcPath, // Application path
NULL, // Command line arguments
NULL, // Process attributes
NULL, // Thread attributes
FALSE, // Inherit handles
0, // Creation flags
NULL, // Environment variables
NULL, // Current directory
&startupInfo, // Startup info
&processInfo // Process info
))
{
PSX_PRINT("calc.exe started successfully.\n");
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
}
else
{
PSX_PRINT("Failed to start calc.exe.");
return 1;
}
PSX_PRINT("Done\n");
return 0;
}