#include "giochannel-blind.h"
#include <glib-object.h>
#include "reactos/internal/se.h" /* for SeInit2() */
+#include "captive/leave.h"
/* Are we initialized? */
}
+BOOLEAN captive_cc_FileObject_delete(FILE_OBJECT *FileObject);
+void captive_cc_flush(void);
+
/**
* captive_shutdown:
*
g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: g_main_context_iteration() proceeded",G_STRLOC);
captive_PoQueueShutdownWorkItem_hooklist_invoke();
+ captive_cc_flush();
+
+ /* During IoShutdownRegisteredFileSystems() - IRP_MJ_SHUTDOWN to be specific
+ * some buffers will be written but after the IofCallDriver() it will be
+ * no longer possible to flush such buffers to their DeviceVolumeFile.
+ * Therefore we must flush such buffers on the fly although such behaviour
+ * would crash us in regular case as filesystems access BCBs even after their
+ * CcUnpinData().
+ */
+ captive_cc_unmounting=TRUE;
/* FIXME: ntoskrnl/ex/power.c/NtShutdownSystem() does
* IoShutdownRegistered{Devices,FileSystems} order; is it correct?
*/
IoShutdownRegisteredFileSystems();
+
+ /* Just a sanity check as all the dirty data should
+ * get already flushed during IoShutdownRegisteredFileSystems().
+ */
+ captive_cc_FileObject_delete(
+ NULL); /* FileObject */
+
IoShutdownRegisteredDevices();
/* libcaptive is not authorized to shutdown 'captive_image_channel'. */