2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS User I/O driver
5 * PURPOSE: IRP_MJ_CREATE and IRP_MJ_CLOSE handling
6 * PROGRAMMERS: Cameron Gutman (cameron.gutman@reactos.org)
16 NduDispatchCreate(PDEVICE_OBJECT DeviceObject
,
19 PIO_STACK_LOCATION IrpSp
= IoGetCurrentIrpStackLocation(Irp
);
21 ASSERT(DeviceObject
== GlobalDeviceObject
);
23 /* This is associated with an adapter during IOCTL_NDISUIO_OPEN_(WRITE_)DEVICE */
24 IrpSp
->FileObject
->FsContext
= NULL
;
25 IrpSp
->FileObject
->FsContext2
= NULL
;
27 /* Completed successfully */
28 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
29 Irp
->IoStatus
.Information
= FILE_OPENED
;
30 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
33 return STATUS_SUCCESS
;
38 NduDispatchClose(PDEVICE_OBJECT DeviceObject
,
41 PIO_STACK_LOCATION IrpSp
= IoGetCurrentIrpStackLocation(Irp
);
42 PNDISUIO_ADAPTER_CONTEXT AdapterContext
= IrpSp
->FileObject
->FsContext
;
43 PNDISUIO_OPEN_ENTRY OpenEntry
= IrpSp
->FileObject
->FsContext2
;
45 ASSERT(DeviceObject
== GlobalDeviceObject
);
47 /* Check if this handle was ever associated with an adapter */
48 if (AdapterContext
!= NULL
)
50 ASSERT(OpenEntry
!= NULL
);
52 /* Call the our helper */
53 DereferenceAdapterContextWithOpenEntry(AdapterContext
, OpenEntry
);
57 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
58 Irp
->IoStatus
.Information
= 0;
59 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
62 return STATUS_SUCCESS
;