I am creating a child process which executes a batch file
success = CodebenderccAPI::CreateProcess(
NULL,
(LPWSTR)command.c_str(), // command line
NULL, // process security attributes
NULL, // primary thread security attributes
TRUE, // Inherit pipe handles from parent process
CREATE_NEW_CONSOLE, // creation flags
NULL, // use parent's environment
current_dir, // use the plugin's directory
&si, // __in, STARTUPINFO pointer
&pi); // __out, receives PROCESS_INFORMATION
The above code was tested and works as it should in various machines but recently failed in a Windows 7 machine and I am still trying to figure out why...
I have ensured that the user has administrative permissions to the folder where the batch file is installed as well as that the batch file is in the working directory. Moreover I disabled the antivirus (to verify that it didn't cause the problem) and tried again with no sucess. CreateProcess always fails with error code 2: ERROR_FILE_NOT_FOUND.
Any ideas what could cause that failure?