ReactOS 0.4.16-dev-297-gc569aee
pcmcia.c File Reference
#include <pcmcia.h>
#include <debug.h>
Include dependency graph for pcmcia.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI PcmciaCreateClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI PcmciaDeviceControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
VOID NTAPI PcmciaUnload (PDRIVER_OBJECT DriverObject)
 
NTSTATUS NTAPI PcmciaPlugPlay (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI PcmciaPower (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI PcmciaAddDevice (PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
 
NTSTATUS NTAPI DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
 

Variables

BOOLEAN IoctlEnabled
 
DRIVER_DISPATCH PcmciaCreateClose
 
DRIVER_DISPATCH PcmciaDeviceControl
 
DRIVER_UNLOAD PcmciaUnload
 
DRIVER_DISPATCH PcmciaPlugPlay
 
DRIVER_DISPATCH PcmciaPower
 
DRIVER_ADD_DEVICE PcmciaAddDevice
 

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( PDRIVER_OBJECT  DriverObject,
PUNICODE_STRING  RegistryPath 
)

Definition at line 224 of file pcmcia.c.

226{
229
231
232 DPRINT1("PCMCIA: DriverEntry\n");
233
237 DriverObject->MajorFunction[IRP_MJ_PNP] = PcmciaPlugPlay;
238 DriverObject->MajorFunction[IRP_MJ_POWER] = PcmciaPower;
239
240 DriverObject->DriverExtension->AddDevice = PcmciaAddDevice;
241 DriverObject->DriverUnload = PcmciaUnload;
242
244
246 QueryTable[0].Name = L"IoctlInterface";
248
250 L"Pcmcia\\Parameters",
252 NULL,
253 NULL);
254 if (!NT_SUCCESS(Status))
255 {
256 /* Key not present so assume disabled */
258 }
259
260 DPRINT("PCMCIA: Ioctl interface %s\n",
261 (IoctlEnabled ? "enabled" : "disabled"));
262
263 return STATUS_SUCCESS;
264}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:25
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4220
#define RTL_QUERY_REGISTRY_REQUIRED
Definition: nt_native.h:132
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define RTL_REGISTRY_SERVICES
Definition: nt_native.h:162
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define L(x)
Definition: ntvdm.h:50
DRIVER_DISPATCH PcmciaPlugPlay
Definition: pcmcia.c:75
BOOLEAN IoctlEnabled
Definition: pcmcia.c:14
DRIVER_DISPATCH PcmciaDeviceControl
Definition: pcmcia.c:35
DRIVER_DISPATCH PcmciaPower
Definition: pcmcia.c:97
DRIVER_UNLOAD PcmciaUnload
Definition: pcmcia.c:65
DRIVER_ADD_DEVICE PcmciaAddDevice
Definition: pcmcia.c:180
DRIVER_DISPATCH PcmciaCreateClose
Definition: pcmcia.c:16
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define IRP_MJ_POWER

◆ PcmciaAddDevice()

NTSTATUS NTAPI PcmciaAddDevice ( PDRIVER_OBJECT  DriverObject,
PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 184 of file pcmcia.c.

186{
190
191 DPRINT("PCMCIA: AddDevice\n");
192
194 sizeof(*FdoExt),
195 NULL,
198 FALSE,
199 &Fdo);
200 if (!NT_SUCCESS(Status))
201 return Status;
202
203 FdoExt = Fdo->DeviceExtension;
204
205 RtlZeroMemory(FdoExt, sizeof(*FdoExt));
206
208 KeInitializeSpinLock(&FdoExt->Lock);
209
210 FdoExt->Common.Self = Fdo;
211 FdoExt->Common.IsFDO = TRUE;
212 FdoExt->Common.State = dsStopped;
213
216
217 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
218
219 return STATUS_SUCCESS;
220}
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define TRUE
Definition: types.h:120
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
@ dsStopped
Definition: isapnp.h:30
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
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:87
PDEVICE_OBJECT Self
Definition: pcmcia.h:17
PCMCIA_DEVICE_STATE State
Definition: pcmcia.h:20
KSPIN_LOCK Lock
Definition: pcmcia.h:35
PCMCIA_COMMON_EXTENSION Common
Definition: pcmcia.h:32
PDEVICE_OBJECT Ldo
Definition: pcmcia.h:33
LIST_ENTRY ChildDeviceList
Definition: pcmcia.h:34
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461

◆ PcmciaCreateClose()

NTSTATUS NTAPI PcmciaCreateClose ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 20 of file pcmcia.c.

22{
24
25 Irp->IoStatus.Status = STATUS_SUCCESS;
26 Irp->IoStatus.Information = 0;
27
28 DPRINT("PCMCIA: Create/Close\n");
29
31
32 return STATUS_SUCCESS;
33}
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ PcmciaDeviceControl()

NTSTATUS NTAPI PcmciaDeviceControl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 39 of file pcmcia.c.

41{
44
46
47 DPRINT("PCMCIA: DeviceIoControl\n");
48
49 Irp->IoStatus.Information = 0;
50
51 switch (IrpSp->Parameters.DeviceIoControl.IoControlCode)
52 {
53 default:
54 DPRINT1("PCMCIA: Unknown ioctl code: %x\n", IrpSp->Parameters.DeviceIoControl.IoControlCode);
56 }
57
58 Irp->IoStatus.Status = Status;
59
61
62 return Status;
63}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
struct _IO_STACK_LOCATION::@1579::@1580 DeviceIoControl
union _IO_STACK_LOCATION::@1579 Parameters

◆ PcmciaPlugPlay()

NTSTATUS NTAPI PcmciaPlugPlay ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 79 of file pcmcia.c.

81{
82 PPCMCIA_COMMON_EXTENSION Common = DeviceObject->DeviceExtension;
83
84 DPRINT("PCMCIA: PnP\n");
85 if (Common->IsFDO)
86 {
88 Irp);
89 }
90 else
91 {
93 Irp);
94 }
95}
NTSTATUS NTAPI PcmciaFdoPlugPlay(PPCMCIA_FDO_EXTENSION FdoExt, PIRP Irp)
Definition: fdo.c:16
NTSTATUS NTAPI PcmciaPdoPlugPlay(PPCMCIA_PDO_EXTENSION PdoExt, PIRP Irp)
Definition: pdo.c:16

◆ PcmciaPower()

NTSTATUS NTAPI PcmciaPower ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 101 of file pcmcia.c.

103{
104 PPCMCIA_COMMON_EXTENSION Common = DeviceObject->DeviceExtension;
107
108 switch (IrpSp->MinorFunction)
109 {
111 /* I don't see any reason that we should care */
112 DPRINT("PCMCIA: IRP_MN_QUERY_POWER\n");
114 break;
115
117 DPRINT("PCMCIA: IRP_MN_POWER_SEQUENCE\n");
119 &Common->PowerSequence,
120 sizeof(POWER_SEQUENCE));
122 break;
123
124 case IRP_MN_WAIT_WAKE:
125 /* Not really sure about this */
126 DPRINT("PCMCIA: IRP_MN_WAIT_WAKE\n");
128 break;
129
130 case IRP_MN_SET_POWER:
131 DPRINT("PCMCIA: IRP_MN_SET_POWER\n");
133 {
134 Common->SystemPowerState = IrpSp->Parameters.Power.State.SystemState;
135
137 }
138 else
139 {
140 Common->DevicePowerState = IrpSp->Parameters.Power.State.DeviceState;
141
142 /* Update the POWER_SEQUENCE struct */
143 if (Common->DevicePowerState <= PowerDeviceD1)
144 Common->PowerSequence.SequenceD1++;
145
146 if (Common->DevicePowerState <= PowerDeviceD2)
147 Common->PowerSequence.SequenceD2++;
148
149 if (Common->DevicePowerState <= PowerDeviceD3)
150 Common->PowerSequence.SequenceD3++;
151
152 /* Start the underlying device if we are handling this for a PDO */
153 if (!Common->IsFDO)
155 else
157 }
158
159 /* Report that we changed state to the Power Manager */
161 IrpSp->Parameters.Power.Type,
162 IrpSp->Parameters.Power.State);
163 break;
164
165 default:
166 DPRINT1("PCMCIA: Invalid MN code in MJ_POWER handler %x\n", IrpSp->MinorFunction);
167 ASSERT(FALSE);
169 break;
170 }
171
172 Irp->IoStatus.Status = Status;
173 Irp->IoStatus.Information = 0;
174
176
177 return Status;
178}
#define ASSERT(a)
Definition: mode.c:44
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:729
@ PowerDeviceD1
Definition: ntpoapi.h:50
@ PowerDeviceD2
Definition: ntpoapi.h:51
@ PowerDeviceD3
Definition: ntpoapi.h:52
NTSTATUS NTAPI PcmciaPdoSetPowerState(PPCMCIA_PDO_EXTENSION PdoExt)
Definition: pdo.c:30
struct _IO_STACK_LOCATION::@3978::@4014 Power
PPOWER_SEQUENCE PowerSequence
Definition: iotypes.h:3282
POWER_SEQUENCE PowerSequence
Definition: pcmcia.h:19
SYSTEM_POWER_STATE SystemPowerState
Definition: pcmcia.h:22
DEVICE_POWER_STATE DevicePowerState
Definition: pcmcia.h:21
ULONG SequenceD2
Definition: iotypes.h:1180
ULONG SequenceD1
Definition: iotypes.h:1179
ULONG SequenceD3
Definition: iotypes.h:1181
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define IRP_MN_WAIT_WAKE
#define IRP_MN_POWER_SEQUENCE
#define IRP_MN_SET_POWER
_In_ SYSTEM_POWER_STATE SystemPowerState
Definition: iotypes.h:7519
#define IRP_MN_QUERY_POWER

◆ PcmciaUnload()

VOID NTAPI PcmciaUnload ( PDRIVER_OBJECT  DriverObject)

Definition at line 69 of file pcmcia.c.

70{
72 DPRINT("PCMCIA: Unload\n");
73}

Variable Documentation

◆ IoctlEnabled

BOOLEAN IoctlEnabled

Definition at line 14 of file pcmcia.c.

Referenced by DriverEntry().

◆ PcmciaAddDevice

DRIVER_ADD_DEVICE PcmciaAddDevice

Definition at line 180 of file pcmcia.c.

Referenced by DriverEntry().

◆ PcmciaCreateClose

DRIVER_DISPATCH PcmciaCreateClose

Definition at line 16 of file pcmcia.c.

Referenced by DriverEntry().

◆ PcmciaDeviceControl

DRIVER_DISPATCH PcmciaDeviceControl

Definition at line 35 of file pcmcia.c.

Referenced by DriverEntry().

◆ PcmciaPlugPlay

DRIVER_DISPATCH PcmciaPlugPlay

Definition at line 75 of file pcmcia.c.

Referenced by DriverEntry().

◆ PcmciaPower

DRIVER_DISPATCH PcmciaPower

Definition at line 97 of file pcmcia.c.

Referenced by DriverEntry().

◆ PcmciaUnload

DRIVER_UNLOAD PcmciaUnload

Definition at line 65 of file pcmcia.c.

Referenced by DriverEntry().