EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Windows Service Deployment and Network Drives

Posted: 10/23/2009 04:37:30
by Vladimir Cherniga (Team)

Please check that your vsmntntf.dll successfully loaded into explorer process. Use "process explorer" tool for this purposes ("Find handle or dll..." from menu). If not - you will not see drive in explorer.
We have checked cbfs CPP sample running as service and its works without objection (folder with ";demo;test" name is absent, drive visible in explorer).
If this possible post your sample binaries and source code for testing.
Posted: 10/26/2009 18:48:25
by Gavin McKay (Standard support level)
Joined: 09/01/2009
Posts: 48

I ran Process Explorer and I can find "vsmntntf.dll" as one of the processes that has been loaded.

My code is as follows (C# .NET):

// Create callback system
            mCbFs = new CallbackFileSystem();

// Create CBFS events
            mCbFs.OnMount = new CbFsMountEvent(CbFsMount);
            mCbFs.OnUnmount = new CbFsUnmountEvent(CbFsUnmount);
            mCbFs.OnGetVolumeSize = new CbFsGetVolumeSizeEvent(CbFsGetVolumeSize);
            mCbFs.OnGetVolumeLabel = new CbFsGetVolumeLabelEvent(CbFsGetVolumeLabel);
            mCbFs.OnSetVolumeLabel = new CbFsSetVolumeLabelEvent(CbFsSetVolumeLabel);
            mCbFs.OnGetVolumeId = new CbFsGetVolumeIdEvent(CbFsGetVolumeId);
            mCbFs.OnOpenVolume = new CbFsOpenVolumeEvent(CbFsOpenVolume);
            mCbFs.OnCloseVolume = new CbFsCloseVolumeEvent(CbFsCloseVolume);
            mCbFs.OnCreateFile = new CbFsCreateFileEvent(CbFsCreateFile);
            mCbFs.OnOpenFile = new CbFsOpenFileEvent(CbFsOpenFile);
            mCbFs.OnCloseFile = new CbFsCloseFileEvent(CbFsCloseFile);
            mCbFs.OnGetFileInfo = new CbFsGetFileInfoEvent(CbFsGetFileInfo);
            mCbFs.OnEnumerateNamedStreams = new CbFsEnumerateNamedStreamsEvent(CbFsEnumerateNamedStreams);
            mCbFs.OnEnumerateDirectory = new CbFsEnumerateDirectoryEvent(CbFsEnumerateDirectory);
            mCbFs.OnCloseEnumeration = new CbFsCloseEnumerationEvent(CbFsCloseEnumeration);
            mCbFs.OnSetAllocationSize = new CbFsSetAllocationSizeEvent(CbFsSetAllocationSize);
            mCbFs.OnSetEndOfFile = new CbFsSetEndOfFileEvent(CbFsSetEndOfFile);
            mCbFs.OnSetFileAttributes = new CbFsSetFileAttributesEvent(CbFsSetFileAttributes);
            mCbFs.OnCanFileBeDeleted = new CbFsCanFileBeDeletedEvent(CbFsCanFileBeDeleted);
            mCbFs.OnDeleteFile = new CbFsDeleteFileEvent(CbFsDeleteFile);
            mCbFs.OnRenameOrMoveFile = new CbFsRenameOrMoveFileEvent(CbFsRenameOrMoveFile);
            mCbFs.OnReadFile = new CbFsReadFileEvent(CbFsReadFile);
            mCbFs.OnWriteFile = new CbFsWriteFileEvent(CbFsWriteFile);

// Create storage
string sRegKey = "deletedmykey";


// Mount

// Add mount points
                string mountingPoint = "Z:;demoserver;test";

                // Create the root folder and store context
                g_DiskContext = new i3VirtualFolder("\\");
                g_DiskContextHandle = GCHandle.Alloc(g_DiskContext);

                mCbFs.AddNetworkMountingPoint(mountingPoint, false, CbFsNetworkSymLinkFlags.nsmAllowMapAsDrive);

Like I said, this code works in a .NET Windows Forms app, but not in my .NET Windows Service.
Posted: 10/27/2009 02:10:28
by Eugene Mayevski (Team)

Please post your project in both compiled and source code form to the HelpDesk. Note that the helpdesk has file size limitaion of 1Mb, so please choose only the needed files (don't put PDB, precompiled headers and other junk) and put them all to ZIP file.

Sincerely yours
Eugene Mayevski
Posted: 10/28/2009 14:09:11
by Kurt Griffiths (Standard support level)
Joined: 12/08/2008
Posts: 34

Just for the record, I've seen a perhaps related issue since we started using AddNetworkMountingPoint by default when CBFS 2 was released.

It has nothing to do with the helper DLLs not being installed (they are). We install the drivers, etc. once when our software is installed. The (C++) call we make from the service running as LOCALSYSTEM is:

AddNetworkMountingPoint(mountingPoint, false, NULL, (CallbackFileSystem::CbFsNetworkSymLinkFlags)0);

That call mounts the virtual drive OK until the user logs off and then back on. At that point, the drive letter looses it's label, reverting to the generic "Network Drive".

There also seems to be an intermittent issue with the drive unmounting cleanly using DeleteMountingPointEx("J:", false, NULL); I haven't tracked down the specific scenario for that, but it is odd that it sometimes works and sometimes doesn't.

Happens in Vista and Windows 7 (not sure about XP). This still occurs with the latest CBFS release.

I am planning on trying to mount/unmount the drive in the user's session when they log in, rather than the service, as a workaround unless there is something I'm doing obviously wrong that you can see.
Posted: 10/29/2009 01:46:18
by Eugene Mayevski (Team)

Mr.Griffiths, your message has been moved to HelpDesk for detailed investigation of the specific issues that you've described.

Sincerely yours
Eugene Mayevski
Posted: 11/03/2009 18:11:16
by Gavin McKay (Standard support level)
Joined: 09/01/2009
Posts: 48

Thanks to Vlad, I found this was my own stupid fault on a very imbarassing mistake in code. Which I shall now tell world + dog about so they don't smack themselves in the head like I just did :)

When using AddNetworkMountPoint I passed the value z:;demoserver;test. I then create a virtual folder inside this drive, however instead of creating z:\myfolder I was accidentally passing in z:;demoserver;test\myfolder! This had the effect of auto-creating the ;demoserver;test folder.

Thanks for everyones help on this, I couldn't see the problem for looking :)



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