0

In my software I am using MoveFileEx to mark my files for deletion to be deleted on system reboot.

That is in the case when for some reasons I cannot delete the file with my software (for example it is locked by other software).

But I assume that the system could crash, or other unexpected situations could reboot the system, and I want be able to delete the file or to mark it for deletion with MoveFileEx.

Now I am planning to mark the file with MoveFileEx immediately after the software starts to use it.

I have three questions:

  1. Is there a function (which I could use) to remove the record from windows regestry for a specific file?

    The case is: I mark the file for deleting on system reboot, work with it and I delete it successfully - then I wont need this record in my registry and I don't want to have records for files that are deleted successfully. (maybe millions successfully deleted and 5-10 unsuccessfully).

  2. If there isn't such function (mentioned in question '1') how big would be the problem to have millions unwanted records in my registry?

  3. If the answer of question 2 is very negative, is there other solution for this?

Community
  • 1
  • 1
Boris Todorov
  • 390
  • 1
  • 4
  • 17
  • It probably isn't a good idea to register a file for deletion on reboot if you aren't actually planning to reboot. Just keep your own records, so that if necessary your software can delete any leftover file(s) the next time it starts up. Consider using `FILE_FLAG_DELETE_ON_CLOSE` when creating the files if appropriate; that should ensure they are deleted if your software crashes or the system is rebooted in an orderly way. – Harry Johnston Apr 15 '15 at 07:33
  • Hi, the problem is that I do not want to delete them immediately after stop using them. The files stay longer on the disk(because my operations to retrieve the file and save it is a bit heavy, also we work with thousands files that could be reused after few minutes) and we do not want to retrieve it again. So ... it stays longer. And here is the case if the system reboot before the time to delete this file. I will not be able to delete it after that. – Boris Todorov Apr 15 '15 at 08:04
  • Does your software not start up again after the system reboots? Couldn't you install a component that does so? – Harry Johnston Apr 15 '15 at 08:21

0 Answers0