Hi Frank,
thank you for reply!
IIUC, in general, RTFileWrite (on the host-OS) should (also in isolation!) mimic the behavior of the
"write" system call of the guest-OS (that gets forwarded to RTFileWrite via guest additions[1]).
(Even though "mimic" could actually only mean to equally handle the
modification time.)
For instance, [please use a monospaced font for this preformatted table]
Guest-OS Host-OS Behavior of RTFileWrite (on the Host) Implementation
of RTFileWrite
---------------------------------------------------------------------------------------------
Windows Linux as Windows' WriteFile, 1) cache
modif./creation time
i.e. not reseting modification *of the file*
(and creation?) time. (how the
guest-OS sees them),
2) call ´write´,
3) restore
cached parts of timestamp
Linux Windows as Linux' write, 1) call
´WriteFile´,
i.e. reset modification and 2) reset modif.
and creation times
creation time! to the current
*system time*
(how the
guest-OS sees it)!
Windows Windows as Windows' WriteFile simply call
´WriteFile´
Linux Linux as Linux' write simply call
´write´
[1] Do I understand this correctly? Do guest additions really intercept system calls (such as
WriteFile on Windows) and forward them (if desired) to the Host-OS VirtualBox services (such as
RTFileWrite)?
Kind regards,
Eugen
P.S. The table is also attached as a text file (in case the formatting goes
wrong here).
On 2012-02-29 22:33, Frank Mehnert wrote:
Eugen,
actually this was a helpful investigation. Indeed the file modification
time is handled different between a Windows host and a Linux host when
using RTFileWrite and a Windows guest does apparently first open the
file, then sets the modification time and writes to that file afterwards.
The fix is probably to cache the file modification time and set it
before the file is closed (the Microsoft documentation for WriteFile
says that the file must be closed to get the file modification time
correctly applied).
Kind regards,
Frank
Guest-OS Host-OS Behavior of RTFileWrite (on the Host) Implementation
of RTFileWrite
---------------------------------------------------------------------------------------------
Windows Linux as Windows' WriteFile, 1) cache
modif./creation time
i.e. not reseting modification *of the file*
(and creation?) time. (how the
guest-OS sees them),
2) call ´write´,
3) restore
cached parts of timestamp
Linux Windows as Linux' write, 1) call
´WriteFile´,
i.e. reset modification and 2) reset modif.
and creation times
creation time! to the current
*system time*
(how the
guest-OS sees it)!
Windows Windows as Windows' WriteFile simply call
´WriteFile´
Linux Linux as Linux' write simply call
´write´
_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev