Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

install.c

Go to the documentation of this file.
00001 /*
00002  *  This program is free software; you can redistribute it and/or
00003  *  modify it under the terms of the GNU General Public License
00004  *  as published by the Free Software Foundation; either version
00005  *  2 of the License, or (at your option) any later version.
00006  *
00007  *  Copyright 2004 Spiro Trikaliotis
00008  *
00009  */
00010 
00020 #include <wdm.h>
00021 #include "cbm_driver.h"
00022 
00023 #include "cbmioctl.h"
00024 #include "version.h"
00025 
00051 NTSTATUS
00052 cbm_install(IN PDEVICE_EXTENSION Pdx, OUT PCBMT_I_INSTALL_OUT ReturnBuffer, IN OUT PULONG ReturnLength)
00053 {
00054     CBMT_I_INSTALL_OUT result;
00055 
00056     FUNC_ENTER();
00057 
00058     RtlZeroMemory(&result, sizeof(result));
00059 
00060     // Set the driver version
00061 
00062     result.DriverVersion = 
00063         CBMT_I_INSTALL_OUT_MAKE_VERSION(CBM4WIN_VERSION_MAJOR, CBM4WIN_VERSION_MINOR, 
00064                                         CBM4WIN_VERSION_SUBMINOR, CBM4WIN_VERSION_DEVEL);
00065 
00066     result.DriverVersionEx = 
00067         CBMT_I_INSTALL_OUT_MAKE_VERSION_EX(CBM4WIN_VERSION_PATCHLEVEL);
00068 
00069     // first of all, assume there is nothing to report
00070 
00071     result.ErrorFlags = 0;
00072 
00073     // Now, check if we have an interrupt
00074 
00075     if (!Pdx->ParallelPortAllocatedInterrupt)
00076     {
00077         // try to allow the allocation of the interrupt
00078         // by setting the appropriate registry settings
00079 
00080         if (!Pdx->IsNT4)
00081         {
00082             ParPortAllowInterruptIoctl(Pdx);
00083         }
00084 
00085         // report that we do not have any interrupt access currently.
00086 
00087         result.ErrorFlags |= CBM_I_DRIVER_INSTALL_0M_NO_INTERRUPT;
00088     }
00089 
00090     // Report the size of returned information.
00091     // Make sure that it is not longer then the maximum info we can give
00092 
00093     if (*ReturnLength > sizeof(CBMT_I_INSTALL_OUT))
00094     {
00095         *ReturnLength = sizeof(CBMT_I_INSTALL_OUT);
00096     }
00097 
00098     // Copy the return value into the return buffer
00099 
00100     RtlCopyMemory(ReturnBuffer, &result, *ReturnLength);
00101 
00102     FUNC_LEAVE_NTSTATUS_CONST(STATUS_SUCCESS);
00103 }

Generated on Sun Apr 30 18:45:52 2006 for opencbm by  doxygen 1.4.2