EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CallbackFilter: question re modified buffer data

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 04/05/2008 08:52:04
by Ray Mond Yeoh (Basic support level)
Joined: 04/04/2008
Posts: 7

I'm going through the help file, and there's something I hope you can help me with.

If I wanted to intercept some data, compress it, and write it out to disk, do I:

a) compress the data and write the data out to disk myself, and set ProcessRequest to false
b) compress the data and change the Buffer parameter to point to the compresed block, but I can't change the BytesToWrite value, so that doesn't seem doable
c) something else?

Basically, I want to compress the data before its written to disk, which I can do just fine as I simply read the data from the Buffer parameter. However, what I'm unclear on is how do I write the compressed data to disk? Do I do it, or does the OS handle it? Either way, I'm unsure how it should be done.

Posted: 04/07/2008 08:06:44
by Vladimir Cherniga (EldoS Corp.)

To write the data out to disk you should copy compressed data to address pointed by Buffer parameter, then set parameter ProcessRequest to true. Any additional write/read operations to the same file can be done by opening the handle in PostCreate callback and using Win32Api ReadFile/WriteFile. All datas must be aligned for nonbuffered io. To handle the EOF value you should process OnGetFileInfo callback and OnDirectoryEnumeration callback(it will be added in the next build).
Posted: 04/07/2008 09:22:52
by Ray Mond Yeoh (Basic support level)
Joined: 04/04/2008
Posts: 7

When the data is compressed, the size should usually be smaller. I don't think I can change the BytesToWrite value. How can I tell Windows the new size to write to disk?

Posted: 04/07/2008 14:40:49
by Vladimir Cherniga (EldoS Corp.)

You are right that you cannot change the BytesToWrite value in OnWrite callback.
You can change the file size when the file will be closed, for example.
OnClose callback will be added in the next build to simplify handling such tasks.
Posted: 04/07/2008 14:45:52
by Vladimir Cherniga (EldoS Corp.)

We plans to improve Callback Filter samples to demonstrate simple compression \ decompression filter.
Posted: 04/08/2008 06:02:04
by Ray Mond Yeoh (Basic support level)
Joined: 04/04/2008
Posts: 7

I'll wait for the demo to clear things up, thanks.
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.



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