Beispiel #1
0
BOOL GetPreferencesInfo (LPIDENT lpi, LPTSTR pszPath, WORD *pwVer)
{
   if (lpi == NULL)
      return FALSE;

   // HKCU\Software\...\SVRMgr + \CellName
   //
   lstrcpy (pszPath, REGSTR_SETTINGS_PREFS);
   lstrcat (pszPath, TEXT("\\"));
   lpi->GetCellName (&pszPath[ lstrlen(pszPath) ]);

   // HKCU\Software\...\SVRMgr\CellName + \ServerName
   //
   lstrcat (pszPath, TEXT("\\"));
   lpi->GetLongServerName (&pszPath[ lstrlen(pszPath) ]);

   *pwVer = wVerSERVER_PREF;

   if (lpi->fIsService())
      {
      // HKCU\Software\...\SVRMgr\CellName\ServerName + \Services\ServiceName
      //
      lstrcat (pszPath, TEXT("\\"));
      lstrcat (pszPath, SERVICES_KW);
      lstrcat (pszPath, TEXT("\\"));
      lpi->GetServiceName (&pszPath[ lstrlen(pszPath) ]);
      *pwVer = wVerSERVICE_PREF;
      }
   else if (lpi->fIsAggregate())
      {
      // HKCU\Software\...\SVRMgr\CellName\ServerName + \Aggs\AggregateName
      //
      lstrcat (pszPath, TEXT("\\"));
      lstrcat (pszPath, AGGREGATES_KW);
      lstrcat (pszPath, TEXT("\\"));
      lpi->GetAggregateName (&pszPath[ lstrlen(pszPath) ]);
      *pwVer = wVerAGGREGATE_PREF;
      }
   else if (lpi->fIsFileset())
      {
      // HKCU\Software\...\SVRMgr\CellName\ServerName + \Filesets\FilesetName
      //
      lstrcat (pszPath, TEXT("\\"));
      lstrcat (pszPath, FILESETS_KW);
      lstrcat (pszPath, TEXT("\\"));
      lpi->GetFilesetName (&pszPath[ lstrlen(pszPath) ]);
      *pwVer = wVerFILESET_PREF;
      }

   return TRUE;
}
Beispiel #2
0
void Services_Delete_OnInitDialog (HWND hDlg, LPIDENT lpi)
{
   TCHAR szServer[ cchNAME ];
   TCHAR szService[ cchNAME ];
   lpi->GetServerName (szServer);
   lpi->GetServiceName (szService);

   TCHAR szOld[ cchRESOURCE ];
   GetDlgItemText (hDlg, IDC_DELSVC_DESC, szOld, cchRESOURCE);

   LPTSTR pszNew = FormatString (szOld, TEXT("%s%s"), szServer, szService);
   SetDlgItemText (hDlg, IDC_DELSVC_DESC, pszNew);
   FreeString (pszNew);
}
Beispiel #3
0
void Services_OnSelect (HWND hDlg)
{
   LPIDENT lpi;
   if ( ((lpi = (LPIDENT)FL_GetSelectedData (GetDlgItem (hDlg, IDC_SVC_LIST))) == NULL) ||
        (!lpi->fIsService()) )
      {
      EnableWindow (GetDlgItem (hDlg, IDC_SVC_RESTART), FALSE);
      EnableWindow (GetDlgItem (hDlg, IDC_SVC_DELETE), FALSE);
      }
   else
      {
      TCHAR szName[ cchRESOURCE ];
      lpi->GetServiceName (szName);

      if (!lstrcmpi (szName, TEXT("BOS")))
         EnableWindow (GetDlgItem (hDlg, IDC_SVC_DELETE), FALSE);
      else
         EnableWindow (GetDlgItem (hDlg, IDC_SVC_DELETE), TRUE);

      EnableWindow (GetDlgItem (hDlg, IDC_SVC_RESTART), TRUE);
      }
}
Beispiel #4
0
LPTSTR Services_GetColumnText (LPIDENT lpi, SERVICECOLUMN svccol, BOOL fShowServerName)
{
    static TCHAR aszBuffer[ nSERVICECOLUMNS ][ cchRESOURCE ];
    static size_t iBufferNext = 0;
    LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ];
    if (iBufferNext == nSERVICECOLUMNS)
        iBufferNext = 0;
    *pszBuffer = TEXT('\0');

    LPSERVICESTATUS lpss = NULL;
    LPSERVICE_PREF lpsp;
    if ((lpsp = (LPSERVICE_PREF)lpi->GetUserParam()) != NULL)
        lpss = &lpsp->ssLast;

    switch (svccol)
    {
    case svccolNAME:
        if (!fShowServerName)
            lpi->GetServiceName (pszBuffer);
        else
        {
            TCHAR szNameSvr[ cchNAME ];
            TCHAR szNameSvc[ cchNAME ];
            lpi->GetServerName (szNameSvr);
            lpi->GetServiceName (szNameSvc);
            LPTSTR pszName = FormatString (IDS_SERVER_SERVICE, TEXT("%s%s"), szNameSvr, szNameSvc);
            lstrcpy (pszBuffer, pszName);
            FreeString (pszName);
        }
        break;

    case svccolTYPE:
        if (lpss)
        {
            if (lpss->type == SERVICETYPE_SIMPLE)
                GetString (pszBuffer, IDS_SERVICETYPE_SIMPLE);
            else if (lpss->type == SERVICETYPE_FS)
                GetString (pszBuffer, IDS_SERVICETYPE_FS);
            else
                GetString (pszBuffer, IDS_SERVICETYPE_CRON);
        }
        break;

    case svccolPARAMS:
        if (lpss)
        {
            lstrncpy (pszBuffer, lpss->szParams, cchRESOURCE-1);
            pszBuffer[ cchRESOURCE-1 ] = TEXT('\0');

            for (LPTSTR pch = pszBuffer; *pch; ++pch)
            {
                if (*pch == TEXT('\r') || *pch == TEXT('\t') || *pch == TEXT('\n'))
                    *pch = TEXT(' ');
            }
        }
        break;

    case svccolNOTIFIER:
        if (lpss)
        {
            lstrncpy (pszBuffer, lpss->szNotifier, cchRESOURCE-1);
            pszBuffer[ cchRESOURCE-1 ] = TEXT('\0');

            for (LPTSTR pch = pszBuffer; *pch; ++pch)
            {
                if (*pch == TEXT('\r') || *pch == TEXT('\t') || *pch == TEXT('\n'))
                    *pch = TEXT(' ');
            }
        }
        break;

    case svccolSTATUS:
        if (lpss)
        {
            if (lpss->state == SERVICESTATE_RUNNING)
                GetString (pszBuffer, IDS_SERVICESTATE_RUNNING);
            else if (lpss->state == SERVICESTATE_STOPPING)
                GetString (pszBuffer, IDS_SERVICESTATE_STOPPING);
            else if (lpss->state == SERVICESTATE_STARTING)
                GetString (pszBuffer, IDS_SERVICESTATE_STARTING);
            else
                GetString (pszBuffer, IDS_SERVICESTATE_STOPPED);
        }
        break;

    case svccolDATE_START:
        if (lpss)
        {
            if (!FormatTime (pszBuffer, TEXT("%s"), &lpss->timeLastStart))
                pszBuffer[0] = TEXT('\0');
        }
        break;

    case svccolDATE_STOP:
        if (lpss)
        {
            if (!FormatTime (pszBuffer, TEXT("%s"), &lpss->timeLastStop))
                pszBuffer[0] = TEXT('\0');
        }
        break;

    case svccolDATE_STARTSTOP:
        if (lpss)
        {
            LPSYSTEMTIME pst;
            int ids;
            if ((lpss->state == SERVICESTATE_RUNNING) || (lpss->state == SERVICESTATE_STARTING))
            {
                ids = IDS_SERVICE_STARTDATE;
                pst = &lpss->timeLastStart;
            }
            else
            {
                ids = IDS_SERVICE_STOPDATE;
                pst = &lpss->timeLastStop;
            }

            TCHAR szDate[ cchRESOURCE ];
            if (FormatTime (szDate, TEXT("%s"), pst))
            {
                LPTSTR psz = FormatString (ids, TEXT("%s"), szDate);
                lstrcpy (pszBuffer, psz);
                FreeString (psz);
            }
        }
        break;

    case svccolDATE_FAILED:
        if (lpss)
        {
            if (!FormatTime (pszBuffer, TEXT("%s"), &lpss->timeLastFail))
                pszBuffer[0] = TEXT('\0');
        }
        break;

    case svccolLASTERROR:
        if (lpss)
        {
            LPTSTR psz = FormatString (IDS_SERVICE_LASTERROR, TEXT("%ld"), lpss->dwErrLast);
            lstrcpy (pszBuffer, psz);
            FreeString (psz);
        }
        break;
    }

    return pszBuffer;
}
Beispiel #5
0
LPTSTR Alert_GetDescriptionFunc (LPIDENT lpiPrimary, size_t iAlertPrimary, LPIDENT lpiServer, BOOL fFull)
{
   LPOBJECTALERTS lpoa;
   if ((lpoa = Alert_GetObjectAlerts (lpiPrimary)) != NULL)
      {
      int ids;
      TCHAR szServer[ cchRESOURCE ];
      TCHAR szService[ cchRESOURCE ];
      TCHAR szAggregate[ cchRESOURCE ];
      TCHAR szFileset[ cchRESOURCE ];

      switch (lpoa->aAlerts[ iAlertPrimary ].alert)
         {
         case alertTIMEOUT:
            ids = (fFull) ? IDS_ALERT_DESCFULL_TIMEOUT : IDS_ALERT_DESCSHORT_TIMEOUT;
            lpiPrimary->GetServerName (szServer);
            return FormatString (ids, TEXT("%s%t%e"), szServer, &lpoa->aAlerts[ iAlertPrimary ].aiTIMEOUT.stLastAttempt, lpoa->aAlerts[ iAlertPrimary ].aiTIMEOUT.status);

         case alertFULL:
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            if (lpiPrimary->fIsAggregate())
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_AGG_FULL : IDS_ALERT_DESCSHORT_AGG_FULL;
               return FormatString (ids, TEXT("%s%s%d%.1B"), szServer, szAggregate, lpoa->aAlerts[ iAlertPrimary ].aiFULL.perWarning, 1024.0 * (double)lpoa->aAlerts[ iAlertPrimary ].aiFULL.ckWarning);
               }
            else if (lpiPrimary->fIsFileset())
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_SET_FULL : IDS_ALERT_DESCSHORT_SET_FULL;
               lpiPrimary->GetFilesetName (szFileset);
               return FormatString (ids, TEXT("%s%s%s%d%.1B"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiFULL.perWarning, 1024.0 * (double)lpoa->aAlerts[ iAlertPrimary ].aiFULL.ckWarning);
               }
            break;

         case alertNO_VLDBENT:
            ids = (fFull) ? IDS_ALERT_DESCFULL_NO_VLDBENT : IDS_ALERT_DESCSHORT_NO_VLDBENT;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s"), szServer, szAggregate, szFileset);

         case alertNO_SVRENT:
            if (lpiPrimary->fIsFileset())
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_NO_SVRENT_SET : IDS_ALERT_DESCSHORT_NO_SVRENT_SET;
               lpiPrimary->GetServerName (szServer);
               lpiPrimary->GetAggregateName (szAggregate);
               lpiPrimary->GetFilesetName (szFileset);
               return FormatString (ids, TEXT("%s%s%s"), szServer, szAggregate, szFileset);
               }
            else
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_NO_SVRENT_AGG : IDS_ALERT_DESCSHORT_NO_SVRENT_AGG;
               lpiPrimary->GetServerName (szServer);
               lpiPrimary->GetAggregateName (szAggregate);
               return FormatString (ids, TEXT("%s%s"), szServer, szAggregate);
               }
            break;

         case alertSTOPPED:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STOPPED : IDS_ALERT_DESCSHORT_STOPPED;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetServiceName (szService);
            return FormatString (ids, TEXT("%s%s%t%t%lu"), szServer, szService, &lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.stStopped, &lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.stLastError, lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.errLastError);

         case alertBADCREDS:
            ids = (fFull) ? IDS_ALERT_DESCFULL_BADCREDS : IDS_ALERT_DESCSHORT_BADCREDS;
            lpiPrimary->GetServerName (szServer);
            return FormatString (ids, TEXT("%s"), szServer);

         case alertOVERALLOC:
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            ids = (fFull) ? IDS_ALERT_DESCFULL_AGG_ALLOC : IDS_ALERT_DESCSHORT_AGG_ALLOC;
            return FormatString (ids, TEXT("%s%s%.1B%.1B"), szServer, szAggregate, 1024.0 * (double)(lpoa->aAlerts[ iAlertPrimary ].aiOVERALLOC.ckCapacity), 1024.0 * (double)(lpoa->aAlerts[ iAlertPrimary ].aiOVERALLOC.ckAllocated));

         case alertSTATE_NO_VNODE:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_NO_VNODE : IDS_ALERT_DESCSHORT_STATE_NO_VNODE;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State);

         case alertSTATE_NO_SERVICE:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_NO_SERVICE : IDS_ALERT_DESCSHORT_STATE_NO_SERVICE;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State);

         case alertSTATE_OFFLINE:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_OFFLINE : IDS_ALERT_DESCSHORT_STATE_OFFLINE;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State);
         }
      }

   return NULL;
}
Beispiel #6
0
void Services_GuessLogName (LPTSTR pszLogFile, LPIDENT lpiService)
{
   TCHAR szService[ cchRESOURCE ];
   lpiService->GetServiceName (szService);
   Services_GuessLogName (pszLogFile, szService);
}