// -------------------------------------------------------------------------- // dtor // /// Destructor for QMIService. // -------------------------------------------------------------------------- QMIService::~QMIService() { if (m_isOpen) { CloseService(); } ::CloseHandle(m_hReadExitEvent); }
IHU_SERVICE_MANAGER::~IHU_SERVICE_MANAGER() { if (mService) { CloseService(); } if (mSCManager) { CloseSCManager(); } }
bool IHU_SERVICE_MANAGER::DeleteService() { //IHU_DBG_ASSERT(mSCManager && mService); bool bResult = false; if (!::DeleteService(mService)) { //IHU_DBG_LOGA(IHU_, IHU_LEVEL_ERROR, ("DeleteService Failed. GetLastError = 0x%x\n", GetLastError())); goto FuncEnd; } /* * We don't care for its return value :) */ CloseService(); bResult = true; FuncEnd: return bResult; }
void InitService(void) { CountService(); OpenService(); CloseService(TRUE); }
void EditService(void) { int records, i, o, x, y; char pick[12]; FILE *fil; char temp[PATH_MAX]; int offset; clr_index(); working(1, 0, 0); IsDoing("Browsing Menu"); if (config_read() == -1) { working(2, 0, 0); return; } records = CountService(); if (records == -1) { working(2, 0, 0); return; } if (OpenService() == -1) { working(2, 0, 0); return; } o = 0; for (;;) { clr_index(); set_color(WHITE, BLACK); ftnd_mvprintw( 5, 4, "16. SERVICE MANAGER"); set_color(CYAN, BLACK); if (records != 0) { snprintf(temp, PATH_MAX, "%s/etc/service.temp", getenv("FTND_ROOT")); working(1, 0, 0); if ((fil = fopen(temp, "r")) != NULL) { fread(&servhdr, sizeof(servhdr), 1, fil); x = 2; y = 7; set_color(CYAN, BLACK); for (i = 1; i <= 20; i++) { if (i == 11) { x = 42; y = 7; } if ((o + i) <= records) { offset = sizeof(servhdr) + (((o + i) - 1) * servhdr.recsize); fseek(fil, offset, 0); fread(&servrec, servhdr.recsize, 1, fil); if (servrec.Active) set_color(CYAN, BLACK); else set_color(LIGHTBLUE, BLACK); snprintf(temp, 81, "%3d. %-15s %s", o+i, servrec.Service, getservice(servrec.Action)); temp[37] = 0; ftnd_mvprintw(y, x, temp); y++; } } fclose(fil); } } strcpy(pick, select_record(records, 20)); if (strncmp(pick, "-", 1) == 0) { CloseService(FALSE); return; } if (strncmp(pick, "A", 1) == 0) { working(1, 0, 0); if (AppendService() == 0) { records++; working(1, 0, 0); } else working(2, 0, 0); } if (strncmp(pick, "N", 1) == 0) if ((o + 20) < records) o = o + 20; if (strncmp(pick, "P", 1) == 0) if ((o - 20) >= 0) o = o - 20; if ((atoi(pick) >= 1) && (atoi(pick) <= records)) { EditServiceRec(atoi(pick)); o = ((atoi(pick) - 1) / 20) * 20; } } }