ReactOS 0.4.15-dev-5895-g2687c1b
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{
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
45ByeBye:
46 Irp->IoStatus.Status = Status;
47 Irp->IoStatus.Information = 0;
49 return Status;
50}
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define TRACE_(x)
Definition: compat.h:76
struct _SERIAL_DEVICE_EXTENSION * PSERIAL_DEVICE_EXTENSION
DRIVER_DISPATCH SerialCreate
Definition: serial.h:217
Status
Definition: gdiplustypes.h:25
if(dx< 0)
Definition: linetemp.h:194
#define IoCompleteRequest
Definition: irp.c:1240
#define INFO_(ch,...)
Definition: debug.h:159
#define WARN_(ch,...)
Definition: debug.h:157
#define STATUS_SUCCESS
Definition: shellext.h:65
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IO_NO_INCREMENT
Definition: iotypes.h:598