I have a function, that reads a registry key, get a path for a program there, and call a CreateProcessA with this path as second parameter. Debugging the application, it fails saying that the file was not found.
a) yes, the file exists
b) yes, i have access to execute the file
Question: The function that actually reads the reg key and give the path to CreateProcessA, doesn’t escape the path: it means, CreateProcessA receives a string like “C:\Program Files\prog.exe” and not like “C:\\Program Files\\prog.exe”. Is that the problem? Does exist any Windows Function to escape all backslashes automatically?
Common errors include not specifying the path to the executable as the first argument to CreateProcess, and not quoting the path to the executable in the second argument
Like so:
I just copied and adapted some, so there might be some errors in the above, but the idea is there. Make sure to use path without quotes in the first parameter and path with quotes in the second and you should be fine.