Commit graph

69 commits

Author SHA1 Message Date
Serge Gautherie 5ba5051f79 [FLTMGR] CreateClientPort(): Fix ObInsertObject() error handling
Avoid extra ObDereferenceObject().

CORE-17904
2021-12-28 02:27:50 +03:00
Jérôme Gardou 3adf450867 [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build
Put data into PAGEDATA or INITDATA sections
Keep section declaration for prototypes

CORE-17540
2021-05-12 11:04:29 +02:00
Victor Perevertkin ba447018c8
[MOUNTMGR] Move the driver to drivers/storage
Effectively mountmgr.sys is an essential part of the storage stack
2020-11-01 12:35:56 +03:00
Nguyen Trung Khanh 9adcacdbc8
[MOUNTMGR] Fix pool memory disclosure in QueryPointsFromMemory (#3022) 2020-08-17 16:45:35 +02:00
Victor Perevertkin a77a65ab6d
[MOUNTMGR] Avoid an endless loop while sending GUID_IO_VOLUME_NAME_CHANGE notification 2020-08-01 04:58:08 +03:00
Victor Perevertkin 7e069ccdb2
[CMAKE] Replace custom functions to built-in ones
add_target_compile_definitions -> target_compile_definitions
add_target_compile_flags -> target_compile_options
add_target_include_directories -> target_include_directories
2020-04-16 15:59:38 +03:00
Hermès Bélusca-Maïto 7e0927a39f
[FLTMGR][NDK] Fix typos. 2020-04-09 16:05:26 +02:00
Thomas Faber 9215413a68
[FLTMGR] Safely query object name in FltpGetObjectName. CID 1420811 2020-01-18 13:19:22 +01:00
Mark Jansen d4a0549eb6
[MOUNTMGR] Fix out of bounds write
CORE-16530
2019-11-23 16:24:56 +01:00
Pierre Schweitzer 457612702b
[MOUNTMGR] Fix invalid WorkerReferences check in QueueWorkItem()
This fixes shutting down ReactOS under certain circumstances, where
the references were incremented, but no worker thread started.
Also, took the opportunity to clarify the WorkerReferences comparisons
where relevant.

CORE-16446
2019-10-22 21:53:48 +02:00
Pierre Schweitzer 16fcf694ef
[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.
2019-10-21 12:58:30 +02:00
Pierre Schweitzer bced3eaa25
[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
2019-10-21 11:03:43 +02:00
Pierre Schweitzer 7608ac9f71
[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
2019-10-21 10:58:14 +02:00
Pierre Schweitzer a058e680b6
[MOUNTMGR] Don't kill Mm when a device has several symlinks
On preflight to compute output size, device name & unique ID were
counted only once per device.
Then, on copy, these two were copied on every MOUNTMGR_MOUNT_POINT
structure. This is counter efficient (data duplication) but also,
it was overruning the output buffer, since the preflight was not
expecting these extra copies.
2019-10-19 18:04:30 +02:00
Pierre Schweitzer a53992180d
[MOUNTMGR] Fix enumerating drive letter for creating new mountpoint
This is purely a copypasta error fix, which was causing MountMgrNextDriveLetterWorker
to fail as no drive letters were enumerated previously.

With that set of patches, MountMgr now properly assigns drive letters to
new devices!
2019-10-19 16:59:58 +02:00
Pierre Schweitzer e359a3c888
[MOUNTMGR] Fix interpretation of QueryDeviceInformation GptDriveLetter
Being TRUE doesn't mean the device is GPT and has a drive letter. It just
means that it's not a GPT device with GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER
attribute. In short, if TRUE, it means that the device can receive a drive
letter mount point.

This fixes MountMgrNextDriveLetterWorker bailing out for any attempt to
assign a drive letter to a device.
2019-10-19 16:59:58 +02:00
Pierre Schweitzer 961693f060
[MOUNTMGR] Fix IsFtVolume so that it returns TRUE only for FT volumes 2019-10-19 16:59:58 +02:00
Pierre Schweitzer 225a1e92bd
[MOUNTMGR] Query proper device when creating mount point
We must query the target device, and not the symbolic link
we attempt to create. The later will always fail as it doesn't
exist yet.

This fixes MountMgrCreatePointWorker not working.
2019-10-19 16:59:57 +02:00
Pierre Schweitzer 7b650d2c3e
[MOUNTMGR] Remove cancel routine before completing pending IRP 2019-10-19 16:59:57 +02:00
Pierre Schweitzer 2da92ac67b
[MOUNTMGR] QueryPointsFromMemory: take into account the multiple MOUNTMGR_MOUNT_POINT
This fixes returning too small structure on an IOCTL_MOUNTMGR_QUERY_POINTS call.
The multiple MOUNTMGR_MOUNT_POINT structures were ignored and thus the data of the
first one were erased by the multiple structures.
MountMgr now returns consistent output on this IOCTL call.
2019-10-17 22:42:47 +02:00
Serge Gautherie f5f52417cb [MOUNTMGR] QueryPointsFromSymbolicLinkName(): Fix a copypasta
Addendum to r55156.

CORE-16371
2019-10-16 21:07:47 +02:00
Serge Gautherie 09beb7502e [MOUNTMGR] Properly look for device and break when found
Also use same pattern in MountMgrCreatePointWorker().

Addendum to a7f97cc70f.
2019-10-06 10:58:30 +02:00
Serge Gautherie 9f8e5d1ce0 [MOUNTMGR] QueryPointsFromMemory(): Do not leak DeviceName.Buffer
Follow-up to 7601011f4e.
2019-10-06 10:52:05 +02:00
Pierre Schweitzer a7f97cc70f
[MOUNTMGR] Properly look for symlink and break when found
This fixes a bug where MountMgr was returning first found entry
on query even when not matching the requested device.
2019-10-05 21:30:55 +02:00
Serge Gautherie 085528c31a [MOUNTMGR] HasDriveLetter(): Simplify code by using a for() loop 2019-09-22 10:25:09 +02:00
Pierre Schweitzer bf6215c601
[MOUNTMGR] Properly enumerate pending IRPs on cleanup
CORE-16370
2019-09-14 09:41:47 +02:00
Pierre Schweitzer 0a5f86d44a
[MOUNTMGR] Fix MountState usage in MountMgrTargetDeviceNotification
CORE-13882
2019-09-13 20:08:39 +02:00
Pierre Schweitzer 5c678a76a6
[MOUNTMGR] Fix broken check
Only mark volume mounted if it's not waiting for unloading

CORE-13882
2019-09-13 20:08:39 +02:00
Pierre Schweitzer d904ee19c5
[MOUNTMGR] Properly return EpicNumber in MountMgrChangeNotify 2019-09-07 23:07:54 +02:00
Serge Gautherie b45f27cf2e [MOUNTMGR] Remove a leftover UNREFERENCED_PARAMETER()
Addendum to 77657c22c9.
2019-09-06 08:34:14 +02:00
Pierre Schweitzer ff19ce934b
[MOUNTMGR] Don't overrun output buffer in QueryPointsFromMemory 2019-09-06 08:30:18 +02:00
Pierre Schweitzer 26a31b160a
[MOUNTMGR] Fix QueryPointsFromSymbolicLinkName and make it working
Select the current stack location for output buffer
And set output size so that buffer gets properly copied to caller
2019-09-06 08:28:36 +02:00
Pierre Schweitzer d592e00dfa
[MOUNTMGR] Fix QueryPointsFromMemory and make it working
Select the current stack location for output buffer
And set output size so that buffer gets properly copied to caller
2019-09-05 08:36:19 +02:00
Pierre Schweitzer 70d29ec423
[MOUNTMGR] Properly validate input buffer size
This avoids IOCTL_MOUNTMGR_QUERY_POINTS always failing
2019-09-05 08:36:19 +02:00
Pierre Schweitzer 77657c22c9
[MOUNTMGR] Fix global symbolic link creations
They were wrongly pointing to the original target once rewritten
instead of pointing to the proper target: the device.

This notably fixes opening the MountMgr device from user
mode (to perform IOCTL calls, for instance), and might
also fix various bugs dealing with global namespaces.
This might have some various effects in ReactOS~.
2019-09-05 08:36:19 +02:00
Bișoc George 42ce8519b6 [FASTFAT][FLTMGR][NTOS] Do not explicitly call ObfDereferenceObject() (#1636)
"Most code should not directly call the platform-specific ObfDereferenceObject() function but use the ObDereferenceObject() macro instead."

CORE-16081
2019-06-22 16:20:58 +02:00
Jérôme Gardou 23373acbb9 [CMAKE] Use modules instead of shared libraries
There is no need to compile our DLLs as shared libraries since we are
managing symbols exports and imports through spec files.

On my system, this reduces the configure-time by a factor of two.
2019-04-06 17:43:38 +02:00
Hermès Bélusca-Maïto b6c49bdff2
[MOUNTMGR] Fix MSVC build after commit 53abbb06. 2019-01-27 16:09:54 +01:00
Hermès Bélusca-Maïto 53abbb06b5
[MOUNTMGR][MUP] Use global definition of INIT_FUNCTION/INIT_SECTION (Addendum to 71fefa32). 2019-01-27 02:40:11 +01:00
Pierre Schweitzer 20ddde0a97
[MOUNTMGR] Misc. fixes to QueryDeviceInformation:
- Simplify failure path for DeviceName query failure
- Don't make stable query failure fail the whole function call

Based on a patch by Vadim Galiant

CORE-15550
2019-01-20 17:38:29 +01:00
Pierre Schweitzer d84ab9ec7c
[MOUNTMGR] Fix buffer length checking
Found by Vadim Galiant.

CORE-15549
2019-01-03 23:12:16 +01:00
Pierre Schweitzer f39f25ca17 [FLTMGR] Remove duplicated export 2018-10-29 23:56:39 +01:00
Ged Murphy fa46f362ea [FLTMGR] Add a bit more basic code layout for filter registration
Needs implementing
2018-10-29 23:56:39 +01:00
Pierre Schweitzer 97066b792c [FLTMGR] Remove duplicated export 2018-10-29 23:56:39 +01:00
Ged Murphy c73c1825e2 [FLTMGR] Callers must have registered an unload routine to be allowed to unload 2018-10-29 23:56:39 +01:00
Ged Murphy 4d603e689e [FLTMGR] Delete unused file 2018-10-29 23:56:39 +01:00
Pierre Schweitzer f21a2a6cfb [FLTMGR] Stub FltReleaseFileNameInformation() 2018-10-29 23:56:39 +01:00
Pierre Schweitzer c6b9ee5649 [FLTMGR] Stub FltGetDestinationFileNameInformation() 2018-10-29 23:56:39 +01:00
Pierre Schweitzer 08c4954007 [FLTMGR] Stub FltAttachVolume() 2018-10-29 23:56:39 +01:00
Pierre Schweitzer b67887df10 [FLTMGR] Export FltCreateCommunicationPort() and FltCloseCommunicationPort() 2018-10-29 23:56:39 +01:00