EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Offline file sizes

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#31029
Posted: 10/16/2014 23:31:23
by Jon Woolman (Standard support level)
Joined: 09/26/2014
Posts: 6

In a filter driver I was able to set a file's info with the EndOfFile value set to the local partial file size (say 100 bytes) and the AllocationSize value set to the actual remote file size (say 2000 bytes) and the file would display in Explorer with a 'size' of 2000 and a 'size on disk' of 100.

This does not work in the OnEnumerateDirectory or OnGetFileInfo callbacks. Is there any way to get this to work with CBFS?
#31030
Posted: 10/17/2014 01:30:46
by Volodymyr Zinin (EldoS Corp.)

I don't think such decision will work. For example some program decides to open a file and before its opening it requests the file size ("end of file" size) which is reported to be 100 bytes. Then the program allocates a buffer for this 100 bytes and reads only this quantity. There is no way at the time of this algorithm working to report the program that the actual file size is greater than 100 bytes.
So it's required to report correct file size ("end of file" size) from your CBFS callbacks.
#31038
Posted: 10/17/2014 11:42:44
by Jon Woolman (Standard support level)
Joined: 09/26/2014
Posts: 6

This is exactly how OneDrive works. Files that have the Offline attribute are online only files. In explorer they show the correct full file size, but if you right click and select properties then it will show Size as the full file size and the SizeOnDisk as 0 or maybe 20k or so if has downloaded the first chunk.

In the case you list above where a program requests a file that is not fully downloaded, the CBFS callback would download the rest of the file (or at least the requested chunk) before returning.

I have had this working in a filter driver, but it seems that CBFS must do some checking and altering of the EndOfFile and AllocationSize values that I set in my callback.
#31039
Posted: 10/17/2014 13:08:27
by Volodymyr Zinin (EldoS Corp.)

Quote
jdwoolman wrote:
I have had this working in a filter driver,

What a filter driver do you mean?

Quote
jdwoolman wrote:
This is exactly how OneDrive works.

Could you specify in details how to reproduce it?

Thanks.
#31040
Posted: 10/17/2014 13:22:41
by Jon Woolman (Standard support level)
Joined: 09/26/2014
Posts: 6

Quote
Volodymyr Zinin wrote:
What a filter driver do you mean?


Before using CBFS, I wrote my own filter driver for this project. In the filter driver callbacks I was able to do what I stated above.

Quote
Volodymyr Zinin wrote:
Could you specify in details how to reproduce it?


If you go into your OneDrive folder and right click on a file that has 'Online-only' in the 'Availability' column, then select properties. You will see that the file size is the full file size, but the size on disk is not.

After experimenting more with this, I feel that this is only possible in a PostOperationCallback in a filter driver as these values are probably considered invalid and corrected lower in the driver stack.
#31041
Posted: 10/17/2014 14:07:00
by Volodymyr Zinin (EldoS Corp.)

As I understand it's a feature of Windows 8.1. Is it so?
http://windows.microsoft.com/en-us/wi...le-offline
#31046
Posted: 10/17/2014 16:54:57
by Jon Woolman (Standard support level)
Joined: 09/26/2014
Posts: 6

Well, it seems that Microsoft is doing some stuff behind the scenes that is not available to us, at least not without writing our own custom drivers and we decided against that.

The only real visible difference is that when we display our files in Explorer we will have to show the full file size for the 'SizeOnDisk' value when the file is not downloaded yet. Not a big deal, I was just trying to get it to work like OneDrive.

Thanks for your help.
#31047
Posted: 10/17/2014 17:57:06
by Jon Woolman (Standard support level)
Joined: 09/26/2014
Posts: 6

oops, I had my values reversed in my first post above - Eldos does allow you to set EndOfFile less than AllocationSize, but what I need is to be able to set EndOfFile to the full file size and set AllocationSize to less than the full file size so the "sizeOnDisk" will reflect the partial downloaded size.

Volodymyr,
Can you check if CBFS is enforcing that the value of AllocationSize must be equal to or greater than EndOfFile size? Because in a minifilter driver this is not enforced and is allowed.

Thanks,
Jon
#31050
Posted: 10/20/2014 02:36:29
by Volodymyr Zinin (EldoS Corp.)

Quote
jdwoolman wrote:
Can you check if CBFS is enforcing that the value of AllocationSize must be equal to or greater than EndOfFile size? Because in a minifilter driver this is not enforced and is allowed.

Yes, CBFS enforces it. But it's possible to correct it. I suggest the following - I will correct the CBFS code to allow to set AllocationSize to be less than EndOfFile and then create a test driver for you.

Also we will investigate how OneDrive works on Windows 8.1 machines (the offline feature) and if possible will implement the same in CBFS.
#36581
Posted: 04/26/2016 19:06:39
by Tanooj Luthra (Priority Standard support level)
Joined: 05/08/2014
Posts: 1

I stumbled across this thread from a while back trying to do a very similar thing. I'm not able to set the AllocationSize to be less than EndOfFile, it always just appears as the EndOfFile value. Is it possible to have the size appear as 4KB and have the size on disk be 0B (for example)?
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

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