EldoS | Feel safer!

Software components for data protection, secure storage and transfer

File sizes callback and notification

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#18593
Posted: 12/30/2011 12:51:51
by Ivan Erceg (Basic support level)
Joined: 12/30/2011
Posts: 8

Hi,

I'm having issues with both OnPostGetFileSizesC and OnGetFileSizesN:
1. If I specify GetSizesNotify in AddFilterCallbackRule, without even trying to handle the event, the app uniformly crashes. Nothing changes if I add handler for it - the app still just crashes.
2. OnPostGetFileSizesC handler sometimes gets called and sometimes it doesn't get called. I need to rely on it and it's unclear to me what, if anything, I'm doing wrong.
3. Is there no OnGetFileSizesC? This would be useful - I wouldn't have to rely on post-event.

I'm specifying all flags in AddFilterCallbackRule (except GetSizesNotify due to the crash) and everything is working correctly except this one bit regarding the sizes.

Furthermore, I think that API could use a full-fledged CreateFile() function and not just CreateFile(file name). CreateNonCbFile() says that it's not to be used from callbacks so that lives me out of options if I need to create or open a file from callback in some fashion other than default.

Please advise.

Thanks,
Ivan
#18594
Posted: 12/30/2011 13:10:32
by Ivan Erceg (Basic support level)
Joined: 12/30/2011
Posts: 8

Hi again,

More info: post-GetFileSizes event starts triggering when I don't specify some flags. Previously I was specifying all the flags in AddFilterCallbackRule. Now I'm specifying only Create, Open, SetBasicInfo, SetSizes, Read, Write, Close, SetSizesNotify, Delete, SetSecurity and GetSizes and *now* post-GetFileSizes gets triggered.

One question: post-GetFileSizes event handler sends pointers to __int64 values of end-of-file and allocation size. I'm trying to intercept these calls and return end-of-file/allocation size different than what they are in reality. I'm changing the values that pointers point to but that doesn't seem to have an effect. Are these values just for notification then? If so why pass them as pointers vs. plain __int64 values like you do in say post-ReadFile event.

Thanks,
Ivan
#18595
Posted: 12/31/2011 06:13:16
by Vladimir Cherniga (EldoS Corp.)

Hi,

Quote
1. If I specify GetSizesNotify in AddFilterCallbackRule, without even trying to handle the event, the app uniformly crashes. Nothing changes if I add handler for it - the app still just crashes.


We will check this issue asap.

Quote
2. OnPostGetFileSizesC handler sometimes gets called and sometimes it doesn't get called. I need to rely on it and it's unclear to me what, if anything, I'm doing wrong.


You may control file system requests flow with a Procmon tool from sysinternals.com and compare the log produced by this tool with a log from callbacks.

Quote
3. Is there no OnGetFileSizesC? This would be useful - I wouldn't have to rely on post-event.


OnGetFileSizesC callback is a part of more complex file system request, so it is not possible to satisfy this request in pre-event path. We are going to add this type of callback in the future release that will implement virtual files functionality.

Quote
Furthermore, I think that API could use a full-fledged CreateFile() function and not just CreateFile(file name). CreateNonCbFile() says that it's not to be used from callbacks so that lives me out of options if I need to create or open a file from callback in some fashion other than default.


You may use CreateNonCbFile() api from the callbacks, but this will not synchronize file handle manipulations with a callback processing. The major purpose of CreateFile(file name) api is synchronous file system in-callback requests, for the same file that was currently processed.

Quote
I'm changing the values that pointers point to but that doesn't seem to have an effect

Try to change those values in enumerate directory callback as well.

Quote
Now I'm specifying only Create, Open, SetBasicInfo, SetSizes, Read, Write, Close, SetSizesNotify, Delete, SetSecurity and GetSizes and *now* post-GetFileSizes gets triggered.

We will check this issue in a short.
#18604
Posted: 01/04/2012 03:26:00
by Vladimir Cherniga (EldoS Corp.)

Quote
If I specify GetSizesNotify in AddFilterCallbackRule, without even trying to handle the event, the app uniformly crashes.


This issue will be fixed in the nearest build.

Quote
Previously I was specifying all the flags in AddFilterCallbackRule. Now I'm specifying only .... and GetSizes and *now* post-GetFileSizes gets triggered.

Could you specify exactly what the flags you've specified previously. Thanks in advance.
#18606
Posted: 01/04/2012 08:40:09
by Ivan Erceg (Basic support level)
Joined: 12/30/2011
Posts: 8

Quote
This issue will be fixed in the nearest build.


Ok, thanks.

Quote
Could you specify exactly what the flags you've specified previously. Thanks in advance.


I OR-ed all the values in CbFltCallbackFlags which resulted in 0xEFFF0FFF which I first used. After that didn't work due to crashes I OR-ed all enum values and started excluding one half then the other and so on until I found that GetSizesNotify was crashing the app. After that I only excluded GetSizesNotify but left all the other enum values. That no longer crashed the app but post-GetFileSizes wouldn't work until I excluded all the notify flags (not sure if it's only one of those flags that's causing the issue or all or some combination of them).
#18612
Posted: 01/04/2012 11:18:20
by Vladimir Cherniga (EldoS Corp.)

It seems that EnumerateDirectory callback requires default implementation, if EnumerateDirectoryCallback flag specified (In this callback it is assumed that you should return TRUE in FileFound parameter for every direntry ). It will be fixed soon.
#18616
Posted: 01/04/2012 11:55:44
by Ivan Erceg (Basic support level)
Joined: 12/30/2011
Posts: 8

I can confirm that if EnumerateDirectoryCallback is specified then post-GetFileSizes event handler is never triggered.

Here's another defect with regards to EnumerateDirectoryCallback flag: if I specify it then filter behaves as if I had also specified PostWriteCallback and PostReadCallback (and I haven't).

So two problems with specifying EnumerateDirectoryCallback (even with a callback handler doing nothing):
1. post-GetFileSizes will *not* be triggered even if specified.
2. post-ReadFile and post-ReadWrite file will be triggered even if *not* specified.
#18620
Posted: 01/05/2012 03:49:40
by Vladimir Cherniga (EldoS Corp.)

Quote
2. post-ReadFile and post-ReadWrite file will be triggered even if *not* specified.

these callbacks will be triggered even without flags specified, setting event handlers for them is enough. It was made for compatibility between different version. Such behavior is specific for post-read and post-write callbacks only.
#18621
Posted: 01/05/2012 05:50:17
by Ivan Erceg (Basic support level)
Joined: 12/30/2011
Posts: 8

Quote
these callbacks will be triggered even without flags specified, setting event handlers for them is enough. It was made for compatibility between different version. Such behavior is specific for post-read and post-write callbacks only.


Ok, I'll stop setting callbacks for them. But you still have a defect: these callbacks are triggered only when I specify EnumerateDirectoryCallback (or post-Read/Write enums but then it's what one would expect).

What about the other issue, GetFileSizes not triggering when EnumerateDirectoryCallback is specified? Were you able to repro that?

Thanks,
Ivan
#18622
Posted: 01/05/2012 07:18:16
by Vladimir Cherniga (EldoS Corp.)

[quote]What about the other issue, GetFileSizes not triggering when EnumerateDirectoryCallback is specified? Were you able to repro that?[quote]

As i said before, EnumerateDirectoryCallback works wrong, when event handler not specified. More precisely - it returns empty directory content on enumeration. In this way it affect on system behavior so that other callbacks not triggered. To workaround this problem do not specify EnumerateDirectoryCallback flag or implement default handler for it. If you have any side effects using this "fix" then please report about it. The real fix will be applied to the forthcoming build of CallbackFilter.
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

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