I’m making a GUI for a third party untouchable console executable. This executable reads an input file, processes the data and generates an output file. As the process can take a long time I need to monitor the progress.
What I want to do is to locate the console executable process id (done), with the process id retrieve the list of files opened by the process (done) and then, once the input file is identified and it’s handle is retreived (done), I want to call SetFilePointer(handle, 0, currentPosition) so it tells me what ammount of file has been already read. Then, (read/totalSize) will give me the progress of the process.
THE PROBLEM is that invoking SetFilePointer() always returns 0xFFFFFFFF (fail) and GetLastError() returns 6 (invalid handle). Any ideas?
Thank you in advance.
Handles belong to the owning process and can only be operated on by the owning process. If you want to modify a handle in another process you’ll need to inject code into that process, or use
DuplicateHandle.