Commit graph

193 commits

Author SHA1 Message Date
Timo Kreuzer 0c2cdcae83 [REACTOS] Add missing line breaks at end of file 2024-10-06 10:47:11 +03:00
Hermès Bélusca-Maïto 61b7fb99eb
[PARTMGR] Filter some currently-unimplemented MountMgr MOUNTDEV notifications.
CORE-17200

Helps reducing debug log noise like:
```
(drivers\storage\port\scsiport\ioctl.c:542) unknown ioctl code: 0x4D0018
```

The other notifications are already implemented there.
These are handled by the volume manager, which is currently
stubbed into ReactOS' partition manager.

See commit ed27d733f7 for what the deprecated versions
of IOCTL_MOUNTDEV_LINK_[CREATED|DELETED] are all about.
2024-07-17 17:24:26 +02:00
Hermès Bélusca-Maïto 9e07d0cc74
[PARTMGR] Trigger mount points removal when a partition/volume is deleted (#7034)
CORE-18139

When a partition is created, PartMgr notifies the volume manager
(FTDisk on Windows <= 2003, VolMgr on Vista+) of its presence.
(Note that currently in ReactOS, our partmgr does the job of both
PartMgr *AND* VolMgr.)
The VolMgr then sends a `GUID_DEVINTERFACE_VOLUME` PnP notification,
which is handled by the mount manager (MountMgr) as part of a
`GUID_DEVICE_INTERFACE_ARRIVAL` notification:
```
MountMgr!MountMgrMountedDeviceNotification -> MountMgrMountedDeviceArrival
followed by
MountMgr!MountMgrTargetDeviceNotification
```

When a partition is deleted, via e.g. Disk Management or DiskPart,
it can be observed, on Windows, that the PartMgr gets notified by
the PnP manager, as part of QueryDeviceRelations. Before actually
removing the partition, it notifies the VolMgr. The latter invalidates
any volume mounted on that partition (`*PartitionRemoved*` functions
for basic volumes), then requests (`*DeleteMountPoints` function)
the MountMgr to delete all the mount points associated to the volume:
```
VolMgr!*DeleteMountPoints
-> MountMgr!MountMgrDeviceControl -> MountMgrDeletePoints
```
**** THIS is the new functionality that is implemented for ReactOS ****
**** in the present commit.                                        ****

Following this, a subsequent PnP notification is sent, which calls
```
MountMgr!MountMgrTargetDeviceNotification
-> MountMgr!MountMgrMountedDeviceRemoval
```
(Note that this observation somewhat invalidates the modification
made in ReactOS commit 62a4f9d42b : our MountMgr placed in Windows
*WOULD* receive a `GUID_TARGET_DEVICE_REMOVE_COMPLETE` target-device
notification...)

Finally, a `GUID_DEVICE_INTERFACE_REMOVAL` PnP notification is sent
to the MountMgr:
```
MountMgr!MountMgrMountedDeviceNotification
-> MountMgr!MountMgrMountedDeviceRemoval
```
2024-07-11 13:46:52 +02:00
Hermès Bélusca-Maïto 7e89227a00
[MOUNTMGR] Fix initial sending of device online notification (#7030)
1. MountMgrMountedDeviceArrival():
   Fix the conditions under which the device's online notifications
   are skipped (SkipNotifications == TRUE) and fix the code comments.
   Now, things make much more sense:
   online notifications are skipped when the device is already offline
   or is a legacy (NT <= 4) fault-tolerant volume (see point 2 below),
   or is NOT mounted (doesn't have a drive letter).
   Previously, we were sending an online notification if the device
   was NOT mounted (why?!...) or if it was deemed as "valid" (wrongly
   determined, see point 2 below).

2. QueryDeviceInformation():
   * The usage of the "Valid" parameter didn't make much sense. Indeed,
     when a partition/volume device is reported to the Mount Manager,
     it's already valid. (Also, setting "Valid" to TRUE only in the case
     of an MBR partition while ignoring GPT ones, and resetting it to
     FALSE if IOCTL_STORAGE_GET_DEVICE_NUMBER returned success, pointed
     to something incorrect was going on.)
     Instead, what we are checking here is whether the device is a
     legacy fault-tolerant volume: such volume can only reside on an
     MBR disk, have the expected partition type, and does not really
     reside on a specific storage device (hence the check for
     IOCTL_STORAGE_GET_DEVICE_NUMBER returning failure).

   * Take also the opportunity to SAL2-ify the function.
2024-06-25 22:51:08 +02:00
Hermès Bélusca-Maïto 5f26356079
[MOUNTMGR] Rectify "NoAutoMount" usage (#7030)
This "NoAutoMount" member was not consistently used. Sometimes it was
used correctly, some other times it was used as "not NoAutoMount" i.e.
"AutoMount" enabled.
Fix this consistently throughout the source, and fix also some comments.
2024-06-25 22:51:07 +02:00
Hermès Bélusca-Maïto ab0e04c81d
[MOUNTMGR] Introduce MountMgrSendSyncDeviceIoCtl() to replace repeated code (#6960)
See https://www.osr.com/blog/2018/02/14/beware-iobuilddeviceiocontrolrequest/
for some details about IRQL requirements.
2024-06-13 20:01:16 +02:00
Hermès Bélusca-Maïto ed27d733f7
[MOUNTMGR][DDK] Fix some IOCTLs definitions to Win2k3+ compatibility (#6959)
Fix IOCTL_MOUNTDEV_LINK_CREATED, IOCTL_MOUNTDEV_LINK_DELETED,
IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY, to Win2k3+ compatible definitions.
The previous versions of these IOCTLs (in Win2000 and XP) were defined without any access protection.

This was noticed here:
https://community.osr.com/t/ioctl-mountdev-link-created-definition-changed/29428
2024-06-12 12:31:32 +02:00
Hermès Bélusca-Maïto 7930bed0a1
[MPR][MOUNTMGR][DDK] Remove unused wine-specific code (#6958)
Usage of these in MPR was already inside #ifndef __REACTOS__ block,
so, "This Is Fine".
2024-06-12 12:29:22 +02:00
Hermès Bélusca-Maïto 0d36818422
[MOUNTMGR] Some cleanup 2024-06-12 12:29:06 +02:00
Hermès Bélusca-Maïto e80cd6760c
[PARTMGR] Reimplement IOCTL_MOUNTDEV_QUERY_UNIQUE_ID for MBR and GPT partitions (#6926)
CORE-15575

In addition, fix a PartitionId assignment copy-paste error in PartitionCreateDevice().

The returned standard UniqueId has the following format:

- Basic volume on MBR disk: disk Mbr.Signature + partition StartingOffset (length: 0x0C)
- Basic volume on GPT disk: "DMIO:ID:" + Gpt.PartitionGuid (length: 0x18)
- Volume on Basic disk (NT <= 4): 8-byte FTDisk identifier (length: 0x08)
- Volume on Dynamic disk (NT 5+): "DMIO:ID:" + dmio VolumeGuid (length: 0x18)
- Super-floppy (single-partition with StartingOffset == 0),
  or Removable media: DiskInterfaceName.
- As fallback, we use the VolumeInterfaceName.

References:
- https://winreg-kb.readthedocs.io/en/latest/sources/system-keys/Mounted-devices.html
- https://stackoverflow.com/a/72787681/21852502
- Manual testing on Windows.
2024-06-12 12:15:31 +02:00
Hermès Bélusca-Maïto 3d26d76a4c
[PARTMGR] Detect and flag partitionless ("super-floppy") disks (#6926)
CORE-15575

Detect whether the disk is a "super-floppy", which is the name given
to partitionless disk having no MBR, with the unique partition volume
starting at sector offset zero and spanning the whole disk.
The name comes from the fact that at the partitioning level, the disk
"looks like" a large-capacity floppy disk.

This is typically how external removable (USB, ...) drives are
partitioned by default by Windows.

https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-and-gpt-faq?view=windows-11#superfloppy

The kernel-mode functions IoReadPartitionTable() / IoWritePartitionTable()
report the drive layout of a "super-floppy" disk as follows:
an MBR-style disk containing only one single partition starting at the
beginning of the disk (StartingOffset == 0) without hidden sectors, and
its type being FAT16 non-bootable.
The disk NTFT signature is set to 0x00000001.

----

Additional bug fixes to make the feature work reliably:

- Make PartMgrGetDriveLayout() also update the FDO DiskData's
  PartitionStyle and Signature/GPT DiskId for consistency (code moved
  from PartMgrRefreshDiskData()).

- In FdoIoctlDiskSetDriveLayout[Ex](), if the disk is "super-floppy",
  but the user wants to create more than one partition, fail the call.
  (In the Ex call, fail also if the partition style changes.)
2024-06-12 12:15:22 +02:00
Hermès Bélusca-Maïto 33ac3578fd
[PARTMGR] Fix the way the "symlink -> target" DPRINT is displayed 2024-06-12 12:14:53 +02:00
Hermès Bélusca-Maïto 2d6bbdc6ed
[PARTMGR] Fix x64 build warning
warning C4267: 'function': conversion from 'size_t' to 'ULONG', possible loss of data'

The OutputBufferLength member that was temporarily stored in
outBufferLength is already a ULONG, and IssueSyncIoControlRequest()
takes the length as a ULONG. So there is no need to use 'size_t' here.
2024-06-12 12:14:45 +02:00
Hermès Bélusca-Maïto 0a8b421d53
[PARTMGR] Implement IOCTL_VOLUME_QUERY_VOLUME_NUMBER and IOCTL_VOLUME_IS_PARTITION (#6911)
- Implement IOCTL_VOLUME_QUERY_VOLUME_NUMBER:
  See usage example in:
  7241cebfa2/mayfield/branches/spr/src/umapps/ndassvc/service/drivematch.cpp (L627)

- Stubplement IOCTL_VOLUME_IS_PARTITION:
  The only type of volume we support right now is disk partition
  so we just return success. A more robust algorithm would be
  to check whether the volume has only one single extent, that
  covers the whole partition on which it lies upon. If this is
  not the case, return STATUS_UNSUCCESSFUL instead.
2024-06-10 21:32:47 +02:00
Andrei Miloiu 9ecf552fe4
[DRIVERS][INF] Update Romanian (ro-RO) translation (#6088) 2023-12-09 20:19:54 +01:00
Dmitry Borisov c0c57e2324 [PCIIDEX] Improve and fix the driver
- Fix IRP handling, add missing IRP handlers
- Specify the device name for DO
- The legacy IRQ descriptor is edge-triggered
- Improve pool tagging
- Place the PNP code in a pageable section

CORE-17256
2023-07-16 13:20:30 +03:00
Hermès Bélusca-Maïto 157491e297
[STORPORT] MaximumNumberOfLogicalUnits should be initialized to SCSI_MAXIMUM_LOGICAL_UNITS
See https://www.osronline.com/article.cfm%5Earticle=538.htm
2023-06-19 21:10:53 +02:00
Hermès Bélusca-Maïto 3bc71f9086
[FREELDR][SCSIPORT][STORPORT] Use existing defines for some hardcoded max values.
See https://www.osronline.com/article.cfm%5Earticle=538.htm

[SCSIPORT] Remove 'MaxBus' variable, deprecated since commit fc3d38d1c (r26220).
2023-06-19 21:10:51 +02:00
Hermès Bélusca-Maïto 4f41000714
[FLOPPY] "zero" parameters in IoQueryDeviceDescription() call are NULL pointers. 2023-06-14 11:24:47 +02:00
Atharva Kulkarni 6eee9f9daf
[SCSIPORT] Flush and Free Map Registers (#5190)
- Flush Map registers once the DMA completes
- Free Map registers once the DMA completes
- Add support for SGL allocated from NonPagedPool

Test:
Force Allocations of SGL from Non Paged Pool and ensure OS boots and functions properly

Test Logs:
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
DHCPCSVC: Adapter Name: [{7cd69ac0-dabb-410a-b927-cb3961d174da}] (dynamic)
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
WARNING:  HalCalculateScatterGatherListSize at hal\halx86\generic\dma.c:1168 is UNIMPLEMENTED!
SpiAdapterControlFORCING ALLOCATION FROM SGPOOL
SpiAdapterControlFORCING ALLOCATION FROM SGPOO
2023-04-21 12:44:31 +02:00
Joachim Henze 16decc61be [UNIATA] PROPERLY mark the rosdiff when touching 3rd party code
This is an addendum to 0.4.15-dev-5854-g 08248e83a0 from (#5053).

The review requests had not been addressed entirely before committing!
2023-03-22 06:18:54 +01:00
Atharva Kulkarni 08248e83a0
[UNIATA] Fix Memory leak while claiming PCI IDE controller (#5053)
HalAssignSlotResources will allocate a new resource list which the caller must free.
2023-03-22 01:01:18 +03:00
Joachim Henze 09dde2cff9
[REACTOS] "http://www.reactos" -> "https://reactos" (#5043)
To harmonize, to save some bytes, and last but not least for security reasons.
This can be understood as an addendum to (#2619).
2023-02-06 17:01:52 +03:00
Hervé Poussineau 0676247932 [FLOPPY] Correctly return media changed information
If disk changed since last time, we must either return STATUS_IO_DEVICE_ERROR
or STATUS_VERIFY_REQUIRED, depending of VPB_MOUNTED flag.
This is already handled by the SignalMediaChanged() function.

CORE-18244
2022-09-10 22:52:00 +02:00
Stanislav Motylkov bbccad0ed6
[INF] Set manufacturer as ReactOS Project for consistency
Also make it non-localizable. CORE-18191
2022-06-27 17:00:18 +03:00
Victor Perevertkin f155b9377f
[CMAKE] Elimitate the use of GCC and CLANG variables 2022-05-27 01:37:34 +03:00
Stanislav Motylkov 5ee633f7d7
[BUSLOGIC] Fix reference link to VMware driver source page
- Clarify driver version in 3rd Party Files.
- Fix some minor formatting problems.
- Also add missing OBJ_KERNEL_HANDLE to match Zw*() uses. (#4499)

CORE-10207 CORE-18180

Co-authored-by: Serge Gautherie <reactos-git_serge_171003@gautherie.fr>
2022-05-13 17:24:02 +03:00
Luke Luo f59c58d833
[TRANSLATION] Improve Simplified & Traditional Chinese translations (#4388)
Reviewed-by: Chan Chilung <eason066@gmail.com>
Reviewed-by: Stanislav Motylkov <x86corez@gmail.com>
2022-03-31 20:38:52 +03:00
Victor Perevertkin 7ed1883c8e
[DRIVERS] Use IoForwardIrpSynchronously in drivers
Instead of having an own routine in each driver
IoForwardIrpSynchronously can be used.
2022-01-05 02:17:56 +03:00
Stanislav Motylkov 6ebe2ed3a1
[UNIATA] Fix packing for port configuration information structures
Now it's consistent with our structure in sdk/include/ddk/srb.h.
Thanks to Hervé Poussineau for help with problem analysis.

Also MSDN doesn't say anything about the structure packing:
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/srb/ns-srb-_port_configuration_information

CORE-17966
2022-01-04 14:30:27 +03:00
Victor Perevertkin 1a6bd2704a
[SCSIPORT] Reduce and improve debug printing 2021-12-28 04:23:51 +03:00
Hervé Poussineau ac5536aa48 [SCSIPORT] Ignore LUNs not supported by the adapter
CORE-17641
2021-12-17 11:09:23 +01:00
Serge Gautherie cd991e3d63 [UNIATA] Fix copy-pasta on 5 Promise device ids
Addendum to 5783342 (r62493).
CORE-17898
2021-12-09 17:10:09 +03:00
Hervé Poussineau 06fc9c43ed [PARTMGR] Mark partitions as removable if device is removable
CORE-17392
2021-10-30 08:47:38 +02:00
Hervé Poussineau 7fdf078134 [UNIATA] Better split of model name between Vendor and Product
UNIATA is converting IDE identify data into SCSI identify data.
However, IDE model is described with a unique field of 20 chars,
while SCSI model is described with 2 fields of 16 + 8 chars.
When displaying SCSI model, a space is added between vendor and product
fields.

Try to split model into vendor and product on a space if possible.

CORE-17400
2021-10-03 23:09:55 +02:00
Hermès Bélusca-Maïto 9393fc320e
[FORMATTING] Remove trailing whitespace. Addendum to 34593d93.
Excluded: 3rd-party code (incl. wine) and most of the win32ss.
2021-09-13 03:52:22 +02:00
Julen Urizar Compains ea6e774050
[TRANSLATION] Fix minor typos and untranslated dialogs in Spanish (#3890)
- usetup: New bootsector page.
- shell32: Copy and paste, and moving elements.
  Also, some strings related to the shutdown and logoff.
- Minor Spanish grammar fix - some female words and minor latin american typos.
- First revision of the .inf, that includes the translation of the Services,
  audio, processors and other drivers and minor things.
2021-09-04 17:22:41 +03:00
Victor Perevertkin 3927ad9d47
[SFLOPPY] Move storage/floppy_new -> storage/class/sfloppy
This is a SCSI Floppy driver, which depends on classpnp.
Don't mix that with the other floppy (FDC) stack.
2021-08-08 02:42:34 +03:00
Victor Perevertkin 3088717b3f
[CDROM][DISK] Remove "_new" suffix from cdrom and disk drivers 2021-08-08 02:42:34 +03:00
Victor Perevertkin 49444127fd
[CDROM][CLASS2][DISK] Remove the old class drivers stack
These drivers are based on NT4 DDK sample code, were originally
started by Alexey Bragin and then constantly patched by Pierre
Schweitzer to fix compatibility with NT5+ storage stack.
Replaced with Microsoft drivers published on GitHub by an open
license.
These drivers were originally added as part of 4e7b22b216
2021-08-08 02:42:30 +03:00
Timo Kreuzer 41bc57ddf0 [REACTOS] Silence warnings in 3r-party code 2021-07-23 22:03:48 +02:00
Timo Kreuzer 5d8e834897 [REACTOS] Fix a number of MSVC warnings 2021-07-23 22:03:48 +02:00
Serge Gautherie ba77a09c04
[UNIATA] Workaround random crashes on Virtual PC (#3377)
I am not sure why this line was added.
I don't know how I could improve that case.
Then, disable it, for the time being.

Addendum to 4b9cf2e (r71252). CORE-12441 CORE-17371
2021-06-20 00:44:09 +03:00
Serge Gautherie d65d4137d3 [UNIATA] BusMasterAdapters[]: 8086:7111 is really PIIX4, not PIIX3
Reverts a part of deaba45 (r57265).
2021-06-20 00:34:23 +03:00
Victor Perevertkin 34593d933b
[FORMATTING][NTOS][HAL][DRIVERS][SDK] Fix trailing spaces 2021-06-11 15:33:08 +03:00
Piotr Hetnarowicz 07ad5eb338
[DISK_NEW] Add Polish (pl-PL) translation (#3660)
Addendum to f144b8c1 and da4ee18c. CORE-17129
2021-05-18 14:58:34 +03:00
Piotr Hetnarowicz 3a7cd6256b
[CDROM_NEW] Add Polish (pl-PL) translation (#3659)
Addendum to 83b85e21. CORE-17129

Co-authored-by: Adam Słaboń <asaillen@protonmail.com>
2021-05-18 14:54:05 +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
Dmitry Borisov 0fb3c1e91e
[PCIIDE] Make the resource section not discardable. CORE-17401 (#3594)
[PCIX] Make the resource section not discardable.

These drivers need to be able to access their message resources at any time.
2021-05-10 00:36:38 +02:00
Serge Gautherie ea3eaa5d87 [UNIATA] uniata_reg.inf: Add 'PnpInterface\5' key
commented out, for the time being.

CORE-17395
2021-04-11 09:30:42 +03:00