Reputation: 400
I have a win32 app and I'm starting a robocopy child process for some file transfers. If I terminate the process using TerminateProcess is there a possibility to end with corrupt files? If so how to avoid this?
Upvotes: 0
Views: 5473
Reputation: 6299
From TerminateProcess function,
The TerminateProcess function is used to unconditionally cause a process to exit. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.
Keep in mind that TerminateProcess
does not allow its target to clean up and exit in a valid state.
Try to close the process cleanly, refer the link below,
If the robocopy process is terminated, the file being copied will have a timestamp of (a) 1980-01-01 (b) the same size as the original file.
Then use robocopy to copy files with TimeStamp in command line again.
Refer: How to use Robocopy to copy files with TimeStamp in command line
Upvotes: 1