ReactOS  0.4.15-dev-1070-ge1a01de
create.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: Serial port driver
4  * FILE: drivers/dd/serial/create.c
5  * PURPOSE: Serial IRP_MJ_CREATE operations
6  *
7  * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
8  */
9 
10 #include "serial.h"
11 
12 #include <debug.h>
13 
17  IN PIRP Irp)
18 {
19  PIO_STACK_LOCATION Stack;
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 IN
Definition: typedefs.h:39
#define INFO_(ch,...)
Definition: debug.h:159
Iosb Status
Definition: create.c:4287
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
if(OpenRequiringOplock &&(Iosb.Status==STATUS_SUCCESS))
Definition: create.c:4300
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
NTSTATUS NTAPI SerialCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: create.c:15
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define IoCompleteRequest
Definition: irp.c:1240
#define TRACE_(x)
Definition: compat.h:76
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
struct _SERIAL_DEVICE_EXTENSION * PSERIAL_DEVICE_EXTENSION
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
#define IO_NO_INCREMENT
Definition: iotypes.h:581
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157
HRESULT Create([out]ITransactionReceiver **ppReceiver)