int Init (const char * driverPath) { BOOL ret = FALSE; if (InitDriver () == FALSE) { if (strlen (driverPath)) { StartStopService ("r2k",TRUE); RemoveService ("r2k"); eprintf ("Installing driver: %s\n", driverPath); if (InstallService (driverPath, "r2k", "r2k")) { StartStopService ("r2k",FALSE); ret = InitDriver (); } } else { eprintf ("Error initalizating driver, try r2k://pathtodriver\nEx: radare2.exe r2k://c:\\r2k.sys"); } } else { eprintf ("Driver present [OK]\n"); ret = TRUE; } return ret; }
static int r2k__close(RIODesc *fd) { #if __WINDOWS__ if (gHandleDriver) { CloseHandle (gHandleDriver); StartStopService (TEXT ("r2k"),TRUE); } #elif defined (__linux__) && !defined (__GNU__) if (fd) { close ((int)(size_t)fd->data); } #else eprintf ("TODO: r2k not implemented for this plataform.\n"); #endif return 0; }