예제 #1
0
void Group_Create_OnInitDialog (HWND hDlg)
{
   LPCREATEGROUPDLG lpp = (LPCREATEGROUPDLG)GetWindowLongPtr (hDlg, DWLP_USER);

   // Fix the title of the dialog
   //
   ULONG status;
   TCHAR szName[ cchNAME ];
   asc_CellNameGet_Fast (g.idClient, g.idCell, szName, &status);

   TCHAR szText[ cchRESOURCE ];
   GetDlgItemText (hDlg, IDC_NEWGROUP_TITLE, szText, cchRESOURCE);

   LPTSTR pszText = FormatString (szText, TEXT("%s"), szName);
   SetDlgItemText (hDlg, IDC_NEWGROUP_TITLE, pszText);
   FreeString (pszText);

   // Attach a spinner to the ID control
   //
   CheckDlgButton (hDlg, IDC_NEWGROUP_ID_AUTO, TRUE);
   CreateSpinner (GetDlgItem (hDlg, IDC_NEWGROUP_ID), 10, TRUE, -0x7FFFFFFF, -1, -1);
   Group_Create_OnID (hDlg);

   StartTask (taskOBJECT_GET, hDlg, (PVOID)(g.idCell));
}
예제 #2
0
void GetCredentialsDlgParams (LPCREDENTIALSDLG_PARAMS lpp)
{
   memset (lpp, 0x00, sizeof(CREDENTIALSDLG_PARAMS));
   lpp->hParent = g.hMain;
   lpp->hCreds = g.hCreds;
   if (g.idCell)
      asc_CellNameGet_Fast (g.idClient, g.idCell, lpp->szCell);
   else
      AfsAppLib_GetLocalCell (lpp->szCell);
   GetBadCredsDlgParams (&lpp->bcdp);
}
예제 #3
0
EXPORTED BOOL ADMINAPI AfsAppLib_asc_CellNameGet_Fast (UINT_PTR idClient, ASID idCell, LPTSTR pszCell, ULONG *pStatus)
{
   return asc_CellNameGet_Fast (idClient, idCell, pszCell, pStatus);
}
예제 #4
0
파일: display.cpp 프로젝트: bagdxk/openafs
void Display_OnEndTask_UpdMachines (LPTASKPACKET ptp)
{
   HWND hDlg = GetTabChild (GetDlgItem (g.hMain, IDC_TAB));
   HWND hList = GetDlgItem (hDlg, IDC_MACHINES_LIST);
   if (IsWindow (hList) && !lstrcmpi (TASKDATA(ptp)->szPattern, g.szPatternMachines))
      {
      FastList_Begin (hList);

      // Update the title above the list to indicate what we're showing
      //
      TCHAR szCell[ cchRESOURCE ];
      asc_CellNameGet_Fast (g.idClient, g.idCell, szCell);

      LPTSTR pszTitle = FormatString ((TASKDATA(ptp)->szPattern[0]) ? IDS_MACHINES_PATTERN : IDS_MACHINES_ALL, TEXT("%s"), szCell);
      SetDlgItemText (hDlg, IDC_MACHINES_TITLE, pszTitle);
      FreeString (pszTitle);

      // For faster access, we'll want to use a hashlist to deal with
      // the items in our ASIDLIST (right now it's just a flat array).
      // This lets us remove duplicates--which is no big deal because
      // there shouldn't be any anyway--but more importantly it lets
      // us instantly determine if a particular ASID is in the list
      // (the asc_AsidListTest function is O(n), and we need O(1)).
      //
      LPHASHLIST pAsidList = New (HASHLIST);
      if (TASKDATA(ptp)->pAsidList)
         {
         for (size_t iAsid = 0; iAsid < TASKDATA(ptp)->pAsidList->cEntries; ++iAsid)
            pAsidList->AddUnique ((PVOID)(TASKDATA(ptp)->pAsidList->aEntries[ iAsid ].idObject));
         }

      // Delete any items which are currently in the FastList but
      // which aren't in our AsidList.
      //
      HLISTITEM hItemNext;
      for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = hItemNext)
         {
         hItemNext = FastList_FindNext (hList, hItem);
         ASID idObject = (ASID)FastList_GetItemParam (hList, hItem);
         if (!pAsidList->fIsInList ((PVOID)idObject))
            FastList_RemoveItem (hList, hItem);
         }

      // Add items for any entries which are in our AsidList but aren't
      // currently in the FastList.
      //
      DWORD dwStyle = GetWindowLong (hList, GWL_STYLE);

      for (LPENUM pEnum = pAsidList->FindFirst(); pEnum; pEnum = pEnum->FindNext())
         {
         ASID idObject = (ASID)( pEnum->GetObject() );

         HLISTITEM hItem;
         if ((hItem = FastList_FindItem (hList, (LPARAM)idObject)) == NULL)
            {
            FASTLISTADDITEM ai;
            memset (&ai, 0x00, sizeof(ai));
            Display_GetImageIcons (dwStyle, gr.ivMch, idObject, imageSERVER, IMAGE_NOIMAGE, &ai.iFirstImage, &ai.iSecondImage);
            ai.lParam = (LPARAM)idObject;
            hItem = FastList_AddItem (hList, &ai);
            }
         }

      Delete (pAsidList);
      FastList_End (hList);
      }

   Display_StopWorking();
}
예제 #5
0
파일: browse.cpp 프로젝트: bagdxk/openafs
void Browse_OnInitDialog (HWND hDlg)
{
   LPBROWSE_PARAMS lpp;
   if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL)
      {
      // First, the text of the dialog is woefully ugly right now. Put
      // in the strings which the caller supplied.
      //
      TCHAR szText[ cchRESOURCE ];
      GetString (szText, lpp->idsTitle);
      SetWindowText (hDlg, szText);

      GetString (szText, lpp->idsPrompt);
      SetDlgItemText (hDlg, IDC_BROWSE_TYPE, szText);

      SetDlgItemText (hDlg, IDC_BROWSE_NAMED, lpp->szName);

      SetDlgItemText (hDlg, IDC_BROWSE_PATTERN, TEXT(""));

      ULONG status;
      asc_CellNameGet_Fast (g.idClient, g.idCell, szText, &status);
      SetDlgItemText (hDlg, IDC_BROWSE_CELL, szText);
      EnableWindow (GetDlgItem (hDlg, IDC_BROWSE_CELL), FALSE);

      if (GetDlgItem (hDlg, IDC_BROWSE_CHECK))
         {
         if (lpp->idsCheck == 0)
            ShowWindow (GetDlgItem (hDlg, IDC_BROWSE_CHECK), FALSE);
         else
            {
            GetString (szText, lpp->idsCheck);
            SetDlgItemText (hDlg, IDC_BROWSE_CHECK, szText);
            }

         CheckDlgButton (hDlg, IDC_BROWSE_CHECK, (lpp->pObjectsToSkip) ? TRUE : FALSE);
         }

      if (GetDlgItem (hDlg, IDC_BROWSE_COMBO))
         {
         HWND hCombo = GetDlgItem (hDlg, IDC_BROWSE_COMBO);
         LPARAM lpSelect = 0;
         CB_StartChange (hCombo, TRUE);

         if (lpp->TypeToShow & TYPE_USER)
            {
            CB_AddItem (hCombo, IDS_SHOW_USERS, TYPE_USER);
            if (!lpSelect)
               lpSelect = TYPE_USER;
            }

         if (lpp->TypeToShow & TYPE_GROUP)
            {
            CB_AddItem (hCombo, IDS_SHOW_GROUPS, TYPE_GROUP);
            if (!lpSelect)
               lpSelect = TYPE_GROUP;
            }

         CB_EndChange (hCombo, lpSelect);
         }

      // If the caller requested that we disallow multiple selection,
      // change the fastlist's styles...
      //
      if (!lpp->fAllowMultiple)
         {
         DWORD dwStyle = GetWindowLong (GetDlgItem (hDlg, IDC_BROWSE_LIST), GWL_STYLE);
         dwStyle &= ~(FLS_SELECTION_MULTIPLE);
         SetWindowLong (GetDlgItem (hDlg, IDC_BROWSE_LIST), GWL_STYLE, dwStyle);
         }

      // Finally, update the listbox to show a valid list of users/groups.
      // Oh--since we're in initdialog, add an imagelist to the window too.
      //
      FastList_SetImageLists (GetDlgItem (hDlg, IDC_BROWSE_LIST), AfsAppLib_CreateImageList(FALSE), NULL);
      Browse_UpdateDialog (hDlg);
      }
}