mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
[COMPBATT] Use the documented debug switches
Use the debug switches that are documented and have a name rather than some cryptic values with no meaning or some shit.
This commit is contained in:
parent
c6bdbefdc4
commit
95f062bf0d
3 changed files with 49 additions and 49 deletions
|
@ -25,7 +25,7 @@ CompBattOpenClose(
|
||||||
_In_ PIRP Irp)
|
_In_ PIRP Irp)
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING OpenClose\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING OpenClose\n");
|
||||||
|
|
||||||
/* Complete the IRP with success */
|
/* Complete the IRP with success */
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
@ -33,7 +33,7 @@ CompBattOpenClose(
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: Exiting OpenClose\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: Exiting OpenClose\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ CompBattSystemControl(
|
||||||
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING System Control\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING System Control\n");
|
||||||
|
|
||||||
/* Are we attached yet? */
|
/* Are we attached yet? */
|
||||||
if (DeviceExtension->AttachedDevice)
|
if (DeviceExtension->AttachedDevice)
|
||||||
|
@ -95,7 +95,7 @@ CompBattRecalculateTag(
|
||||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||||
ULONG Tag;
|
ULONG Tag;
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING CompBattRecalculateTag\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING CompBattRecalculateTag\n");
|
||||||
|
|
||||||
/* Loop the battery list */
|
/* Loop the battery list */
|
||||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||||
|
@ -122,7 +122,7 @@ CompBattRecalculateTag(
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING CompBattRecalculateTag\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING CompBattRecalculateTag\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -133,7 +133,7 @@ CompBattIoctl(
|
||||||
{
|
{
|
||||||
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING Ioctl\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING Ioctl\n");
|
||||||
|
|
||||||
/* Let the class driver handle it */
|
/* Let the class driver handle it */
|
||||||
Status = BatteryClassIoctl(DeviceExtension->ClassData, Irp);
|
Status = BatteryClassIoctl(DeviceExtension->ClassData, Irp);
|
||||||
|
@ -146,7 +146,7 @@ CompBattIoctl(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING Ioctl\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING Ioctl\n");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ CompBattQueryTag(
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING QueryTag\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING QueryTag\n");
|
||||||
|
|
||||||
/* Was a tag assigned? */
|
/* Was a tag assigned? */
|
||||||
if (!(DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED))
|
if (!(DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED))
|
||||||
|
@ -182,7 +182,7 @@ CompBattQueryTag(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING QueryTag\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING QueryTag\n");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ CompBattDisableStatusNotify(
|
||||||
{
|
{
|
||||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING DisableStatusNotify\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING DisableStatusNotify\n");
|
||||||
|
|
||||||
/* Loop the battery list */
|
/* Loop the battery list */
|
||||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||||
|
@ -210,7 +210,7 @@ CompBattDisableStatusNotify(
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING DisableStatusNotify\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING DisableStatusNotify\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ CompBattGetBatteryInformation(
|
||||||
BATTERY_QUERY_INFORMATION InputBuffer;
|
BATTERY_QUERY_INFORMATION InputBuffer;
|
||||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryInformation\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING GetBatteryInformation\n");
|
||||||
|
|
||||||
/* Set defaults */
|
/* Set defaults */
|
||||||
BatteryInfo->DefaultAlert1 = 0;
|
BatteryInfo->DefaultAlert1 = 0;
|
||||||
|
@ -298,7 +298,7 @@ CompBattGetBatteryInformation(
|
||||||
|
|
||||||
/* Next time we can use the static copy */
|
/* Next time we can use the static copy */
|
||||||
BatteryData->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
BatteryData->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
||||||
if (CompBattDebug & 2)
|
if (CompBattDebug & COMPBATT_DEBUG_INFO)
|
||||||
DbgPrint("CompBattGetBatteryInformation: Read individual BATTERY_INFORMATION\n"
|
DbgPrint("CompBattGetBatteryInformation: Read individual BATTERY_INFORMATION\n"
|
||||||
"-------- Capabilities = %x\n-------- Technology = %x\n"
|
"-------- Capabilities = %x\n-------- Technology = %x\n"
|
||||||
"-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
|
"-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
|
||||||
|
@ -364,7 +364,7 @@ CompBattGetBatteryInformation(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print out final combined data */
|
/* Print out final combined data */
|
||||||
if (CompBattDebug & 2)
|
if (CompBattDebug & COMPBATT_DEBUG_INFO)
|
||||||
DbgPrint("CompBattGetBatteryInformation: Returning BATTERY_INFORMATION\n"
|
DbgPrint("CompBattGetBatteryInformation: Returning BATTERY_INFORMATION\n"
|
||||||
"-------- Capabilities = %x\n-------- Technology = %x\n"
|
"-------- Capabilities = %x\n-------- Technology = %x\n"
|
||||||
"-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
|
"-------- Chemistry[4] = %x\n-------- DesignedCapacity = %x\n"
|
||||||
|
@ -389,7 +389,7 @@ CompBattGetBatteryInformation(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are done */
|
/* We are done */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryInformation\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING GetBatteryInformation\n");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ CompBattGetBatteryGranularity(
|
||||||
BATTERY_REPORTING_SCALE BatteryScale[4];
|
BATTERY_REPORTING_SCALE BatteryScale[4];
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryGranularity\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING GetBatteryGranularity\n");
|
||||||
|
|
||||||
/* Set defaults */
|
/* Set defaults */
|
||||||
ReportingScale[0].Granularity = -1;
|
ReportingScale[0].Granularity = -1;
|
||||||
|
@ -476,7 +476,7 @@ CompBattGetBatteryGranularity(
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryGranularity\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING GetBatteryGranularity\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ CompBattQueryInformation(
|
||||||
ULONG QueryLength = 0;
|
ULONG QueryLength = 0;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING QueryInformation\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING QueryInformation\n");
|
||||||
|
|
||||||
/* Check for valid/correct tag */
|
/* Check for valid/correct tag */
|
||||||
if ((Tag != DeviceExtension->Tag) ||
|
if ((Tag != DeviceExtension->Tag) ||
|
||||||
|
@ -601,7 +601,7 @@ CompBattQueryInformation(
|
||||||
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
||||||
|
|
||||||
/* Return function result */
|
/* Return function result */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING QueryInformation\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING QueryInformation\n");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ BatteryIoctl(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING BatteryIoctl\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING BatteryIoctl\n");
|
||||||
|
|
||||||
/* Initialize the event and IRP */
|
/* Initialize the event and IRP */
|
||||||
KeInitializeEvent(&Event, SynchronizationEvent, 0);
|
KeInitializeEvent(&Event, SynchronizationEvent, 0);
|
||||||
|
@ -53,16 +53,16 @@ BatteryIoctl(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print failure */
|
/* Print failure */
|
||||||
if (!(NT_SUCCESS(Status)) && (CompBattDebug & 8))
|
if (!(NT_SUCCESS(Status)) && (CompBattDebug & COMPBATT_DEBUG_ERR))
|
||||||
DbgPrint("BatteryIoctl: Irp failed - %x\n", Status);
|
DbgPrint("BatteryIoctl: Irp failed - %x\n", Status);
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING BatteryIoctl\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING BatteryIoctl\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Out of memory */
|
/* Out of memory */
|
||||||
if (CompBattDebug & 8) DbgPrint("BatteryIoctl: couldn't create Irp\n");
|
if (CompBattDebug & COMPBATT_DEBUG_ERR) DbgPrint("BatteryIoctl: couldn't create Irp\n");
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ CompBattPowerDispatch(
|
||||||
_In_ PIRP Irp)
|
_In_ PIRP Irp)
|
||||||
{
|
{
|
||||||
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: PowerDispatch received power IRP.\n");
|
if (CompBattDebug & COMPBATT_DEBUG_WARN) DbgPrint("CompBatt: PowerDispatch received power IRP.\n");
|
||||||
|
|
||||||
/* Start the next IRP */
|
/* Start the next IRP */
|
||||||
PoStartNextPowerIrp(Irp);
|
PoStartNextPowerIrp(Irp);
|
||||||
|
@ -39,7 +39,7 @@ RemoveBatteryFromList(
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||||
if (CompBattDebug & 1)
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE)
|
||||||
DbgPrint("CompBatt: ENTERING RemoveBatteryFromList\n");
|
DbgPrint("CompBatt: ENTERING RemoveBatteryFromList\n");
|
||||||
|
|
||||||
/* Loop the battery list */
|
/* Loop the battery list */
|
||||||
|
@ -70,7 +70,7 @@ RemoveBatteryFromList(
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING RemoveBatteryFromList\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING RemoveBatteryFromList\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ IsBatteryAlreadyOnList(
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||||
BOOLEAN Found = FALSE;
|
BOOLEAN Found = FALSE;
|
||||||
if (CompBattDebug & 1)
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE)
|
||||||
DbgPrint("CompBatt: ENTERING IsBatteryAlreadyOnList\n");
|
DbgPrint("CompBatt: ENTERING IsBatteryAlreadyOnList\n");
|
||||||
|
|
||||||
/* Loop the battery list */
|
/* Loop the battery list */
|
||||||
|
@ -107,7 +107,7 @@ IsBatteryAlreadyOnList(
|
||||||
|
|
||||||
/* Release the lock and return search status */
|
/* Release the lock and return search status */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING IsBatteryAlreadyOnList\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING IsBatteryAlreadyOnList\n");
|
||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ CompBattAddNewBattery(
|
||||||
PIO_STACK_LOCATION IoStackLocation;
|
PIO_STACK_LOCATION IoStackLocation;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 1)
|
if (CompBattDebug & COMPBATT_DEBUG_WARN)
|
||||||
DbgPrint("CompBatt: ENTERING AddNewBattery \"%w\" \n", BatteryName->Buffer);
|
DbgPrint("CompBatt: ENTERING AddNewBattery \"%w\" \n", BatteryName->Buffer);
|
||||||
|
|
||||||
/* Is this a new battery? */
|
/* Is this a new battery? */
|
||||||
|
@ -189,13 +189,13 @@ CompBattAddNewBattery(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Fail, no memory */
|
/* Fail, no memory */
|
||||||
if (CompBattDebug & 8)
|
if (CompBattDebug & COMPBATT_DEBUG_ERR)
|
||||||
DbgPrint("CompBatt: Couldn't allocate new battery Irp\n");
|
DbgPrint("CompBatt: Couldn't allocate new battery Irp\n");
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
ObDereferenceObject(BatteryData->DeviceObject);
|
ObDereferenceObject(BatteryData->DeviceObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CompBattDebug & 8)
|
else if (CompBattDebug & COMPBATT_DEBUG_ERR)
|
||||||
{
|
{
|
||||||
/* Fail */
|
/* Fail */
|
||||||
DbgPrint("CompBattAddNewBattery: Failed to get device Object. status = %lx\n",
|
DbgPrint("CompBattAddNewBattery: Failed to get device Object. status = %lx\n",
|
||||||
|
@ -211,14 +211,14 @@ CompBattAddNewBattery(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Fail, no memory */
|
/* Fail, no memory */
|
||||||
if (CompBattDebug & 8)
|
if (CompBattDebug & COMPBATT_DEBUG_ERR)
|
||||||
DbgPrint("CompBatt: Couldn't allocate new battery node\n");
|
DbgPrint("CompBatt: Couldn't allocate new battery node\n");
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING AddNewBattery\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING AddNewBattery\n");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ CompBattRemoveBattery(
|
||||||
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
|
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: RemoveBattery\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: RemoveBattery\n");
|
||||||
|
|
||||||
/* Remove the entry */
|
/* Remove the entry */
|
||||||
BatteryData = RemoveBatteryFromList(BatteryName, DeviceExtension);
|
BatteryData = RemoveBatteryFromList(BatteryName, DeviceExtension);
|
||||||
|
@ -257,7 +257,7 @@ CompBattGetBatteries(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWCHAR LinkList;
|
PWCHAR LinkList;
|
||||||
UNICODE_STRING LinkString;
|
UNICODE_STRING LinkString;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteries\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING GetBatteries\n");
|
||||||
|
|
||||||
/* Get all battery links */
|
/* Get all battery links */
|
||||||
Status = IoGetDeviceInterfaces(&GUID_DEVICE_BATTERY, NULL, 0, &LinkList);
|
Status = IoGetDeviceInterfaces(&GUID_DEVICE_BATTERY, NULL, 0, &LinkList);
|
||||||
|
@ -279,14 +279,14 @@ CompBattGetBatteries(
|
||||||
/* Parsing complete, clean up buffer */
|
/* Parsing complete, clean up buffer */
|
||||||
ExFreePool(LinkList);
|
ExFreePool(LinkList);
|
||||||
}
|
}
|
||||||
else if (CompBattDebug & 8)
|
else if (CompBattDebug & COMPBATT_DEBUG_ERR)
|
||||||
{
|
{
|
||||||
/* Fail */
|
/* Fail */
|
||||||
DbgPrint("CompBatt: Couldn't get list of batteries\n");
|
DbgPrint("CompBatt: Couldn't get list of batteries\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteries\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING GetBatteries\n");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,31 +296,31 @@ CompBattPnpEventHandler(
|
||||||
_In_ PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification,
|
_In_ PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification,
|
||||||
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
|
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING PnpEventHandler\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING PnpEventHandler\n");
|
||||||
if (CompBattDebug & 2) DbgPrint("CompBatt: Received device interface change notification\n");
|
if (CompBattDebug & COMPBATT_DEBUG_WARN) DbgPrint("CompBatt: Received device interface change notification\n");
|
||||||
|
|
||||||
/* Check what happened */
|
/* Check what happened */
|
||||||
if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_ARRIVAL))
|
if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_ARRIVAL))
|
||||||
{
|
{
|
||||||
/* Add the new battery */
|
/* Add the new battery */
|
||||||
if (CompBattDebug & 2)
|
if (CompBattDebug & COMPBATT_DEBUG_WARN)
|
||||||
DbgPrint("CompBatt: Received notification of battery arrival\n");
|
DbgPrint("CompBatt: Received notification of battery arrival\n");
|
||||||
CompBattAddNewBattery(Notification->SymbolicLinkName, DeviceExtension);
|
CompBattAddNewBattery(Notification->SymbolicLinkName, DeviceExtension);
|
||||||
}
|
}
|
||||||
else if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_REMOVAL))
|
else if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_REMOVAL))
|
||||||
{
|
{
|
||||||
/* Don't do anything */
|
/* Don't do anything */
|
||||||
if (CompBattDebug & 2)
|
if (CompBattDebug & COMPBATT_DEBUG_WARN)
|
||||||
DbgPrint("CompBatt: Received notification of battery removal\n");
|
DbgPrint("CompBatt: Received notification of battery removal\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Shouldn't happen */
|
/* Shouldn't happen */
|
||||||
if (CompBattDebug & 2) DbgPrint("CompBatt: Received unhandled PnP event\n");
|
if (CompBattDebug & COMPBATT_DEBUG_WARN) DbgPrint("CompBatt: Received unhandled PnP event\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done, return success */
|
/* Done, return success */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING PnpEventHandler\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING PnpEventHandler\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ CompBattAddDevice(
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
UNICODE_STRING SymbolicLinkName;
|
UNICODE_STRING SymbolicLinkName;
|
||||||
BATTERY_MINIPORT_INFO MiniportInfo;
|
BATTERY_MINIPORT_INFO MiniportInfo;
|
||||||
if (CompBattDebug & 2) DbgPrint("CompBatt: Got an AddDevice - %x\n", PdoDeviceObject);
|
if (CompBattDebug & COMPBATT_DEBUG_WARN) DbgPrint("CompBatt: Got an AddDevice - %x\n", PdoDeviceObject);
|
||||||
|
|
||||||
/* Create the device */
|
/* Create the device */
|
||||||
RtlInitUnicodeString(&DeviceName, L"\\Device\\CompositeBattery");
|
RtlInitUnicodeString(&DeviceName, L"\\Device\\CompositeBattery");
|
||||||
|
@ -364,7 +364,7 @@ CompBattAddDevice(
|
||||||
if (!DeviceExtension->AttachedDevice)
|
if (!DeviceExtension->AttachedDevice)
|
||||||
{
|
{
|
||||||
/* Fail */
|
/* Fail */
|
||||||
if (CompBattDebug & 8)
|
if (CompBattDebug & COMPBATT_DEBUG_ERR)
|
||||||
DbgPrint("CompBattAddDevice: Could not attach to LowerDevice.\n");
|
DbgPrint("CompBattAddDevice: Could not attach to LowerDevice.\n");
|
||||||
IoDeleteDevice(DeviceObject);
|
IoDeleteDevice(DeviceObject);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
@ -417,7 +417,7 @@ CompBattPnpDispatch(
|
||||||
PIO_STACK_LOCATION IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING PnpDispatch\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: ENTERING PnpDispatch\n");
|
||||||
|
|
||||||
/* Set default error */
|
/* Set default error */
|
||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
|
@ -438,14 +438,14 @@ CompBattPnpDispatch(
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Now go get the batteries */
|
/* Now go get the batteries */
|
||||||
if (CompBattDebug & 2)
|
if (CompBattDebug & COMPBATT_DEBUG_WARN)
|
||||||
DbgPrint("CompBatt: Successfully registered for PnP notification\n");
|
DbgPrint("CompBatt: Successfully registered for PnP notification\n");
|
||||||
Status = CompBattGetBatteries(DeviceExtension);
|
Status = CompBattGetBatteries(DeviceExtension);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We failed */
|
/* We failed */
|
||||||
if (CompBattDebug & 8)
|
if (CompBattDebug & COMPBATT_DEBUG_ERR)
|
||||||
DbgPrint("CompBatt: Couldn't register for PnP notification - %x\n",
|
DbgPrint("CompBatt: Couldn't register for PnP notification - %x\n",
|
||||||
Status);
|
Status);
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ CompBattPnpDispatch(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the remove lock and return status */
|
/* Release the remove lock and return status */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING PnpDispatch\n");
|
if (CompBattDebug & COMPBATT_DEBUG_TRACE) DbgPrint("CompBatt: EXITING PnpDispatch\n");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue