https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4b4ffa92f564a334ad919…
commit 4b4ffa92f564a334ad919bdda2404561aa1ab10f
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Jun 10 19:44:59 2021 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Jun 11 02:21:48 2021 +0200
[NTOS:IO] Modify when 'PartitionBuffer' and how 'DriveLayout' are freed in IopCreateArcNamesDisk().
- Manage the lifetime of the temporary 'PartitionBuffer' buffer where
it is locally used only, and free it as soon as possible, just after
calculating the sector checksum. No need to then free it outside of
the main for-loop.
- When the 'DriveLayout' buffer is freed, ensure the pointer is NULL-ed
(and assert this at the top of the main for-loop), since it can also
be freed at cleanup outside this for-loop, and in this case a NULL
check is performed.
This will avoid the scenario of possibly double-freeing a pointer,
in the case the 'DriveLayout' was previously freed (when e.g. reading
the sector for checksum calculation failed), then the for-loop goes to
the next disk and stops early.
---
ntoskrnl/io/iomgr/arcname.c | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/ntoskrnl/io/iomgr/arcname.c b/ntoskrnl/io/iomgr/arcname.c
index 3be5930ec69..937b5cfb0c5 100644
--- a/ntoskrnl/io/iomgr/arcname.c
+++ b/ntoskrnl/io/iomgr/arcname.c
@@ -478,6 +478,8 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
/* Start browsing disks */
for (DiskNumber = 0; DiskNumber < DiskCount; DiskNumber++)
{
+ ASSERT(DriveLayout == NULL);
+
/* Check if we have an enabled disk */
if (lSymbolicLinkList && *lSymbolicLinkList != UNICODE_NULL)
{
@@ -652,6 +654,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
&IoStatusBlock);
if (!Irp)
{
+ ExFreePoolWithTag(PartitionBuffer, TAG_IO);
ObDereferenceObject(FileObject);
Status = STATUS_INSUFFICIENT_RESOURCES;
goto Cleanup;
@@ -665,20 +668,26 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = IoStatusBlock.Status;
}
- if (!NT_SUCCESS(Status))
+
+ /* If reading succeeded, calculate checksum by adding data */
+ if (NT_SUCCESS(Status))
{
- ExFreePool(DriveLayout);
- ExFreePoolWithTag(PartitionBuffer, TAG_IO);
- ObDereferenceObject(FileObject);
- continue;
+ for (i = 0, CheckSum = 0; i < 512 / sizeof(ULONG); i++)
+ {
+ CheckSum += PartitionBuffer[i];
+ }
}
+ /* Release now unnecessary resources */
+ ExFreePoolWithTag(PartitionBuffer, TAG_IO);
ObDereferenceObject(FileObject);
- /* Calculate checksum by adding data */
- for (i = 0, CheckSum = 0; i < 512 / sizeof(ULONG) ; i++)
+ /* If we failed, release drive layout before going to next disk */
+ if (!NT_SUCCESS(Status))
{
- CheckSum += PartitionBuffer[i];
+ ExFreePool(DriveLayout);
+ DriveLayout = NULL;
+ continue;
}
/* Browse each ARC disk */
@@ -800,29 +809,22 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
}
}
- /* Release memory before jumping to next item */
+ /* Finally, release drive layout */
ExFreePool(DriveLayout);
DriveLayout = NULL;
- ExFreePoolWithTag(PartitionBuffer, TAG_IO);
- PartitionBuffer = NULL;
}
Status = STATUS_SUCCESS;
Cleanup:
- if (SymbolicLinkList)
- {
- ExFreePool(SymbolicLinkList);
- }
-
if (DriveLayout)
{
ExFreePool(DriveLayout);
}
- if (PartitionBuffer)
+ if (SymbolicLinkList)
{
- ExFreePoolWithTag(PartitionBuffer, TAG_IO);
+ ExFreePool(SymbolicLinkList);
}
return Status;
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fdd74eb97e79bd7ad62c0…
commit fdd74eb97e79bd7ad62c0fc2f26541db1ff1009c
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Jun 10 19:31:43 2021 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Jun 11 02:21:47 2021 +0200
[NTOS:IO/FSTUB] Fix the determination of 'SingleDisk' in IoGetBootDiskInformation().
The purpose of 'SingleDisk' is the same as in the IopCreateArcNames()
function. It is an optimization for that when looking up the
firmware-recognized ARC disks list, in order to match one of these with
the current NT disk being analysed (see e.g. also in IopCreateArcNamesDisk()),
we avoid a possible IopVerifyDiskSignature() call and directly build a
corresponding ARC name NT symbolic link for it.
'SingleDisk' will actually be TRUE, whether the DiskSignatureListHead
list is empty or contains only one element: Indeed in only both these
cases, 'DiskSignatureListHead.Flink->Flink' will refer to the list head.
(If the list is empty but 'SingleDisk' is TRUE, this does not matter,
because the DiskSignatureListHead looking-up loop never starts.)
---
ntoskrnl/fstub/fstubex.c | 8 +++++---
ntoskrnl/io/iomgr/arcname.c | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/ntoskrnl/fstub/fstubex.c b/ntoskrnl/fstub/fstubex.c
index 21a0dbd1561..1904d32339a 100644
--- a/ntoskrnl/fstub/fstubex.c
+++ b/ntoskrnl/fstub/fstubex.c
@@ -1866,13 +1866,15 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
/* Init some useful stuff:
* Get ARC disks information
- * Check whether we have a single disk
+ * Check whether we have a single disk on the machine
* Check received structure size (extended or not?)
* Init boot strings (system/boot)
* Finaly, get disk count
*/
ArcDiskInformation = IopLoaderBlock->ArcDiskInformation;
- SingleDisk = IsListEmpty(&(ArcDiskInformation->DiskSignatureListHead));
+ SingleDisk = (ArcDiskInformation->DiskSignatureListHead.Flink->Flink ==
+ &ArcDiskInformation->DiskSignatureListHead);
+
IsBootDiskInfoEx = (Size >= sizeof(BOOTDISK_INFORMATION_EX));
RtlInitAnsiString(&ArcBootString, IopLoaderBlock->ArcBootDeviceName);
RtlInitAnsiString(&ArcSystemString, IopLoaderBlock->ArcHalDeviceName);
@@ -2147,7 +2149,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
}
}
- /* Finally, release drive layout structure */
+ /* Finally, release drive layout */
ExFreePool(DriveLayout);
}
diff --git a/ntoskrnl/io/iomgr/arcname.c b/ntoskrnl/io/iomgr/arcname.c
index bdb3e7b1324..3be5930ec69 100644
--- a/ntoskrnl/io/iomgr/arcname.c
+++ b/ntoskrnl/io/iomgr/arcname.c
@@ -48,8 +48,8 @@ IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
ANSI_STRING ArcSystemString, ArcString, LanmanRedirector, LoaderPathNameA;
/* Check if we only have one disk on the machine */
- SingleDisk = ArcDiskInfo->DiskSignatureListHead.Flink->Flink ==
- (&ArcDiskInfo->DiskSignatureListHead);
+ SingleDisk = (ArcDiskInfo->DiskSignatureListHead.Flink->Flink ==
+ &ArcDiskInfo->DiskSignatureListHead);
/* Create the global HAL partition name */
sprintf(Buffer, "\\ArcName\\%s", LoaderBlock->ArcHalDeviceName);
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6e65e6b28d78eae93896a…
commit 6e65e6b28d78eae93896aeb95fc4876b83063c85
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Jun 10 19:24:04 2021 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Jun 11 02:21:47 2021 +0200
[NTOS:IO] Minor code style fixes (typos; improve comments/DPRINT; IN vs. OUT parameter).
---
ntoskrnl/fstub/fstubex.c | 14 +++++++-------
ntoskrnl/io/iomgr/arcname.c | 36 +++++++++++++++++-------------------
2 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/ntoskrnl/fstub/fstubex.c b/ntoskrnl/fstub/fstubex.c
index 84296e0a722..6e43f238e66 100644
--- a/ntoskrnl/fstub/fstubex.c
+++ b/ntoskrnl/fstub/fstubex.c
@@ -1852,7 +1852,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
PAGED_CODE();
- /* Get loader block. If it's null, we come to late */
+ /* Get loader block. If it's null, we come too late */
if (!IopLoaderBlock)
{
return STATUS_TOO_LATE;
@@ -1865,7 +1865,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
}
/* Init some useful stuff:
- * Get arc disks information
+ * Get ARC disks information
* Check whether we have a single disk
* Check received structure size (extended or not?)
* Init boot strings (system/boot)
@@ -1955,7 +1955,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
DiskGeometry.BytesPerSector = 512;
}
- /* Now, for each arc disk, try to find the matching */
+ /* Now, for each ARC disk, try to find the matching */
for (NextEntry = ArcDiskInformation->DiskSignatureListHead.Flink;
NextEntry != &ArcDiskInformation->DiskSignatureListHead;
NextEntry = NextEntry->Flink)
@@ -1963,7 +1963,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
ArcDiskSignature = CONTAINING_RECORD(NextEntry,
ARC_DISK_SIGNATURE,
ListEntry);
- /* If they matches, ie
+ /* If they match, i.e.
* - There's only one disk for both BIOS and detected
* - Signatures are matching
* - This is MBR
@@ -1973,7 +1973,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
(IopVerifyDiskSignature(DriveLayout, ArcDiskSignature, &Signature))) &&
(DriveLayout->PartitionStyle == PARTITION_STYLE_MBR))
{
- /* Create arc name */
+ /* Create ARC name */
sprintf(ArcBuffer, "\\ArcName\\%s", ArcDiskSignature->ArcName);
RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
@@ -1995,7 +1995,7 @@ IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
Signature = DriveLayout->Mbr.Signature;
}
- /* Create partial arc name */
+ /* Create partial ARC name */
sprintf(ArcBuffer, "%spartition(%lu)", ArcDiskSignature->ArcName, PartitionNumber);
RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
@@ -2524,7 +2524,7 @@ IoWritePartitionTableEx(IN PDEVICE_OBJECT DeviceObject,
FALSE,
DriveLayout->PartitionCount,
DriveLayout->PartitionEntry);
- /* If it succeed, also update backup table */
+ /* If it succeeded, also update backup table */
if (NT_SUCCESS(Status))
{
Status = FstubWritePartitionTableEFI(Disk,
diff --git a/ntoskrnl/io/iomgr/arcname.c b/ntoskrnl/io/iomgr/arcname.c
index 2e7cbb968b1..c36af33a5e8 100644
--- a/ntoskrnl/io/iomgr/arcname.c
+++ b/ntoskrnl/io/iomgr/arcname.c
@@ -24,16 +24,14 @@ PCHAR IoLoaderArcBootDeviceName;
CODE_SEG("INIT")
NTSTATUS
NTAPI
-IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock
-);
+IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock);
CODE_SEG("INIT")
NTSTATUS
NTAPI
IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN BOOLEAN SingleDisk,
- IN PBOOLEAN FoundBoot
-);
+ OUT PBOOLEAN FoundBoot);
CODE_SEG("INIT")
NTSTATUS
@@ -136,7 +134,7 @@ IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
/* Loop every disk and try to find boot disk */
Status = IopCreateArcNamesDisk(LoaderBlock, SingleDisk, &FoundBoot);
- /* If it succeed but we didn't find boot device, try to browse Cds */
+ /* If it succeeded but we didn't find boot device, try to browse Cds */
if (NT_SUCCESS(Status) && !FoundBoot)
{
Status = IopCreateArcNamesCd(LoaderBlock);
@@ -178,7 +176,7 @@ IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
* that have been successfully handled by MountMgr driver
* and that already own their device name. This is the "new" way
* to handle them, that came with NT5.
- * Currently, Windows 2003 provides an arc names creation based
+ * Currently, Windows 2003 provides an ARC names creation based
* on both enabled drives and not enabled drives (lack from
* the driver).
* Given the current ReactOS state, that's good for us.
@@ -357,7 +355,7 @@ IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Status = IoStatusBlock.Status;
}
- /* Reading succeed, compute checksum by adding data, 2048 bytes checksum */
+ /* If reading succeeded, compute checksum by adding data, 2048 bytes checksum */
if (NT_SUCCESS(Status))
{
for (i = 0; i < 2048 / sizeof(ULONG); i++)
@@ -413,7 +411,7 @@ NTSTATUS
NTAPI
IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN BOOLEAN SingleDisk,
- IN PBOOLEAN FoundBoot)
+ OUT PBOOLEAN FoundBoot)
{
PIRP Irp;
PVOID Data;
@@ -644,7 +642,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
goto Cleanup;
}
- /* Read a sector for computing checksum */
+ /* Read the first sector for computing checksum */
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
DeviceObject,
PartitionBuffer,
@@ -677,7 +675,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
ObDereferenceObject(FileObject);
- /* Calculate checksum, that's an easy computation, just adds read data */
+ /* Calculate checksum by adding data */
for (i = 0, CheckSum = 0; i < 512 / sizeof(ULONG) ; i++)
{
CheckSum += PartitionBuffer[i];
@@ -692,7 +690,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
ARC_DISK_SIGNATURE,
ListEntry);
- /* If they matches, ie
+ /* If they match, i.e.
* - There's only one disk for both BIOS and detected/enabled
* - Signatures are matching
* - Checksums are matching
@@ -789,15 +787,15 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
}
else
{
- /* In case there's a valid partition, a matching signature,
- BUT a none matching checksum, or there's a duplicate
- signature, or even worse a virus played with partition
- table */
- if (ArcDiskSignature->Signature == Signature &&
- (ArcDiskSignature->CheckSum + CheckSum != 0) &&
- ArcDiskSignature->ValidPartitionTable)
+ /* Debugging feedback: Warn in case there's a valid partition,
+ * a matching signature, BUT a non-matching checksum: this can
+ * be the sign of a duplicate signature, or even worse a virus
+ * played with the partition table. */
+ if (ArcDiskSignature->ValidPartitionTable &&
+ (ArcDiskSignature->Signature == Signature) &&
+ (ArcDiskSignature->CheckSum + CheckSum != 0))
{
- DPRINT("Be careful, or you have a duplicate disk signature, or a virus altered your MBR!\n");
+ DPRINT("Be careful, you have a duplicate disk signature, or a virus altered your MBR!\n");
}
}
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6e29107f316e7d2f69cde…
commit 6e29107f316e7d2f69cde974639d208fbaa40fef
Author: Oleg Dubinskiy <oleg.dubinskij2013(a)yandex.ua>
AuthorDate: Fri Jun 4 17:32:07 2021 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Fri Jun 11 02:06:11 2021 +0300
[SOUNDS] Add new Recycle Bin system sound
Add new sound for Recycle Bin sound event.
Since this sound event is now working properly after some fixes in shell32 code, it's now possible for user to set the sound for this sound event manually.
But don't enable it by default, since it is also disabled on Windows Server 2003.
CORE-15868
---
media/CMakeLists.txt | 1 +
media/sounds/ReactOS_Recycle.wav | Bin 0 -> 109412 bytes
2 files changed, 1 insertion(+)
diff --git a/media/CMakeLists.txt b/media/CMakeLists.txt
index dd2a78ea9f8..2f8cecc8b22 100644
--- a/media/CMakeLists.txt
+++ b/media/CMakeLists.txt
@@ -12,6 +12,7 @@ add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/drivers/etc/networks DESTINATION re
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/drivers/etc/protocol DESTINATION reactos/system32/drivers/etc FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/drivers/etc/services DESTINATION reactos/system32/drivers/etc FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/sounds/ReactOS_LogOn.wav DESTINATION reactos/media FOR all)
+add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/sounds/ReactOS_Recycle.wav DESTINATION reactos/media FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/systemcompatible.manifest DESTINATION reactos/winsxs/manifests FOR all)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/forwardcompatible.manifest DESTINATION reactos/winsxs/manifests FOR all)
diff --git a/media/sounds/ReactOS_Recycle.wav b/media/sounds/ReactOS_Recycle.wav
new file mode 100644
index 00000000000..bf9c7fa57f1
Binary files /dev/null and b/media/sounds/ReactOS_Recycle.wav differ