Beispiel #1
0
void Filesets_Restore (LPIDENT lpiParent)
{
   LPSET_RESTORE_PARAMS psrp = New (SET_RESTORE_PARAMS);
   psrp->lpi = lpiParent;
   psrp->szFileset[0] = TEXT('\0');
   psrp->szFilename[0] = TEXT('\0');
   psrp->fIncremental = FALSE;

   if (lpiParent && lpiParent->fIsFileset())
      lpiParent->GetFilesetName (psrp->szFileset);

   INT_PTR rc = ModalDialogParam (IDD_SET_RESTORE, GetActiveWindow(), (DLGPROC)Filesets_Restore_DlgProc, (LPARAM)psrp);
   if (rc != IDOK)
      {
      Delete (psrp);
      }
   else if (!ASSERT( psrp->lpi != NULL ))
      {
      Delete (psrp);
      }
   else if (!ASSERT( psrp->szFileset[0] != TEXT('\0') ))
      {
      Delete (psrp);
      }
   else if (!ASSERT( psrp->szFilename[0] != TEXT('\0') ))
      {
      Delete (psrp);
      }
   else
      {
      StartTask (taskSET_RESTORE, NULL, psrp);
      }
}
Beispiel #2
0
void Filesets_Create (LPIDENT lpiParent)
{
   LPSET_CREATE_PARAMS pscp = New (SET_CREATE_PARAMS);
   memset (pscp, 0x00, sizeof(SET_CREATE_PARAMS));
   pscp->lpiParent = lpiParent;
   pscp->szName[0] = TEXT('\0');
   pscp->fCreateClone = FALSE;
   pscp->ckQuota = ckQUOTA_DEFAULT;

   // Show the Create dialog.
   //
   INT_PTR rc = ModalDialogParam (IDD_SET_CREATE, GetActiveWindow(), (DLGPROC)Filesets_Create_DlgProc, (LPARAM)pscp);

   if (rc != IDOK)
      {
      Delete (pscp);
      }
   else if (!ASSERT( pscp->lpiParent && pscp->lpiParent->fIsAggregate() ))
      {
      Delete (pscp);
      }
   else if (!ASSERT( pscp->szName[0] != TEXT('\0') ))
      {
      Delete (pscp);
      }
   else
      {
      StartTask (taskSET_CREATE, NULL, pscp);
      }
}
Beispiel #3
0
void OnExpiredCredentials (WPARAM wp, LPARAM lp)
{
   BOOL fExpired = (BOOL)wp;
   LPCREDENTIALSDLG_PARAMS lpp = (LPCREDENTIALSDLG_PARAMS)lp;

   if (lpp && lpp->bcdp.pfShowWarningEver && *(lpp->bcdp.pfShowWarningEver))
      {
      int idsWarning = (wp) ? IDS_BADCREDS_DESC_EXPIRED : IDS_BADCREDS_DESC_DESTROYED;

      int idsDesc = (lpp->bcdp.idsDesc) ? lpp->bcdp.idsDesc : IDS_BADCREDS_DESC2;
      LPTSTR pszDesc = FormatString (idsDesc, TEXT("%s"), lpp->szCell);
      LPTSTR pszFullText = FormatString (idsWarning, TEXT("%s%s%m"), lpp->szCell, pszDesc, IDS_BADCREDS_DESC3);
      FreeString (pszDesc);

      REALBADCREDSDLG_PARAMS pp;
      memset (&pp, 0x00, sizeof(pp));
      pp.pszFullText = pszFullText;
      memcpy (&pp.bcdp, &lpp->bcdp, sizeof(BADCREDSDLG_PARAMS));

      if (ModalDialogParam (IDD_APPLIB_BADCREDS, NULL, (DLGPROC)BadCreds_DlgProc, (LPARAM)&pp) != IDCANCEL)
         {
         AfsAppLib_ShowCredentialsDialog (lpp);
         }

      FreeString (pszFullText);
      }

   if (lpp)
      {
      Delete (lpp);
      }
}
Beispiel #4
0
void ObtainCredsThread(void * data)
{
    struct _obtaincreds * oc = (struct _obtaincreds *)data;

    ModalDialogParam (oc->type, oc->parent, (DLGPROC)NewCreds_DlgProc, (LPARAM)oc->cell);
    free(oc->cell);
    free(oc);
}
Beispiel #5
0
void Services_Delete (LPIDENT lpiService)
{
   INT_PTR rc = ModalDialogParam (IDD_SVC_DELETE, GetActiveWindow(), (DLGPROC)Services_Delete_DlgProc, (LPARAM)lpiService);
   if (rc == IDOK)
      {
      StartTask (taskSVC_DELETE, NULL, lpiService);
      }
}
Beispiel #6
0
void Server_General_OnChangeAddr (HWND hDlg, LPIDENT lpiServer)
{
   LPSVR_CHANGEADDR_PARAMS lpp = New (SVR_CHANGEADDR_PARAMS);
   memset (lpp, 0x00, sizeof(SVR_CHANGEADDR_PARAMS));
   lpp->lpiServer = lpiServer;

   if (ModalDialogParam (IDD_SVR_ADDRESS, hDlg, (DLGPROC)ChangeAddr_DlgProc, (LPARAM)lpp) == IDOK)
      {
      StartTask (taskSVR_CHANGEADDR, NULL, lpp);
      }
   else
      {
      Delete (lpp);
      }
}
Beispiel #7
0
void Group_ShowCreate (HWND hParent)
{
   LPCREATEGROUPDLG lpp = New (CREATEGROUPDLG);
   memset (lpp, 0x00, sizeof(CREATEGROUPDLG));
   memcpy (&lpp->Advanced, &gr.CreateGroup, sizeof(GROUPPROPINFO));
   lpp->Advanced.pMembers = NULL;
   lpp->Advanced.pGroupsOwner = NULL;

   (void)ModalDialogParam (IDD_NEWGROUP, hParent, (DLGPROC)Group_Create_DlgProc, (LPARAM)lpp);

   if (lpp->Advanced.pMembers)
      asc_AsidListFree (&lpp->Advanced.pMembers);
   if (lpp->Advanced.pGroupsOwner)
      asc_AsidListFree (&lpp->Advanced.pGroupsOwner);
   Delete (lpp);
}
Beispiel #8
0
void Services_Stop (LPIDENT lpiService)
{
   SERVICE_STARTSTOP_PARAMS dp;
   memset (&dp, 0x00, sizeof(dp));
   dp.lpi = lpiService;
   dp.fStart = FALSE;

   if (ModalDialogParam (IDD_SVC_STARTSTOP, NULL, (DLGPROC)Services_StartStop_DlgProc, (LPARAM)&dp) == IDOK)
      {
      LPSVC_STOP_PARAMS lpp = New (SVC_STOP_PARAMS);
      memset (lpp, 0x00, sizeof(SVC_STOP_PARAMS));
      lpp->lpiStop = lpiService;
      lpp->fTemporary = dp.fTemporary;
      StartTask (taskSVC_STOP, NULL, lpp);
      }
}
Beispiel #9
0
void Filesets_Dump (LPIDENT lpi)
{
   LPSET_DUMP_PARAMS psdp = New (SET_DUMP_PARAMS);
   memset (psdp, 0x00, sizeof(SET_DUMP_PARAMS));
   psdp->lpi = lpi;

   INT_PTR rc = ModalDialogParam (IDD_SET_DUMP, NULL, (DLGPROC)Filesets_Dump_DlgProc, (LPARAM)psdp);

   if (rc != IDOK)
      {
      Delete (psdp);
      }
   else
      {
      StartTask (taskSET_DUMP, NULL, psdp);
      }
}
Beispiel #10
0
void AutoMap_OnAdd(HWND hDlg)
{
	DRIVEMAP DriveMap;
   memset(&DriveMap, 0, sizeof(DRIVEMAP));

	if (ModalDialogParam (IDD_GLOBAL_DRIVES_ADDEDIT, hDlg, (DLGPROC)AutoMapEdit_DlgProc, (LPARAM)&DriveMap) != IDOK)
		return;

	if (DriveMap.chDrive) {
      if (DefineDosDrive(&DriveMap)) {
		   AddToDriveList(GlobalDrives, DriveMap);
		   ShowDriveList(hDlg, GlobalDrives);
		}
	}

	AutoMap_OnSelect(hDlg);
}
Beispiel #11
0
void CellEdit_OnAdd (HWND hDlg)
{
   CELLDBLINE Line;
   memset (&Line, 0x00, sizeof(CELLDBLINE));

   int iOrder = 0;

   HWND hList = GetDlgItem (hDlg, IDC_LIST);
   for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = FastList_FindNext (hList, hItem))
      {
      PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);
      iOrder = max (iOrder, 1+ (int)(pInfo->pNext));
      }

   if (ModalDialogParam (IDD_SERVER_EDIT, hDlg, (DLGPROC)ServerEdit_DlgProc, (LPARAM)&Line) == IDOK)
      {
      CellEdit_AddServerEntry (hDlg, &Line, iOrder);
      }
}
Beispiel #12
0
BOOL ShowBrowseDialog (LPBROWSE_PARAMS lpp)
{
   int nTypesToShow = 0;
   if (lpp->TypeToShow & TYPE_USER)
      ++nTypesToShow;
   if (lpp->TypeToShow & TYPE_GROUP)
      ++nTypesToShow;
   lpp->fQuerying = FALSE;

   int idd = (nTypesToShow == 1) ? IDD_BROWSE : (lpp->idsCheck) ? IDD_BROWSE_BOTH : IDD_BROWSE_COMBO;

   if (ModalDialogParam (idd, lpp->hParent, (DLGPROC)Browse_DlgProc, (LPARAM)lpp) != IDOK)
      return FALSE;

   if (!lpp->pObjectsSelected)
      return FALSE;

   return TRUE;
}
Beispiel #13
0
BOOL AfsAppLib_ShowBrowseDialog (LPBROWSEDLG_PARAMS lpp)
{
   BROWSEDIALOGPARAMS *pbdp;
   BOOL rc = FALSE;

   if ((pbdp = New (BROWSEDIALOGPARAMS)) != NULL)
   {
      memset (pbdp, 0x00, sizeof(BROWSEDIALOGPARAMS));
      lstrcpy (pbdp->szNamed, lpp->szNamed);
      lstrcpy (pbdp->szCell, lpp->szCell);
      pbdp->lpcl = lpp->lpcl;
      pbdp->bt = lpp->bt;
      pbdp->idsTitle = lpp->idsTitle;
      pbdp->idsPrompt = lpp->idsPrompt;
      pbdp->idsNone = lpp->idsNone;
      pbdp->hCreds = lpp->hCreds;

      switch (pbdp->bt)
      {
         case btLOCAL_USER:
         case btLOCAL_GROUP:
            pbdp->fThisCellOnly = TRUE;
            break;

         case btANY_USER:
         case btANY_GROUP:
            pbdp->fThisCellOnly = FALSE;
            break;
      }

      if (ModalDialogParam (IDD_APPLIB_BROWSE, lpp->hParent, (DLGPROC)DlgProc_Browse, (LPARAM)pbdp) == IDOK)
      {
         lstrcpy (lpp->szCell, pbdp->szCell);
         lstrcpy (lpp->szNamed, pbdp->szNamed);
         rc = TRUE;
      }

      Delete (pbdp);
   }

   return rc;
}
Beispiel #14
0
BOOL AfsAppLib_ShowCredentialsDialog (LPCREDENTIALSDLG_PARAMS lpp)
{
   HINSTANCE hInst = APP_HINST;
   if (lpp->idd == 0)
      {
      hInst = APPLIB_HINST;
      lpp->idd = IDD_APPLIB_CREDENTIALS;
      }
   if (lpp->hCreds == 0)
      {
      if (lpp->szCell[0])
         lpp->hCreds = AfsAppLib_GetCredentials (lpp->szCell);
      else
         lpp->hCreds = AfsAppLib_GetCredentials (NULL);
      }

   INT_PTR rc = ModalDialogParam (lpp->idd, lpp->hParent, (DLGPROC)NewCreds_DlgProc, (LPARAM)lpp);

   return (rc == IDOK) ? TRUE : FALSE;
}
Beispiel #15
0
BOOL Subsets_GetSaveName (HWND hParent, LPTSTR pszSubset)
{
   SUBSET_OPENSAVE_PARAMS lpp;
   lpp.fOpen = FALSE;
   lpp.szCell[0] = TEXT('\0');
   lstrcpy (lpp.szSubset, pszSubset);

   if (g.lpiCell)
      g.lpiCell->GetCellName (lpp.szCell);

   INT_PTR rc = ModalDialogParam (IDD_SUBSET_LOADSAVE,
                          hParent, (DLGPROC)Subsets_OpenSave_DlgProc,
                          (LPARAM)&lpp);

   if (rc == IDOK)
      {
      lstrcpy (pszSubset, lpp.szSubset);
      }

   return (rc == IDOK) ? TRUE : FALSE;
}
Beispiel #16
0
void AutoMap_OnEdit (HWND hDlg)
{
   DRIVEMAP *pOldDrive = GetSelectedDrive(hDlg);
   if (!pOldDrive)
      return;

   DRIVEMAP NewDrive;
   memcpy(&NewDrive, pOldDrive, sizeof(DRIVEMAP));

	if (ModalDialogParam (IDD_GLOBAL_DRIVES_ADDEDIT, hDlg, (DLGPROC)AutoMapEdit_DlgProc, (LPARAM)&NewDrive) != IDOK)
		return;

   if (DefineDosDrive(pOldDrive, DDD_REMOVE)) {
      RemoveFromDriveList(GlobalDrives, *pOldDrive);

      if (DefineDosDrive(&NewDrive))
   	   AddToDriveList(GlobalDrives, NewDrive);

   	ShowDriveList(hDlg, GlobalDrives);
	}

	AutoMap_OnSelect(hDlg);
}
Beispiel #17
0
void CellEdit_OnEdit (HWND hDlg)
{
   HWND hList = GetDlgItem (hDlg, IDC_LIST);
   HLISTITEM hItem = FastList_FindFirstSelected (hList);
   PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);

   CELLDBLINE Line;
   memcpy (&Line, pInfo, sizeof(CELLDBLINE));

   if (ModalDialogParam (IDD_SERVER_EDIT, hDlg, (DLGPROC)ServerEdit_DlgProc, (LPARAM)&Line) == IDOK)
      {
      CELLDBLINEINFO Info;
      CSDB_CrackLine (&Info, Line.szLine);

      TCHAR szServer[ cchRESOURCE ];
      lstrcpy (szServer, inet_ntoa (*(struct in_addr *)&Info.ipServer));

      FastList_SetItemText (hList, hItem, 0, Info.szComment);
      FastList_SetItemText (hList, hItem, 1, szServer);

      lstrcpy (pInfo->szLine, Line.szLine);
      }
}
Beispiel #18
0
void Server_Hosts_OnAddEntry (HWND hDlg, LPSVR_HOSTS_PARAMS lpp)
{
   LPSVR_ADDHOST_PARAMS pAdd = New (SVR_ADDHOST_PARAMS);
   memset (pAdd, 0x00, sizeof(pAdd));
   pAdd->lpiServer = lpp->lpiServer;

   if (ModalDialogParam (IDD_SVR_ADDHOST, hDlg, (DLGPROC)Server_AddHost_DlgProc, (LPARAM)pAdd) == IDOK)
      {
      size_t iEntry;
      for (iEntry = 0; iEntry < lpp->lpList->cEntries; ++iEntry)
         {
         LPHOSTLISTENTRY pEntry = &lpp->lpList->aEntries[ iEntry ];
         if (pEntry->szHost[0] == TEXT('\0'))
            continue;
         if (!lstrcmpi (pEntry->szHost, pAdd->szHost))
            break;
         }

      if (iEntry >= lpp->lpList->cEntries)
         {
         iEntry = AfsClass_HostList_AddEntry (lpp->lpList, pAdd->szHost);
         }

      HWND hList = GetDlgItem (hDlg, IDC_HOST_LIST);
      FL_StartChange (hList, FALSE);

      HLISTITEM hItem;
      if ((hItem = FastList_FindItem (hList, (LPARAM)iEntry)) == NULL)
         {
         hItem = FL_AddItem (hList, 1, (LPARAM)iEntry, 0, pAdd->szHost);
         }

      FL_EndChange (hList, (LPARAM)hItem);
      }

   Delete (pAdd);
}
Beispiel #19
0
BOOL AfsAppLib_CheckCredentials (LPCHECKCREDS_PARAMS lpp)
{
   BOOL fCredsOK = TRUE;
   int idsWarning = IDS_BADCREDS_DESC_GENERAL;

   TCHAR szCell[ cchNAME ];
   TCHAR szUser[ cchNAME ];
   SYSTEMTIME stExpire;

   if (!AfsAppLib_CrackCredentials (lpp->hCreds, szCell, szUser, &stExpire))
      {
      fCredsOK = FALSE;
      }
   else if (!AfsAppLib_IsUserAdmin (lpp->hCreds, szUser))
      {
      fCredsOK = FALSE;
      idsWarning = IDS_BADCREDS_DESC_BADCHOICE;
      }
   else if (!AfsAppLib_IsTimeInFuture (&stExpire))
      {
      fCredsOK = FALSE;
      idsWarning = IDS_BADCREDS_DESC_EXPIRED;
      }

   if (!fCredsOK && lpp->fShowWarning)
      {
      if (lpp->bcdp.pfShowWarningEver && !(*lpp->bcdp.pfShowWarningEver))
         {
         fCredsOK = TRUE; // user says always ignore bad credentials.
         }
      else
         {
         if (!szCell[0])
            AfsAppLib_GetLocalCell (szCell);

         int idsDesc = (lpp->bcdp.idsDesc) ? lpp->bcdp.idsDesc : IDS_BADCREDS_DESC2;
         LPTSTR pszDesc = FormatString (idsDesc, TEXT("%s"), szCell);
         LPTSTR pszFullText = FormatString (idsWarning, TEXT("%s%s%m"), szCell, pszDesc, IDS_BADCREDS_DESC3);
         FreeString (pszDesc);

         REALBADCREDSDLG_PARAMS pp;
         memset (&pp, 0x00, sizeof(pp));
         pp.pszFullText = pszFullText;
         memcpy (&pp.bcdp, &lpp->bcdp, sizeof(BADCREDSDLG_PARAMS));

         HINSTANCE hInst = APP_HINST;
         if (pp.bcdp.idd == 0)
            {
            hInst = APPLIB_HINST;
            pp.bcdp.idd = IDD_APPLIB_BADCREDS;
            }

         INT_PTR rc = ModalDialogParam (pp.bcdp.idd, pp.bcdp.hParent, (DLGPROC)BadCreds_DlgProc, (LPARAM)&pp);
         if (rc == IDCANCEL)
            {
            fCredsOK = TRUE; // user says ignore bad credentials this time.
            }

         FreeString (pszFullText);
         }
      }

   return fCredsOK;
}
Beispiel #20
0
INT_PTR ModalDialog (int idd, HWND hWndParent, DLGPROC lpDialogFunc)
{
   return ModalDialogParam (idd, hWndParent, lpDialogFunc, 0);
}
Beispiel #21
0
void ChangeAddr_OnChange (HWND hDlg, LPSVR_CHANGEADDR_PARAMS lpp)
{
   HWND hList = GetDlgItem (hDlg, IDC_SVR_ADDRESSES);

   int iSel;
   if ((iSel = LB_GetSelected (hList)) != -1)
      {
      TCHAR szItem[ cchRESOURCE ] = TEXT("");
      SendMessage (hList, LB_GETTEXT, iSel, (LPARAM)szItem);

      SOCKADDR_IN AddrSel;
      Server_ParseAddress (&AddrSel, szItem);

      int AddrSelInt;
      AfsClass_AddressToInt (&AddrSelInt, &AddrSel);

      if (AddrSelInt != 0)
         {
         SOCKADDR_IN AddrNew = AddrSel;
         if (ModalDialogParam (IDD_SVR_NEWADDR, hDlg, (DLGPROC)NewAddr_DlgProc, (LPARAM)&AddrNew) != IDOK)
            return;

         int AddrNewInt;
         AfsClass_AddressToInt (&AddrNewInt, &AddrNew);
         if (AddrNewInt && (AddrNewInt != AddrSelInt))
            {

            // First see if the new IP address is already in the server's
            // list of IP addresses--if so, just delete the old address.
            //
            size_t iAddr;
            for (iAddr = 0; iAddr < lpp->ssOld.nAddresses; ++iAddr)
               {
               int OldAddrInt;
               AfsClass_AddressToInt (&OldAddrInt, &lpp->ssOld.aAddresses[iAddr]);

               int NewAddrInt;
               AfsClass_AddressToInt (&NewAddrInt, &lpp->ssNew.aAddresses[iAddr]);

               if ((OldAddrInt == AddrNewInt) || (NewAddrInt == AddrNewInt))
                  {
                  AddrNewInt = 0;
                  break;
                  }
               }

            // Now update the SERVERSTATUS structure.
            //
            for (iAddr = 0; iAddr < lpp->ssOld.nAddresses; ++iAddr)
               {
               int OldAddrInt;
               AfsClass_AddressToInt (&OldAddrInt, &lpp->ssOld.aAddresses[iAddr]);

               int NewAddrInt;
               AfsClass_AddressToInt (&NewAddrInt, &lpp->ssNew.aAddresses[iAddr]);

               if ((OldAddrInt == AddrSelInt) || (NewAddrInt == AddrSelInt))
                  {
                  AfsClass_IntToAddress (&lpp->ssNew.aAddresses[iAddr], AddrNewInt);
                  break;
                  }
               }
            }
         }

      Server_FillAddrList (hDlg, &lpp->ssNew, FALSE);
      ChangeAddr_OnSelect (hDlg);
      }
}