EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Sample program "VDisk" and UNC paths

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#18471
Posted: 12/13/2011 15:59:39
by Dave Foster (Basic support level)
Joined: 12/09/2011
Posts: 7

OK, I finally see it, in all of its forms. The code below, is a hybrid of what I have been given, and what I have learned:

Code
      if ( _tcslen( MountingPoint ) > 2 ) {

         //g_CbFs.AddMountingPoint(L"W:;server;share", CBFS_SYMLINK_NETWORK | CBFS_SYMLINK_NETWORK_ALLOW_MAP_AS_DRIVE, NULL);
         g_CbFs.AddMountingPoint( MountingPoint, CBFS_SYMLINK_NETWORK | CBFS_SYMLINK_NETWORK_ALLOW_MAP_AS_DRIVE, NULL);

         TCHAR Drive[32] = _T(""), Server[32], Share[32];
         int n = 0;
         TCHAR *pNext = MountingPoint;
         if ( *pNext != ';' )
            _stscanf( pNext, _T("%31[^;]%n"), Drive, &n );
         pNext = &pNext[n+1];
         _stscanf( pNext, _T("%31[^;]%n"), Server, &n );
         pNext = &pNext[n+1];
         _stscanf( pNext, _T("%31[^;]%n"), Share, &n );

         _stprintf( MountingPoint, _T("\\\\%s\\%s"), Server, Share );
      }
      else
         g_CbFs.AddMountingPoint(MountingPoint);
        
      _tcscat(MountingPoint, _T("\\Sample\\"));
      CreateDirectory(MountingPoint, NULL);
        
      _tcscat(MountingPoint, _T("testfile_1.txt"));


Any comment on why it sometimes takes up to 30 seconds to complete the function call AddMountingPoint() for network mounted devices?

Dave
#18476
Posted: 12/13/2011 23:32:05
by Eugene Mayevski (EldoS Corp.)

Quote
Dave Foster wrote:
Any comment on why it sometimes takes up to 30 seconds to complete the function call AddMountingPoint() for network mounted devices?


It's the OS and network subsystem that cause delays, not us.

Also please note that what Vladimir has shown is not the UNC paths we initially were talking about. We still have to check what's up with your attempt to create a simple UNC path, as it works fine for other users.


Sincerely yours
Eugene Mayevski
#18478
Posted: 12/14/2011 05:23:01
by Eugene Mayevski (EldoS Corp.)

Quote
Dave Foster wrote:
However, when I "Create Storage", followed by "Mount", type the mount point name "test", and then "Add" it, the hFile in the routine OnCallbackAddPoint() is invalid, and so no wonder I cannot see the device, even with the path "\\.\test". Am I looking at the same evaluation kit as you?


Regarding the sample - it creates a directory and a file and for UNC paths it does this wrong (doesn't add "\\.\" prefix for UNC path). This part will be fixed. Yet it's not clear how you are going to "see the device" if it's hidden. UNC paths are passed to API functions. If you change the code in the sample to add a prefix in calls to CreateDirectory etc., you will see them working right.


Sincerely yours
Eugene Mayevski
#18479
Posted: 12/14/2011 14:26:27
by Dave Foster (Basic support level)
Joined: 12/09/2011
Posts: 7

Hello again. I'm not sure how I'm going to see the device if it's hidden either. I would like to see the filesystem in the Open/Save As dialogs of our application, and confirm it in the Windows Explorer. My thought was to perhaps set the "Look In:" (Windows 7 Explorer) field to something like "\\.\Server\Share" to see our files. This does seem to work with a "network" mounting point, as Vladimir suggested, but that process may be too slow to execute during application start-up. Am I incorrect in assuming that the "Look In:" field will not respond to this type of UNC path?

Here is what I have now:
Code
      if ( _tcslen( MountingPoint ) > 2 && _tcschr( MountingPoint, ';' ) ) {

         //g_CbFs.AddMountingPoint(L"W:;server;share", CBFS_SYMLINK_NETWORK | CBFS_SYMLINK_NETWORK_ALLOW_MAP_AS_DRIVE, NULL);
         g_CbFs.AddMountingPoint( MountingPoint, CBFS_SYMLINK_NETWORK | CBFS_SYMLINK_NETWORK_ALLOW_MAP_AS_DRIVE, NULL);

         TCHAR Drive[32] = _T(""), Server[32], Share[32];
         int n = 0;
         TCHAR *pNext = MountingPoint;
         if ( *pNext != ';' )
            _stscanf( pNext, _T("%31[^;]%n"), Drive, &n );
         pNext = &pNext[n+1];
         _stscanf( pNext, _T("%31[^;]%n"), Server, &n );
         pNext = &pNext[n+1];
         _stscanf( pNext, _T("%31[^;]%n"), Share, &n );

         _stprintf( MountingPoint, _T("\\\\%s\\%s"), Server, Share );
      }
      else {
         g_CbFs.AddMountingPoint(MountingPoint);
         if ( ! _tcschr( MountingPoint, ':' ) ) {
            TCHAR Server[32];
            _tcscpy( Server, MountingPoint );
            _stprintf( MountingPoint, _T("\\\\.\\%s"), Server );
         }
      }
        
      _tcscat(MountingPoint, _T("\\Sample\\"));
      CreateDirectory(MountingPoint, NULL);
        
      _tcscat(MountingPoint, _T("testfile_1.txt"));
#18481
Posted: 12/15/2011 00:14:15
by Eugene Mayevski (EldoS Corp.)

Quote
Dave Foster wrote:
Hello again. I'm not sure how I'm going to see the device if it's hidden either.


Via Windows API calls. UNC paths are *hidden* and they are used to *hide* the presence of the virtual disk from the user.

Quote
Dave Foster wrote:
"\\.\Server\Share" to see our files.


It can be either \\.\Point or \\Server\Share, but not what you've written.


Sincerely yours
Eugene Mayevski
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.

Reply

Statistics

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