Author: pschweitzer
Date: Sat Nov 1 21:09:10 2014
New Revision: 65174
URL: http://svn.reactos.org/svn/reactos?rev=65174&view=rev
Log:
[EXT2LIB]
Whatever happened during format, always unmount the volume.
This allows switching FS in usetup after formating an ext2 volume.
As a record, before (read, with the IopParseDevice) hack, this wasn't possible and if formating with ext2 was possible, kernel would have written with either RawFS or FastFAT driver. Which is not exactly what we want ;-).
But no joy guys... The Ext2Fsd needs to work in ReactOS first before we can effectively install ReactOS on ext2 volumes.
In any case, that's a clear step forward :-)
Modified:
trunk/reactos/lib/fslib/ext2lib/Mke2fs.c
Modified: trunk/reactos/lib/fslib/ext2lib/Mke2fs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/ext2lib/Mke2fs.c…
==============================================================================
--- trunk/reactos/lib/fslib/ext2lib/Mke2fs.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/ext2lib/Mke2fs.c [iso-8859-1] Sat Nov 1 21:09:10 2014
@@ -987,16 +987,10 @@
ext2_free_block_bitmap(&FileSys);
ext2_free_inode_bitmap(&FileSys);
- if (!bRet)
+ if(bLocked)
{
Ext2DisMountVolume(&FileSys);
- }
- else
- {
- if(bLocked)
- {
- Ext2UnLockVolume(&FileSys);
- }
+ Ext2UnLockVolume(&FileSys);
}
Ext2CloseDevice(&FileSys);
Author: pschweitzer
Date: Sat Nov 1 20:19:52 2014
New Revision: 65173
URL: http://svn.reactos.org/svn/reactos?rev=65173&view=rev
Log:
[FASTFAT]
Implement some kind of volume dismount in FastFAT (ie, implement VfatDismountVolume())
This is not fully perfect situation, but it does most of the job (+ leaking a few things). So far, this is not dramatic as its main use is for 1st stage. This will have to be improved later on.
CORE-8732 #comment Can you retest please?
Modified:
trunk/reactos/drivers/filesystems/fastfat/fsctl.c
Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] Sat Nov 1 20:19:52 2014
@@ -909,18 +909,77 @@
PVFAT_IRP_CONTEXT IrpContext)
{
PDEVICE_EXTENSION DeviceExt;
+ PLIST_ENTRY NextEntry;
+ PVFATFCB Fcb;
DPRINT1("VfatDismountVolume(%p)\n", IrpContext);
DeviceExt = IrpContext->DeviceExt;
+ /* We HAVE to be locked. Windows also allows dismount with no lock
+ * but we're here mainly for 1st stage, so KISS
+ */
if (!(DeviceExt->Flags & VCB_VOLUME_LOCKED))
{
return STATUS_ACCESS_DENIED;
}
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ /* Race condition? */
+ if (DeviceExt->Flags & VCB_DISMOUNT_PENDING)
+ {
+ return STATUS_VOLUME_DISMOUNTED;
+ }
+
+ /* Notify we'll dismount. Pass that point there's no reason we fail */
+ FsRtlNotifyVolumeEvent(IrpContext->Stack->FileObject, FSRTL_VOLUME_DISMOUNT);
+
+ ExAcquireResourceExclusiveLite(&DeviceExt->FatResource, TRUE);
+
+ /* Browse all the available FCBs first, and force data writing to disk */
+ for (NextEntry = DeviceExt->FcbListHead.Flink;
+ NextEntry != &DeviceExt->FcbListHead;
+ NextEntry = NextEntry->Flink)
+ {
+ Fcb = CONTAINING_RECORD(NextEntry, VFATFCB, FcbListEntry);
+
+ ExAcquireResourceExclusiveLite(&Fcb->MainResource, TRUE);
+ ExAcquireResourceExclusiveLite(&Fcb->PagingIoResource, TRUE);
+
+ if (Fcb->FileObject)
+ {
+ if (Fcb->Flags & FCB_IS_DIRTY)
+ {
+ VfatUpdateEntry(Fcb);
+ }
+
+ CcPurgeCacheSection(Fcb->FileObject->SectionObjectPointer, NULL, 0, FALSE);
+ CcUninitializeCacheMap(Fcb->FileObject, &Fcb->RFCB.FileSize, NULL);
+ }
+
+ ExReleaseResourceLite(&Fcb->PagingIoResource);
+ ExReleaseResourceLite(&Fcb->MainResource);
+ }
+
+ /* Rebrowse the FCB in order to free them now */
+ while (!IsListEmpty(&DeviceExt->FcbListHead))
+ {
+ NextEntry = RemoveHeadList(&DeviceExt->FcbListHead);
+ Fcb = CONTAINING_RECORD(NextEntry, VFATFCB, FcbListEntry);
+ vfatDestroyFCB(Fcb);
+ }
+
+ /* Mark we're being dismounted */
+ DeviceExt->Flags |= VCB_DISMOUNT_PENDING;
+ IrpContext->DeviceObject->Vpb->Flags &= ~VPB_MOUNTED;
+
+ ExReleaseResourceLite(&DeviceExt->FatResource);
+
+ /* Release a few resources and quit, we're done */
+ ExDeleteResourceLite(&DeviceExt->DirResource);
+ ExDeleteResourceLite(&DeviceExt->FatResource);
+ ObDereferenceObject(DeviceExt->FATFileObject);
+
+ return STATUS_SUCCESS;
}
/*
Author: hbelusca
Date: Sat Nov 1 17:51:39 2014
New Revision: 65170
URL: http://svn.reactos.org/svn/reactos?rev=65170&view=rev
Log:
[BASESRV]
- Correctly set the VdmPower flag when the process being started is a NT VDM
- Return a correct status code if VDM access is forbidden.
Modified:
trunk/reactos/subsystems/win/basesrv/proc.c
trunk/reactos/subsystems/win/basesrv/vdm.c
Modified: trunk/reactos/subsystems/win/basesrv/proc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win/basesrv/pro…
==============================================================================
--- trunk/reactos/subsystems/win/basesrv/proc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win/basesrv/proc.c [iso-8859-1] Sat Nov 1 17:51:39 2014
@@ -71,7 +71,7 @@
HANDLE ProcessHandle, ThreadHandle;
PCSR_THREAD CsrThread;
PCSR_PROCESS Process;
- ULONG Flags = 0, VdmPower = 0, DebugFlags = 0;
+ ULONG Flags = 0, DebugFlags = 0, VdmPower = 0;
/* Get the current client thread */
CsrThread = CsrGetClientThread();
@@ -82,6 +82,13 @@
/* Extract the flags out of the process handle */
Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3;
CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3);
+
+ /* Some things should be done if this is a VDM process */
+ if (CreateProcessRequest->VdmBinaryType)
+ {
+ /* We need to set the VDM power later on */
+ VdmPower = 1;
+ }
/* Duplicate the process handle */
Status = NtDuplicateObject(Process->ProcessHandle,
@@ -112,10 +119,9 @@
return Status;
}
- /* See if this is a VDM process */
+ /* If this is a VDM process, request VDM power */
if (VdmPower)
{
- /* Request VDM powers */
Status = NtSetInformationProcess(ProcessHandle,
ProcessWx86Information,
&VdmPower,
Modified: trunk/reactos/subsystems/win/basesrv/vdm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win/basesrv/vdm…
==============================================================================
--- trunk/reactos/subsystems/win/basesrv/vdm.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win/basesrv/vdm.c [iso-8859-1] Sat Nov 1 17:51:39 2014
@@ -576,7 +576,7 @@
BOOLEAN NewConsoleRecord = FALSE;
/* Don't do anything if the VDM has been disabled in the registry */
- if (!BaseSrvIsVdmAllowed()) return STATUS_ACCESS_DENIED;
+ if (!BaseSrvIsVdmAllowed()) return STATUS_VDM_DISALLOWED;
/* Validate the message buffers */
if (!CsrValidateMessageBuffer(ApiMessage,