From 5996afcd47047087f012511741e8916cf6ad4313 Mon Sep 17 00:00:00 2001 From: short <> Date: Sun, 5 Oct 2003 20:28:49 +0000 Subject: [PATCH] captive_shared_cache_map_data_validate_read(): Fixed validated mem to 'clean'. captive_shared_cache_map_purge(): Flush the buffers to disk. - Needed for FAT32 by fastfat.sys of NT-5.1sp1. --- src/libcaptive/cc/sharedcachemap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libcaptive/cc/sharedcachemap.c b/src/libcaptive/cc/sharedcachemap.c index 6dec135..46440b9 100644 --- a/src/libcaptive/cc/sharedcachemap.c +++ b/src/libcaptive/cc/sharedcachemap.c @@ -420,6 +420,7 @@ ULONG got; g_assert(got<=PAGE_SIZE); after_eof=(gotpages[now/PAGE_SIZE].data_valid=TRUE; + captive_shared_cache_map_object->pages[now/PAGE_SIZE].dirty=FALSE; } } @@ -462,6 +463,7 @@ guint64 now; for (now=start;nowpages[now/PAGE_SIZE].data_valid=TRUE; + /* .dirty is undefined */ } } @@ -532,11 +534,18 @@ CaptiveSharedCacheMapObject_page *page; g_signal_emit(captive_shared_cache_map_object,purge_signal,0); + /* Needed by fastfat.sys of NT-5.1sp1 during FAT32 unmount + * otherwise it fails on: g_assert(!page->dirty); + * It corrupts the disk if the buffer is dropped instead. + */ + captive_shared_cache_map_flush(captive_shared_cache_map_object, + 0,CAPTIVE_ROUND_UP64(captive_shared_cache_map_object->AllocationSize,PAGE_SIZE)); + for (offset=0;offsetAllocationSize,PAGE_SIZE);offset+=PAGE_SIZE) { page=captive_shared_cache_map_object->pages+offset/PAGE_SIZE; if (!page->data_valid) continue; - g_assert(!page->dirty); /* FIXME: Is it allowed by W32? */ + g_assert(!page->dirty); page->data_valid=FALSE; } } -- 1.8.3.1