I have an automatic update system that replaces my existing program files upon reboot. (Suffice it to say that this is a very complex program with many drivers, services and user-level modules. There is no other way. Believe me.)
The MoveFileEx function is used with MOVEFILE_DELAY_UNTIL_REBOOT to set this file replacement. I find that this is working fine. However, if the source and target files are on different drives, the target is deleted, but the source does not move. As a result, when the user installs the software on a drive other than the system partition, the update deletes the product file rather than updating it.
Now I see in the documentation for MoveFileEx that MOVEFILE_COPY_ALLOWED should be used when moving a file from one volume to another. But he also says that the flag cannot be used with MOVEFILE_DELAY_UNTIL_REBOOT.
Q: How can I move a file on reboot, overwriting an existing file when the source and target are not on the same volume?
source share