EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Implementing OnGetFileNameByFileId

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#26805
Posted: 10/14/2013 04:55:35
by Volodymyr Zinin (EldoS Corp.)

As a variant you can add in your context associated with TCbFsFilInfo a boolean field, something like IsDirectory, and initialize it during the file/folder opening (in the OnCreate/OnOpen callback).
In any case your implementation of the CallbackFS callbacks should know information about the "backend" files/directories. For example at any time the OnGetFileInfo callback can come to request information about any file or folder.
#26806
Posted: 10/15/2013 05:34:00
by david atkins (Basic support level)
Joined: 06/12/2013
Posts: 13

Ok I am now trying to run your mapper sample and have dropped the vcl files into a project in Builder XE and am receiving an Unresolved External linker error for 'NtOpenFile' do you know how I would go about correcting this?
#26807
Posted: 10/15/2013 05:51:04
by Vladimir Cherniga (EldoS Corp.)

It must have been linked statically with a next declaration in Main.pas:
Code
function NtOpenFile(FileHandle: PHandle; DesiredAccess: ACCESS_MASK;
  ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK;
  ShareAccess: ULONG; OpenOptions: ULONG): Integer; stdcall; external 'ntdll.dll';

If this is a problem, try to load this library dynamically. There is a code in CbFsGetFileNameByFileId callback handler that is demonstrate this technique.
#26815
Posted: 10/15/2013 08:01:44
by david atkins (Basic support level)
Joined: 06/12/2013
Posts: 13

Also when I uncomment the section that is labelled "uncomment in order to support NFS sharing" I receive a System Error Code 50 "request is not supported" when the line FCbFs.CreateStorage; is executed.

I believe it is caused by:
FCbFs.StorageCharacteristics := [TCbFsStorageCharacteristic(0)];

If I comment this line out then it runs fine but the characteristic are no set correctly.

EDIT:
I have managed to fix the problem by replacing this line:

FCbFs.StorageCharacteristics := [TCbFsStorageCharacteristic(0)];

with this one:

FCbFs.StorageCharacteristics := [];
#26824
Posted: 10/15/2013 11:11:48
by Vladimir Cherniga (EldoS Corp.)

We will fix the sample, thank you for your comments.
#26844
Posted: 10/16/2013 07:48:58
by david atkins (Basic support level)
Joined: 06/12/2013
Posts: 13

I am running the Mapper sample and I am able to mount a drive pointing at C:\1 but when I open the mounted drive in windows explorer I instantly get an exception thrown in the GetFileSecurity callback thrown as shown using the code in below:

Code
  if Not GetFileSecurityW(PWideChar(FRootPath + FileInfo.FileName),
    SecurityInformation, SecurityDescriptor, Length, LengthNeeded) then begin
   Error := GetLastError;
   raise ECBFSError.Create(Error);
  end;
#26845
Posted: 10/16/2013 07:57:39
by Volodymyr Zinin (EldoS Corp.)

Please specify the content of the Error variable?
Thanks.
#26846
Posted: 10/16/2013 08:00:48
by david atkins (Basic support level)
Joined: 06/12/2013
Posts: 13

It contains 122 which according to MSDN is:

The data area passed to a system call is too small.
#26847
Posted: 10/16/2013 08:17:01
by Volodymyr Zinin (EldoS Corp.)

This is correct situation. The system GetFileSecurity API call returns such error in the case the buffer for security descriptor is not big enough and the LengthNeeded parameter is set to required size. So on the next call (with the bigger buffer) the function completes successfully. At least it should be so.
#26848
Posted: 10/16/2013 08:19:13
by david atkins (Basic support level)
Joined: 06/12/2013
Posts: 13

So why does your code throw an exception when this happens if it is correct?
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 5339 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!