24 #define DVRH_USE_PARPORT_ECP_ADDR 1
29 #define DBG_PROGNAME "OPENCBM.SYS"
38 #define CBMDEVICENAME L"\\DosDevices\\opencbm"
79 PARALLEL_INTERRUPT_SERVICE_ROUTINE
Pisr;
82 PARALLEL_INTERRUPT_INFORMATION
Pii;
134 DriverCommonInit(IN PDRIVER_OBJECT Driverobject, IN PUNICODE_STRING RegistryPath);
140 AddDeviceCommonInit(IN PDEVICE_OBJECT Fdo, IN PUNICODE_STRING DeviceName, IN PCWSTR ParallelPortName);
159 cbm_dbg_readbuffer(IN PDEVICE_EXTENSION Pdx, OUT PCHAR ReturnBuffer, IN OUT PULONG ReturnLength);
196 cbm_isr(IN PKINTERRUPT Interrupt, IN PVOID Pdx);
207 #ifndef PENUMERATE_DEFINED
222 ParPortInit(PUNICODE_STRING ParallelPortName, PDEVICE_EXTENSION Pdx);
259 IN PDEVICE_EXTENSION Pdx);
NTSTATUS cbm_lock(IN PDEVICE_EXTENSION Pdx)
Lock the parallel port for the driver.
BOOLEAN cbm_isr(IN PKINTERRUPT Interrupt, IN PVOID Pdx)
Interrupt Service Routine (ISR)
NTSTATUS cbm_execute_createopen(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
Execute IRPs containing the IRP_MJ_CREATEOPEN I/O function code.
PARALLEL_INTERRUPT_INFORMATION Pii
struct _ARCH_DEVICE_EXTENSION ARCH_DEVICE_EXTENSION
PDEVICE_OBJECT ParallelPortFdo
NTSTATUS cbm_start_thread(IN PDEVICE_EXTENSION Pdx)
Start the worker thread.
PARALLEL_INTERRUPT_SERVICE_ROUTINE Pisr
VOID CLI(VOID)
Stop interrupts with CLI assembler command.
NTSTATUS cbm_unlock_parport(IN PDEVICE_EXTENSION Pdx)
Unlock the parallel port for the driver.
NTSTATUS AddDeviceCommonInit(IN PDEVICE_OBJECT Fdo, IN PUNICODE_STRING DeviceName, IN PCWSTR ParallelPortName)
Initialize device object, common to WDM and NT4 driver.
UNICODE_STRING DeviceName
NTSTATUS cbm_execute_readwrite(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
Executes reads from or writes to the driver.
VOID cbm_initialize_cable_deferred(IN PDEVICE_EXTENSION Pdx)
Initialize the cable.
NTSTATUS DriverCommonInit(IN PDRIVER_OBJECT Driverobject, IN PUNICODE_STRING RegistryPath)
Perform driver initialization, common to WDM and NT4 driver.
NTSTATUS ParPortSetMode(PDEVICE_EXTENSION Pdx)
Set the operational mode of the parallel port.
Definitions for the configuration of the cbm4win driver.
VOID DriverUnload(IN PDRIVER_OBJECT DriverObject)
Unload routine of the driver.
ULONG CbmGetCurrentProcessorNumber(VOID)
Wrapper for KeGetCurrentProcessorNumber()
NTSTATUS ParPortAllowInterruptIoctl(PDEVICE_EXTENSION Pdx)
Set registry key such that we can get the interrupt of a parallel port.
Define the IOCTL codes for the opencbm driver.
NTSTATUS cbm_readwrite(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Services reads from or writes to the driver.
NTSTATUS CbmOpenDeviceRegistryKey(IN PDEVICE_OBJECT a, IN ULONG b, IN ACCESS_MASK c, OUT PHANDLE d)
Stub for a function.
NTSTATUS cbm_registry_close(IN HANDLE HandleKey)
Close a registry key.
NTSTATUS ParPortEnumerate(PENUMERATE EnumStruct, PCWSTR *DriverName)
Get next enumerated parallel port driver.
VOID cbm_thread(IN PVOID Context)
The thread function.
NTSTATUS cbm_registry_open_hardwarekey(OUT PHANDLE HandleKey, OUT PDEVICE_OBJECT *Pdo, IN PDEVICE_EXTENSION Pdx)
Open the hardware key for another driver.
NTSTATUS cbm_dbg_readbuffer(IN PDEVICE_EXTENSION Pdx, OUT PCHAR ReturnBuffer, IN OUT PULONG ReturnLength)
Give the debug buffer contents to the installer.
A QUEUE object A QUEUE object is an object which can be used to queue IRPs for processing. This QUEUE object is optimized for being polled from an own worker thread. Anyway, a concept called FastStart is also implemented, which allows some IRPs to be completed immediately, without being queued, if no IRP is executed yet and the caller has stated that he wants this IRP to be started fast if possible.
Definitions for the queueing functions.
KIRQL IecBlockIrqPreviousIrql
VOID cbm_stop_thread(IN PDEVICE_EXTENSION Pdx)
Stop the worker thread.
VOID ParPortEnumerateClose(PENUMERATE EnumStruct)
Stop enumeration of the parallel port drivers.
BOOLEAN ParallelPortAllocated
NTSTATUS cbm_createopenclose(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Services IRPs containing the IRP_MJ_CREATE or IRP_MJ_CLOSE I/O function code.
NTSTATUS cbm_registry_read_ulong(IN HANDLE HandleKey, IN PCWSTR KeyName, OUT PULONG Value)
Read a ULONG value out of a registry key.
NTSTATUS ParPortSetModeWdm(PDEVICE_EXTENSION Pdx)
Set the operational mode of the parallel port, WDM Version.
NTSTATUS cbm_cleanup(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Services IRPs containing the IRP_MJ_CLEANUP I/O function code.
NTSTATUS cbm_devicecontrol(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Services IOCTLs.
BOOLEAN ParallelPortIsLocked
NTSTATUS ParPortFree(PDEVICE_EXTENSION Pdx)
Free a parallel port after using it.
NTSTATUS cbm_lock_parport(IN PDEVICE_EXTENSION Pdx)
Lock the parallel port for the driver.
NTSTATUS ParPortUnsetMode(PDEVICE_EXTENSION Pdx)
Unset the operational mode of the parallel port.
VOID cbm_init_registry(IN PUNICODE_STRING RegistryPath, IN PDEVICE_EXTENSION Pdx)
Initialize from registry.
VOID DriverCommonUninit(VOID)
Undo what DriverCommonInit() has done.
PFILE_OBJECT ParallelPortFileObject
VOID STI(VOID)
Restart interrupts with STI assembler command.
NTSTATUS ParPortEnumerateOpen(PENUMERATE *EnumStruct)
Start enumeration of the parallel port drivers.
BOOLEAN ParallelPortAllocatedInterrupt
NTSTATUS cbm_startio(IN PDEVICE_OBJECT Fdo, IN PIRP Irp)
Execute an IRP.
NTSTATUS cbm_unlock(IN PDEVICE_EXTENSION Pdx)
Unlock the parallel port for the driver.
NTSTATUS cbm_install(IN PDEVICE_EXTENSION Pdx, OUT PCBMT_I_INSTALL_OUT ReturnBuffer, IN OUT PULONG ReturnLength)
Complete driver installation.
ULONG CbmGetNumberProcessors(VOID)
Get the number of processors in the system.
NTSTATUS ParPortInit(PUNICODE_STRING ParallelPortName, PDEVICE_EXTENSION Pdx)
Initialize the knowledge on a parallel port.
NTSTATUS ParPortDeinit(PDEVICE_EXTENSION Pdx)
Undoes anything ParPortInit has done.
NTSTATUS cbm_execute_devicecontrol(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
Executes IOCTLs.
NTSTATUS ParPortAllocate(PDEVICE_EXTENSION Pdx)
Allocate a parallel port for using it.
NTSTATUS cbm_registry_close_hardwarekey(IN HANDLE HandleKey, IN PDEVICE_OBJECT Pdo)
Close a hardware registry key.
NTSTATUS ParPortAllocInterrupt(PDEVICE_EXTENSION Pdx, PKSERVICE_ROUTINE Isr)
Allocate an interrupt routine for a parallel port.
NTSTATUS cbm_execute_close(IN PDEVICE_EXTENSION Pdx, IN PIRP Irp)
Execute IRPs containing the IRP_MJ_CLOSE I/O function code.
KEVENT EventWaitForListener
PPARALLEL_PORT_INFORMATION PortInfo
BOOLEAN ParallelPortModeSet
LONG IecBlockIrqUsageCount
NTSTATUS ParPortUnsetModeWdm(PDEVICE_EXTENSION Pdx)
Unset the operational mode of the parallel port, WDM Version.
NTSTATUS cbm_registry_open_for_read(OUT PHANDLE HandleKey, IN PUNICODE_STRING Path)
Open a registry path for reading.
NTSTATUS ParPortFreeInterrupt(PDEVICE_EXTENSION Pdx)
Free an interrupt routine for a parallel port after using it.
NTSTATUS cbm_registry_write_ulong(IN HANDLE HandleKey, IN PCWSTR KeyName, IN ULONG Value)
Write a ULONG value out of a registry key.