1 // Copyright (c) 2004, Antony C. Roberts
2 
3 // Use of this file is subject to the terms
4 // described in the LICENSE.TXT file that
5 // accompanies this file.
6 //
7 // Your use of this file indicates your
8 // acceptance of the terms described in
9 // LICENSE.TXT.
10 //
11 // http://www.freebt.net
12 
13 #ifndef _FREEBT_POWER_H
14 #define _FREEBT_POWER_H
15 
16 typedef struct _POWER_COMPLETION_CONTEXT
17 {
18     PDEVICE_OBJECT DeviceObject;
19     PIRP           SIrp;
20 
21 } POWER_COMPLETION_CONTEXT, *PPOWER_COMPLETION_CONTEXT;
22 
23 typedef struct _WORKER_THREAD_CONTEXT
24 {
25     PDEVICE_OBJECT DeviceObject;
26     PIRP           Irp;
27     PIO_WORKITEM   WorkItem;
28 
29 } WORKER_THREAD_CONTEXT, *PWORKER_THREAD_CONTEXT;
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 NTSTATUS NTAPI FreeBT_DispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
36 NTSTATUS NTAPI HandleSystemQueryPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
37 NTSTATUS NTAPI HandleSystemSetPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
38 NTSTATUS NTAPI HandleDeviceQueryPower(PDEVICE_OBJECT DeviceObject, PIRP Irp);
39 NTSTATUS NTAPI SysPoCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension);
40 VOID NTAPI SendDeviceIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
41 VOID NTAPI DevPoCompletionRoutine(
42     IN PDEVICE_OBJECT   DeviceObject,
43     IN UCHAR            MinorFunction,
44     IN POWER_STATE      PowerState,
45     IN PVOID            Context,
46     IN PIO_STATUS_BLOCK IoStatus
47     );
48 
49 NTSTATUS NTAPI HandleDeviceSetPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
50 NTSTATUS NTAPI FinishDevPoUpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension);
51 NTSTATUS NTAPI SetDeviceFunctional(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension);
52 NTSTATUS NTAPI FinishDevPoDnIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension);
53 NTSTATUS NTAPI HoldIoRequests(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
54 VOID NTAPI HoldIoRequestsWorkerRoutine(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context);
55 NTSTATUS NTAPI QueueRequest(IN OUT PDEVICE_EXTENSION DeviceExtension, IN PIRP Irp);
56 VOID NTAPI CancelQueued(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
57 NTSTATUS NTAPI WaitWakeCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension);
58 NTSTATUS NTAPI IssueWaitWake(IN PDEVICE_EXTENSION DeviceExtension);
59 VOID NTAPI CancelWaitWake(IN PDEVICE_EXTENSION DeviceExtension);
60 VOID NTAPI WaitWakeCallback(
61 	IN PDEVICE_OBJECT   DeviceObject,
62     IN UCHAR            MinorFunction,
63     IN POWER_STATE      PowerState,
64     IN PVOID            Context,
65     IN PIO_STATUS_BLOCK IoStatus
66     );
67 
68 PCHAR NTAPI PowerMinorFunctionString(IN UCHAR MinorFunction);
69 
70 #ifdef __cplusplus
71 };
72 #endif
73 
74 #endif
75