char *InitSys( void ) { static char name[] = "\\\\.\\DBGPORT1"; int i; if( !(GetVersion() & 0x80000000) ) { PortHdl = CreateFile( name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ); if ( PortHdl == INVALID_HANDLE_VALUE ) return( TRP_ERR_cannot_access_parallel_ports ); } PortsFound = 0; for( i = 0; i < NUM_ELTS( PortTest ); ++i ) { if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) { PortAddress[ PortsFound++ ] = PortTest[ i ]; } } return( NULL ); }
static void InitPorts( void ) { int i; int portnum; portnum = 0; for( i = 0; i < 3; ++i ) { if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) { PortAddress[ portnum++ ] = PortTest[ i ]; } } }
char *InitSys() { int i; PortsFound = 0; for( i = 0; i < NUM_ELTS( PortTest ); ++i ) { if (!AccessPorts(PortTest[i], PortTest[i])) { printf("Failed to get I/O permissions. This program must run as root!\n"); exit(-1); } if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) { PortAddress[ PortsFound++ ] = PortTest[ i ]; } FreePorts(PortTest[i], PortTest[i]); } return( NULL ); }
char *InitSys() { SEL global; SEL local; int i; DosGetInfoSeg( &global, &local ); GInfoSeg = MK_FP( global, 0 ); PortsFound = 0; for( i = 0; i < NUM_ELTS( PortTest ); ++i ) { AccessPorts( PortTest[i], PortTest[i] ); if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) { PortAddress[ PortsFound++ ] = PortTest[ i ]; } FreePorts( PortTest[i], PortTest[i] ); } return( 0 ); }