Windows 7 Embedded - Disable Disk Caching Programmatically:

266 Views Asked by At

Preface:

We are using a Windows-7-Embedded image, for making client-ready copies of our software.

The flow is pretty standard:

  1. Take a blank hard-drive.
  2. Restore an in-house Windows-7-Embedded image on the hard-drive.
  3. Install additional software on-top.
  4. Hard-drive ready!

The Problem:

Sometimes, probably due to system crashes, some configurations that are already configured inside the image - reset.

My current problem is with a 'Disable Write Caching' option on the disk. In the image, the option is off. Sometimes, it just resets and turns on.

My Question:

How can I programmatically disable the disk write caching property?

Design Restrictions:

  • Can run an .exe on startup. The system is mostly c++ so that is that would be the optimal language for a code based solution.
  • Can run a .bat file.
  • can run a .vbs file. Not sure which version our current infrastructure are compatible with.

Images (Inside Image -> After Crash):

The Disk Write Caching Option Off The Disk Write Caching Option On

Clarifications:

  • Did my research. did not find anything related to windows write caching option in SO or SE as a whole. Did find a bunch of linux related questions.
  • The system crashes are by-design, at the moment. This is the obvious root cause, but cannot be fixed due to design restrictions and budget issues.
1

There are 1 best solutions below

0
On

There is a registry setting EnableCache you may try to experiment with. It applies to FAT file systems and setting it to 0 shall theoretically disable disk caching. Though I have not tested it.

Look into: HKEY_LOCAL_MACHINE\SYSTEM\StorageManager\FATFS or HKEY_LOCAL_MACHINE\SYSTEM\StorageManager\EXFAT