OpenCBM
Data Structures | Macros | Typedefs | Functions
parport.c File Reference

Program to handle the parallel port for the OPENCBM driver. More...

#include <windows.h>
#include <stdio.h>
#include "i_opencbm.h"
#include <setupapi.h>
#include <cfgmgr32.h>
#include <initguid.h>
#include <ntddpar.h>
#include "debug.h"
#include "libmisc.h"

Go to the source code of this file.

Data Structures

struct  SETUPAPI
 

Macros

#define DBG_USERMODE
 
#define DBG_PROGNAME   "OPENCBM-XA1541.DLL"
 
#define GET_PROC_ADDRESS(_xxx)
 

Typedefs

typedef CMAPI CONFIGRET(* P_CM_Get_Device_ID_ExA )(IN DEVINST dnDevInst, OUT PTCHAR Buffer, IN ULONG BufferLen, IN ULONG ulFlags, IN HMACHINE hMachine)
 
typedef WINSETUPAPI BOOL(* P_SetupDiGetDeviceInfoListDetailA )(IN HDEVINFO DeviceInfoSet, OUT PSP_DEVINFO_LIST_DETAIL_DATA DeviceInfoSetDetailData)
 
typedef struct SETUPAPIPSETUPAPI
 

Functions

VOID CbmParportRestart (VOID)
 Restart the parallel port. More...
 

Detailed Description

Program to handle the parallel port for the OPENCBM driver.



Author
Spiro Trikaliotis

Definition in file parport.c.

Macro Definition Documentation

#define DBG_PROGNAME   "OPENCBM-XA1541.DLL"

The name of the executable

Definition at line 36 of file parport.c.

#define DBG_USERMODE

Mark: We are in user-space (for debug.h)

Definition at line 33 of file parport.c.

#define GET_PROC_ADDRESS (   _xxx)
Value:
if (SetupApi && SetupApi->HandleSetupApiDll) \
{ \
SetupApi->_xxx##_p = (P_##_xxx) GetProcAddress(SetupApi->HandleSetupApiDll, #_xxx); \
DBG_SUCCESS((DBG_PREFIX "p_CM_Get_Device_ID_Ex = %p", SetupApi->_xxx##_p)); \
\
if (SetupApi->_xxx##_p == NULL) \
{ \
DBG_WARN((DBG_PREFIX "GetProcAddress(\"" #_xxx "\") FAILED!")); \
FreeDynamicalAddresses(SetupApi); \
} \
}
#define DBG_WARN(_xxx)
Definition: debug.h:395
#define DBG_SUCCESS(_xxx)
Definition: debug.h:393
#define DBG_PREFIX
Definition: debug.h:320

Get the address of the given function from the DLL

Definition at line 103 of file parport.c.

Typedef Documentation

typedef CMAPI CONFIGRET(* P_CM_Get_Device_ID_ExA)(IN DEVINST dnDevInst, OUT PTCHAR Buffer, IN ULONG BufferLen, IN ULONG ulFlags, IN HMACHINE hMachine)

Pointer to the CM_Get_Device_ID_Ex function. As this function is not supported on NT4, we have to dynamically get its address, because our driver would refuse to load on NT4 else.

Definition at line 60 of file parport.c.

typedef WINSETUPAPI BOOL(* P_SetupDiGetDeviceInfoListDetailA)(IN HDEVINFO DeviceInfoSet, OUT PSP_DEVINFO_LIST_DETAIL_DATA DeviceInfoSetDetailData)

Pointer to the SetupDiGetDeviceInfoListDetailA function. As this function is not supported on NT4, we have to dynamically get its address, because our driver would refuse to load on NT4 else.

Definition at line 68 of file parport.c.

typedef struct SETUPAPI * PSETUPAPI

PSETUPAPI is a pointer to SETUAPI

Function Documentation

VOID CbmParportRestart ( VOID  )

Restart the parallel port.

This function tries to restart the parallel port, so that registry changes can take effect.

Definition at line 143 of file parport.c.

References SETUPAPI::CM_Get_Device_ID_ExA_p, DBG_ASSERT, DBG_ERROR, DBG_PREFIX, DBG_SUCCESS, DBGDO, FUNC_ENTER, FUNC_LEAVE, SETUPAPI::HandleSetupApiDll, and SETUPAPI::SetupDiGetDeviceInfoListDetailA_p.