ReactOS 0.4.16-dev-297-gc569aee
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
20 IN PIRP Irp)
21{
22 PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
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
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
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
112NTAPI
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 */
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 = BATTERY_TAG_INVALID;
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 */
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 if (!NT_SUCCESS(Status))
203 {
204 /* Free the battery data */
205 ExFreePool(BatteryData);
206 }
207 }
208 else
209 {
210 /* Fail, no memory */
211 if (CompBattDebug & 8)
212 DbgPrint("CompBatt: Couldn't allocate new battery node\n");
214 }
215 }
216
217 /* We're done */
218 if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING AddNewBattery\n");
219 return Status;
220}
221
223NTAPI
225 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
226{
227 PCOMPBATT_BATTERY_DATA BatteryData;
228 if (CompBattDebug & 1) DbgPrint("CompBatt: RemoveBattery\n");
229
230 /* Remove the entry */
231 BatteryData = RemoveBatteryFromList(BatteryName, DeviceExtension);
232 if (BatteryData)
233 {
234 /* Dereference and free it */
235 ObDereferenceObject(BatteryData->DeviceObject);
236 ExFreePool(BatteryData);
237
238 /* Notify class driver */
239 DeviceExtension->Flags = 0;
240 BatteryClassStatusNotify(DeviceExtension->ClassData);
241 }
242
243 /* It's done */
244 return STATUS_SUCCESS;
245}
246
248NTAPI
250{
251 PWCHAR p;
253 PWCHAR LinkList;
254 UNICODE_STRING LinkString;
255 if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteries\n");
256
257 /* Get all battery links */
258 Status = IoGetDeviceInterfaces(&GUID_DEVICE_BATTERY, NULL, 0, &LinkList);
259 p = LinkList;
260 if (NT_SUCCESS(Status))
261 {
262 /* Loop all strings inside */
263 while (TRUE)
264 {
265 /* Create the string */
266 RtlInitUnicodeString(&LinkString, p);
267 if (!LinkString.Length) break;
268
269 /* Add this battery and move on */
270 Status = CompBattAddNewBattery(&LinkString, DeviceExtension);
271 p += (LinkString.Length / sizeof(WCHAR)) + sizeof(UNICODE_NULL);
272 }
273
274 /* Parsing complete, clean up buffer */
275 ExFreePool(LinkList);
276 }
277 else if (CompBattDebug & 8)
278 {
279 /* Fail */
280 DbgPrint("CompBatt: Couldn't get list of batteries\n");
281 }
282
283 /* Done */
284 if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteries\n");
285 return Status;
286}
287
289NTAPI
291 IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
292{
293 if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING PnpEventHandler\n");
294 if (CompBattDebug & 2) DbgPrint("CompBatt: Received device interface change notification\n");
295
296 /* Check what happened */
298 {
299 /* Add the new battery */
300 if (CompBattDebug & 2)
301 DbgPrint("CompBatt: Received notification of battery arrival\n");
302 CompBattAddNewBattery(Notification->SymbolicLinkName, DeviceExtension);
303 }
305 {
306 /* Don't do anything */
307 if (CompBattDebug & 2)
308 DbgPrint("CompBatt: Received notification of battery removal\n");
309 }
310 else
311 {
312 /* Shouldn't happen */
313 if (CompBattDebug & 2) DbgPrint("CompBatt: Received unhandled PnP event\n");
314 }
315
316 /* Done, return success */
317 if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING PnpEventHandler\n");
318 return STATUS_SUCCESS;
319}
320
322NTAPI
325{
328 PCOMPBATT_DEVICE_EXTENSION DeviceExtension;
331 BATTERY_MINIPORT_INFO MiniportInfo;
332 if (CompBattDebug & 2) DbgPrint("CompBatt: Got an AddDevice - %x\n", PdoDeviceObject);
333
334 /* Create the device */
335 RtlInitUnicodeString(&DeviceName, L"\\Device\\CompositeBattery");
338 &DeviceName,
341 FALSE,
342 &DeviceObject);
343 if (!NT_SUCCESS(Status)) return Status;
344
345 /* Setup symbolic link for Win32 access */
346 RtlInitUnicodeString(&SymbolicLinkName, L"\\DosDevices\\CompositeBattery");
348
349 /* Initialize the device extension */
350 DeviceExtension = DeviceObject->DeviceExtension;
351 RtlZeroMemory(DeviceExtension, sizeof(COMPBATT_DEVICE_EXTENSION));
352
353 /* Attach to device stack and set DO pointers */
356 DeviceExtension->DeviceObject = DeviceObject;
357 if (!DeviceExtension->AttachedDevice)
358 {
359 /* Fail */
360 if (CompBattDebug & 8)
361 DbgPrint("CompBattAddDevice: Could not attach to LowerDevice.\n");
363 return STATUS_UNSUCCESSFUL;
364 }
365
366 /* Set device object flags */
368 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
369
370 /* Setup the device extension */
371 ExInitializeFastMutex(&DeviceExtension->Lock);
372 InitializeListHead(&DeviceExtension->BatteryList);
373 DeviceExtension->Flags = 0;
374 DeviceExtension->NextTag = 1;
375
376 /* Setup the miniport data */
377 RtlZeroMemory(&MiniportInfo, sizeof(MiniportInfo));
380 MiniportInfo.Context = DeviceExtension;
381 MiniportInfo.DeviceName = &DeviceName;
384 MiniportInfo.SetInformation = NULL;
388 MiniportInfo.Pdo = NULL;
389
390 /* Register with the class driver */
391 Status = BatteryClassInitializeDevice(&MiniportInfo,
392 &DeviceExtension->ClassData);
393 if (!NT_SUCCESS(Status))
394 {
395 /* Undo everything */
396 IoDetachDevice(DeviceExtension->AttachedDevice);
398 }
399
400 /* Return status */
401 return Status;
402}
403
405NTAPI
407 IN PIRP Irp)
408{
411 PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
412 if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING PnpDispatch\n");
413
414 /* Set default error */
416
417 /* Check what kind of PnP function this is */
418 switch (IoStackLocation->MinorFunction)
419 {
421
422 /* Device is starting, register for new batteries and pick up current ones */
424 0,
425 (PVOID)&GUID_DEVICE_BATTERY,
426 DeviceObject->DriverObject,
428 DeviceExtension,
429 &DeviceExtension->NotificationEntry);
430 if (NT_SUCCESS(Status))
431 {
432 /* Now go get the batteries */
433 if (CompBattDebug & 2)
434 DbgPrint("CompBatt: Successfully registered for PnP notification\n");
435 Status = CompBattGetBatteries(DeviceExtension);
436 }
437 else
438 {
439 /* We failed */
440 if (CompBattDebug & 8)
441 DbgPrint("CompBatt: Couldn't register for PnP notification - %x\n",
442 Status);
443 }
444 break;
446
447 /* Explicitly say ok */
449 break;
450
452
453 /* Explicitly say ok */
455 break;
456
458
459 /* Explicitly say ok */
461 break;
462
464
465 /* Add this in */
466 Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
468 break;
469
470 default:
471
472 /* Not supported */
473 break;
474 }
475
476 /* Set IRP status if we have one */
477 if (Status != STATUS_NOT_SUPPORTED) Irp->IoStatus.Status = Status;
478
479 /* Did someone pick it up? */
481 {
482 /* Still unsupported, try ACPI */
484 Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
485 }
486 else
487 {
488 /* Complete the request */
489 Status = Irp->IoStatus.Status;
491 }
492
493 /* Release the remove lock and return status */
494 if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING PnpDispatch\n");
495 return Status;
496}
497
498/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define BATTERY_CLASS_MAJOR_VERSION
Definition: batclass.h:163
PBCLASS_QUERY_INFORMATION_CALLBACK BCLASS_QUERY_INFORMATION
Definition: batclass.h:241
PBCLASS_SET_STATUS_NOTIFY_CALLBACK BCLASS_SET_STATUS_NOTIFY
Definition: batclass.h:243
PBCLASS_DISABLE_STATUS_NOTIFY_CALLBACK BCLASS_DISABLE_STATUS_NOTIFY
Definition: batclass.h:245
#define BATTERY_CLASS_MINOR_VERSION
Definition: batclass.h:164
PBCLASS_QUERY_STATUS_CALLBACK BCLASS_QUERY_STATUS
Definition: batclass.h:242
#define BATTERY_TAG_INVALID
Definition: batclass.h:94
PBCLASS_QUERY_TAG_CALLBACK BCLASS_QUERY_TAG
Definition: batclass.h:240
BCLASSAPI NTSTATUS NTAPI BatteryClassStatusNotify(PVOID ClassData)
Definition: battc.c:79
BCLASSAPI NTSTATUS NTAPI BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo, PVOID *ClassData)
Definition: battc.c:137
return Found
Definition: dirsup.c:1270
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
NTSTATUS NTAPI CompBattMonitorIrpComplete(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PKEVENT Event)
Definition: compbatt.c:70
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
ULONG CompBattDebug
Definition: compbatt.c:17
NTSTATUS NTAPI CompBattDisableStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: compbatt.c:184
NTSTATUS NTAPI CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_DATA BatteryData)
Definition: compbatt.c:80
NTSTATUS NTAPI CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, OUT PULONG Tag)
Definition: compbatt.c:149
NTSTATUS NTAPI CompBattSetStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG BatteryTag, IN PBATTERY_NOTIFY BatteryNotify)
Definition: compbatt.c:211
NTSTATUS NTAPI CompBattQueryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, IN ULONG Tag, IN PBATTERY_STATUS BatteryStatus)
Definition: compbatt.c:221
NTSTATUS NTAPI CompBattGetDeviceObjectPointer(IN PUNICODE_STRING DeviceName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: compmisc.c:74
NTSTATUS NTAPI CompBattRemoveBattery(IN PCUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:224
NTSTATUS NTAPI CompBattPnpEventHandler(IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:290
PCOMPBATT_BATTERY_DATA NTAPI RemoveBatteryFromList(IN PCUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:35
NTSTATUS NTAPI CompBattPowerDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: comppnp.c:19
NTSTATUS NTAPI CompBattAddNewBattery(IN PUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:113
BOOLEAN NTAPI IsBatteryAlreadyOnList(IN PCUNICODE_STRING BatteryName, IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:77
NTSTATUS NTAPI CompBattAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PdoDeviceObject)
Definition: comppnp.c:323
NTSTATUS NTAPI CompBattPnpDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: comppnp.c:406
NTSTATUS NTAPI CompBattGetBatteries(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
Definition: comppnp.c:249
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
const GUID GUID_DEVICE_INTERFACE_ARRIVAL
Definition: deviface.c:14
const GUID GUID_DEVICE_INTERFACE_REMOVAL
Definition: deviface.c:15
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
Status
Definition: gdiplustypes.h:25
GLfloat GLfloat p
Definition: glext.h:8902
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define DbgPrint
Definition: hal.h:12
_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:95
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_ALL_ACCESS
Definition: nt_native.h:651
#define UNICODE_NULL
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
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
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS NTAPI IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList)
Definition: deviface.c:454
#define IoCompleteRequest
Definition: irp.c:1240
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define IoCallDriver
Definition: irp.c:1225
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI IoRegisterPlugPlayNotification(_In_ IO_NOTIFICATION_EVENT_CATEGORY EventCategory, _In_ ULONG EventCategoryFlags, _In_opt_ PVOID EventCategoryData, _In_ PDRIVER_OBJECT DriverObject, _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, _Inout_opt_ PVOID Context, _Out_ PVOID *NotificationEntry)
Definition: pnpnotify.c:346
#define FILE_DEVICE_BATTERY
Definition: winioctl.h:86
#define STATUS_SUCCESS
Definition: shellext.h:65
BCLASS_QUERY_INFORMATION QueryInformation
Definition: batclass.h:252
PDEVICE_OBJECT Pdo
Definition: batclass.h:257
BCLASS_SET_STATUS_NOTIFY SetStatusNotify
Definition: batclass.h:255
BCLASS_SET_INFORMATION SetInformation
Definition: batclass.h:253
PUNICODE_STRING DeviceName
Definition: batclass.h:258
BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify
Definition: batclass.h:256
BCLASS_QUERY_STATUS QueryStatus
Definition: batclass.h:254
BCLASS_QUERY_TAG QueryTag
Definition: batclass.h:251
PDEVICE_OBJECT DeviceObject
Definition: compbatt.h:22
LIST_ENTRY BatteryLink
Definition: compbatt.h:20
UNICODE_STRING BatteryName
Definition: compbatt.h:37
WORK_QUEUE_ITEM WorkItem
Definition: compbatt.h:24
IO_REMOVE_LOCK RemoveLock
Definition: compbatt.h:21
PDEVICE_OBJECT DeviceObject
Definition: compbatt.h:55
PDEVICE_OBJECT AttachedDevice
Definition: compbatt.h:54
struct _IO_STACK_LOCATION::@3978::@4017 Others
union _IO_STACK_LOCATION::@1579 Parameters
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
Definition: wdfdevice.h:3739
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#define IoAcquireRemoveLock(RemoveLock, Tag)
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2680
#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag)
Definition: iofuncs.h:2774
#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark)
Definition: iofuncs.h:2833
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define PNP_DEVICE_NOT_DISABLEABLE
Definition: iotypes.h:1006
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_START_DEVICE
#define DO_POWER_PAGABLE
@ EventCategoryDeviceInterfaceChange
Definition: iotypes.h:1226
* PFILE_OBJECT
Definition: iotypes.h:1998
#define IRP_MN_CANCEL_REMOVE_DEVICE
DRIVER_NOTIFICATION_CALLBACK_ROUTINE * PDRIVER_NOTIFICATION_CALLBACK_ROUTINE
Definition: iotypes.h:1247
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
__wchar_t WCHAR
Definition: xmlstorage.h:180