EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Is OnGetFileNameByFileId mandatory?

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
Posted: 08/19/2010 07:03:57
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

Hi, is this callback mandatory? Unfortunately the help for this one comes with "Page Not Found".

I am getting "The parameter is incorrect" error when I call MountMedia() after upgrading to CBFS3. Previous version (CBFS2) worked fine with the same sequence of calls. The only thing I changed was the call to AddMountingPoint from AddMountingPoint("H:") to AddMountingPoint("H:", CallbackFileSystem.CBFS_SYMLINK_SIMPLE, NULL);

I am wondering if the error could be caused by the OnGetFileNameByFileId callback not being implemented. All other callbacks (except the three that I found in the doc as not mandatory - OnEnumerateNamedStreams, OnGetFileSecurity, OnSetFileSecurity) are implemented.

Petr Chmelar
Posted: 08/19/2010 07:31:29
by Volodymyr Zinin (Team)

Hi Petr,

No, OnGetFileNameByFileId isn't mandatory.
I don't remember but it seems that additional parameters have been added to the OnGetFileInfo and OnEnumerateDirectory callbacks. Maybe the problem is there.
Posted: 08/19/2010 08:22:09
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

Hi Vladimir,

of course I updated the callbacks signatures, otherwise it wouldn't compile. Besides if I understand it correctly the OnGetFileInfo and OnEnumerateDir wouldn't make sense to be called before the MountMedia mounts the media, right?

I also checked the drivers and I have the correct one (CBFS3.sys) in my windows\system32\drivers folder.

I am a bit lost here. I am on W7 x64, the app is a service.

The driver gets installed in the following way:

CallbackFileSystem.Install("cbfs.cab", driverId, false,
ref reboot);

-- reboot is done here

The code then calls:


AddMountingPoint("H:", CallbackFileSystem.CBFS_SYMLINK_SIMPLE, null);

MountMedia(0); <-- here I get ECBFSError with error code -2147467259 (message: The parameter is incorrect)

Any hints?
Thank you,
Posted: 08/19/2010 08:25:52
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

Im just thinking, could it be something to do with these settings?

CallAllOpenCloseCallbacks = false;
StorageType = CbFsStorageType.stDisk;
StorageCharacteristics = CallbackFileSystem.scWriteOnceMedia |
SerializeCallbacks = true;
ShortFileNameSupport = false;
MaxFileNameLength = 255;
MaxFilePathLength = (uint)Int16.MaxValue;
ProcessRestrictionsEnabled = false;
SectorSize = 512;

Posted: 08/20/2010 00:31:03
by Volodymyr Zinin (Team)

Seems everything is correct.
Try the following - reinstall the driver from the latest CallbackFS ver.3 build, check if version of the installed cbfs3.sys driver in the Windows\system32\drivers directory is correct, and relink your code with the CallbackFS library from the latest build.
Posted: 08/23/2010 04:10:04
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

Tried to do what you suggested but no luck. Also tried on different server (also 64bit, 2008 R2 Datacenter) and I am getting the exact same error.

The cbfs3.sys driver version is (fileversion) and (product version), CBFSNet.dll is the same version.

Posted: 08/23/2010 04:30:04
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

OK, I was playing around with the parameters and discovered that it's actually this parameter:
this.MaxFileNameLength = 255;

when commented out it all works fine. What are the valid values for this parameter? There are no restrictions in the documentation.

Posted: 08/23/2010 09:30:14
by Volodymyr Zinin (Team)

This parameter is taken in bytes. But we will change it in the nearest build to be in characters.
Posted: 08/23/2010 09:47:16
by Volodymyr Zinin (Team)

BTW the restriction for it (as well as for the MaxFilePathLength parameter) is
255 <= MaxFileNameLength <= 0x7FFF
255 <= MaxFilePathLength <= 0x7FFF
This is in symbols.
Posted: 08/23/2010 10:17:19
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

Two things:
The documentation says that the length is already in characters:
Use this property to specify, how long the file name may be. The maximal length is set in characters. Default value is 260 (corresponds to MAX_PATH constant in Windows).

and second, if this is the restriction:

255 <= MaxFileNameLength <= 0x7FFF

then this should work:
this.MaxFileNameLength = 255

but it didn't ...
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.



Topic viewed 9350 times

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


Back to top

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

Got it!