ReactOS  0.4.15-dev-1632-g4e289ce
createclose.c File Reference
#include "ndisuio.h"
#include <debug.h>
Include dependency graph for createclose.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI NduDispatchCreate (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI NduDispatchClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 

Function Documentation

◆ NduDispatchClose()

NTSTATUS NTAPI NduDispatchClose ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 40 of file createclose.c.

42 {
44  PNDISUIO_ADAPTER_CONTEXT AdapterContext = IrpSp->FileObject->FsContext;
45  PNDISUIO_OPEN_ENTRY OpenEntry = IrpSp->FileObject->FsContext2;
46 
48 
49  DPRINT("Closing file object 0x%x\n", IrpSp->FileObject);
50 
51  /* Check if this handle was ever associated with an adapter */
52  if (AdapterContext != NULL)
53  {
54  ASSERT(OpenEntry != NULL);
55 
56  DPRINT("Removing binding to adapter %wZ\n", &AdapterContext->DeviceName);
57 
58  /* Call the our helper */
59  DereferenceAdapterContextWithOpenEntry(AdapterContext, OpenEntry);
60  }
61 
62  /* Completed */
63  Irp->IoStatus.Status = STATUS_SUCCESS;
64  Irp->IoStatus.Information = 0;
66 
67  /* Return success */
68  return STATUS_SUCCESS;
69 }
VOID DereferenceAdapterContextWithOpenEntry(PNDISUIO_ADAPTER_CONTEXT AdapterContext, PNDISUIO_OPEN_ENTRY OpenEntry)
Definition: misc.c:149
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
Definition: ndisuio.h:53
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define ASSERT(a)
Definition: mode.c:45
UNICODE_STRING DeviceName
Definition: ndisuio.h:44
PDEVICE_OBJECT GlobalDeviceObject
Definition: main.c:14
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3165
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().

◆ NduDispatchCreate()

NTSTATUS NTAPI NduDispatchCreate ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 16 of file createclose.c.

18 {
20 
22 
23  DPRINT("Created file object 0x%x\n", IrpSp->FileObject);
24 
25  /* This is associated with an adapter during IOCTL_NDISUIO_OPEN_(WRITE_)DEVICE */
26  IrpSp->FileObject->FsContext = NULL;
27  IrpSp->FileObject->FsContext2 = NULL;
28 
29  /* Completed successfully */
30  Irp->IoStatus.Status = STATUS_SUCCESS;
31  Irp->IoStatus.Information = FILE_OPENED;
33 
34  /* Return success */
35  return STATUS_SUCCESS;
36 }
#define FILE_OPENED
Definition: nt_native.h:769
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define ASSERT(a)
Definition: mode.c:45
PDEVICE_OBJECT GlobalDeviceObject
Definition: main.c:14
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3165
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by DriverEntry().