Any equivalent of FlushFileBuffers in kernel?

Hi,
Is there any equivalent of the following usermode code in the kernel? When
the usermode program executes this code, all the open files in C drive will
be closed and the data is flushed to the disk. I would like to do this in
the kernel mode. I tried CcFlushCache and CcPurgeCacheSection (using the
file object from ZwCreateFile) but I didn’t see any close files operation,
though the functions return success. I need to do this before I unload my
driver. Thanks for any suggestion!

Regards,
Sin Lam

============================================================
hFile = CreateFile(“\\.\C:”, GENERIC_ALL, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_DIRECTORY, NULL);
FlushFileBuffers(hFile);


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Use ZwFlushBuffersFile or assemble your own MJ_FLUSH_BUFFERS IRP and send it down to the FSD.

Max

----- Original Message -----
From: “Tan Sin Lam”
To: “File Systems Developers”
Sent: Wednesday, December 12, 2001 12:19 PM
Subject: [ntfsd] Any equivalent of FlushFileBuffers in kernel?

> Hi,
> Is there any equivalent of the following usermode code in the kernel? When
> the usermode program executes this code, all the open files in C drive will
> be closed and the data is flushed to the disk. I would like to do this in
> the kernel mode. I tried CcFlushCache and CcPurgeCacheSection (using the
> file object from ZwCreateFile) but I didn’t see any close files operation,
> though the functions return success. I need to do this before I unload my
> driver. Thanks for any suggestion!
>
> Regards,
> Sin Lam
>
> ============================================================
> hFile = CreateFile(“\\.\C:”, GENERIC_ALL, FILE_SHARE_READ, NULL,
> OPEN_EXISTING, FILE_ATTRIBUTE_DIRECTORY, NULL);
> FlushFileBuffers(hFile);
> ============================================================
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com