BOOL User_GetDisplayName (LPTSTR pszText, ASID idUser) { ASOBJPROP Properties; if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, idUser, &Properties)) { return User_GetDisplayName (pszText, &Properties); } else { return asc_ObjectNameGet_Fast (g.idClient, g.idCell, idUser, pszText); } }
void User_GetColumn (ASID idObject, USERCOLUMN iCol, LPTSTR pszText, LPSYSTEMTIME pstDate, LONG *pcsec, COLUMNTYPE *pcType) { if (pszText) *pszText = TEXT('\0'); if (pstDate) memset (pstDate, 0x00, sizeof(SYSTEMTIME)); if (pcsec) *pcsec = 0; if (pcType) *pcType = ctALPHABETIC; ASOBJPROP Properties; if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, idObject, &Properties)) { switch (iCol) { case usrcolNAME: if (pcType) *pcType = ctALPHABETIC; if (pszText) User_GetDisplayName (pszText, &Properties); break; case usrcolFLAGS: if (pcType) *pcType = ctALPHABETIC; if (pszText) { if (Properties.u.UserProperties.fHaveKasInfo) { if (Properties.u.UserProperties.KASINFO.fIsAdmin) { GetString (pszText, IDS_USRFLAG_ADMIN); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fCanGetTickets) { GetString (pszText, IDS_USRFLAG_TICKET); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fEncrypt) { GetString (pszText, IDS_USRFLAG_ENCRYPT); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fCanChangePassword) { GetString (pszText, IDS_USRFLAG_CHANGEPW); pszText = &pszText[ lstrlen(pszText) -1 ]; } if (Properties.u.UserProperties.KASINFO.fCanReusePasswords) { GetString (pszText, IDS_USRFLAG_REUSEPW); pszText = &pszText[ lstrlen(pszText) -1 ]; } } } break; case usrcolADMIN: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fIsAdmin) ? IDS_YES : IDS_NO); } break; case usrcolTICKET: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fCanGetTickets) ? IDS_YES : IDS_NO); } break; case usrcolSYSTEM: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fEncrypt) ? IDS_NO : IDS_YES); } break; case usrcolCHANGEPW: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fCanChangePassword) ? IDS_YES : IDS_NO); } break; case usrcolREUSEPW: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) GetString (pszText, (Properties.u.UserProperties.KASINFO.fCanReusePasswords) ? IDS_YES : IDS_NO); } break; case usrcolEXPIRES: if (pcType) *pcType = ctDATE; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatTime (pszText, TEXT("%t"), &Properties.u.UserProperties.KASINFO.timeExpires); if (pstDate) memcpy (pstDate, &Properties.u.UserProperties.KASINFO.timeExpires, sizeof(SYSTEMTIME)); } break; case usrcolLASTPW: if (pcType) *pcType = ctDATE; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatTime (pszText, TEXT("%t"), &Properties.u.UserProperties.KASINFO.timeLastPwChange); if (pstDate) memcpy (pstDate, &Properties.u.UserProperties.KASINFO.timeLastPwChange, sizeof(SYSTEMTIME)); } break; case usrcolLASTMOD: if (pcType) *pcType = ctDATE; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatTime (pszText, TEXT("%t"), &Properties.u.UserProperties.KASINFO.timeLastMod); if (pstDate) memcpy (pstDate, &Properties.u.UserProperties.KASINFO.timeLastMod, sizeof(SYSTEMTIME)); } break; case usrcolLASTMODBY: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) lstrcpy (pszText, Properties.u.UserProperties.KASINFO.szUserLastMod); } break; case usrcolLIFETIME: if (pcType) *pcType = ctELAPSED; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatElapsedSeconds (pszText, Properties.u.UserProperties.KASINFO.csecTicketLifetime); if (pcsec) *pcsec = Properties.u.UserProperties.KASINFO.csecTicketLifetime; } break; case usrcolCDAYPW: if (pcType) *pcType = ctELAPSED; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatElapsedSeconds (pszText, Properties.u.UserProperties.KASINFO.cdayPwExpire * csec1DAY); if (pcsec) *pcsec = Properties.u.UserProperties.KASINFO.cdayPwExpire * csec1DAY; } break; case usrcolCFAILLOGIN: if (pcType) *pcType = ctNUMERIC; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) wsprintf (pszText, TEXT("%lu"), Properties.u.UserProperties.KASINFO.cFailLogin); } break; case usrcolCSECLOCK: if (pcType) *pcType = ctELAPSED; if (Properties.u.UserProperties.fHaveKasInfo) { if (pszText) FormatElapsedSeconds (pszText, Properties.u.UserProperties.KASINFO.csecFailLoginLock); if (pcsec) *pcsec = Properties.u.UserProperties.KASINFO.csecFailLoginLock; } break; case usrcolCGROUPMAX: if (pcType) *pcType = ctNUMERIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) wsprintf (pszText, TEXT("%lu"), Properties.u.UserProperties.PTSINFO.cgroupCreationQuota); } break; case usrcolUID: if (pcType) *pcType = ctNUMERIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) wsprintf (pszText, TEXT("%ld"), Properties.u.UserProperties.PTSINFO.uidName); } break; case usrcolOWNER: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) { if (Properties.u.UserProperties.PTSINFO.szOwner[0]) wsprintf (pszText, TEXT("%s (%ld)"), Properties.u.UserProperties.PTSINFO.szOwner, Properties.u.UserProperties.PTSINFO.uidOwner); else wsprintf (pszText, TEXT("%ld"), Properties.u.UserProperties.PTSINFO.uidOwner); } } break; case usrcolCREATOR: if (pcType) *pcType = ctALPHABETIC; if (Properties.u.UserProperties.fHavePtsInfo) { if (pszText) { if (Properties.u.UserProperties.PTSINFO.szCreator[0]) wsprintf (pszText, TEXT("%s (%ld)"), Properties.u.UserProperties.PTSINFO.szCreator, Properties.u.UserProperties.PTSINFO.uidCreator); else wsprintf (pszText, TEXT("%ld"), Properties.u.UserProperties.PTSINFO.uidCreator); } } break; } } }
void Browse_OnEndTask_EnumObjects (HWND hDlg, LPTASKPACKET ptp) { LPBROWSE_PARAMS lpp; size_t ii; if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL) { HWND hList = GetDlgItem (hDlg, IDC_BROWSE_LIST); FastList_Begin (hList); FastList_RemoveAll (hList); // If we were successful, we now have a list of all objects of the // appropriate type. However, the user may not want us to display // items which are on our pObjectsToSkip list; if not, convert the // later to a hashlist (for fast lookup) and remove the offending // entries from the former. // if (ptp->rc && TASKDATA(ptp)->pAsidList) { if ((IsDlgButtonChecked (hDlg, IDC_BROWSE_CHECK)) && (lpp->pObjectsToSkip)) { LPHASHLIST pListToSkip = New (HASHLIST); for (ii = 0; ii < lpp->pObjectsToSkip->cEntries; ++ii) pListToSkip->AddUnique ((PVOID)(lpp->pObjectsToSkip->aEntries[ii].idObject)); for (ii = 0; ii < TASKDATA(ptp)->pAsidList->cEntries; ) { if (pListToSkip->fIsInList ((PVOID)(TASKDATA(ptp)->pAsidList->aEntries[ii].idObject))) asc_AsidListRemoveEntryByIndex (&TASKDATA(ptp)->pAsidList, ii); else ii++; } Delete (pListToSkip); } } // OK, we're ready to go--populate that list! // for (ii = 0; ii < TASKDATA(ptp)->pAsidList->cEntries; ++ii) { ULONG status; ASOBJPROP Properties; if (!asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, TASKDATA(ptp)->pAsidList->aEntries[ii].idObject, &Properties, &status)) continue; TCHAR szName[ MAX_PATH ]; if (Properties.Type == TYPE_USER) User_GetDisplayName (szName, &Properties); else lstrcpy (szName, Properties.szName); FASTLISTADDITEM flai; memset (&flai, 0x00, sizeof(flai)); flai.iFirstImage = (Properties.Type == TYPE_USER) ? imageUSER : (Properties.Type == TYPE_GROUP) ? imageGROUP : IMAGE_NOIMAGE; flai.iSecondImage = IMAGE_NOIMAGE; flai.pszText = szName; FastList_AddItem (hList, &flai); } FastList_End (hList); lpp->fQuerying --; } }