EldoS | Feel safer!

Software components for data protection, secure storage and transfer

throw ECBFSError(xxxx) problem

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#7104
Posted: 07/29/2008 06:51:46
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

I do have a problem throwing errors (I am using cbfs 2.0.35.97). The first time I saw it was when I was trying to update an Image using PhotoShop CS3. To see what I was doing wrong I looked into the samples

In the Mapper sample I changed CbFsCreateFile and CbFsDeleteFile so they always throw ERROR_ACCESS_DENIED.

When I try to create a new directory I get the message:
I:\>mkdir jens
Access is denied.
This is OK

When I try to delete an existing directory I get no message:
I:\>mkdir jens
Access is denied.I:\>rmdir hans

I:\>
This is NOT OK


I then made some more tests throwing different errors from mkdir. Here is a short list:

Windows error Message from dos promt
ERROR_INVALID_FUNCTION The request is not supported.
ERROR_FILE_NOT_FOUND The system cannot find the file specified.
ERROR_PATH_NOT_FOUND A device attached to the system is not functioning.
ERROR_TOO_MANY_OPEN_FILES The system cannot open the file.
ERROR_ACCESS_DENIED Access is denied.
ERROR_INVALID_HANDLE The handle is invalid.
ERROR_ARENA_TRASHED A device attached to the system is not functioning.
ERROR_NOT_ENOUGH_MEMORY Not enough storage is available to process this command.
ERROR_INVALID_BLOCK A device attached to the system is not functioning.
ERROR_BAD_ENVIRONMENT A device attached to the system is not functioning.

ERROR_SHARING_VIOLATION A device attached to the system is not functioning.

Can you tell me what the problem is?

#7124
Posted: 07/30/2008 03:12:07
by Eugene Mayevski (EldoS Corp.)

Moved to HelpDesk for investigation.


Sincerely yours
Eugene Mayevski
#7142
Posted: 07/30/2008 13:41:59
by Volodymyr Zinin (EldoS Corp.)

Hello,

Use the CbFsCanFileBeDeleted event instead of CbFsDeleteFile. Exceptions thrown from CbFsDeleteFile are ignored.


Quote
Søren Kristensen wrote:
I then made some more tests throwing different errors from mkdir. Here is a short list:
...

When a callback function (CbFsCreateFile in your case) throws an error, the error before sending to Windows is converted from win32 error format to some STATUS-code. For example ERROR_ACCESS_DENIED is converted to STATUS_ACCESS_DENIED. It's necessary because the kernel code in Windows works with the STATUS_... error codes. But the internal CallbackFS function that performs this conversion doesn't convert all the win32 errors (at least now). A lot of win32 errors are converted as default to STATUS_UNSUCCESSFUL (with code 0xC0000001). That's why some ERROR_-codes above shows the same description (i.e. "A device attached to the system is not functioning."). I will add the conversion for such errors to the next build. Tell me if you want to throw other errors and I will add the conversion for it too.
#7151
Posted: 07/31/2008 03:30:47
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

This rises more questions:

Whic events is it possible to trow exceptions from that are not ignored? This is important to know in order implement my application!

I will at least miss ERROR_SHARING_VIOLATION, but probably also others. Could you supply me with a list of Error codes that are converted?

The problem was seen in Adobe Photoshop that returned the error: "Could not save <filename> because the file name was not walid" when I tried to save a change.

The Message I get from Adobe Photoshop when accessing a normal fileSystem is "Could not save <filename> because the file is already in use or was left open"


You write:
Quote
Use the CbFsCanFileBeDeleted event instead of CbFsDeleteFile. Exceptions thrown from CbFsDeleteFile are ignored.


Do you mean that I should do the actual delete in CbFsCanFileBeDeleted?
#7152
Posted: 07/31/2008 05:23:54
by Volodymyr Zinin (EldoS Corp.)

Quote
Søren Kristensen wrote:
Whic events is it possible to trow exceptions from that are not ignored? This is important to know in order implement my application!

All other except the following:
OnUnmount
OnGetVolumeLabel
OnGetVolumeId
OnCloseFile
OnCloseVolume
OnDeleteFile


Quote
Søren Kristensen wrote:
I will at least miss ERROR_SHARING_VIOLATION, but probably also others. Could you supply me with a list of Error codes that are converted?

I have attached the list to this message.

Quote
Søren Kristensen wrote:
The problem was seen in Adobe Photoshop that returned the error: "Could not save <filename> because the file name was not walid" when I tried to save a change.

The Message I get from Adobe Photoshop when accessing a normal fileSystem is "Could not save <filename> because the file is already in use or was left open"

Please describe the problem in more details.

Quote
Søren Kristensen wrote:
You write: Quote Use the CbFsCanFileBeDeleted event instead of CbFsDeleteFile. Exceptions thrown from CbFsDeleteFile are ignored.

Do you mean that I should do the actual delete in CbFsCanFileBeDeleted?

No. Because CbFsCanFileBeDeleted can be called without the following CbFsDeleteFile when some file/directory is moved into the recycle bin. In this case Windows checks whether the file can be deleted or not. But the file won't be deleted, just it will be moved into the bin.


[ Download ]
#7153
Posted: 07/31/2008 06:30:02
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

My problem may be due to the fact that I threw the error in CbFsDelteFile. I then changed it to be thrown in CbFsCanFileBeDeleted. Now PhotoShop reports the error "Could not save <filename> because of a disk error"

I now use the mapper sample an change CbFsCamFileBeDeleted to
Code
void CbFsCanFileBeDeleted(CallbackFileSystem* Sender, CbFsFileInfo* FileInfo, BOOL* CanBeDeleted)
{
   throw ECBFSError(ERROR_SHARING_VIOLATION);

    *CanBeDeleted = TRUE;
}


I then have a small testprogram doing the following:
Code
      bool result = DeleteFile(fileName);

      if (!result) {
         wprintf(L"Could not delete file %ws: error is [%d]\n" , fileName, GetLastError());
      } else {
         wprintf(L"The file %ws was deleted\n" , fileName);
      }


and output from that program is:

Could not delete file G:\Dir1\IMG_4.jpg: error is [31]

This means that that CbFs converts the errorcode ERROR_SHARING_VIOLATION (32) to ERROR_GEN_FAILURE (31). This may be the reason why PhotoShop reports an disk error.


#7154
Posted: 07/31/2008 07:27:53
by Volodymyr Zinin (EldoS Corp.)

Quote
Søren Kristensen wrote:
This means that that CbFs converts the errorcode ERROR_SHARING_VIOLATION (32) to ERROR_GEN_FAILURE (31). This may be the reason why PhotoShop reports an disk error.

This is because I only yesterday added the conversion of this error. I.e. in the next build this error will be converted to STATUS_SHARING_VIOLATION.
#7165
Posted: 08/01/2008 00:06:44
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

Do you have any idea when the next build will be available?
#7167
Posted: 08/01/2008 03:17:46
by Volodymyr Zinin (EldoS Corp.)

I think it will be on the next week, after the some reported bugs are fixed.
#7194
Posted: 08/04/2008 05:25:25
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

In a previous post you wrote that it was possible to throw exceptions from:
Quote
All other except the following:
OnUnmount
OnGetVolumeLabel
OnGetVolumeId
OnCloseFile
OnCloseVolume
OnDeleteFile

Is there a special reason for these functions not to handle exceptions?
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 9002 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!