https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b5ee5ccc79c3104327da…
commit 6b5ee5ccc79c3104327dab6df5ebba5449e1a503
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Thu Feb 1 09:57:35 2024 +0100
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Thu Feb 1 10:08:51 2024 +0100
[BATTC] Make input buffer on IOCTL_BATTERY_QUERY_TAG optional
In that case, don't wait to get battery tag.
---
drivers/battery/battc/battc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/battery/battc/battc.c b/drivers/battery/battc/battc.c
index d07db5f4953..2ad86b9d9e9 100644
--- a/drivers/battery/battc/battc.c
+++ b/drivers/battery/battc/battc.c
@@ -214,14 +214,14 @@ BatteryClassIoctl(PVOID ClassData,
switch (IrpSp->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_BATTERY_QUERY_TAG:
- if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)
||
+ if ((IrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof(ULONG)
&& IrpSp->Parameters.DeviceIoControl.InputBufferLength != 0) ||
IrpSp->Parameters.DeviceIoControl.OutputBufferLength <
sizeof(ULONG))
{
Status = STATUS_BUFFER_TOO_SMALL;
break;
}
- WaitTime = *(PULONG)Irp->AssociatedIrp.SystemBuffer;
+ WaitTime = IrpSp->Parameters.DeviceIoControl.InputBufferLength ==
sizeof(ULONG) ? *(PULONG)Irp->AssociatedIrp.SystemBuffer : 0;
Timeout.QuadPart = Int32x32To64(WaitTime, -1000);