EldoS | Feel safer!

Software components for data protection, secure storage and transfer

MountMedia throws ECBFSError unexpectedly

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#16153
Posted: 03/29/2011 12:00:14
by Mel Reyes (Standard support level)
Joined: 03/28/2011
Posts: 10

I am working on my first implementation of a filesystem. Using .NET / C# API. I have followed the documentation very carefully, but when I try to mount the media I receive the following exception:

Quote
CallbackFS.ECBFSError was unhandled
Message="The operation completed successfully"
Source="CBFSNet"
ErrorCode=-2147467259
NativeErrorCode=0
StackTrace:
at CallbackFS.CallbackFileSystem.MountMedia(Int32 Timeout)



Here is the code that results in the error (in my Main() method)

Code
            CallbackFileSystem cfs = new CallbackFileSystem();
            var mmfs = new FileSystemImplementation();

            cfs.OnCanFileBeDeleted = new CbFsCanFileBeDeletedEvent(mmfs.FS_CanFileBeDeleted);
            cfs.OnCloseEnumeration = new CbFsCloseEnumerationEvent(mmfs.FS_CloseEnumeration);
            cfs.OnCloseFile = new CbFsCloseFileEvent(mmfs.FS_CloseFile);
            cfs.OnCreateFile = new CbFsCreateFileEvent(mmfs.FS_CreateFile);
            cfs.OnDeleteFile = new CbFsDeleteFileEvent(mmfs.FS_DeleteFile);
            cfs.OnEnumerateDirectory = new CbFsEnumerateDirectoryEvent(mmfs.FS_EnumerateDirectory);
            // cfs.OnEnumerateNamedStreams = new CbFsEnumerateNamedStreamsEvent(mmfs.FS_EnumerateNamedStreams);
            cfs.OnFlushFile = new CbFsFlushFileEvent(mmfs.FS_FlushFile);
            cfs.OnGetFileInfo = new CbFsGetFileInfoEvent(mmfs.FS_GetFileInfo);
            cfs.OnGetFileNameByFileId = new CbFsGetFileNameByFileIdEvent(mmfs.FS_GetFileNameByFileId);
            //cfs.OnGetFileSecurity = new CbFsGetFileSecurityEvent(mmfs.FS_GetFileSecurity);
            cfs.OnGetVolumeId = new CbFsGetVolumeIdEvent(mmfs.FS_GetVolumeID);
            cfs.OnGetVolumeLabel = new CbFsGetVolumeLabelEvent(mmfs.FS_GetVolumeLabel);
            cfs.OnGetVolumeSize = new CbFsGetVolumeSizeEvent(mmfs.FS_GetVolumeSize);
            cfs.OnIsDirectoryEmpty = new CbFsIsDirectoryEmptyEvent(mmfs.FS_IsDirectoryEmpty);
            cfs.OnMount = new CbFsMountEvent(mmfs.FS_Mount);
            cfs.OnOpenFile = new CbFsOpenFileEvent(mmfs.FS_OpenFile);
            cfs.OnReadFile = new CbFsReadFileEvent(mmfs.FS_ReadFile);
            cfs.OnRenameOrMoveFile = new CbFsRenameOrMoveFileEvent(mmfs.FS_RenameOrMove);
            cfs.OnSetAllocationSize = new CbFsSetAllocationSizeEvent(mmfs.FS_SetAllocationSize);
            cfs.OnSetEndOfFile = new CbFsSetEndOfFileEvent(mmfs.FS_SetEndOfFile);
            cfs.OnSetFileAttributes = new CbFsSetFileAttributesEvent(mmfs.FS_SetFileAttributes);
            //cfs.OnSetFileSecurity = new CbFsSetFileSecurityEvent(mmfs.FS_SetFileSecurity);
            cfs.OnSetVolumeLabel = new CbFsSetVolumeLabelEvent(mmfs.FS_SetVolumeLabel);
            cfs.OnStorageEjected = new CbFsStorageEjectedEvent(mmfs.FS_StorageEjected);
            cfs.OnUnmount = new CbFsUnmountEvent(mmfs.FS_Unmount);
            cfs.OnWriteFile = new CbFsWriteFileEvent(mmfs.FS_WriteFile);

            cfs.ShortFileNameSupport = false;
            cfs.CreateStorage();
            cfs.AddMountingPoint(";server;share", CallbackFileSystem.CBFS_SYMLINK_NETWORK | CallbackFileSystem.CBFS_SYMLINK_NETWORK_HIDDEN_SHARE, null);

            cfs.MountMedia(0);


If I break the execution immediately before the call to "MountMedia", the mounting point is available (i.e., windows reports "Not Ready" as opposed to "Not Found")

I have reviewed the documentation and the sample code carefully and I cannot see what I am doing differently. I have tried adding the mount point with a simple drive letter, and I have also tried calling Mount() before calling AddMountingPoint(), both with the same effect. I do have some of the event handlers commented out as the documentation indicates they are optional and not to susbcribe to events that you will not handle. I find it very perplexing that I should receive an exception with the error code indicating "The operation completed successfully" - what am I doing wrong?

The VMounter sample shows the driver is installed and runs fine.
#16154
Posted: 03/29/2011 15:22:00
by Mel Reyes (Standard support level)
Joined: 03/28/2011
Posts: 10

I was able to determine this error is triggered if you do not subscribe to the (supposedly deprecated) OnVolumeOpen and OnOpenClose delegates.

These items were removed from the documentation and I was advised via the forums that they were deprecated and not necessary, but apparently this information is not correct. If you do not subscribe to these delegates it will result in the above specified error.
#16155
Posted: 03/30/2011 01:16:57
by Eugene Mayevski (EldoS Corp.)

They were declared as obsolete but not removed from the check list for some reason. We will make them optional in code in the next update.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 2542 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!