EldoS | Feel safer!

Software components for data protection, secure storage and transfer

OnFsRead

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#7308
Posted: 08/15/2008 07:43:25
by Tomas de Freitas (Basic support level)
Joined: 08/15/2008
Posts: 8

Hello -

The VB.NET sample app "VMounter" has a callback method in it called OnFsRead(). This method is not mentioned in the docs or in this forum or the knowledgebase for the Callback File System.

I need to stream dynamically generated data when a virtual file is opened for read. Is this where I do it? If so, can I see sample code that writes ascii bytes for "Hello World" to the outgoing byte stream?

Thanks,
T
#7314
Posted: 08/15/2008 08:34:29
by Eugene Mayevski (EldoS Corp.)

1) Did you check the Getting Started article in the knowledgebase. If no, please start with it - it will give you understanding of what needs to be done and how Callback File System works.

2) I don't see any method called OnFsRead. If you are talking about CbFsFsRead(), then yes, this is where you return the contents of your virtual file. BUT! You implement all callbacks, not just this particular one.


Sincerely yours
Eugene Mayevski
#7316
Posted: 08/15/2008 08:40:15
by Tomas de Freitas (Basic support level)
Joined: 08/15/2008
Posts: 8

I already commented on the getting started article in the other thread. Yes, I've used it.

I've figured out that the sample's delegate for OnReadFile() is called onFsRead. This was the source of the confusion.

_T
#7318
Posted: 08/15/2008 08:59:57
by Vladimir Cherniga (EldoS Corp.)

If you see that delegate name in the error message:
"Event OnFsRead not defined you must define all events", then it is erronously named OnReadFile delegate, the same is with OnWriteFile (OnFsWrite) delegate. This message not reffer to the actual OnFsRead delegate, we will fix this.
#7319
Posted: 08/15/2008 09:11:11
by Tomas de Freitas (Basic support level)
Joined: 08/15/2008
Posts: 8

Ok, great. Thanks.

Now I'm still interested in seeing a "Hello World" for writing dynamically generated data to a stream inside the OnReadFile() callback.

I've been working on this for a while here and cannot get any more data into the stream and seen when the file is open.

What I'm doing:

1) Driver check + CreateStorage() + MountMedia() + AddPoint()
2) Use stream writer to make a small starter/temp file.
3) In OnReadFile() I've commented the sample code and am just writing the generated data to Buffer and setting BytesRead.

When this file is opened in a hex editor my generated bytes are not there.

Additional issue:

* I do not know the file length from the beginning, the data is dynamically generated/streamed. Do I need to report a high value for the file size from the start so that apps will ask for more bytes than the number in the original starter/temp file?

_T
#7330
Posted: 08/15/2008 10:02:35
by Eugene Mayevski (EldoS Corp.)

Are you currently modifying the provided sample or you are writing the code from scratch? I would suggest that you start with modifying the sample and see how your changes work (or don't work) and what effects they cause.

Quote
Tomas de Freitas wrote:
I do not know the file length from the beginning, the data is dynamically generated/streamed. Do I need to report a high value for the file size from the start so that apps will ask for more bytes than the number in the original starter/temp file?


Generally the file must have the known file size. I think that in your case you can report the enormously large file size. The problem is that if the application attempts to read beoynd the data that actually exists, you will have to either provide this data or report some error. What is your plan for this?

What application(s) will read such dynamic files? If this is some homemade application, then using sockets or named pipes to provide the data to that application would be more suitable solution than the virtual file.


Sincerely yours
Eugene Mayevski
#7331
Posted: 08/15/2008 10:08:56
by Tomas de Freitas (Basic support level)
Joined: 08/15/2008
Posts: 8

Unfortunately pipes/sockets will not work for our purpose.

The data must be generated dynamically and must be exposed as a file.

We do have plans for addressing the EoF issue.

We've been working with the sample code for two days now. ... Still looking for that hello world addition to the sample...
#7334
Posted: 08/15/2008 11:02:18
by Eugene Mayevski (EldoS Corp.)

"Looking for" is not the right way - according to our support policy we don't provide samples on request (from unregistered customers). What I offer is modifying the sample code line by line and seeing when it stops working.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

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