EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Error 87 - The parameter is incorrect

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#19224
Posted: 02/27/2012 15:49:46
by Rick Gordon (Standard support level)
Joined: 02/07/2012
Posts: 3

Hello, could you provide us with clearer detail on this error message? Our developers would like to know more about the error we are seeing so that we may further debug the issue. We get this error message but find it to be too general and generic.

CBFS ver 3.2.105.261

SectorSize = 4 * 1024
StorageType = CbFsStorageType.stDisk
StorageCharacteristics = 0

Code where we get this error : CBFSys.MountMedia(3000);
ERROR - ECBFSError = 87
The parameter is incorrect

System used:
WS2008R2 x64


Thanks
Rick from Canada
#19228
Posted: 02/28/2012 01:44:26
by Eugene Mayevski (EldoS Corp.)

There's no way for the driver to return more specific error code, because error codes are translated from NT error code set to Win32 errors by Windows.

Obviously your developers need to change some parameters to see what's up. Eg. Keep SectorSize at 512 bytes (other sizes can cause incompatibility with third-party applications) and set timeout to something more reasonable like 30000 (30 seconds as 3 seconds can easily expire while you handle the callback).

If you have a license, please assign the license ticket to your user account before we continue. The ticket itself and the procedure of it's use are specified in the registration e-mail that was sent to you upon license purchase.


Sincerely yours
Eugene Mayevski
#19236
Posted: 02/28/2012 12:31:58
by Rick Gordon (Standard support level)
Joined: 02/07/2012
Posts: 3

Thanks for the reply Eugene,

We DO indeed have support. Looked around in my account but did not see a field for entering the license account number. I can IM it to you if needed in the meantime.

Update to the error seen above:
We compiled our software with three versions of CBFS and tested. All variables are the same across each test build.
3.2.105 we see the error above
3.2.104 not tested with
3.2.103 no error seen
3.2.102 no error seen

So it is our belief that something changed for this API call in either 104 or 105. Could you look into it and please enlighten us?
Also, under v3.2.105 we did indeed test with various variables for the call in question. Results did not change depending on the variables.

Cordially,
Rick from Canada
#19237
Posted: 02/28/2012 12:44:31
by Eugene Mayevski (EldoS Corp.)

Instructions for linking the ticket are present in the registration e-mail.

Since there's nothing special in your code and CBFS works fine for other users (including our own SFTP Net Drive application which is widely used), I assume the problem can be specific either to your computers or to your particular code.

Please specify what API (.NET, C++, VCL) you are using and maybe show larger piece of code (including calls to AddMountingPoint) that you have. I will try to reproduce the problem.

Also did you try using default value of sector size (which is 512)? We just recently had the same problem with other user who had error 87 with sector size being 4Kb. But he was using storage in plug-n-play mode, and there the upper driver (not CBFS) didn't like 4Kb-large sectors.


Sincerely yours
Eugene Mayevski
#19239
Posted: 02/28/2012 13:15:16
by Rick Gordon (Standard support level)
Joined: 02/07/2012
Posts: 3

Checking the registration email now. I apologize for not having this entered sooner.

API: .Net 3.5 SP1
IDE: VS2010

Sector size: 512, 4 * 1024 both them used with no difference.
Code
        internal void StartCallBackFileSystem()
        {
            const int CBFS_REMOVABLE_MEDIA = 16;

            bool result = IsVDriverInstalled();

            if (result)
            {
                this.CBFSys = new CallbackFileSystem()
                {
                    SectorSize =  4 * 1024,
                    StorageType = CbFsStorageType.stDisk,
                    StorageCharacteristics = CBFS_REMOVABLE_MEDIA
                };

                this.CbFsCreateEvents();
                result = this.CreateStorage();

                if (!result)
                    Console.WriteLine("Unable to create virtual drive storage");
                else
                {
                    result = this.MountVirtualDrive();

                    if (!result)
                        Console.WriteLine("Unable to mount virtual drive");
                    else
                    {
                        result = this.AddVirtualDrivePoint();
                        if (!result)
                            Console.WriteLine("Unable to add virtual drive point");
                        else
                        {
                            // this.CBFSys.SetIcon("SQOVMIcon");
                            result = this.CBFSys.SetFileSystemName(ServiceCommon.FileSystemName);
                            //this.CBFSys.CallAllOpenCloseCallbacks = true;
                            //result = this.CBFSys.DisableFileCache(false); //it's enabled by default
                        }
                    }
                }
            }

}

        
        private bool CreateStorage()
        {

                const string sRegKey = "Our Key";

                try
                {
                    CallbackFileSystem.SetRegistrationKey(sRegKey);
                    this.CBFSys.CreateStorage();
                    return true;
                }
                catch (ECBFSError ex)
                {
                    string msg = string.Format(CultureInfo.CurrentCulture, "{0} , Native error code = {1}", ex.Message, ex.NativeErrorCode.ToString(CultureInfo.CurrentCulture));
                    Logging.LogService.Error(msg);
                }
                catch (Exception ex)
                {
                    Logging.LogService.Error(null, ex);
                }
                return false;
        }


        private bool MountVirtualDrive()
        {
                try
                {
                    CBFSys.MountMedia(180000);
                    return true;
                }
                catch (ECBFSError ex)
                {
                    Logging.LogService.Error(string.Format("ECBFSError = {0} ",ex.ErrorCode.ToString ()), ex);
                }
                catch (Exception ex)
                {
                    Logging.LogService.Error(null, ex);
                }
                return false;
        }


        private bool AddVirtualDrivePoint()
        {
                this.DiskContext = new VirtualFile(Constants.SBackSlash);
                this.diskContextHandle = GCHandle.Alloc(DiskContext);
                do
                {
                    this.GetVDriveLetter();

                    try
                    {
                        CBFSys.AddMountingPoint(this.dLibrary.LibVDriveLetter);
                    }
                    catch (ECBFSError ex)
                    {
                        Logging.LogService.Error(null, ex);
                        if (ex.NativeErrorCode == 183)
                            continue;
                        return false;
                    }
                    catch (Exception ex)
                    {
                        Logging.LogService.Error(null, ex);
                        return false;
                    }
                    break;
                } while (true);

                return true;
        }
#19242
Posted: 02/28/2012 14:31:44
by Eugene Mayevski (EldoS Corp.)

Can you please post complete test project to the HelpDesk (in ZIP archive) so that we could test it? The piece of code above is incomplete.
#23278
Posted: 01/21/2013 10:55:32
by Ivan P (Priority Standard support level)
Joined: 04/11/2011
Posts: 66

I faced the same problem: "The parameter is incorrect" when calling cbfs.MountMedia(30000)

In my case the real problem was that during this call OnGetVolumeSize() is called. For read-only storage we returned the amount of consumed space in TotalAllocationUnits, and sometimes it was 0.
As it turned out, this value is not valid for Windows.

The problem happens with CBFS v3.

The CBFS v4 documentation states that "CBFS adjusts the size to be at least 16 sectors to ensure compatibility with possible changes in future versions of Windows.", so hopefully it's fixed in CBFS v4.

The CBFS 3 doc doesn't have such remark. And to fix it in CBFS v3 I did what v4 is supposed to do automatically - return Total Allocation Units with minimum value of 16. And that works!

Sincerely,
IP
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

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