-
参考
1
:
void
PurgeFileSystemBuffers<
/p>
(
PFILE_OBJECT
FileObject
)
{
KeEnterCritical
Region
();
if
(
ExAcquireResourceExclusiveLite
p>
(
((
PFSR
TL_COMMON_FCB_HEADER
)
FileO
p>
bject
->
FsContext
)->
Resource
,
< br>
FALSE
))
{
if
(
FileObject
->
p>
SectionObjectPointer
)
{
IoSetTopLevelIrp
(
(
PIRP
)
FSRTL_FSP_
TOP_LEVEL_IRP
);
CcFlushCache
(
FileObject
->
SectionObjectPointer
,
NULL
,
0
,
NULL
);
if
(
FileObject
->
SectionObjectPointer
->
ImageSectionObject
)
{
MmFlushImageSection
(
FileObject
->
SectionObjectPointer
,
MmFlushForWrite
//MmFlushForDelete//
)
;
}
if
(
FileObject
->
SectionObje
ctPointer
->
DataSectionObject
)
{
CcPurgeCacheSection
(
FileObj
ect
->
SectionObjectPointer
,
NULL
,
0
,
TRUE
);
//
为
TRUE
,会强迫所有的
FileOb
ject
重新初始化
Cache
}
if
(
FileObject
->
PrivateCacheMap
)
{
CcUninitializeCacheMap
(
FileObject
,
NULL
,
NULL
);;
}
if
(
FileObject
->
SectionObje
ctPointer
->
DataSectionObject
)
{
//rt
=
DELAY_ONE_MILLISECOND
*
500;//500ms
//KeDelayExecutionThread(KernelMode,
FALSE, &Interval);
MmForceSectionClosed
(
FileOb
ject
->
SectionObjectPointer
p>
,
<
/p>
TRUE
//
改为
TRUE,
彻底刷新缓存
!!!
);
}
IoSetT
opLevelIrp
(
NULL
);
}
ExReleaseResourceLite
(
((
PFSRTL_COMMON_FCB_HEADER
)
FileObject
->
F
sContext
)->
Resou
rce
);
}
KeLeaveCritica
lRegion
();
}
参考
2
:
void
ManageFileCache
(
PFILE_OBJECT
pFileObject
)
{
PFSRTL_COMMON_FCB_HEADER
pFcb
;
LARGE_INTEGER
liInterval
;
//BOOLEAN bNeedReleaseResource = FALSE;
//BOOLEAN
bNeedReleasePagingIoResource = FALSE;
KIRQL irql
;
BOOLEAN bLockedResource
=
FALSE
;
BOOLEAN bLockedPagingIoResource
p>
=
FALSE
;
BOOLEAN bReleaseResource
=
FALSE
;
BOOLEAN bReleasePagingIoResource<
/p>
=
FALSE
;
pFcb
=
(
PFSRTL_COMMON_FCB_HEADER
)
pFileObject
->
FsContext
;
if
(
pFcb
==
NULL
)
{
return
;
}
irql
=
KeGetCurrentIrql
();
if
(
irql
>=
DISPATCH_LEVEL
)
{
return
;
}
liInterval
.
QuadPart
=
-
1
*
(
LON
GLONG
)
50
;
< br>
//KeEnterCriticalRegion();
bLockedPagingIoResource
=
-
-
-
-
-
-
-
-
-
上一篇:国家崛起之爱国战争秘籍
下一篇:BUSINESS REPORT范文