Jin,
As Peter said, you cannot simply make modifications to the hard disk and
expect the applications to see the change. Sometimes it’ll happen to
work, but most times it won’t. To understand why, you must consider
that Windows has a fairly advanced cache manager, which keeps data that
was read from the HDD around in memory until there’s memory pressure(*).
So, on a machine with much memory, reads of a file can happen only once
from the HDD. This makes performance much better than constantly going
to the media.
As Peter said, you need to interact with the file system. This is
highly suggested for many reasons, but let me throw in a couple
interesting (and relatively common) scenarios (which may not matter in a
closed system):
- Mirrored HDD. Have to change both.
- Striped HDD. How to change any?
I believe that, as long as you are processing at passive level, you can
open a file from a driver. If you need to use the user’s buffer, you
may need to lock it down (depending on if you know you’re in the
caller’s context), but by using the file system directly you can ensure
proper cache updates.
Perhaps you could (Echo?) tell us what problem you are trying to solve
by doing this, and then someone on the list can share a known-good
method of solving that problem?
Hth,
.
(*) Yes, this is an over-simplification.
-----Original Message-----
From: Jin Ren [mailto:ren.j@263.net]
Sent: Thursday, July 21, 2005 9:12 PM
Subject: Re: How to make FS display the disk block level change
To build a fs driver will introduce new unpredictable problem to my
system,
so what I want is to find some alternative approach.
“Peter Wieland” wrote:xxxxx@ntdev…
You’re trying to change a block beneath the file system and have the FS
recognize this?
You can’t. You need to make the changes through the file system if you
want to ensure they’re visible through the file system.
-p