EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Recursive callbacks when using callbackFilter.OpenFile

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.
#20289
Posted: 06/01/2012 09:49:33
by mike athan (Basic support level)
Joined: 06/01/2012
Posts: 6

Hi, i am trying to catch an OnPostOpenFileCallback for some filtered files. These file will be zero length initialy, and once they found i need to open a handle and fill them with data (data will be produced from different process)

At the moment am just trying to change the file size in the PostOpenFileEventC

if the file is zero length i call :

if (size == 0){

var handle = sender.OpenFile(filename);

int newSize = 1000;

sender.SetEndOfFile(handle, 1000);

sender.CloseFile(handle);
}

the sender.OpenFile(filename); will fire multiple OpenFileCallback events, which i dont want. I would expect to fire only one since its going to execute the OpenFile() command once.

how can i get a file handle without firing more OpenFileCallbacks ?
I tried using CreateNonCbFile but the documentation says not to use it inside a callback and it also gives me an invalid handle with an exception :

"The client you are using is not licensed to use this system. Your logon
request is denied. "

thanks
#20291
Posted: 06/01/2012 10:17:53
by Vladimir Cherniga (EldoS Corp.)

Check the Encrypt sample, it uses the same method to obtain file handle from callbacks.
#20292
Posted: 06/01/2012 10:28:13
by Vladimir Cherniga (EldoS Corp.)

Quote
I tried using CreateNonCbFile but the documentation says not to use it inside a callback

It cannot be used from callback by the reason of synchronization problem, it doesn't synchronize callback with a file operations, performed with a handle obtained from CreateNonCbFile.
#20294
Posted: 06/01/2012 10:31:53
by Eugene Mayevski (EldoS Corp.)

Also, if you want to forge contents of the file, writing anything to this file is not the best idea. Instead you need to tell the fake file size to the OS (in directory enumeration and GetFileInfo callbacks) and then provide fake data in ReadFile callback.


Sincerely yours
Eugene Mayevski
#20342
Posted: 06/06/2012 07:04:00
by mike athan (Basic support level)
Joined: 06/01/2012
Posts: 6

Thanks for your quick answers.
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

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