ReactOS  0.4.15-dev-3719-g41b8715
create.c File Reference
#include "serial.h"
#include <debug.h>
Include dependency graph for create.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI SerialCreate (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Function Documentation

◆ SerialCreate()

NTSTATUS NTAPI SerialCreate ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 15 of file create.c.

18 {
20  PSERIAL_DEVICE_EXTENSION DeviceExtension;
22 
23  TRACE_(SERIAL, "IRP_MJ_CREATE\n");
25  DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
26 
27  if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
28  {
29  INFO_(SERIAL, "Not a directory\n");
31  goto ByeBye;
32  }
33 
34  if(DeviceExtension->IsOpened)
35  {
36  WARN_(SERIAL, "COM%lu is already opened\n", DeviceExtension->ComPort);
38  goto ByeBye;
39  }
40 
41  INFO_(SERIAL, "Open COM%lu: successfull\n", DeviceExtension->ComPort);
42  DeviceExtension->IsOpened = TRUE;
44 
45 ByeBye:
46  Irp->IoStatus.Status = Status;
47  Irp->IoStatus.Information = 0;
49  return Status;
50 }
#define INFO_(ch,...)
Definition: debug.h:159
Iosb Status
Definition: create.c:4287
#define TRUE
Definition: types.h:120
if(OpenRequiringOplock &&(Iosb.Status==STATUS_SUCCESS))
Definition: create.c:4300
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
LONG NTSTATUS
Definition: precomp.h:26
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
Status
Definition: gdiplustypes.h:24
#define TRACE_(x)
Definition: compat.h:76
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
struct _SERIAL_DEVICE_EXTENSION * PSERIAL_DEVICE_EXTENSION
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_SUCCESS
Definition: shellext.h:65
#define WARN_(ch,...)
Definition: debug.h:157