[MSI]
[reactos.git] / rosapps / drivers / green / power.c
1 /*
2 * PROJECT: ReactOS VT100 emulator
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/base/green/power.c
5 * PURPOSE: IRP_MJ_POWER operations
6 * PROGRAMMERS: Copyright 2006 Hervé Poussineau (hpoussin@reactos.org)
7 */
8
9 #include "green.h"
10
11 #define NDEBUG
12 #include <debug.h>
13
14 NTSTATUS
15 GreenPower(
16 IN PDEVICE_OBJECT DeviceObject,
17 IN PIRP Irp)
18 {
19 GREEN_DEVICE_TYPE Type;
20 PIO_STACK_LOCATION Stack;
21 ULONG_PTR Information = Irp->IoStatus.Information;
22 NTSTATUS Status = Irp->IoStatus.Status;
23
24 Type = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type;
25 Stack = IoGetCurrentIrpStackLocation(Irp);
26
27 switch (Stack->MinorFunction)
28 {
29 case IRP_MN_SET_POWER: /* 0x02 */
30 {
31 DPRINT("IRP_MJ_POWER / IRP_MN_SET_POWER\n");
32 if (Type == GreenFDO)
33 {
34 PoStartNextPowerIrp(Irp);
35 Status = STATUS_SUCCESS;
36 }
37 else
38 {
39 DPRINT1("IRP_MJ_POWER / IRP_MN_SET_POWER / Unknown type 0x%lx\n",
40 Type);
41 ASSERT(FALSE);
42 }
43 break;
44 }
45 default:
46 {
47 DPRINT1("IRP_MJ_POWER / unknown minor function 0x%lx\n", Stack->MinorFunction);
48 break;
49 }
50 }
51
52 Irp->IoStatus.Status = Status;
53 Irp->IoStatus.Information = Information;
54 if (Status != STATUS_PENDING)
55 IoCompleteRequest(Irp, IO_NO_INCREMENT);
56
57 return Status;
58 }