https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c79e5dc476a7041b018eb…
commit c79e5dc476a7041b018eba6eaf532f75d00be4f6
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Aug 12 10:05:25 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Aug 12 10:05:25 2018 +0200
[KMTESTS:MM] Properly clean up files
This fixes driver unloading on Windows.
ROSTESTS-266
---
modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c
b/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c
index 45f20b5e85..a547207f21 100644
--- a/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c
+++ b/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c
@@ -413,13 +413,16 @@ TestIrpHandler(
{
Fcb = IoStack->FileObject->FsContext;
ok(Fcb != NULL, "Null pointer!\n");
- if (IoStack->FileObject->SectionObjectPointer != NULL &&
- IoStack->FileObject->SectionObjectPointer->SharedCacheMap != NULL)
+ if (IoStack->FileObject->SectionObjectPointer != NULL)
{
LARGE_INTEGER Zero = RTL_CONSTANT_LARGE_INTEGER(0LL);
- CcFlushCache(&Fcb->SectionObjectPointers, NULL, 0, NULL);
- CcPurgeCacheSection(&Fcb->SectionObjectPointers, NULL, 0, FALSE);
+ if (CcIsFileCached(IoStack->FileObject))
+ {
+ CcFlushCache(&Fcb->SectionObjectPointers, NULL, 0, NULL);
+ CcPurgeCacheSection(&Fcb->SectionObjectPointers, NULL, 0, FALSE);
+ }
+
KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE);
CcUninitializeCacheMap(IoStack->FileObject, &Zero,
&CacheUninitEvent);
KeWaitForSingleObject(&CacheUninitEvent.Event, Executive, KernelMode,
FALSE, NULL);