39 DbgPrint(
"CmBattWaitWakeLoop: PoRequestPowerIrp: status = 0x%08x.\n",
46 DbgPrint(
"CmBattWaitWakeLoop: failed: status = 0x%08x.\n",
81 DbgPrint(
"CmBattGetAcpiInterfaces: Failed to allocate Irp\n");
100 AcpiInterface->Version = 1;
131 DbgPrint(
"CmBattGetAcpiInterfaces: Could not get ACPI driver interfaces, status = %x\n",
Status);
156 DbgPrint(
"CmBattRemoveDevice: CmBatt (%x), Type %d, _UID %d\n",
214 DbgPrint(
"CmBattPowerDispatch: IRP_MN_WAIT_WAKE\n");
219 DbgPrint(
"CmBattPowerDispatch: IRP_MN_POWER_SEQUENCE\n");
224 DbgPrint(
"CmBattPowerDispatch: IRP_MN_WAIT_WAKE\n");
229 DbgPrint(
"CmBattPowerDispatch: IRP_MN_SET_POWER type: %d, State: %d \n",
319 Irp->IoStatus.Information &= ~PNP_DEVICE_NOT_DISABLEABLE;
328 DbgPrint(
"CmBattPnpDispatch: IRP_MN_SURPRISE_REMOVAL\n");
339 DbgPrint(
"CmBattPnpDispatch: IRP_MN_START_DEVICE\n");
348 DbgPrint(
"CmBattPnpDispatch: IRP_MN_STOP_DEVICE\n");
357 DbgPrint(
"CmBattPnpDispatch: IRP_MN_QUERY_REMOVE_DEVICE\n");
372 DbgPrint(
"CmBattPnpDispatch: Received two consecutive QUERY_REMOVE requests.\n");
386 DbgPrint(
"CmBattPnpDispatch: IRP_MN_REMOVE_DEVICE\n");
394 DbgPrint(
"CmBattPnpDispatch: IRP_MN_CANCEL_REMOVE_DEVICE\n");
406 DbgPrint(
"CmBattPnpDispatch: Received CANCEL_REMOVE when OpenCount == %x\n",
417 DbgPrint(
"CmBattPnpDispatch: IRP_MN_QUERY_STOP_DEVICE\n");
425 DbgPrint(
"CmBattPnpDispatch: IRP_MN_CANCEL_STOP_DEVICE\n");
461 DbgPrint(
"CmBattPnpDispatch: IRP_MN_QUERY_CAPABILITIES %d Capabilities->SystemWake = %x\n",
471 DbgPrint(
"CmBattPnpDispatch: IRP_MN_QUERY_CAPABILITIES Wake not supported.\n");
473 else if (!(DeviceExtension->
PowerIrp) &&
484 DbgPrint(
"CmBattPnpDispatch: IRP_MN_QUERY_CAPABILITIES wait/Wake irp sent.\n");
495 DbgPrint(
"CmBattPnpDispatch: Unimplemented minor %0x\n",
550 DbgPrint(
"CmBattCreateFdo: Error %x from _UID, assuming unit #0\n",
Status);
565 DbgPrint(
"CmBattCreateFdo: error (0x%x) creating device object\n",
Status);
571 FdoDeviceObject->
Flags &= ~DO_DEVICE_INITIALIZING;
588 DbgPrint(
"CmBattCreateFdo: IoAttachDeviceToDeviceStack failed.\n");
601 DbgPrint(
"CmBattCreateFdo: Could not get ACPI interfaces: %x\n",
Status);
641 *NewDeviceObject = FdoDeviceObject;
643 DbgPrint(
"CmBattCreateFdo: Created FDO %x\n", FdoDeviceObject);
668 DbgPrint(
"CmBattAddBattery: error (0x%x) creating Fdo\n",
Status);
705 DbgPrint(
"CmBattAddBattery: error (0x%x) registering with class\n",
Status);
714 DbgPrint(
"CmBattAddBattery: Could not register as a WMI provider, status = %Lx\n",
Status);
729 DbgPrint(
"CmBattAddBattery: Could not register for battery notify, status = %Lx\n",
Status);
753 DbgPrint(
"CmBatt: Second AC adapter found. Current version of driver only supports 1 adapter.\n");
770 DbgPrint(
"CmBattAddAcAdapter: error (0x%x) creating Fdo\n",
Status);
782 DbgPrint(
"CmBattAddBattery: Could not register as a WMI provider, status = %Lx\n",
Status);
790 DbgPrint(
"CmBattAddAcAdapter: Could not register for power notify, status = %Lx\n",
Status);
808 ULONG PowerSourceType;
829 DbgPrint(
"CmBattAddDevice: Could not get the software branch: %x\n",
Status);
846 DbgPrint(
"CmBattAddDevice: Could not read the power type identifier: %x\n",
Status);
852 if (PowerSourceType == 1)
857 else if (PowerSourceType == 0)
866 DbgPrint(
"CmBattAddDevice: Invalid POWER_SOURCE_TYPE == %d \n", PowerSourceType);
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedExchange
#define BATTERY_UNKNOWN_CAPACITY
#define BATTERY_CLASS_MAJOR_VERSION
#define BATTERY_CLASS_MINOR_VERSION
BCLASSAPI NTSTATUS NTAPI BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo, PVOID *ClassData)
BCLASSAPI NTSTATUS NTAPI BatteryClassUnload(PVOID ClassData)
#define FILE_DEVICE_SECURE_OPEN
PDEVICE_OBJECT AcAdapterPdo
NTSTATUS NTAPI CmBattDisableStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CmBattQueryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG Tag, IN PBATTERY_STATUS BatteryStatus)
NTSTATUS NTAPI CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension, IN ULONG Tag, IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel, IN OPTIONAL LONG AtRate, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnedLength)
VOID NTAPI CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG NotifyValue)
NTSTATUS NTAPI CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, OUT PULONG Tag)
NTSTATUS NTAPI CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG BatteryTag, IN PBATTERY_NOTIFY BatteryNotify)
NTSTATUS NTAPI CmBattSetTripPpoint(PCMBATT_DEVICE_EXTENSION DeviceExtension, ULONG AlarmValue)
NTSTATUS NTAPI CmBattGetUniqueId(PDEVICE_OBJECT DeviceObject, PULONG UniqueId)
#define ACPI_BATT_NOTIFY_STATUS
NTSTATUS NTAPI CmBattWmiRegistration(PCMBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CmBattWmiDeRegistration(PCMBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI CmBattPowerDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI CmBattPnpDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI CmBattCreateFdo(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject, IN ULONG DeviceExtensionSize, IN PDEVICE_OBJECT *NewDeviceObject)
NTSTATUS NTAPI CmBattAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PdoDeviceObject)
NTSTATUS NTAPI CmBattIoCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PKEVENT Event)
NTSTATUS NTAPI CmBattAddAcAdapter(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PdoDeviceObject)
VOID NTAPI CmBattWaitWakeLoop(IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PVOID Context, IN PIO_STATUS_BLOCK IoStatusBlock)
NTSTATUS NTAPI CmBattRemoveDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI CmBattGetAcpiInterfaces(IN PDEVICE_OBJECT DeviceObject, IN OUT PACPI_INTERFACE_STANDARD AcpiInterface)
VOID NTAPI CmBattDestroyFdo(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI CmBattAddBattery(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject)
#define STATUS_NOT_SUPPORTED
#define STATUS_DEVICE_REMOVED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeSetEvent(pEvt, foo, foo2)
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT _In_ PUSB_PORT_PATH _Out_ PUSB_CD_ERROR_INFORMATION _In_ USHORT _In_ PDEVICE_OBJECT PdoDeviceObject
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
static OUT PIO_STATUS_BLOCK IoStatusBlock
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValuePartialInformation
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define IRP_MN_SURPRISE_REMOVAL
#define IoSkipCurrentIrpStackLocation(Irp)
#define IoCopyCurrentIrpStackLocationToNext(Irp)
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
#define IoCompleteRequest
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
BOOLEAN NTAPI IoCancelIrp(IN PIRP Irp)
VOID NTAPI IoFreeIrp(IN PIRP Irp)
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
NTSTATUS NTAPI PoRequestPowerIrp(_In_ PDEVICE_OBJECT DeviceObject, _In_ UCHAR MinorFunction, _In_ POWER_STATE PowerState, _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction, _In_opt_ __drv_aliasesMem PVOID Context, _Outptr_opt_ PIRP *pIrp)
#define STATUS_NO_MORE_ENTRIES
NTSTATUS NTAPI IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, IN ULONG DevInstKeyType, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DevInstRegKey)
#define FILE_DEVICE_BATTERY
struct _INTERFACE * PINTERFACE
#define KeQueryInterruptTime()
#define STATUS_MORE_PROCESSING_REQUIRED
PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications
PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications
BCLASS_QUERY_INFORMATION QueryInformation
BCLASS_SET_STATUS_NOTIFY SetStatusNotify
BCLASS_SET_INFORMATION SetInformation
PUNICODE_STRING DeviceName
BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify
BCLASS_QUERY_STATUS QueryStatus
BCLASS_QUERY_TAG QueryTag
CMBATT_EXTENSION_TYPE FdoType
PDEVICE_OBJECT DeviceObject
PDEVICE_OBJECT AttachedDevice
IO_REMOVE_LOCK RemoveLock
ACPI_INTERFACE_STANDARD AcpiInterface
union _IO_STACK_LOCATION::@1580 Parameters
struct _IO_STACK_LOCATION::@3979::@4005 QueryInterface
struct _IO_STACK_LOCATION::@3979::@4006 DeviceCapabilities
struct _IO_STACK_LOCATION::@3979::@4015 Power
#define RtlZeroMemory(Destination, Length)
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_OBJECT_NAME_NOT_FOUND
SYSTEM_POWER_STATE SystemState
#define PLUGPLAY_REGKEY_DRIVER
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
_In_ UCHAR _In_ UCHAR MinorFunction
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
#define IoAcquireRemoveLock(RemoveLock, Tag)
#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag)
#define PLUGPLAY_REGKEY_DEVICE
#define IoReleaseRemoveLock(_RemoveLock, _Tag)
#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark)
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
struct _ACPI_INTERFACE_STANDARD ACPI_INTERFACE_STANDARD
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_POWER_SEQUENCE
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_POWER
#define IRP_MN_QUERY_REMOVE_DEVICE