EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Office file saving.

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#33041
Posted: 04/15/2015 10:50:14
by Paolo Manili (Basic support level)
Joined: 02/23/2015
Posts: 16

Hi everyone,

we are experiencing difficulties with Office's atomic save operations inside CBFS volume backed by a database and encrypted storage.
I have searched the forum for other relevant discussions on the subject but it is not very clear what the expected behavior is in some cases.

Saving an example.docx file:
1)Creation of example.docx.
2)Deletion of example.docx
3)Creation of example.docx
4)Deletion of example.docx.
5)Creation of ~WRD000.TMP
(Here it gets strange)
6)Read of 4K from the start of the ~WRD000.TMP File
First question. The file is empty so far. What values should we give back as bytes read?
Should we say 0 or populate the passed Buffer with zeroes?
Mapper sample appears to give back a zeroes Buffer.
7)Write of a small number of bytes from a given offset (example 583 -> 952) to ~WRD000.TMP
9)Read of 4K from the start of the ~WRD000.TMP file
We expect to give back 952bytes read and a buffer containing zeroes up to byte 583. is this correct?
Or should we report 369 bytes read and a buffer beginning with the first non zero byte?
10) Word then proceeds to write and read random portions of the file and eventually gives up on the operation.


I know that the expected end of the operation should be word renaming the TMP file to the definitive name but we never get that far.

Possibly Relevant information:
We understand we must be supplying data the wrong way in this case, but it only happens to us with Office files.
Currently testing on Windows 8.1 Office 2010 and 2013.
We are currently mounting as a network drive.

Thanks in advance for any help you can provide.
Paolo Manili
#33042
Posted: 04/15/2015 10:56:08
by Eugene Mayevski (EldoS Corp.)

Quote
paolo.manili wrote:
6)Read of 4K from the start of the ~WRD000.TMP File First question. The file is empty so far. What values should we give back as bytes read? Should we say 0 or populate the passed Buffer with zeroes? Mapper sample appears to give back a zeroes Buffer.


You return whatever you have in the file so far. Returning zero-filled buffer is an obvious choice here. Mapper returns what the underlying real file system gives, which is also zeros.

Quote
paolo.manili wrote:
9)Read of 4K from the start of the ~WRD000.TMP file We expect to give back 952bytes read and a buffer containing zeroes up to byte 583. is this correct? Or should we report 369 bytes read and a buffer beginning with the first non zero byte?


You return exactly what was asked. If you were asked for 4 Kb of data, you must return 4Kb of data. I.e. you return junk (or zeros) in bytes 0 to 583, then some bytes of actual data, then junk or zeros from position 952 to the end of the buffer.

If you do the above correctly, Word will not complain.

Random-access reads and writes are perfectly correct operations for any file system, so you should be prepared for requests going beyond the end of file, or writes in the middle etc.


Sincerely yours
Eugene Mayevski

Reply

Statistics

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