Exemplo n.º 1
0
void SERVER::FreeServices (void)
{
   for (LPENUM pEnum = m_lServices->FindLast(); pEnum; pEnum = pEnum->FindPrevious())
      {
      LPSERVICE lpService = (LPSERVICE)(pEnum->GetObject());
      m_lServices->Remove (lpService);
      Delete (lpService);
      }
}
Exemplo n.º 2
0
void SERVER::FreeAggregates (void)
{
   for (LPENUM pEnum = m_lAggregates->FindLast(); pEnum; pEnum = pEnum->FindPrevious())
      {
      LPAGGREGATE lpAggregate = (LPAGGREGATE)(pEnum->GetObject());
      m_lAggregates->Remove (lpAggregate);
      Delete (lpAggregate);
      }
}
Exemplo n.º 3
0
BOOL SERVER::RefreshServices (BOOL fNotify, ULONG *pStatus)
{
   BOOL rc = TRUE;
   DWORD status = 0;

   if (m_fServicesOutOfDate)
      {
      m_fServicesOutOfDate = FALSE;

      if (fIsMonitored())
         {
         if (fNotify)
            NOTIFYCALLBACK::SendNotificationToAll (evtRefreshServicesBegin, GetIdentifier());

         // First thing is to forget about what services we think we have now.
         //
         LPENUM pEnum;
         for (pEnum = m_lServices->FindLast(); pEnum; pEnum = pEnum->FindPrevious())
            {
            LPSERVICE lpService = (LPSERVICE)(pEnum->GetObject());
            lpService->SendDeleteNotifications();
            m_lServices->Remove (lpService);
            Delete (lpService);
            }

         // Next, the harder part: look through the server to find a list
         // of services.
         //
         PVOID hCell;
         PVOID hBOS;
         if ((hBOS = OpenBosObject (&hCell, &status)) == NULL)
            rc = FALSE;
         else
            {
            WORKERPACKET wpBegin;
            wpBegin.wpBosProcessNameGetBegin.hServer = hBOS;
            if (!Worker_DoTask (wtaskBosProcessNameGetBegin, &wpBegin, &status))
               rc = FALSE;
            else
               {
               LPSERVICE lpService = New2 (SERVICE,(this, TEXT("BOS")));
               m_lServices->Add (lpService);
               NOTIFYCALLBACK::SendNotificationToAll (evtCreate, lpService->GetIdentifier());

               for (;;)
                  {
                  TCHAR szServiceName[ cchNAME ];

                  WORKERPACKET wpNext;
                  wpNext.wpBosProcessNameGetNext.hEnum = wpBegin.wpBosProcessNameGetBegin.hEnum;
                  wpNext.wpBosProcessNameGetNext.pszService = szServiceName;

                  if (!Worker_DoTask (wtaskBosProcessNameGetNext, &wpNext, &status))
                     {
                     if (status == ADMITERATORDONE)
                        status = 0;
                     else
                        rc = FALSE;
                     break;
                     }

                  lpService = New2 (SERVICE,(this, wpNext.wpBosProcessNameGetNext.pszService));
                  m_lServices->Add (lpService);
                  NOTIFYCALLBACK::SendNotificationToAll (evtCreate, lpService->GetIdentifier());
                  }

               WORKERPACKET wpDone;
               wpDone.wpBosProcessNameGetDone.hEnum = wpBegin.wpBosProcessNameGetBegin.hEnum;
               Worker_DoTask (wtaskBosProcessNameGetDone, &wpDone);
               }

            CloseBosObject();
            }

         if (fNotify)
            NOTIFYCALLBACK::SendNotificationToAll (evtRefreshServicesEnd, GetIdentifier(), ((rc) ? 0 : status));
         }
      }

   if (pStatus && !rc)
      *pStatus = status;
   return TRUE;
}
Exemplo n.º 4
0
BOOL SERVER::RefreshAggregates (BOOL fNotify, ULONG *pStatus)
{
   BOOL rc = TRUE;
   DWORD status = 0;

   if (m_fAggregatesOutOfDate)
      {
      m_fAggregatesOutOfDate = FALSE;

      if (fIsMonitored())
         {
         if (fNotify)
            NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAggregatesBegin, GetIdentifier());

         // First thing is to forget about what aggregates we think we have
         // now.
         //
         LPENUM pEnum;
         for (pEnum = m_lAggregates->FindLast(); pEnum; pEnum = pEnum->FindPrevious())
            {
            LPAGGREGATE lpAggregate = (LPAGGREGATE)(pEnum->GetObject());
            lpAggregate->SendDeleteNotifications();
            m_lAggregates->Remove (lpAggregate);
            Delete (lpAggregate);
            }

         // Next, the harder part: look through the server to find a list
         // of aggregates.
         //
         PVOID hCell;
         PVOID hVOS;
         if ((hVOS = OpenVosObject (&hCell, &status)) == NULL)
            rc = FALSE;
         else
            {
            WORKERPACKET wpBegin;
            wpBegin.wpVosPartitionGetBegin.hCell = hCell;
            wpBegin.wpVosPartitionGetBegin.hServer = hVOS;

            if (!Worker_DoTask (wtaskVosPartitionGetBegin, &wpBegin, &status))
               rc = FALSE;
            else
               {
               for (;;)
                  {
                  WORKERPACKET wpNext;
                  wpNext.wpVosPartitionGetNext.hEnum = wpBegin.wpVosPartitionGetBegin.hEnum;
                  if (!Worker_DoTask (wtaskVosPartitionGetNext, &wpNext, &status))
                     {
                     if (status == ADMITERATORDONE)
                        status = 0;
                     else
                        rc = FALSE;
                     break;
                     }

                  vos_partitionEntry_p pData = &wpNext.wpVosPartitionGetNext.Data;

                  LPTSTR pszName = AnsiToString (pData->name);
                  LPTSTR pszDevice = AnsiToString (pData->deviceName);

                  LPAGGREGATE lpAggregate = New2 (AGGREGATE,(this, pszName, pszDevice));

                  lpAggregate->m_as.dwID = lpAggregate->GetID();

                  FreeString (pszDevice, pData->deviceName);
                  FreeString (pszName,   pData->name);

                  lpAggregate->m_wGhost |= GHOST_HAS_SERVER_ENTRY;
                  lpAggregate->m_as.ckStorageTotal = pData->totalSpace;
                  lpAggregate->m_as.ckStorageFree = pData->totalFreeSpace;
                  m_lAggregates->Add (lpAggregate);

                  NOTIFYCALLBACK::SendNotificationToAll (evtCreate, lpAggregate->GetIdentifier());
                  }

               WORKERPACKET wpDone;
               wpDone.wpVosPartitionGetDone.hEnum = wpBegin.wpVosPartitionGetBegin.hEnum;
               Worker_DoTask (wtaskVosPartitionGetDone, &wpDone);
               }

            CloseVosObject();
            }

         if (fNotify)
            NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAggregatesEnd, GetIdentifier(), ((rc) ? 0 : status));
         }
      }

   if (pStatus && !rc)
      *pStatus = status;
   return TRUE;
}