File contains only zero's.
I've got a problem with an embedded PC which generates corrupted files during a shutdown-boot cycle. The corrupted files contain the correct (estimated) number of bytes, but all bytes have a zero value. To make the problem more interesting this occurs sometimes (after 1 cycle or after 30 cycles), and when it happens it can be possible that only the last number of bytes of the file contain zero's. Shutdown means that the power is shut down on the complete machine, thus stopping the PC immdiately. There's no way of forcing the OS to start a shutdown process.
Embedded PIV platform based on Intel 845GV chipset.
Harddisk: Maxtor Fireball 3 or Diamonmax Plus 8 (40Gb). Microsoft XP embedded, EWF using RAM overlay on c: partition. Corrupted files are created on NTFS non-EWF d: partition.
File handling code (c++):
m_hFile = CreateFile( fname,
GENERIC_WRITE | GENERIC_READ,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_RANDOM_ACCESS ,
And on the same file(s), not at the same time:
fp = fopen(fname,"rt");
I suspect that some kind of buffer failed to write (all) bytes to an already prepared file. This explains the number of bytes being zero. If this is an OS buffer, a filesystem buffer or a hardware buffer is unclear to me. Does one of you have experienced the same problem, or got any idea on how I can solve this problem? "
Afsluiting :) :
Thanks in advance,
Greetings from your big friend from The Netherlands,