Wie wäre es mit CreateFile und dem Flat FILE_FLAG_DELETE_ON_CLOSE?
Zitat:
The file is to be deleted immediately after all of its handles are closed, which includes the specified
handle and any other open or duplicated handles.
If there are existing open handles to a file, the call fails unless they were all opened with the FILE_SHARE_DELETE share mode.
Subsequent open requests for the file fail, unless the FILE_SHARE_DELETE share mode is specified.