int WinIOProvider::load() { if(initOk) return 1; lib.load(); if(!lib.isLoaded()) { initOk = false; return 0; } InitializeWinIo = (PrototypeBoolVoid ) lib.resolve("InitializeWinIo"); ShutdownWinIo = (PrototypeVoidVoid ) lib.resolve("ShutdownWinIo"); GetPortVal = (PrototypeWordPdwordByte ) lib.resolve("GetPortVal"); SetPortVal = (PrototypeWordDwordByte ) lib.resolve("SetPortVal"); if (InitializeWinIo()==true) { initOk = true; return 1; } else { initOk = false; return -255; } }
void initializeSegments(void) { driver = (WCHAR *)malloc(128); ctow(driver,sysname); bool ret = InitializeWinIo(); printf("InitializeWinIo returned %d\n", ret); fflush(stdout); ret = InstallWinIoDriver(driver, false); printf("InstallWinIoDriver returned %d\n", ret); fflush(stdout); }
static bool init_iosystem(void) { int i; for (i=0; i<IO_NUM_BASEPOOL; i++) IO_basePool[i].iotype = IO_USE_NULLIO; IO_defaultBase.iotype = IO_USE_PORTIO; IO_defaultBase.addr = 0L; IO_defaultBase.size = 0x10000L; if (IO_POOL_INITLOCK() == false) { err_print("%s: fail to initialize the lock of IO_basePool!\n", __FUNCTION__); return false; } #if defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM) || defined(DMP_DOS_BC) return true; #elif defined(USE_WINIO2) || defined(USE_WINIO3) if (!InitializeWinIo()) { err_print("%s: fail to initialize WinIO!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PCIDEBUG) if (getdllstatus() != DLLSTATUS_NOERROR) { err_print("%s: fail to initialize PCIDEBUG!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PHYMEM) if (LoadPhyMemDriver() == FALSE) { err_print("%s: fail to initialize PHYMEM!\n", __FUNCTION__); return false; } return true; #elif defined(DMP_LINUX) if (iopl(3) != 0) { err_print("%s: fail to set iopl(level=3) (%d)!\n", __FUNCTION__, errno); return false; } if ((IO_mmioFD = open("/dev/mem", O_RDWR | O_SYNC)) == -1) err_print("%s: fail to open /dev/mem (%d)!\n", __FUNCTION__, errno); return true; #endif }
void* lptopen(unsigned long port) { char drv[] = "WinIo.sys"; if (InstallWinIoDriver(drv)) { if (InitializeWinIo()) { LPT* pLpt = &lpt; pLpt->data = port; pLpt->stat = port + 1; pLpt->ctrl = port + 2; return pLpt; } } return 0; }
static bool init_iosystem(void) { int i; for (i=0; i<IO_NUM_BASEPOOL; i++) IO_basePool[i].iotype = IO_USE_NULLIO; // TODO: IO_defaultBase shouldn't be used in WinXP or Linux Kernel Modes // #if defined(DMP_OS_KERNEL) // IO_defaultBase.iotype = IO_USE_NULLIO; // #else IO_defaultBase.iotype = IO_USE_PORTIO; IO_defaultBase.addr = 0L; IO_defaultBase.size = 0x10000L; #if defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM) || defined(DMP_DOS_BC) return true; #elif defined(USE_WINIO2) || defined(USE_WINIO3) if (!InitializeWinIo()) { err_print((char*)"%s: fail to initialize WinIO!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PCIDEBUG) if (getdllstatus() != DLLSTATUS_NOERROR) { err_print((char*)"%s: fail to initialize PCIDEBUG!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PHYMEM) if (LoadPhyMemDriver() == FALSE) { err_print((char*)"%s: fail to initialize PHYMEM!\n", __FUNCTION__); return false; } return true; #elif defined(DMP_LINUX) if (iopl(3) != 0) { err_print((char*)"%s: fail to set iopl(3)!\n", __FUNCTION__); return false; } return true; #endif }
void init_io_library() { InitializeWinIo(); }