This DLL calls a program (MyProgram.exe) whose full path name is provided in 'string1'. MyProgram reads a file whose full path name is provided in 'string2' and creates a file whose name is also provided in 'string2'.
The output file is further exploited in the program calling the DLL.
Everything works fine but based on the results found after exploitation of the output file, I see that there is some delay in the values provided by the DLL.
I have got the feeling that the DLL gives control back to the calling program before MyProgram.exe is finished.
So my question is : does this DLL executes 'synchronously'? Stated otherwise, is control given back to the DLL (and thus also to the program calling this DLL) only after MyProgram.exe is finished? If not, what should be changed in order to have the DLL not give control back to the calling program before MyProgram.exe is finished?
First, you have coded: "WaitForSingleObject(command1.hProcess, INFINITE);" this make your DLL wait for the "MyProgram" to exit. Also, the parameters you used in open the target file have some affect on the result. You can check out the MSDN on create file. The file sharing mode.