mirror of
https://github.com/reactos/reactos.git
synced 2024-07-31 00:28:56 +00:00
[CMBATT]: Implement CmBattGetAcpiInterfaces and CmBattIoCompletion to get the ACPI interface.
[CMBATT]: Implement CmBattWmiRegistration and CmBattWmiDeRegistration to initialize the WMILIB and register with the I/O WMI routines. [DDK]: Add missing IoWMIRegistrationControl flags. svn path=/trunk/; revision=46333
This commit is contained in:
parent
2edf3c4c34
commit
01e54afe0a
|
@ -11,6 +11,7 @@
|
|||
#include <batclass.h>
|
||||
#include <acpiioct.h>
|
||||
#include <wmilib.h>
|
||||
#include <wdmguid.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define CMBATT_GENERIC_STATUS 0x01
|
||||
|
|
|
@ -14,21 +14,85 @@
|
|||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmBattIoCompletion(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PKEVENT Event)
|
||||
CmBattIoCompletion(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
IN PKEVENT Event)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
if (CmBattDebug & 2) DbgPrint("CmBattIoCompletion: Event (%x)\n", Event);
|
||||
|
||||
/* Set the completion event */
|
||||
KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmBattGetAcpiInterfaces(PDEVICE_OBJECT DeviceObject,
|
||||
PACPI_INTERFACE_STANDARD AcpiInterface)
|
||||
CmBattGetAcpiInterfaces(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN OUT PACPI_INTERFACE_STANDARD AcpiInterface)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
PIO_STACK_LOCATION IoStackLocation;
|
||||
KEVENT Event;
|
||||
|
||||
/* Allocate the IRP */
|
||||
Irp = IoAllocateIrp(DeviceObject->StackSize, 0);
|
||||
if (!Irp)
|
||||
{
|
||||
/* Fail */
|
||||
if (CmBattDebug & 0xC)
|
||||
DbgPrint("CmBattGetAcpiInterfaces: Failed to allocate Irp\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Set default error code */
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
|
||||
/* Build the query */
|
||||
IoStackLocation = IoGetNextIrpStackLocation(Irp);
|
||||
IoStackLocation->MinorFunction = IRP_MN_QUERY_INTERFACE;
|
||||
IoStackLocation->Parameters.QueryInterface.InterfaceType = &GUID_ACPI_INTERFACE_STANDARD;
|
||||
IoStackLocation->Parameters.QueryInterface.Size = sizeof(ACPI_INTERFACE_STANDARD);
|
||||
IoStackLocation->Parameters.QueryInterface.Version = 1;
|
||||
IoStackLocation->Parameters.QueryInterface.Interface = (PINTERFACE)AcpiInterface;
|
||||
IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData = NULL;
|
||||
|
||||
/* Set default ACPI interface data */
|
||||
AcpiInterface->Size = sizeof(ACPI_INTERFACE_STANDARD);
|
||||
AcpiInterface->Version = 1;
|
||||
|
||||
/* Initialize our wait event */
|
||||
KeInitializeEvent(&Event, SynchronizationEvent, 0);
|
||||
|
||||
/* Set the completion routine */
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
IoSetCompletionRoutine(Irp,
|
||||
(PVOID)CmBattIoCompletion,
|
||||
&Event,
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE);
|
||||
|
||||
/* Now call ACPI */
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
/* Wait for completion */
|
||||
KeWaitForSingleObject(&Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
/* Free the IRP */
|
||||
IoFreeIrp(Irp);
|
||||
|
||||
/* Return status */
|
||||
if (!(NT_SUCCESS(Status)) && (CmBattDebug & 0xC))
|
||||
DbgPrint("CmBattGetAcpiInterfaces: Could not get ACPI driver interfaces, status = %x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
#include "cmbatt.h"
|
||||
|
||||
/* GLOBALS ********************************************************************/
|
||||
|
||||
WMIGUIDREGINFO CmBattWmiGuidList[1] =
|
||||
{
|
||||
{&GUID_POWER_DEVICE_WAKE_ENABLE, 1, 0}
|
||||
};
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
|
@ -69,18 +76,37 @@ CmBattSetWmiDataItem(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmBattWmiDeRegistration(PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
CmBattWmiDeRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
PAGED_CODE();
|
||||
|
||||
/* De-register */
|
||||
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
||||
WMIREG_ACTION_DEREGISTER);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmBattWmiRegistration(PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
CmBattWmiRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
PAGED_CODE();
|
||||
|
||||
/* GUID information */
|
||||
DeviceExtension->WmiLibInfo.GuidCount = sizeof(CmBattWmiGuidList) /
|
||||
sizeof(WMIGUIDREGINFO);
|
||||
DeviceExtension->WmiLibInfo.GuidList = CmBattWmiGuidList;
|
||||
|
||||
/* Callbacks */
|
||||
DeviceExtension->WmiLibInfo.QueryWmiRegInfo = CmBattQueryWmiRegInfo;
|
||||
DeviceExtension->WmiLibInfo.QueryWmiDataBlock = CmBattQueryWmiDataBlock;
|
||||
DeviceExtension->WmiLibInfo.SetWmiDataBlock = CmBattSetWmiDataBlock;
|
||||
DeviceExtension->WmiLibInfo.SetWmiDataItem = CmBattSetWmiDataItem;
|
||||
DeviceExtension->WmiLibInfo.ExecuteWmiMethod = NULL;
|
||||
DeviceExtension->WmiLibInfo.WmiFunctionControl = NULL;
|
||||
|
||||
/* Register */
|
||||
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
||||
WMIREG_ACTION_REGISTER);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
|
|
@ -3158,6 +3158,12 @@ typedef VOID
|
|||
(DDKAPI *WMI_NOTIFICATION_CALLBACK)(
|
||||
PVOID Wnode,
|
||||
PVOID Context);
|
||||
|
||||
#define WMIREG_ACTION_REGISTER 1
|
||||
#define WMIREG_ACTION_DEREGISTER 2
|
||||
#define WMIREG_ACTION_REREGISTER 3
|
||||
#define WMIREG_ACTION_UPDATE_GUIDS 4
|
||||
#define WMIREG_ACTION_BLOCK_IRPS 5
|
||||
|
||||
#define EVENT_INCREMENT 1
|
||||
#define IO_NO_INCREMENT 0
|
||||
|
|
Loading…
Reference in a new issue