https://git.reactos.org/?p=reactos.git;a=commitdiff;h=16fcf694efc4115d5d354…
commit 16fcf694efc4115d5d354919cf861a81848139f2
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Mon Oct 21 12:58:30 2019 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Mon Oct 21 12:58:30 2019 +0200
[MOUNTMGR] Fix setting up reparse index file name
This fixes memory smashing while attempting to volume
reparse index (we were previously trying to copy the
name on itself, in the middle of itself...).
This code won't go farther on FAT, it requires NTFS.
Now, with this, ReactOS can properly boot with MountMgr
handling DOS devices without any crash or code disabled.
Cf: what was written in 7608ac9.
Modifications in class2, disk, and ntoskrnl are still to
be committed to enable all this.
---
drivers/filters/mountmgr/database.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/filters/mountmgr/database.c b/drivers/filters/mountmgr/database.c
index 5e94f5c9a50..a025f7db3ec 100644
--- a/drivers/filters/mountmgr/database.c
+++ b/drivers/filters/mountmgr/database.c
@@ -678,11 +678,10 @@ ReconcileThisDatabaseWithMasterWorker(IN PVOID Parameter)
goto ReleaseRDS;
}
-
RtlCopyMemory(ReparseFile.Buffer, DeviceInformation->DeviceName.Buffer,
DeviceInformation->DeviceName.Length);
RtlCopyMemory((PVOID)((ULONG_PTR)ReparseFile.Buffer + DeviceInformation->DeviceName.Length),
- ReparseFile.Buffer, ReparseFile.Length);
+ ReparseIndex.Buffer, ReparseIndex.Length);
ReparseFile.Buffer[ReparseFile.Length / sizeof(WCHAR)] = UNICODE_NULL;
InitializeObjectAttributes(&ObjectAttributes,
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bced3eaa25451d2aa093a…
commit bced3eaa25451d2aa093a4d338a63fdf0ca43b74
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Mon Oct 21 11:03:43 2019 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Mon Oct 21 11:03:43 2019 +0200
[MOUNTMGR] That was not meant to be committed
Even though it shows there might be a bug in the
code handling remote databases in the MountMgr ;-)
Addendum to 7608ac9
---
drivers/filters/mountmgr/database.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/filters/mountmgr/database.c b/drivers/filters/mountmgr/database.c
index 694c98a25fa..5e94f5c9a50 100644
--- a/drivers/filters/mountmgr/database.c
+++ b/drivers/filters/mountmgr/database.c
@@ -1622,9 +1622,6 @@ ReconcileThisDatabaseWithMaster(IN PDEVICE_EXTENSION DeviceExtension,
return;
}
- UNIMPLEMENTED;
- return;
-
/* Allocate a work item */
WorkItem = AllocatePool(sizeof(RECONCILE_WORK_ITEM));
if (!WorkItem)
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7608ac9f71956c2ef60a1…
commit 7608ac9f71956c2ef60a18b1e52f4b4f12749d05
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Mon Oct 21 10:54:51 2019 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Mon Oct 21 10:58:14 2019 +0200
[MOUNTMGR] Misc. fixes for WorkerThread()
- Properly quit the active loop when we're out of work items;
- Fix timeout duration (setting it to 1s);
- Fix handling the "Unloading" variable in case of a shutdown
so that waiting loop is properly stopped;
- Documented why we're waiting on VolumesSafeForWriteAccess.
This fixes shutting down ReactOS with work items queued.
This is needed here because no one ever sets that event (properly)
created by SMSS though. A. Ionescu was explaining in 2018 that it's
autochk responsibility, but it doesn't seem to be the case in W2K3.
To be investigated.
This fix with all the previous ones and more uncommitted stuff (yet ;-))
allows reaching the first steps towards a NT5 storage stack:
https://twitter.com/HeisSpiter/status/1186199631740506112
---
drivers/filters/mountmgr/database.c | 40 ++++++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/drivers/filters/mountmgr/database.c b/drivers/filters/mountmgr/database.c
index aa0c6a42ef5..694c98a25fa 100644
--- a/drivers/filters/mountmgr/database.c
+++ b/drivers/filters/mountmgr/database.c
@@ -1168,21 +1168,40 @@ WorkerThread(IN PDEVICE_OBJECT DeviceObject,
NULL,
NULL);
KeInitializeEvent(&Event, NotificationEvent, FALSE);
- Timeout.LowPart = 0xFFFFFFFF;
- Timeout.HighPart = 0xFF676980;
+ Timeout.QuadPart = -10000000LL; /* Wait for 1 second */
- /* Try to wait as long as possible */
- for (i = (Unloading ? 999 : 0); i < 1000; i++)
+ /* Wait as long as possible for clearance from autochk
+ * We will write remote databases only if it is safe
+ * to access volumes.
+ * First, given we start before SMSS, wait for the
+ * event creation.
+ */
+ i = 0;
+ do
{
- Status = ZwOpenEvent(&SafeEvent, EVENT_ALL_ACCESS, &ObjectAttributes);
- if (NT_SUCCESS(Status))
+ /* If we started to shutdown, stop waiting forever and jump to last attempt */
+ if (Unloading)
{
- break;
+ i = 999;
+ }
+ else
+ {
+ /* Attempt to open the event */
+ Status = ZwOpenEvent(&SafeEvent, EVENT_ALL_ACCESS, &ObjectAttributes);
+ if (NT_SUCCESS(Status))
+ {
+ break;
+ }
+
+ /* Wait a bit to give SMSS a chance to create the event */
+ KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &Timeout);
}
- KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &Timeout);
+ ++i;
}
+ while (i < 1000);
+ /* We managed to open the event, wait until autochk signals it */
if (i < 1000)
{
do
@@ -1220,7 +1239,7 @@ WorkerThread(IN PDEVICE_OBJECT DeviceObject,
IoFreeWorkItem(WorkItem->WorkItem);
FreePool(WorkItem);
- if (InterlockedDecrement(&(DeviceExtension->WorkerReferences)) == 0)
+ if (InterlockedDecrement(&(DeviceExtension->WorkerReferences)) < 0)
{
return;
}
@@ -1603,6 +1622,9 @@ ReconcileThisDatabaseWithMaster(IN PDEVICE_EXTENSION DeviceExtension,
return;
}
+ UNIMPLEMENTED;
+ return;
+
/* Allocate a work item */
WorkItem = AllocatePool(sizeof(RECONCILE_WORK_ITEM));
if (!WorkItem)