This QC report say that Delphi doesn't support the file sharing mode FILE_SHARE_DELETE
http://qc.embarcadero.com/wc/qcmain.aspx?d=45628
I need to use this mode with TFileStreams - Can anyone think of a straightforward workaround that doesn't involve modifying the library code, or duplicating reams of stuff from the library?
The QC report is correct.
TFileStream(more specifically, theSysUtils.FileOpen()function) does not supportFILE_SHARE_DELETE. It only supportsFILE_SHARE_READandFILE_SHARE_WRITE.In order to use sharing rights beyond what
TFileStreamnatively supports, you will have to call the Win32 APICreateFile()function directly, then you can construct aTHandleStreamobject using the handle thatCreateFile()returns.