Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencreateclose.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS NDIS User I/O driver 00004 * FILE: createclose.c 00005 * PURPOSE: IRP_MJ_CREATE and IRP_MJ_CLOSE handling 00006 * PROGRAMMERS: Cameron Gutman (cameron.gutman@reactos.org) 00007 */ 00008 00009 #include "ndisuio.h" 00010 00011 //#define NDEBUG 00012 #include <debug.h> 00013 00014 NTSTATUS 00015 NTAPI 00016 NduDispatchCreate(PDEVICE_OBJECT DeviceObject, 00017 PIRP Irp) 00018 { 00019 PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); 00020 00021 ASSERT(DeviceObject == GlobalDeviceObject); 00022 00023 DPRINT("Created file object 0x%x\n", IrpSp->FileObject); 00024 00025 /* This is associated with an adapter during IOCTL_NDISUIO_OPEN_(WRITE_)DEVICE */ 00026 IrpSp->FileObject->FsContext = NULL; 00027 IrpSp->FileObject->FsContext2 = NULL; 00028 00029 /* Completed successfully */ 00030 Irp->IoStatus.Status = STATUS_SUCCESS; 00031 Irp->IoStatus.Information = FILE_OPENED; 00032 IoCompleteRequest(Irp, IO_NO_INCREMENT); 00033 00034 /* Return success */ 00035 return STATUS_SUCCESS; 00036 } 00037 00038 NTSTATUS 00039 NTAPI 00040 NduDispatchClose(PDEVICE_OBJECT DeviceObject, 00041 PIRP Irp) 00042 { 00043 PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); 00044 PNDISUIO_ADAPTER_CONTEXT AdapterContext = IrpSp->FileObject->FsContext; 00045 PNDISUIO_OPEN_ENTRY OpenEntry = IrpSp->FileObject->FsContext2; 00046 00047 ASSERT(DeviceObject == GlobalDeviceObject); 00048 00049 DPRINT("Closing file object 0x%x\n", IrpSp->FileObject); 00050 00051 /* Check if this handle was ever associated with an adapter */ 00052 if (AdapterContext != NULL) 00053 { 00054 ASSERT(OpenEntry != NULL); 00055 00056 DPRINT("Removing binding to adapter %wZ\n", &AdapterContext->DeviceName); 00057 00058 /* Call the our helper */ 00059 DereferenceAdapterContextWithOpenEntry(AdapterContext, OpenEntry); 00060 } 00061 00062 /* Completed */ 00063 Irp->IoStatus.Status = STATUS_SUCCESS; 00064 Irp->IoStatus.Information = 0; 00065 IoCompleteRequest(Irp, IO_NO_INCREMENT); 00066 00067 /* Return success */ 00068 return STATUS_SUCCESS; 00069 } Generated on Fri May 25 2012 04:26:02 for ReactOS by
1.7.6.1
|