#include #include int main() { STARTUPINFO si; PROCESS_INFORMATION pi; // Initialize memory for the structures ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); // Command to be executed (adjust path if necessary) const char* command = "C:\\WINDOWS\\system32\\calc.exe"; // Create child process if (!CreateProcessA( NULL, // No module name (use command line) const_cast(command), // Command line NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE 0, // No creation flags NULL, // Use parent's environment block NULL, // Use parent's starting directory LPSTARTUPINFOA(& si), // Pointer to STARTUPINFO structure &pi // Pointer to PROCESS_INFORMATION structure )) { std::cerr << "Create Process Failed. Error: " << GetLastError() << std::endl; return -1; } // Wait until child process exits WaitForSingleObject(pi.hProcess, INFINITE); std::cout << "Child Complete" << std::endl; // Close process and thread handles CloseHandle(pi.hProcess); CloseHandle(pi.hThread); return 0; }