EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Mapper sample based question regarding file/folder operations

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#18668
Posted: 01/10/2012 05:18:17
by Eugene Mayevski (EldoS Corp.)

Thank you, your explanation is enough for now.

The problem is there's a limited set of things you can do from callbacks and this set can not be strictly defined. When the callback is called, the OS is in very sensitive state - some global kernel objects are locked, filesystem and the driver stack is in waiting state etc. . Performing any operation on virtual drive can potentially cause a deadlock or recursive call or other unpleasant behavior, so such operation is either blocked internally by the driver or just doesn't work as needed.

Consequently you must move any operations that access the virtual drive out of callbacks.

Now about your more global problem. If I understand you right you want to dynamically modify the virtual filesystem in response to filesystem events. This is not something the OS expects you to do, and as such the OS was not designed for such things.

Callbacks are places where you either return information to the OS or write information to the filesystem as requested by the OS. Point. You may not perform any other operations on the filesystem besides the ones requested by the OS.

In general when you want to modify the structure or contents of the filesystem, you can do this in two ways:
1) modify it by performing operations on the virtual filesystem. But this should be done only outside of callbacks.
2) modify the underlying data structures (i.e. files on the physical disk or in the database etc) AND notify the OS about such changes by calling NotifyDirectoryChange() method. But again this can be done only outside of callbacks.


Sincerely yours
Eugene Mayevski
#18669
Posted: 01/10/2012 06:04:53
by ohad (Standard support level)
Joined: 02/02/2011
Posts: 24

Thanks for the explanation.

The interesting thing is that I do have operations for creating a default directory/file structure in the virtual file system which are outside of the callbacks(I think I mentioned it in the previous post),and I still get an "access denied" error in them.

It's a fairly simple affair,a form loads,then the creation and mounting of the storage occur automatically and afterwards this method is called where I just check if the directory/file already exists in said location and if not I attempt to create it.

Will be glad for any further advice.

Regards,
#18670
Posted: 01/10/2012 06:20:15
by Eugene Mayevski (EldoS Corp.)

Quote
greenflower wrote:
The interesting thing is that I do have operations for creating a default directory/file structure in the virtual file system which are outside of the callbacks(I think I mentioned it in the previous post),and I still get an "access denied" error in them.


Yes, I noticed it in the previous post. This is the thing for us to check and we will do this today.


Sincerely yours
Eugene Mayevski
#18674
Posted: 01/10/2012 09:58:01
by ohad (Standard support level)
Joined: 02/02/2011
Posts: 24

Thanks, waiting for your answer.
#18677
Posted: 01/10/2012 12:08:20
by Volodymyr Zinin (EldoS Corp.)

I've modified the Mapper code by only adding Directory.CreateDirectory call to the end of the btnAddPoint_Click handler and it works without error. Here is the code:

Code
private void btnAddPoint_Click(object sender, EventArgs e)
        {
            try
            {
                // This call will create mounting point in the current local session.
                // Consider that in this case the mounting point will not be visible
                // in other user logon sessions.

                mCbFs.AddMountingPoint(edtMountinPoint.Text);


                UpdateMountingPoints();

                btnDeletePoint.Enabled = true;

                Directory.CreateDirectory(edtMountinPoint.Text + "\\qqq");
            }
            catch (ECBFSError err)
            {
                MessageBox.Show(this, err.Message, "Mapper", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }


Please check it. But ensure that there is no such mounting point before the call.
#18688
Posted: 01/12/2012 01:12:02
by ohad (Standard support level)
Joined: 02/02/2011
Posts: 24

Sorry it took me a while to answer,I get a "device attached to the system is not functioning" error at that point all of a sudden(after I already pressed the "create storage" and "mount" buttons).

One important thing to mention is that I had to downgrade the driver version to 3.1.89.219 to match our own current application.
#18689
Posted: 01/12/2012 01:24:44
by Volodymyr Zinin (EldoS Corp.)

It seems the newer driver remained in the system but is tried to use with the version 3.1 of the user mode API. Call CallbackFS.Uninstall before the installing an older version of the driver.
#18725
Posted: 01/15/2012 08:26:19
by ohad (Standard support level)
Joined: 02/02/2011
Posts: 24

Ok,the issue with the Directory.CreateDirectory() access denied outside of the callback was found to be an issue in our own code.

And the "device attached to the system is not functioning" was indeed driver issues.

Thanks.
#18726
Posted: 01/15/2012 09:06:01
by Eugene Mayevski (EldoS Corp.)

Do I understand that the problem has gone away?


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

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