Hi guys
I have a program which, for some years, has been able to access disks in a Linux system (when run as root) using FileOpen which was written in FPC 3.0.4. I am still currently using FPC3.0.4 though I appreciate I really need to get round to updating to FPC 3.2.0.
Anyway, here is my FPC 3.0.4 example:
hSelectedDisk : THandle;
...
hSelectedDisk := FileOpen(SourceDevice, fmOpenRead OR fmShareDenyNone);
if hSelectedDisk = -1 then
begin
ShowMessage('Could not get exclusive disk access ' +
'OS error and code : ' + SysErrorMessageUTF8(GetLastOSError));
end
else
....
However, users began to report access violation errors and having looked into it today, it seems FileOpen constantly returns -1 when trying to access /dev/sd devices now, even when run as root. I'm assuming this is something new to Linux where it is no longer possible to obtain a handle to physical disks using whatever powers FileOpen uses?
Is there a new (new to me at least as I am clearly out of date) way to do this now? Have I missed some news somewhere (quite probably), or is it just no longer possible in FPC? Is FPC 3.2.0 the way to go to achieve this?
Thanks