OpenCBM
Macros | Functions
ioctl.c File Reference

Perform an IOCTL. More...

#include <wdm.h>
#include "cbm_driver.h"
#include "cbmioctl.h"
#include "iec.h"
#include <parallel.h>

Go to the source code of this file.

Macros

#define INPUTVALUE(_ttt_)   ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)
 
#define OUTPUTVALUE(_ttt_)   ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)
 

Functions

NTSTATUS cbm_devicecontrol (IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
 Services IOCTLs. More...
 
NTSTATUS cbm_execute_devicecontrol (IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
 Executes IOCTLs. More...
 

Detailed Description

Perform an IOCTL.



Author
Spiro Trikaliotis, Arnd

Definition in file ioctl.c.

Macro Definition Documentation

#define INPUTVALUE (   _ttt_)    ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)

This translates the inputbuffer in the corresponding value to be used for giving as parameter

Definition at line 336 of file ioctl.c.

Referenced by cbm_execute_devicecontrol().

#define OUTPUTVALUE (   _ttt_)    ((_ttt_ *) Irp->AssociatedIrp.SystemBuffer)

This translates the outputbuffer in the corresponding value to be used for giving as parameter

Definition at line 341 of file ioctl.c.

Referenced by cbm_execute_devicecontrol().

Function Documentation

NTSTATUS cbm_devicecontrol ( IN PDEVICE_OBJECT  Fdo,
IN PIRP  Irp 
)

Services IOCTLs.

Services IRPs containing the IRP_MJ_DEVICE_CONTROL I/O function code.

Parameters
FdoPointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver's AddDevice routine.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values:
STATUS_SUCCESS - Success.
STATUS_PENDING - Request pending.
STATUS_BUFFER_TOO_SMALL - Buffer too small.
STATUS_INVALID_PARAMETER - Invalid io control request.

The driver's DriverEntry routine stored this routine's address in DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL].

Generally, all Dispatch routines execute in an arbitrary thread context at IRQL PASSIVE_LEVEL, but there are exceptions.

Definition at line 115 of file ioctl.c.

References CBMCTRL_CLEAR_EOI, CBMCTRL_CLOSE, CBMCTRL_GET_EOI, CBMCTRL_I_INSTALL, CBMCTRL_I_READDBG, CBMCTRL_IEC_DBG_READ, CBMCTRL_IEC_DBG_WRITE, CBMCTRL_IEC_POLL, CBMCTRL_IEC_RELEASE, CBMCTRL_IEC_SET, CBMCTRL_IEC_SETRELEASE, CBMCTRL_IEC_WAIT, CBMCTRL_LISTEN, CBMCTRL_OPEN, CBMCTRL_PARBURST_READ, CBMCTRL_PARBURST_READ_TRACK, CBMCTRL_PARBURST_READ_TRACK_VAR, CBMCTRL_PARBURST_WRITE, CBMCTRL_PARBURST_WRITE_TRACK, CBMCTRL_PARPORT_LOCK, CBMCTRL_PARPORT_UNLOCK, CBMCTRL_PP_READ, CBMCTRL_PP_WRITE, CBMCTRL_RESET, CBMCTRL_TALK, CBMCTRL_TEST_IRQ, CBMCTRL_UNLISTEN, CBMCTRL_UNTALK, CBMCTRL_UPDATE, DBG_ERROR, DBG_IRPPATH_PROCESS, DBG_PREFIX, FUNC_ENTER, PERF_EVENT_IOCTL_QUEUE, QueueCompleteIrp(), and QueueStartPacket().

Referenced by DriverCommonInit().

NTSTATUS cbm_execute_devicecontrol ( IN PDEVICE_EXTENSION  Pdx,
IN PIRP  Irp 
)

Executes IOCTLs.

Executes IRPs containing the IRP_MJ_DEVICE_CONTROL I/O function code.

Parameters
PdxPointer to the DEVICE_EXTENSION structure.
IrpPointer to an IRP structure that describes the requested I/O operation.
Returns
If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it return one of the error status values:
STATUS_SUCCESS - Success.
STATUS_BUFFER_TOO_SMALL - Buffer too small.

This function does not perform any validity checks on the input and output buffer! This should already been done in cbm_devicecontrol.

Definition at line 363 of file ioctl.c.

References cbm_dbg_readbuffer(), cbm_init_registry(), cbm_install(), cbm_lock(), cbm_lock_parport(), cbm_unlock(), CBMCTRL_CLEAR_EOI, CBMCTRL_CLOSE, CBMCTRL_GET_EOI, CBMCTRL_I_INSTALL, CBMCTRL_I_READDBG, CBMCTRL_IEC_DBG_READ, CBMCTRL_IEC_DBG_WRITE, CBMCTRL_IEC_POLL, CBMCTRL_IEC_RELEASE, CBMCTRL_IEC_SET, CBMCTRL_IEC_SETRELEASE, CBMCTRL_IEC_WAIT, CBMCTRL_LISTEN, CBMCTRL_OPEN, CBMCTRL_PARBURST_READ, CBMCTRL_PARBURST_READ_TRACK, CBMCTRL_PARBURST_READ_TRACK_VAR, CBMCTRL_PARBURST_WRITE, CBMCTRL_PARBURST_WRITE_TRACK, CBMCTRL_PARPORT_LOCK, CBMCTRL_PARPORT_UNLOCK, CBMCTRL_PP_READ, CBMCTRL_PP_WRITE, CBMCTRL_RESET, CBMCTRL_TALK, CBMCTRL_TEST_IRQ, CBMCTRL_UNLISTEN, CBMCTRL_UNTALK, CBMCTRL_UPDATE, cbmiec_clear_eoi(), cbmiec_close(), cbmiec_get_eoi(), cbmiec_iec_dbg_read(), cbmiec_iec_dbg_write(), cbmiec_iec_poll(), cbmiec_iec_release(), cbmiec_iec_set(), cbmiec_iec_setrelease(), cbmiec_iec_wait(), cbmiec_listen(), cbmiec_open(), cbmiec_parallel_burst_read(), cbmiec_parallel_burst_read_track(), cbmiec_parallel_burst_read_track_var(), cbmiec_parallel_burst_write(), cbmiec_pp_read(), cbmiec_pp_write(), cbmiec_reset(), cbmiec_talk(), cbmiec_test_irq(), cbmiec_unlisten(), cbmiec_untalk(), DBG_ASSERT, DBG_ERROR, DBG_IRPPATH_COMPLETE, DBG_IRPPATH_EXECUTE, DBG_PREFIX, FUNC_ENTER, INPUTVALUE, OUTPUTVALUE, PERF_EVENT_IOCTL_EXECUTE, and QueueCompleteIrp().

Referenced by cbm_startio().