https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dac991c056c718fdd1572…
commit dac991c056c718fdd1572582af5755803ab5359a
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Fri Dec 27 17:48:04 2024 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Jan 6 21:26:43 2025 +0100
[PARTMGR] Implement support for IOCTL_STORAGE_GET_DEVICE_NUMBER (#7591)
CORE-13525
Now, sending the IOCTL_STORAGE_GET_DEVICE_NUMBER to a disk partition
correctly returns a non-zero STORAGE_DEVICE_NUMBER::PartitionNumber
value. This is used by the BTRFS filesystem driver and other modules.
When the STORAGE_DEVICE_NUMBER DeviceType member equals FILE_DEVICE_DISK,
the DeviceNumber and PartitionNumber correspond respectively to the
X and Y values in the \Device\Harddisk<X>\Partition<Y> device name.
References:
https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-io…https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddstor/ni-…https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddstor/ns-…
---
drivers/storage/partmgr/partition.c | 40 ++++++++++++++++++++++++++++++++++---
drivers/storage/partmgr/partmgr.c | 12 ++++++++++-
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/drivers/storage/partmgr/partition.c b/drivers/storage/partmgr/partition.c
index e8a38e728ca..3551898389f 100644
--- a/drivers/storage/partmgr/partition.c
+++ b/drivers/storage/partmgr/partition.c
@@ -27,17 +27,26 @@ PartitionCreateDevice(
UNICODE_STRING deviceName;
UINT32 volumeNum;
- // Create the partition/volume device object
-
volumeNum = HarddiskVolumeNextId++;
swprintf(nameBuf, L"\\Device\\HarddiskVolume%lu", volumeNum);
RtlCreateUnicodeString(&deviceName, nameBuf);
+ /*
+ * Create the partition/volume device object.
+ *
+ * Due to the fact we are also a (basic) volume manager, this device is
+ * ALSO a volume device. Because of this, we need to assign it a device
+ * name, and a specific device type for IoCreateDevice() to create a VPB
+ * for this device, so that a filesystem can be mounted on it.
+ * Once we get a separate volume manager, this partition DO can become
+ * anonymous, have a different device type, and without any associated VPB.
+ * (The attached volume, on the contrary, would require a VPB.)
+ */
PDEVICE_OBJECT partitionDevice;
NTSTATUS status = IoCreateDevice(FDObject->DriverObject,
sizeof(PARTITION_EXTENSION),
&deviceName,
- FILE_DEVICE_DISK,
+ FILE_DEVICE_DISK, // FILE_DEVICE_MASS_STORAGE,
FILE_DEVICE_SECURE_OPEN,
FALSE,
&partitionDevice);
@@ -55,6 +64,10 @@ PartitionCreateDevice(
partExt->DeviceObject = partitionDevice;
partExt->LowerDevice = FDObject;
+ // NOTE: See comment above.
+ // PFDO_EXTENSION fdoExtension = FDObject->DeviceExtension;
+ // partitionDevice->DeviceType = /*fdoExtension->LowerDevice*/FDObject->DeviceType;
+
partitionDevice->StackSize = FDObject->StackSize;
partitionDevice->Flags |= DO_DIRECT_IO;
@@ -767,6 +780,27 @@ PartitionHandleDeviceControl(
status = STATUS_SUCCESS;
break;
}
+ case IOCTL_STORAGE_GET_DEVICE_NUMBER:
+ {
+ PSTORAGE_DEVICE_NUMBER deviceNumber = Irp->AssociatedIrp.SystemBuffer;
+ if (!VerifyIrpOutBufferSize(Irp, sizeof(*deviceNumber)))
+ {
+ status = STATUS_BUFFER_TOO_SMALL;
+ break;
+ }
+
+ PartMgrAcquireLayoutLock(fdoExtension);
+
+ deviceNumber->DeviceType = partExt->DeviceObject->DeviceType;
+ deviceNumber->DeviceNumber = fdoExtension->DiskData.DeviceNumber;
+ deviceNumber->PartitionNumber = partExt->DetectedNumber;
+
+ PartMgrReleaseLayoutLock(fdoExtension);
+
+ status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof(*deviceNumber);
+ break;
+ }
case IOCTL_STORAGE_MEDIA_REMOVAL:
{
return ForwardIrpAndForget(DeviceObject, Irp);
diff --git a/drivers/storage/partmgr/partmgr.c b/drivers/storage/partmgr/partmgr.c
index b1c37b5d964..5b79d823898 100644
--- a/drivers/storage/partmgr/partmgr.c
+++ b/drivers/storage/partmgr/partmgr.c
@@ -1182,10 +1182,17 @@ PartMgrAddDevice(
PAGED_CODE();
+ /*
+ * Create the disk FDO. Use FILE_DEVICE_MASS_STORAGE type (or any other
+ * one that is NOT FILE_DEVICE_[DISK|VIRTUAL_DISK|CD_ROM|TAPE]), so that
+ * IoCreateDevice() doesn't automatically create a VPB for this device,
+ * even if we will later want this device to inherit the type of the
+ * underlying PDO which can have any of the types mentioned above.
+ */
NTSTATUS status = IoCreateDevice(DriverObject,
sizeof(FDO_EXTENSION),
NULL,
- FILE_DEVICE_BUS_EXTENDER,
+ FILE_DEVICE_MASS_STORAGE,
FILE_AUTOGENERATED_DEVICE_NAME | FILE_DEVICE_SECURE_OPEN,
FALSE,
&deviceObject);
@@ -1210,6 +1217,9 @@ PartMgrAddDevice(
deviceExtension->PhysicalDiskDO = PhysicalDeviceObject;
KeInitializeEvent(&deviceExtension->SyncEvent, SynchronizationEvent, TRUE);
+ // Update now the device type with the actual underlying device type
+ deviceObject->DeviceType = deviceExtension->LowerDevice->DeviceType;
+
deviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE;
// The device is initialized
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=873488927202bed66a91f…
commit 873488927202bed66a91fa975dc02cdc20c64afb
Author: Mahir Gül <mahirgul(a)gmail.com>
AuthorDate: Mon Jan 6 18:15:21 2025 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Jan 6 18:15:21 2025 +0100
[RAPPS] Update Turkish (tr-TR) translation (#7372)
---
base/applications/rapps/lang/tr-TR.rc | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/base/applications/rapps/lang/tr-TR.rc b/base/applications/rapps/lang/tr-TR.rc
index e6fbdc062b2..f94c432487d 100644
--- a/base/applications/rapps/lang/tr-TR.rc
+++ b/base/applications/rapps/lang/tr-TR.rc
@@ -178,9 +178,9 @@ BEGIN
IDS_WELCOME_TEXT "Solda bir kategori seçiniz, ardından kurmak ya da kaldırmak için bir uygulama seçiniz.\nReactOS'un İnternet sitesi: "
IDS_WELCOME_URL "https://reactos.org"
- IDS_APPWIZ_TITLE "Add/Remove Programs"
- IDS_APPWIZ_TEXT1 "Choose ""Applications"" or ""Updates"" to view the list of applications or updates installed on your system."
- IDS_APPWIZ_TEXT2 "To remove a program or to modify its installed components, select it from the list and click on ""Uninstall"" or ""Modify""."
+ IDS_APPWIZ_TITLE "Program Ekle/Kaldır"
+ IDS_APPWIZ_TEXT1 "Sisteminizde yüklü olan uygulamaların veya güncellemelerin listesini görüntülemek için ""Uygulamalar"" veya ""Güncellemeler"" öğesini seçin."
+ IDS_APPWIZ_TEXT2 "Bir programı kaldırmak veya yüklü bileşenlerini değiştirmek için listeden seçin ve ""Kaldır"" veya ""Değiştir"" üzerine tıklayın."
END
STRINGTABLE
@@ -213,7 +213,7 @@ BEGIN
IDS_APP_DISPLAY_DETAILS "Detaylar"
IDS_APP_DISPLAY_LIST "Liste"
IDS_APP_DISPLAY_TILE "Karo"
- IDS_NO_SEARCH_RESULTS "No search results"
+ IDS_NO_SEARCH_RESULTS "Arama sonucu yok"
END
STRINGTABLE
@@ -266,5 +266,5 @@ END
STRINGTABLE
BEGIN
- IDS_INSTGEN_CONFIRMUNINST "Are you sure you want to uninstall %s?"
+ IDS_INSTGEN_CONFIRMUNINST "Kaldırmak istediğinizden emin misiniz %s?"
END
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5afb7ab003326eeaf3c40…
commit 5afb7ab003326eeaf3c40b2b8c19798225eeb8a2
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Tue Jun 4 17:09:56 2024 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Jan 5 22:03:55 2025 +0100
[NTOS:IO] IoVolumeDeviceToDosName(): Some stylistic changes.
Minor formatting and comments improvements (typo fixes etc.)
---
ntoskrnl/io/iomgr/volume.c | 72 +++++++++++++++++++++-------------------------
1 file changed, 32 insertions(+), 40 deletions(-)
diff --git a/ntoskrnl/io/iomgr/volume.c b/ntoskrnl/io/iomgr/volume.c
index 024823636f5..600d899ce48 100644
--- a/ntoskrnl/io/iomgr/volume.c
+++ b/ntoskrnl/io/iomgr/volume.c
@@ -9,13 +9,13 @@
* Pierre Schweitzer (pierre.schweitzer(a)reactos.org)
*/
-/* INCLUDES *****************************************************************/
+/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
-/* GLOBALS ******************************************************************/
+/* GLOBALS *******************************************************************/
ERESOURCE IopDatabaseResource;
LIST_ENTRY IopDiskFileSystemQueueHead, IopNetworkFileSystemQueueHead;
@@ -1279,10 +1279,10 @@ NTAPI
IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
OUT PUNICODE_STRING DosName)
{
- PIRP Irp;
+ NTSTATUS Status;
ULONG Length;
KEVENT Event;
- NTSTATUS Status;
+ PIRP Irp;
PFILE_OBJECT FileObject;
PDEVICE_OBJECT DeviceObject;
IO_STATUS_BLOCK IoStatusBlock;
@@ -1290,10 +1290,10 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
MOUNTMGR_VOLUME_PATHS VolumePath;
PMOUNTMGR_VOLUME_PATHS VolumePathPtr;
/*
- * This variable with be required to query device name.
+ * This variable is used to query the device name.
* It's based on MOUNTDEV_NAME (mountmgr.h).
- * Doing it that way will prevent dyn memory allocation.
- * Device name won't be longer.
+ * Doing it this way prevents memory allocation.
+ * The device name won't be longer.
*/
struct
{
@@ -1303,10 +1303,11 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
PAGED_CODE();
- /* First step, getting device name */
+ /* First, retrieve the corresponding device name */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(IOCTL_MOUNTDEV_QUERY_DEVICE_NAME,
- VolumeDeviceObject, NULL, 0,
+ VolumeDeviceObject,
+ NULL, 0,
&DeviceName, sizeof(DeviceName),
FALSE, &Event, &IoStatusBlock);
if (!Irp)
@@ -1320,15 +1321,12 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = IoStatusBlock.Status;
}
-
if (!NT_SUCCESS(Status))
{
return Status;
}
- /* Now that we have the device name, we can query the MountMgr
- * So, get its device object first.
- */
+ /* Now, query the MountMgr for the DOS path */
RtlInitUnicodeString(&MountMgrDevice, MOUNTMGR_DEVICE_NAME);
Status = IoGetDeviceObjectPointer(&MountMgrDevice, FILE_READ_ATTRIBUTES,
&FileObject, &DeviceObject);
@@ -1337,16 +1335,16 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
return Status;
}
- /* Then, use the proper IOCTL to query the DOS name */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH,
- DeviceObject, &DeviceName, sizeof(DeviceName),
+ DeviceObject,
+ &DeviceName, sizeof(DeviceName),
&VolumePath, sizeof(VolumePath),
FALSE, &Event, &IoStatusBlock);
if (!Irp)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
- goto DereferenceFO;
+ goto Quit;
}
Status = IoCallDriver(DeviceObject, Irp);
@@ -1356,41 +1354,37 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
Status = IoStatusBlock.Status;
}
- /* Only tolerated failure here is buffer too small, which is
- * expected.
- */
- if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW)
+ /* The only tolerated failure here is buffer too small, which is expected */
+ if (!NT_SUCCESS(Status) && (Status != STATUS_BUFFER_OVERFLOW))
{
- goto DereferenceFO;
+ goto Quit;
}
- /* Compute needed size to store DOS name.
- * Even if MOUNTMGR_VOLUME_PATHS allows bigger
- * name lengths than MAXUSHORT, we can't use
- * them, because we have to return this in an UNICODE_STRING
- * that stores length on USHORT.
- */
- Length = VolumePath.MultiSzLength + sizeof(VolumePath);
+ /* Compute the needed size to store the DOS name.
+ * Even if MOUNTMGR_VOLUME_PATHS allows bigger name lengths
+ * than MAXUSHORT, we can't use them, because we have to return
+ * this in an UNICODE_STRING that stores length in a USHORT. */
+ Length = sizeof(VolumePath) + VolumePath.MultiSzLength;
if (Length > MAXUSHORT)
{
Status = STATUS_INVALID_BUFFER_SIZE;
- goto DereferenceFO;
+ goto Quit;
}
- /* Reallocate memory, even in case of success, because
- * that's the buffer that will be returned to caller
- */
+ /* Reallocate the memory, even in case of success, because
+ * that's the buffer that will be returned to the caller */
VolumePathPtr = ExAllocatePoolWithTag(PagedPool, Length, 'D2d ');
if (!VolumePathPtr)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
- goto DereferenceFO;
+ goto Quit;
}
- /* Requery DOS path with proper size */
+ /* Re-query the DOS path with the proper size */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH,
- DeviceObject, &DeviceName, sizeof(DeviceName),
+ DeviceObject,
+ &DeviceName, sizeof(DeviceName),
VolumePathPtr, Length,
FALSE, &Event, &IoStatusBlock);
if (!Irp)
@@ -1405,7 +1399,6 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = IoStatusBlock.Status;
}
-
if (!NT_SUCCESS(Status))
{
goto ReleaseMemory;
@@ -1420,16 +1413,15 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
RtlMoveMemory(DosName->Buffer, VolumePathPtr->MultiSz, VolumePathPtr->MultiSzLength);
DosName->Buffer[DosName->Length / sizeof(WCHAR)] = UNICODE_NULL;
- /* DON'T release buffer, just dereference FO, and return success */
+ /* Don't release the buffer, just dereference the FO and return success */
Status = STATUS_SUCCESS;
- goto DereferenceFO;
+ goto Quit;
ReleaseMemory:
ExFreePoolWithTag(VolumePathPtr, 'D2d ');
-DereferenceFO:
+Quit:
ObDereferenceObject(FileObject);
-
return Status;
}