EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Size of read

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#7849
Posted: 10/13/2008 17:45:42
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Hello, everyone.

I'm running into an issue that I don't quite understand and I'm hoping someone out there can explain it to me.

I open a file on my virtual disk and read it into a program like notepad and then close it. After that happens someone else externally to my Windows system writes some data into the file and changes its size. After that I go back and read the file with notepad and I only see the original file, not the new changes that were made.

I logged a lot of debugging messages to try to understand this and it seems like notepad does a call to the CbFsGetFileInfo callback to determine how many bytes it should read. When I get that call, my system passes back to CbFs in the EndOfFile parameter the correct length. This is followed immediately by a call to the CbFsReadFile callback where the BytesToRead parameter is somehow set to the old length of the file rather than the new length that I passed back in the GetFileInfo callback. So, my system only reads that amount of bytes and that is why I see only the old file data rather than the new data. I am quite puzzled as to why the CbFsReadFile callback is being passed the incorrect information in the BytesToRead parameter. Anybody have any ideas as to why this is happening?
#7850
Posted: 10/13/2008 18:28:39
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

I looked over my debugging logs a little closer and I think I may have an explanation for this.

When the CbFsGetFileInfo callback is called, I log the originating process and it is notepad, but when the CbFsReadFile callback is called, the originating process is the null string. I am also logging the process that opened the file and that is always Windows Explorer.

So, what I believe is happening is that because I mistakenly set CallAllOpenCloseCallbacks to FALSE!

I just reset it back to TRUE and I will let you know if that fixes the problem.
#7854
Posted: 10/14/2008 01:04:46
by Eugene Mayevski (EldoS Corp.)

"null" process is Memory Manager of Windows. Notepad works via memory-mapped files, which means that the file is mapped into a memory block and then Notepad works with it. When the file is closed, memory manager flushes the block of memory to the disk, but this can be not immediate.


Sincerely yours
Eugene Mayevski
#7856
Posted: 10/14/2008 06:18:39
by Volodymyr Zinin (EldoS Corp.)

Hello,

I've checked it and haven't been able to reproduce it. What type of the CallbackFS library (C++, Delphy, .NET2.0, .NET1.1) and what version of Windows do you use? And please specify in more details your actions that cause the problem.
#7860
Posted: 10/14/2008 10:02:45
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

I'm still experimenting with setting CallAllOpenCloseCallbacks to TRUE, I think the problem is still occurring but I'm not sure yet.

I use Windows XP Professional and I am using the C++ Library version of your API.
#7864
Posted: 10/14/2008 12:28:07
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Well with a little more experimentation I am now convinced that the problem lies somewhere in my system's code rather than yours, so you do not need to work on this anymore until I can find some more evidence that shows that CbFs may be doing something wrong. As of now, I believe you are doing everything right and my code is just not setting things correctly.
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

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