EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Generate "file too large for the destination file system

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#18288
Posted: 11/24/2011 07:26:14
by Christian Schnidrig (Standard support level)
Joined: 10/25/2010
Posts: 44

Hi

In which callback do have to return what error code in order to have windows return the error: "The file 'xyz' is too large for the destination file system."

The same error windows return if you want to write a 5GB file on a FAT filesystem.

Process monitor shows, that windows does return "INVALID PARAMETER" in response to a CreateFile call. In CBFS this is not possible, since one does not get the allocation size in onCreateFile.

Thanks
Christian
#18289
Posted: 11/24/2011 07:50:38
by Volodymyr Zinin (EldoS Corp.)

CallbackFS splits the system CreateFile call on two callbacks - OnCreate and OnSetAllocationSize. The last callback is called right after the first one only if AllocationSize is specified in the original system CreateFile call.
So try to return "INVALID PARAMETER" from OnSetAllocationSize.
#18290
Posted: 11/24/2011 09:31:57
by Christian Schnidrig (Standard support level)
Joined: 10/25/2010
Posts: 44

That is not what I see happening in the debugger:


16:19:55.975 D [CBFS Handler ] WualaCBFSCallbacks.onCreateFile - file=\2048\BlobTest\openSUSE-11.4-DVD-i586.iso, desiredAccess=1442207, shareMode=0, attributes=128

16:19:55.979 D [CBFS Handler ] WualaCBFSCallbacks.onGetFileInfo - getting file info for \2048\BlobTest\openSUSE-11.4-DVD-i586.iso

16:19:55.980 D [CBFS Handler ] WualaCBFSCallbacks.onCloseFile - closing handle /2048/BlobTest/openSUSE-11.4-DVD-i586.iso

16:19:55.981 D [CBFS Handler ] WualaCBFSCallbacks.onGetFileInfo - getting file info for \2048

16:19:55.982 D [CBFS Handler ] WualaCBFSCallbacks.onGetFileInfo - getting file info for \2048\BlobTest

16:19:55.982 D [CBFS Handler ] WualaCBFSCallbacks.onGetFileInfo - getting file info for \2048\BlobTest\openSUSE-11.4-DVD-i586.iso

16:19:55.983 D [CBFS Handler ] WualaCBFSCallbacks.onOpenFile - file=\2048\BlobTest\openSUSE-11.4-DVD-i586.iso, desiredAccess=1442207, shareMode=0

16:19:55.984 D [CBFS Handler ] WualaCBFSCallbacks.onSetAllocationSize - id=618926 FileElement, key: [89732,1367481,18], version: 1, name: openSUSE-11.4-DVD-i586.iso; AllocationSize 0

16:19:55.984 D [CBFS Handler ] WualaCBFSCallbacks.onSetEndOfFile - setting eof to 0 for id=618926 FileElement, key: [89732,1367481,18], version: 1, name: openSUSE-11.4-DVD-i586.iso

16:19:56.105 D [CBFS Handler ] WualaCBFSCallbacks.onSetFileAttributes - setting file attrs for id=618926 FileElement, key: [89732,1367481,18], version: 1, name: openSUSE-11.4-DVD-i586.iso

16:19:56.132 D [CBFS Handler ] WualaCBFSCallbacks.onSetAllocationSize - id=618926 FileElement, key: [89732,1367481,18], version: 2, name: openSUSE-11.4-DVD-i586.iso; AllocationSize 4541382656

If I return Error code 87 here at this last call, then windows will complain about an unexpected error "invalid parameter". It will not genereate the error: "The file 'xyz' is too large for the destination file system."
#18291
Posted: 11/24/2011 09:56:01
by Eugene Mayevski (EldoS Corp.)

You need to experiment with error codes. Due to double translation of error codes (to NT native format and back to Win32) it's not always possible to get the same code that you passed in the exception. There's no one-to-one match between native and Win32 error codes.


Sincerely yours
Eugene Mayevski
#18293
Posted: 11/24/2011 11:11:20
by Volodymyr Zinin (EldoS Corp.)

The log shows that AllocationSize isn't specified in the CreateFile call. Note that AllocationSize can be specified only for CreateFile call, but not for OpenFile.
#18351
Posted: 12/01/2011 06:55:46
by Christian Schnidrig (Standard support level)
Joined: 10/25/2010
Posts: 44

No. The log above shows what CBFS sends to the application. Windows does make a createFile operation with the allocation size set correctly. I verified that with Process Monitor.

It is CBFS that turns that into a onCreateFile call with allocation size 0.

----------

As to playing with errorcodes: This is exactly why I'm asking my question here.
I could not find anything suitable. For example, if I return 223 ERROR_FILE_TOO_LARGE then windows will tell the user that it could not read the source file, which is absolute rubbish.
#18353
Posted: 12/01/2011 09:37:24
by Volodymyr Zinin (EldoS Corp.)

Quote
Christian Schnidrig wrote:
Windows does make a createFile operation with the allocation size set correctly. I verified that with Process Monitor.

Could you please specify a Process Monitor log for it?
Thanks
#18364
Posted: 12/03/2011 18:48:46
by Eaton Zveare (Standard support level)
Joined: 11/28/2011
Posts: 20

I have recently been trying to do this as well. My file is created fine in CreateFile, but I don't see any size related parameter there, so I did what Vladimir said and threw an ECBFSError in OnSetAllocationSize.

I have not been able to locate the appropriate error code to pass to generate the "file to large" message, which is what I desire.

I am also curious that even if I find the error code somewhere, the file is still made, with its size as 0. Is it possible, in this specific case, to throw the file too long error and prevent the file from being made entirely? That would be the best functionality.

Possible Callback File System suggestion:
Maybe make a property named "MaxFileSize" so users can set their size limitation and Callback File System can handle the checking and file creation prevention internally.
#18380
Posted: 12/05/2011 13:17:57
by Volodymyr Zinin (EldoS Corp.)

Answered in HelpDesk.
#18381
Posted: 12/05/2011 18:19:34
by Eaton Zveare (Standard support level)
Joined: 11/28/2011
Posts: 20

Replied^

Christian: I'll make sure to post any solution here so you too can have this solved.
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 4927 times

Number of guests: 2, 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!