OpenCBM
sys/libcommon/install.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 2004 Spiro Trikaliotis
8  *
9  */
10 
19 #include <wdm.h>
20 #include "cbm_driver.h"
21 
22 #include "cbmioctl.h"
23 #include "version.h"
24 
50 NTSTATUS
51 cbm_install(IN PDEVICE_EXTENSION Pdx, OUT PCBMT_I_INSTALL_OUT ReturnBuffer, IN OUT PULONG ReturnLength)
52 {
53  CBMT_I_INSTALL_OUT result;
54 
55  FUNC_ENTER();
56 
57  RtlZeroMemory(&result, sizeof(result));
58 
59  // Set the driver version
60 
61  result.DriverVersion =
62  CBMT_I_INSTALL_OUT_MAKE_VERSION(OPENCBM_VERSION_MAJOR, OPENCBM_VERSION_MINOR,
63  OPENCBM_VERSION_SUBMINOR, OPENCBM_VERSION_DEVEL);
64 
65  result.DriverVersionEx =
66  CBMT_I_INSTALL_OUT_MAKE_VERSION_EX(OPENCBM_VERSION_PATCHLEVEL);
67 
68  // first of all, assume there is nothing to report
69 
70  result.ErrorFlags = 0;
71 
72  // Now, check if we have an interrupt
73 
74  if (!Pdx->ParallelPortAllocatedInterrupt)
75  {
76  // try to allow the allocation of the interrupt
77  // by setting the appropriate registry settings
78 
79  if (!Pdx->IsNT4)
80  {
82  }
83 
84  // report that we do not have any interrupt access currently.
85 
87  }
88 
89  // Report the size of returned information.
90  // Make sure that it is not longer then the maximum info we can give
91 
92  if (*ReturnLength > sizeof(CBMT_I_INSTALL_OUT))
93  {
94  *ReturnLength = sizeof(CBMT_I_INSTALL_OUT);
95  }
96 
97  // Copy the return value into the return buffer
98 
99  RtlCopyMemory(ReturnBuffer, &result, *ReturnLength);
100 
101  FUNC_LEAVE_NTSTATUS_CONST(STATUS_SUCCESS);
102 }
struct CBMT_I_INSTALL_OUT CBMT_I_INSTALL_OUT
NTSTATUS ParPortAllowInterruptIoctl(PDEVICE_EXTENSION Pdx)
Set registry key such that we can get the interrupt of a parallel port.
Definition: PortAccess.c:729
Define the IOCTL codes for the opencbm driver.
ULONG DriverVersionEx
Definition: cbmioctl.h:185
#define CBMT_I_INSTALL_OUT_MAKE_VERSION(_x, _y, _z, _w)
Definition: cbmioctl.h:155
#define CBMT_I_INSTALL_OUT_MAKE_VERSION_EX(_w)
Definition: cbmioctl.h:163
NTSTATUS cbm_install(IN PDEVICE_EXTENSION Pdx, OUT PCBMT_I_INSTALL_OUT ReturnBuffer, IN OUT PULONG ReturnLength)
Complete driver installation.
Defining OpenCBM version.
#define FUNC_ENTER()
Definition: debug.h:347
#define CBM_I_DRIVER_INSTALL_0M_NO_INTERRUPT
CBMCTRL_I_INSTALL: No interrupt available.
Definition: cbmioctl.h:356
Definitions for the opencbm driver.