ReactOS  0.4.14-dev-554-g2f8d847
comppnp.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Composite Battery Driver
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: boot/drivers/bus/acpi/compbatt/comppnp.c
5  * PURPOSE: Plug-and-Play IOCTL/IRP Handling
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "compbatt.h"
12 
13 #include <wdmguid.h>
14 
15 /* FUNCTIONS ******************************************************************/
16 
18 NTAPI
20  IN PIRP Irp)
21 {
23  if (CompBattDebug & 1) DbgPrint("CompBatt: PowerDispatch received power IRP.\n");
24 
25  /* Start the next IRP */
27 
28  /* Call the next driver in the stack */
30  return PoCallDriver(DeviceExtension->AttachedDevice, Irp);
31 }
32 
34 NTAPI
36  IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
37 {
38  PLIST_ENTRY ListHead, NextEntry;
39  PCOMPBATT_BATTERY_DATA BatteryData;
40  if (CompBattDebug & 1)
41  DbgPrint("CompBatt: ENTERING RemoveBatteryFromList\n");
42 
43  /* Loop the battery list */
44  ExAcquireFastMutex(&DeviceExtension->Lock);
45  ListHead = &DeviceExtension->BatteryList;
46  NextEntry = ListHead->Flink;
47  while (NextEntry != ListHead)
48  {
49  /* Get the battery information and compare the name */
50  BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
51  if (!RtlCompareUnicodeString(BatteryName, &BatteryData->BatteryName, TRUE))
52  {
53  /* Flush pending deletes and any lock waiters */
54  IoAcquireRemoveLock(&BatteryData->RemoveLock, 0);
55  ExReleaseFastMutex(&DeviceExtension->Lock);
56  IoReleaseRemoveLockAndWait(&BatteryData->RemoveLock, 0);
57 
58  /* Remove the entry from the list */
59  ExAcquireFastMutex(&DeviceExtension->Lock);
60  RemoveEntryList(&BatteryData->BatteryLink);
61  ExReleaseFastMutex(&DeviceExtension->Lock);
62  return BatteryData;
63  }
64 
65  /* Next */
66  NextEntry = NextEntry->Flink;
67  }
68 
69  /* Done */
70  ExReleaseFastMutex(&DeviceExtension->Lock);
71  if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING RemoveBatteryFromList\n");
72  return NULL;
73 }
74 
75 BOOLEAN
76 NTAPI
78  IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
79 {
80  PLIST_ENTRY ListHead, NextEntry;
81  PCOMPBATT_BATTERY_DATA BatteryData;
83  if (CompBattDebug & 1)
84  DbgPrint("CompBatt: ENTERING IsBatteryAlreadyOnList\n");
85 
86  /* Loop the battery list */
87  ExAcquireFastMutex(&DeviceExtension->Lock);
88  ListHead = &DeviceExtension->BatteryList;
89  NextEntry = ListHead->Flink;
90  while (NextEntry != ListHead)
91  {
92  /* Get the battery information and compare the name */
93  BatteryData = CONTAINING_RECORD(NextEntry, COMPBATT_BATTERY_DATA, BatteryLink);
94  if (!RtlCompareUnicodeString(BatteryName, &BatteryData->BatteryName, TRUE))
95  {
96  /* Got it */
97  Found = TRUE;
98  break;
99  }
100 
101  /* Next */
102  NextEntry = NextEntry->Flink;
103  }
104 
105  /* Release the lock and return search status */
106  ExReleaseFastMutex(&DeviceExtension->Lock);
107  if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING IsBatteryAlreadyOnList\n");
108  return Found;
109 }
110 
111 NTSTATUS
112 NTAPI
114  IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
115 {
117  PCOMPBATT_BATTERY_DATA BatteryData;
118  PIRP Irp;
119  PIO_STACK_LOCATION IoStackLocation;
121  PAGED_CODE();
122  if (CompBattDebug & 1)
123  DbgPrint("CompBatt: ENTERING AddNewBattery \"%w\" \n", BatteryName->Buffer);
124 
125  /* Is this a new battery? */
126  if (!IsBatteryAlreadyOnList(BatteryName, DeviceExtension))
127  {
128  /* Allocate battery data */
129  BatteryData = ExAllocatePoolWithTag(NonPagedPool,
130  sizeof(COMPBATT_BATTERY_DATA) +
131  BatteryName->Length,
132  'CtaB');
133  if (BatteryData)
134  {
135  /* Initialize the data and write the battery name */
136  RtlZeroMemory(BatteryData, sizeof(COMPBATT_BATTERY_DATA));
137  BatteryData->Tag = 0;
138  BatteryData->BatteryName.MaximumLength = BatteryName->Length;
139  BatteryData->BatteryName.Buffer = (PWCHAR)(BatteryData + 1);
140  RtlCopyUnicodeString(&BatteryData->BatteryName, BatteryName);
141 
142  /* Get the device object */
145  &FileObject,
146  &BatteryData->DeviceObject);
147  if (NT_SUCCESS(Status))
148  {
149  /* Reference the DO and drop the FO */
150  ObReferenceObject(BatteryData->DeviceObject);
152 
153  /* Allocate the battery IRP */
154  Irp = IoAllocateIrp(BatteryData->DeviceObject->StackSize + 1, 0);
155  if (Irp)
156  {
157  /* Save it */
158  BatteryData->Irp = Irp;
159 
160  /* Setup the stack location */
161  IoStackLocation = IoGetNextIrpStackLocation(Irp);
162  IoStackLocation->Parameters.Others.Argument1 = DeviceExtension;
163  IoStackLocation->Parameters.Others.Argument2 = BatteryData;
164 
165  /* Set IRP data */
167  Irp->IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED;
168  BatteryData->WaitFlag = 0;
169 
170  /* Insert this battery in the list */
171  ExAcquireFastMutex(&DeviceExtension->Lock);
172  InsertTailList(&DeviceExtension->BatteryList,
173  &BatteryData->BatteryLink);
174  ExReleaseFastMutex(&DeviceExtension->Lock);
175 
176  /* Initialize the work item and delete lock */
177  IoInitializeRemoveLock(&BatteryData->RemoveLock, 0, 0, 0);
178  ExInitializeWorkItem(&BatteryData->WorkItem,
180  BatteryData);
181 
182  /* Setup the IRP work entry */
183  CompBattMonitorIrpComplete(BatteryData->DeviceObject, Irp, 0);
185  }
186  else
187  {
188  /* Fail, no memory */
189  if (CompBattDebug & 8)
190  DbgPrint("CompBatt: Couldn't allocate new battery Irp\n");
192  ObDereferenceObject(BatteryData->DeviceObject);
193  }
194  }
195  else if (CompBattDebug & 8)
196  {
197  /* Fail */
198  DbgPrint("CompBattAddNewBattery: Failed to get device Object. status = %lx\n",
199  Status);
200  }
201 
202  /* Free the battery data */
203  ExFreePool(BatteryData);
204  }
205  else
206  {
207  /* Fail, no memory */
208  if (CompBattDebug & 8)
209  DbgPrint("CompBatt: Couldn't allocate new battery node\n");
211  }
212  }
213 
214  /* We're done */
215  if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING AddNewBattery\n");
216  return Status;
217 }
218 
219 NTSTATUS
220 NTAPI
222  IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
223 {
224  PCOMPBATT_BATTERY_DATA BatteryData;
225  if (CompBattDebug & 1) DbgPrint("CompBatt: RemoveBattery\n");
226 
227  /* Remove the entry */
228  BatteryData = RemoveBatteryFromList(BatteryName, DeviceExtension);
229  if (BatteryData)
230  {
231  /* Dereference and free it */
232  ObDereferenceObject(BatteryData->DeviceObject);
233  ExFreePool(BatteryData);
234 
235  /* Notify class driver */
236  DeviceExtension->Flags = 0;
237  BatteryClassStatusNotify(DeviceExtension->ClassData);
238  }
239 
240  /* It's done */
241  return STATUS_SUCCESS;
242 }
243 
244 NTSTATUS
245 NTAPI
247 {
248  PWCHAR p;
250  PWCHAR LinkList;
251  UNICODE_STRING LinkString;
252  if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteries\n");
253 
254  /* Get all battery links */
255  Status = IoGetDeviceInterfaces(&GUID_DEVICE_BATTERY, NULL, 0, &LinkList);
256  p = LinkList;
257  if (NT_SUCCESS(Status))
258  {
259  /* Loop all strings inside */
260  while (TRUE)
261  {
262  /* Create the string */
263  RtlInitUnicodeString(&LinkString, p);
264  if (!LinkString.Length) break;
265 
266  /* Add this battery and move on */
267  Status = CompBattAddNewBattery(&LinkString, DeviceExtension);
268  p += (LinkString.Length / sizeof(WCHAR)) + sizeof(UNICODE_NULL);
269  }
270 
271  /* Parsing complete, clean up buffer */
272  ExFreePool(LinkList);
273  }
274  else if (CompBattDebug & 8)
275  {
276  /* Fail */
277  DbgPrint("CompBatt: Couldn't get list of batteries\n");
278  }
279 
280  /* Done */
281  if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteries\n");
282  return Status;
283 }
284 
285 NTSTATUS
286 NTAPI
288  IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
289 {
290  if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING PnpEventHandler\n");
291  if (CompBattDebug & 2) DbgPrint("CompBatt: Received device interface change notification\n");
292 
293  /* Check what happened */
294  if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_ARRIVAL))
295  {
296  /* Add the new battery */
297  if (CompBattDebug & 2)
298  DbgPrint("CompBatt: Received notification of battery arrival\n");
299  CompBattAddNewBattery(Notification->SymbolicLinkName, DeviceExtension);
300  }
301  else if (IsEqualGUIDAligned(&Notification->Event, &GUID_DEVICE_INTERFACE_REMOVAL))
302  {
303  /* Don't do anything */
304  if (CompBattDebug & 2)
305  DbgPrint("CompBatt: Received notification of battery removal\n");
306  }
307  else
308  {
309  /* Shouldn't happen */
310  if (CompBattDebug & 2) DbgPrint("CompBatt: Received unhandled PnP event\n");
311  }
312 
313  /* Done, return success */
314  if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING PnpEventHandler\n");
315  return STATUS_SUCCESS;
316 }
317 
318 NTSTATUS
319 NTAPI
322 {
325  PCOMPBATT_DEVICE_EXTENSION DeviceExtension;
327  UNICODE_STRING SymbolicLinkName;
328  BATTERY_MINIPORT_INFO MiniportInfo;
329  if (CompBattDebug & 2) DbgPrint("CompBatt: Got an AddDevice - %x\n", PdoDeviceObject);
330 
331  /* Create the device */
332  RtlInitUnicodeString(&DeviceName, L"\\Device\\CompositeBattery");
335  &DeviceName,
338  FALSE,
339  &DeviceObject);
340  if (!NT_SUCCESS(Status)) return Status;
341 
342  /* Setup symbolic link for Win32 access */
343  RtlInitUnicodeString(&SymbolicLinkName, L"\\DosDevices\\CompositeBattery");
344  IoCreateSymbolicLink(&SymbolicLinkName, &DeviceName);
345 
346  /* Initialize the device extension */
347  DeviceExtension = DeviceObject->DeviceExtension;
348  RtlZeroMemory(DeviceExtension, sizeof(COMPBATT_DEVICE_EXTENSION));
349 
350  /* Attach to device stack and set DO pointers */
353  DeviceExtension->DeviceObject = DeviceObject;
354  if (!DeviceExtension->AttachedDevice)
355  {
356  /* Fail */
357  if (CompBattDebug & 8)
358  DbgPrint("CompBattAddDevice: Could not attach to LowerDevice.\n");
360  return STATUS_UNSUCCESSFUL;
361  }
362 
363  /* Set device object flags */
366 
367  /* Setup the device extension */
368  ExInitializeFastMutex(&DeviceExtension->Lock);
369  InitializeListHead(&DeviceExtension->BatteryList);
370  DeviceExtension->Flags = 0;
371  DeviceExtension->NextTag = 1;
372 
373  /* Setup the miniport data */
374  RtlZeroMemory(&MiniportInfo, sizeof(MiniportInfo));
377  MiniportInfo.Context = DeviceExtension;
378  MiniportInfo.DeviceName = &DeviceName;
381  MiniportInfo.SetInformation = NULL;
385  MiniportInfo.Pdo = NULL;
386 
387  /* Register with the class driver */
388  Status = BatteryClassInitializeDevice(&MiniportInfo,
389  &DeviceExtension->ClassData);
390  if (!NT_SUCCESS(Status))
391  {
392  /* Undo everything */
393  IoDetachDevice(DeviceExtension->AttachedDevice);
395  }
396 
397  /* Return status */
398  return Status;
399 }
400 
401 NTSTATUS
402 NTAPI
404  IN PIRP Irp)
405 {
409  if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING PnpDispatch\n");
410 
411  /* Set default error */
413 
414  /* Check what kind of PnP function this is */
415  switch (IoStackLocation->MinorFunction)
416  {
417  case IRP_MN_START_DEVICE:
418 
419  /* Device is starting, register for new batteries and pick up current ones */
421  0,
422  (PVOID)&GUID_DEVICE_BATTERY,
423  DeviceObject->DriverObject,
425  DeviceExtension,
426  &DeviceExtension->NotificationEntry);
427  if (NT_SUCCESS(Status))
428  {
429  /* Now go get the batteries */
430  if (CompBattDebug & 2)
431  DbgPrint("CompBatt: Successfully registered for PnP notification\n");
432  Status = CompBattGetBatteries(DeviceExtension);
433  }
434  else
435  {
436  /* We failed */
437  if (CompBattDebug & 8)
438  DbgPrint("CompBatt: Couldn't register for PnP notification - %x\n",
439  Status);
440  }
441  break;
443 
444  /* Explicitly say ok */
446  break;
447 
449 
450  /* Explicitly say ok */
452  break;
453 
455 
456  /* Explicitly say ok */
458  break;
459 
461 
462  /* Add this in */
463  Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
465  break;
466 
467  default:
468 
469  /* Not supported */
471  break;
472  }
473 
474  /* Set IRP status if we have one */
475  if (Status != STATUS_NOT_SUPPORTED) Irp->IoStatus.Status = Status;
476 
477  /* Did someone pick it up? */
479  {
480  /* Still unsupported, try ACPI */
482  Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
483  }
484  else
485  {
486  /* Complete the request */
487  Status = Irp->IoStatus.Status;
489  }
490 
491  /* Release the remove lock and return status */
492  if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING PnpDispatch\n");
493  return Status;
494 }
495 
496 /* EOF */
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define DO_POWER_PAGABLE
PDEVICE_OBJECT AttachedDevice
Definition: compbatt.h:54
#define IN
Definition: typedefs.h:38
DRIVER_NOTIFICATION_CALLBACK_ROUTINE * PDRIVER_NOTIFICATION_CALLBACK_ROUTINE
Definition: iotypes.h:1204
#define TRUE
Definition: types.h:120
PCOMPBATT_BATTERY_DATA NTAPI RemoveBatteryFromList(IN PCUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:35
const GUID GUID_DEVICE_INTERFACE_ARRIVAL
Definition: deviface.c:14
BCLASSAPI NTSTATUS NTAPI BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo, PVOID *ClassData)
Definition: battc.c:137
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
BOOLEAN NTAPI IsBatteryAlreadyOnList(IN PCUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:77
#define FILE_ALL_ACCESS
Definition: nt_native.h:651
#define DbgPrint
Definition: loader.c:25
USHORT MaximumLength
Definition: env_spec_w32.h:370
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
_In_ PIRP Irp
Definition: csq.h:116
#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark)
Definition: iofuncs.h:2785
#define FILE_DEVICE_BATTERY
Definition: winioctl.h:146
NTSTATUS NTAPI CompBattAddNewBattery(IN PUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:113
PBCLASS_QUERY_STATUS_CALLBACK BCLASS_QUERY_STATUS
Definition: batclass.h:242
PBCLASS_SET_STATUS_NOTIFY_CALLBACK BCLASS_SET_STATUS_NOTIFY
Definition: batclass.h:243
LONG NTSTATUS
Definition: precomp.h:26
LIST_ENTRY BatteryLink
Definition: compbatt.h:20
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
NTSTATUS NTAPI IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList)
Definition: deviface.c:454
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
_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
Definition: hubbusif.h:89
uint16_t * PWCHAR
Definition: typedefs.h:54
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define InsertTailList(ListHead, Entry)
PDEVICE_OBJECT DeviceObject
Definition: compbatt.h:22
WORK_QUEUE_ITEM WorkItem
Definition: compbatt.h:24
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define PAGED_CODE()
Definition: video.h:57
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSTATUS NTAPI CompBattPnpEventHandler(IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:287
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define UNICODE_NULL
BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify
Definition: batclass.h:256
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
UNICODE_STRING BatteryName
Definition: compbatt.h:37
PDEVICE_OBJECT DeviceObject
Definition: compbatt.h:55
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK BCLASS_DISABLE_STATUS_NOTIFY
Definition: batclass.h:245
smooth NULL
Definition: ftsmooth.c:416
BCLASSAPI NTSTATUS NTAPI BatteryClassStatusNotify(PVOID ClassData)
Definition: battc.c:79
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
return Found
Definition: dirsup.c:1270
NTSTATUS NTAPI CompBattAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PdoDeviceObject)
Definition: comppnp.c:320
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
NTSTATUS NTAPI CompBattPnpDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: comppnp.c:403
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
NTSTATUS NTAPI CompBattSetStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG BatteryTag, IN PBATTERY_NOTIFY BatteryNotify)
Definition: compbatt.c:211
NTSTATUS NTAPI CompBattDisableStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: compbatt.c:184
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
PDEVICE_OBJECT Pdo
Definition: batclass.h:257
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define IRP_MN_START_DEVICE
#define PNP_DEVICE_NOT_DISABLEABLE
Definition: iotypes.h:969
NTSTATUS NTAPI CompBattGetDeviceObjectPointer(IN PUNICODE_STRING DeviceName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: compmisc.c:74
* PFILE_OBJECT
Definition: iotypes.h:1955
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
PUNICODE_STRING DeviceName
Definition: batclass.h:258
NTSTATUS NTAPI CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG Tag, IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel, IN OPTIONAL LONG AtRate, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnedLength)
Definition: compbatt.c:482
static const WCHAR L[]
Definition: oid.c:1250
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
NTSTATUS NTAPI IoRegisterPlugPlayNotification(IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, IN ULONG EventCategoryFlags, IN PVOID EventCategoryData OPTIONAL, IN PDRIVER_OBJECT DriverObject, IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, IN PVOID Context, OUT PVOID *NotificationEntry)
Definition: pnpnotify.c:249
BCLASS_QUERY_INFORMATION QueryInformation
Definition: batclass.h:252
Definition: typedefs.h:117
NTSTATUS NTAPI CompBattPowerDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: comppnp.c:19
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
#define BATTERY_CLASS_MINOR_VERSION
Definition: batclass.h:164
NTSTATUS NTAPI CompBattMonitorIrpComplete(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PKEVENT Event)
Definition: compbatt.c:70
NTSTATUS NTAPI CompBattRemoveBattery(IN PCUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:221
NTSTATUS NTAPI CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, OUT PULONG Tag)
Definition: compbatt.c:149
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
const GUID GUID_DEVICE_INTERFACE_REMOVAL
Definition: deviface.c:15
BCLASS_SET_INFORMATION SetInformation
Definition: batclass.h:253
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define ObReferenceObject
Definition: obfuncs.h:204
IO_REMOVE_LOCK RemoveLock
Definition: compbatt.h:21
PBCLASS_QUERY_TAG_CALLBACK BCLASS_QUERY_TAG
Definition: batclass.h:240
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
#define IO_NO_INCREMENT
Definition: iotypes.h:566
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)
Definition: device.c:1031
NTSTATUS NTAPI CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_DATA BatteryData)
Definition: compbatt.c:80
ULONG CompBattDebug
Definition: compbatt.c:17
BCLASS_SET_STATUS_NOTIFY SetStatusNotify
Definition: batclass.h:255
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag)
Definition: iofuncs.h:2726
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define IRP_MN_CANCEL_STOP_DEVICE
NTSTATUS NTAPI CompBattGetBatteries(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:246
BCLASS_QUERY_TAG QueryTag
Definition: batclass.h:251
GLfloat GLfloat p
Definition: glext.h:8902
BCLASS_QUERY_STATUS QueryStatus
Definition: batclass.h:254
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
PBCLASS_QUERY_INFORMATION_CALLBACK BCLASS_QUERY_INFORMATION
Definition: batclass.h:241
return STATUS_SUCCESS
Definition: btrfs.c:2938
NTSTATUS NTAPI CompBattQueryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG Tag, IN PBATTERY_STATUS BatteryStatus)
Definition: compbatt.c:221
#define IoAcquireRemoveLock(RemoveLock, Tag)
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2632
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define BATTERY_CLASS_MAJOR_VERSION
Definition: batclass.h:163