https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8248f02ff46abbc5b9a1c…
commit 8248f02ff46abbc5b9a1cec8703c88655cf1813a
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Sun Jan 31 05:37:27 2021 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Sun Jan 31 05:37:27 2021 +0300
[HALX86] Restore Windows compatibility on reporting device IDs
And forwarding IRPs from FDO to PDO
This along with 8aff2c9de7cf45dd306e447b0c27a379f827fe4c reverts the commit 74b889b3977594229a78d87066dfc22c1f9b46b8
---
hal/halx86/acpi/halpnpdd.c | 23 +++++++++++++++++------
hal/halx86/legacy/halpnpdd.c | 23 +++++++++++++++++------
2 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/hal/halx86/acpi/halpnpdd.c b/hal/halx86/acpi/halpnpdd.c
index 03c195293a5..3f3d895cf2c 100644
--- a/hal/halx86/acpi/halpnpdd.c
+++ b/hal/halx86/acpi/halpnpdd.c
@@ -561,10 +561,6 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject,
switch (IdType)
{
case BusQueryDeviceID:
- /* HACK */
- Id = L"Root\\ACPI_HAL";
- break;
-
case BusQueryHardwareIDs:
/* This is our hardware ID */
@@ -676,11 +672,26 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
default:
DPRINT("Other IRP: %lx\n", Minor);
- Status = Irp->IoStatus.Status;
+ Status = STATUS_NOT_SUPPORTED;
break;
}
- /* Nowhere for the IRP to go since we also own the PDO */
+ /* What happpened? */
+ if ((NT_SUCCESS(Status)) || (Status == STATUS_NOT_SUPPORTED))
+ {
+ /* Set the IRP status, unless this isn't understood */
+ if (Status != STATUS_NOT_SUPPORTED)
+ {
+ Irp->IoStatus.Status = Status;
+ }
+
+ /* Pass it on */
+ IoSkipCurrentIrpStackLocation(Irp);
+ return IoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
+ }
+
+ /* Otherwise, we failed, so set the status and complete the request */
+ DPRINT1("IRP failed with status: %lx\n", Status);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
diff --git a/hal/halx86/legacy/halpnpdd.c b/hal/halx86/legacy/halpnpdd.c
index 716b0d269e7..b2c03f2e417 100644
--- a/hal/halx86/legacy/halpnpdd.c
+++ b/hal/halx86/legacy/halpnpdd.c
@@ -559,10 +559,6 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject,
switch (IdType)
{
case BusQueryDeviceID:
- /* HACK */
- Id = L"Root\\PCI_HAL";
- break;
-
case BusQueryHardwareIDs:
/* This is our hardware ID */
@@ -673,11 +669,26 @@ HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject,
default:
DPRINT("Other IRP: %lx\n", Minor);
- Status = Irp->IoStatus.Status;
+ Status = STATUS_NOT_SUPPORTED;
break;
}
- /* Nowhere for the IRP to go since we also own the PDO */
+ /* What happpened? */
+ if ((NT_SUCCESS(Status)) || (Status == STATUS_NOT_SUPPORTED))
+ {
+ /* Set the IRP status, unless this isn't understood */
+ if (Status != STATUS_NOT_SUPPORTED)
+ {
+ Irp->IoStatus.Status = Status;
+ }
+
+ /* Pass it on */
+ IoSkipCurrentIrpStackLocation(Irp);
+ return IoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
+ }
+
+ /* Otherwise, we failed, so set the status and complete the request */
+ DPRINT1("IRP failed with status: %lx\n", Status);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2486558ae1d15e878e2df…
commit 2486558ae1d15e878e2df4d067858a710f168580
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Fri Jan 29 18:15:17 2021 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Fri Jan 29 18:18:09 2021 +0100
[RTL] Do not mess with critical section lock when there is no reason to.
- When process is shutting down.
- When the caller is so drunk that they leave twice the pub altough they entered it only once.
---
sdk/lib/rtl/critical.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/sdk/lib/rtl/critical.c b/sdk/lib/rtl/critical.c
index c9b9c68ff6d..0911a8ce76f 100644
--- a/sdk/lib/rtl/critical.c
+++ b/sdk/lib/rtl/critical.c
@@ -114,12 +114,6 @@ RtlpWaitForCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
EXCEPTION_RECORD ExceptionRecord;
BOOLEAN LastChance = FALSE;
- /* Do we have an Event yet? */
- if (!CriticalSection->LockSemaphore)
- {
- RtlpCreateCriticalSectionSem(CriticalSection);
- }
-
/* Increase the Debug Entry count */
DPRINT("Waiting on Critical Section Event: %p %p\n",
CriticalSection,
@@ -136,10 +130,15 @@ RtlpWaitForCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
LdrpShutdownThreadId == NtCurrentTeb()->RealClientId.UniqueThread)
{
DPRINT("Forcing ownership of critical section %p\n", CriticalSection);
- CriticalSection->LockCount = 0;
return STATUS_SUCCESS;
}
+ /* Do we have an Event yet? */
+ if (!CriticalSection->LockSemaphore)
+ {
+ RtlpCreateCriticalSectionSem(CriticalSection);
+ }
+
for (;;)
{
/* Increase the number of times we've had contention */
@@ -715,9 +714,13 @@ RtlLeaveCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
*/
if (--CriticalSection->RecursionCount)
{
+ if (CriticalSection->RecursionCount < 0)
+ {
+ DPRINT1("CRITICAL SECTION MESS: Section %p is not acquired!\n", CriticalSection);
+ return STATUS_UNSUCCESSFUL;
+ }
/* Someone still owns us, but we are free. This needs to be done atomically. */
InterlockedDecrement(&CriticalSection->LockCount);
-
}
else
{