40#define SIDN_LOOKUPSUCCEEDED (0x101)
52 switch (AceHeader->AceType)
109 CurItem = *PrincipalsListHead;
110 while (CurItem !=
NULL)
113 AceEntry = CurItem->
ACEs;
114 while (AceEntry !=
NULL)
116 NextAceEntry = AceEntry->
Next;
120 AceEntry = NextAceEntry;
143 *PrincipalsListHead =
NULL;
155 if (AceEntry !=
NULL)
165 AceLink = &Principal->ACEs;
166 while (*AceLink !=
NULL)
168 AceLink = &(*AceLink)->
Next;
183 for (CurItem = PrincipalsListHead;
185 CurItem = CurItem->
Next)
215 if (SidRequestResult !=
NULL)
249 PrincipalLink = &
sp->PrincipalsListHead;
250 while (*PrincipalLink !=
NULL)
252 PrincipalLink = &(*PrincipalLink)->Next;
261 if (PrincipalListItem !=
NULL)
267 (
PSID)(PrincipalListItem + 1),
274 if (AceEntry !=
NULL)
282 PrincipalListItem->
ACEs = AceEntry;
287 *PrincipalLink = PrincipalListItem;
300 PrincipalListItem =
NULL;
305 if (PrincipalListItem !=
NULL && LookupDeferred !=
NULL)
307 *LookupDeferred = Deferred;
310 return PrincipalListItem;
324 SidReqResult->AccountName,
325 SidReqResult->DomainName,
326 SidReqResult->AccountName);
333 SidReqResult->AccountName);
336 return lpDisplayString;
344 if (PrincipalListItem->SidReqResult !=
NULL)
354 return lpDisplayString;
362 if (PrincipalListItem->SidReqResult !=
NULL)
367 PrincipalListItem->SidReqResult->AccountName);
375 return lpDisplayString;
387 if (PrincipalListItem->SidReqResult !=
NULL)
389 switch (PrincipalListItem->SidReqResult->SidNameUse)
408 li->pszText = PrincipalListItem->DisplayString;
409 li->iImage = ImageIndex;
410 li->lParam = (
LPARAM)PrincipalListItem;
422 if (PrincipalListItem->DisplayString !=
NULL)
459 IN INT PrincipalIndex,
466 if (PrincipalListItem->SidReqResult !=
NULL)
469 PrincipalListItem->SidReqResult);
474 PrincipalListItem->SidReqResult = SidReqResult;
477 if (PrincipalListItem->DisplayString !=
NULL)
515 &
sp->PrincipalsListHead);
518 hRet =
sp->psi->lpVtbl->GetSecurity(
sp->psi,
609 if (PrincipalListItem !=
NULL && LookupDeferred)
633 if (Selected !=
NULL)
656 WCHAR szPermissions[255];
661 sizeof(szPermissions) /
sizeof(szPermissions[0])))
681 if (
sp->OwnerSid !=
NULL &&
685 if (LookupInfo->SidRequestResult !=
NULL)
693 if (DisplayName !=
NULL)
703 for (CurItem =
sp->PrincipalsListHead;
705 CurItem = CurItem->
Next)
715 lvfi.lParam = (
LPARAM)CurItem;
720 if (PrincipalIndex != -1)
726 LookupInfo->SidRequestResult);
799 ULONG nAccessList, DefaultAccessIndex;
800 WCHAR szSpecialPermissions[255];
812 hRet =
sp->psi->lpVtbl->GetAccessRights(
sp->psi,
817 &DefaultAccessIndex);
825 if (DefaultAccess !=
NULL)
827 *DefaultAccess = AccessList[DefaultAccessIndex];
830 LastAccess = AccessList + nAccessList;
831 for (CurAccess = &AccessList[0];
832 CurAccess != LastAccess;
843 sizeof(NameBuffer) /
sizeof(NameBuffer[0])))
848 sizeof(NameBuffer) /
sizeof(NameBuffer[0]));
850 NameStr = NameBuffer;
864 SpecialPermissionsPresent =
TRUE;
865 SpecialPermissionsMask |= CurAccess->
mask;
872 if (SpecialPermissionsPresent &&
875 szSpecialPermissions,
876 sizeof(szSpecialPermissions) /
sizeof(szSpecialPermissions[0])))
881 (
WPARAM)SpecialPermissionsMask,
882 (
LPARAM)szSpecialPermissions);
883 if (
sp->SpecialPermCheckIndex != -1)
898 HWND hWndAllow, hWndDeny, hWndOwnerEdit;
899 RECT rcControl, rcControl2, rcControl3, rcWnd;
900 INT cxWidth, cxEdge, btnSpacing;
960 sp->hWndPrincipalsList,
976 btnSpacing = rcControl2.
left - rcControl.
right;
986 pt.x + cxWidth - (rcControl2.
right - rcControl2.
left) -
1007 pt.x + cxWidth - (rcControl2.
right - rcControl2.
left) - cxEdge,
1030 sp->hPermissionsForLabel,
1034 cxWidth - (rcControl2.
right - rcControl2.
left) -
1036 (2 * btnSpacing) - cxEdge,
1053 cxWidth - (rcControl2.
right - rcControl2.
left) -
1055 btnSpacing - cxEdge,
1074 cxWidth - (rcControl2.
right - rcControl2.
left) - cxEdge,
1099 (rcControl3.
bottom - rcControl3.
top) -
pt.x - btnSpacing :
1115 cxWidth - (rcControl2.
right - rcControl2.
left) - cxEdge,
1126 cxWidth - (rcControl2.
right - rcControl2.
left) +
pt.x,
1144 lvc.cx = rcControl.
right;
1168 SidStart) + (
WORD)SidLen;
1175 Ace->Header.AceFlags = 0;
1176 Ace->Header.AceSize = AceSize;
1177 Ace->Mask =
sp->DefaultAccess.mask;
1183 return &
Ace->Header;
1205 if (AceHeader !=
NULL)
1208 BOOL LookupDeferred;
1215 if (PrincipalListItem !=
NULL && LookupDeferred)
1249 if (pnmh->
hwndFrom ==
sp->hWndPrincipalsList)
1267 else if (pnmh->
hwndFrom ==
sp->hAceCheckList)
1315 &
sp->pDsObjectPicker);
1342 if (SelectedPrincipal !=
NULL)
1376 sp->SpecialPermCheckIndex = -1;
1390 if (
sp->hiPrincipals !=
NULL)
1396 if (hbmImages !=
NULL)
1409 if (
sp->hiPrincipals !=
NULL)
1422 lvc.cx = rcLvClient.
right;
1444 &
sp->DefaultAccess);
1499 DPRINT(
"No ISecurityInformation class passed!\n");
1506 hRet = psi->lpVtbl->GetObjectInformation(psi,
1513 DPRINT(
"CreateSecurityPage() failed! Failed to query the object information!\n");
1526 if (SidCacheMgr ==
NULL)
1528 DPRINT(
"Creating the SID cache failed!\n");
1536 DPRINT(
"CoInitialize failed!\n");
1550 DPRINT(
"Not enough memory to allocate a SECURITY_PAGE!\n");
1567 psp.lParam = (
LPARAM)sPage;
1574 if (psp.pszTitle !=
NULL)
1581 psp.pszTitle =
NULL;
1612 DPRINT(
"No ISecurityInformation class passed!\n");
1619 hRet = psi->lpVtbl->GetObjectInformation(psi,
1626 DPRINT(
"GetObjectInformation() failed!\n");
1632 if (hPages[0] ==
NULL)
1634 DPRINT(
"CreateSecurityPage(), couldn't create property sheet!\n");
1640 psh.hwndParent = hwndOwner;
1651 psh.pszCaption = lpCaption;
1660 psh.phpage = hPages;
1664 if (lpCaption !=
NULL)
1687 DPRINT(
"Registering the CHECKLIST_ACLUI class failed!\n");
#define SI_ACCESS_CONTAINER
#define SI_ACCESS_SPECIFIC
#define SI_ACCESS_GENERAL
static VOID DestroySecurityPage(IN PSECURITY_PAGE sp)
static VOID ReloadPrincipalsList(IN PSECURITY_PAGE sp)
static int CALLBACK PrincipalCompare(IN LPARAM lParam1, IN LPARAM lParam2, IN LPARAM lParamSort)
static VOID LoadPermissionsList(IN PSECURITY_PAGE sp, IN GUID *GuidObjectType, IN DWORD dwFlags, OUT SI_ACCESS *DefaultAccess)
static VOID UpdatePrincipalListItem(IN PSECURITY_PAGE sp, IN INT PrincipalIndex, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN PSIDREQRESULT SidReqResult)
static void UpdatePrincipalInfo(IN PSECURITY_PAGE sp, IN PSIDLOOKUPNOTIFYINFO LookupInfo)
struct _SIDLOOKUPNOTIFYINFO SIDLOOKUPNOTIFYINFO
static PACE_ENTRY AddAceToPrincipal(IN PPRINCIPAL_LISTITEM Principal, IN PACE_HEADER AceHeader)
static VOID FreePrincipalsList(IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM *PrincipalsListHead)
static VOID SetAceCheckListColumns(IN HWND hAceCheckList, IN UINT Button, IN HWND hLabel)
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
static PSID AceHeaderToSID(IN PACE_HEADER AceHeader)
static VOID UpdateControlStates(IN PSECURITY_PAGE sp)
static VOID CreatePrincipalListItem(OUT LVITEM *li, IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN INT Index, IN BOOL Selected)
static LPWSTR GetPrincipalAccountNameString(IN PPRINCIPAL_LISTITEM PrincipalListItem)
static PPRINCIPAL_LISTITEM FindSidInPrincipalsListAddAce(IN PPRINCIPAL_LISTITEM PrincipalsListHead, IN PSID Sid, IN PACE_HEADER AceHeader)
static INT AddPrincipalListEntry(IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN INT Index, IN BOOL Selected)
struct _SIDLOOKUPNOTIFYINFO * PSIDLOOKUPNOTIFYINFO
#define SIDN_LOOKUPSUCCEEDED
static LPWSTR GetPrincipalDisplayString(IN PPRINCIPAL_LISTITEM PrincipalListItem)
static BOOL AddSelectedPrincipal(IN IDsObjectPicker *pDsObjectPicker, IN HWND hwndParent OPTIONAL, IN PSID pSid, IN PVOID Context OPTIONAL)
static PPRINCIPAL_LISTITEM AddPrincipalToList(IN PSECURITY_PAGE sp, IN PSID Sid, IN PACE_HEADER AceHeader, OUT BOOL *LookupDeferred OPTIONAL)
static VOID SidLookupCompletion(IN HANDLE SidCacheMgr, IN PSID Sid, IN PSIDREQRESULT SidRequestResult, IN PVOID Context)
static PACE_HEADER BuildDefaultPrincipalAce(IN PSECURITY_PAGE sp, IN PSID pSid)
static LPWSTR GetDisplayStringFromSidRequestResult(IN PSIDREQRESULT SidReqResult)
static UINT CALLBACK SecurityPageCallback(IN HWND hwnd, IN UINT uMsg, IN LPPROPSHEETPAGE ppsp)
static INT_PTR CALLBACK SecurityPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
BOOL WINAPI EditSecurity(IN HWND hwndOwner, IN LPSECURITYINFO psi)
static VOID ResizeControls(IN PSECURITY_PAGE sp, IN INT Width, IN INT Height)
HPROPSHEETPAGE WINAPI CreateSecurityPage(IN LPSECURITYINFO psi)
interface ISecurityInformation * LPSECURITYINFO
DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, OUT LPTSTR *lpTarget,...)
static VOID FreeObjectPicker(IN IDsObjectPicker *pDsObjectPicker)
BOOL RegisterCheckListControl(IN HINSTANCE hInstance)
VOID UnregisterCheckListControl(HINSTANCE hInstance)
#define ERROR_NOT_ENOUGH_MEMORY
HRESULT InitializeObjectPicker(IN PCWSTR ServerName, IN PSI_OBJECT_INFO ObjectInfo, OUT IDsObjectPicker **pDsObjectPicker)
BOOL ListViewSelectItem(IN HWND hwnd, IN INT Index)
HRESULT InvokeObjectPickerDialog(IN IDsObjectPicker *pDsObjectPicker, IN HWND hwndParent OPTIONAL, IN POBJPICK_SELECTED_SID SelectedSidCallback, IN PVOID Context OPTIONAL)
LPARAM ListViewGetSelectedItemData(IN HWND hwnd)
#define CLM_CLEARCHECKBOXES
VOID DestroySidCacheMgr(IN HANDLE SidCacheMgr)
struct _NMCHANGEITEMCHECKBOX * PNMCHANGEITEMCHECKBOX
#define CLM_ENABLEQUICKSEARCH
#define CIS_ALLOWDISABLED
struct _PRINCIPAL_LISTITEM * PPRINCIPAL_LISTITEM
VOID ReferenceSidReqResult(IN HANDLE SidCacheMgr, IN PSIDREQRESULT ReqResult)
#define CLM_SETCHECKBOXCOLUMN
struct _SECURITY_PAGE * PSECURITY_PAGE
#define CLN_CHANGINGITEMCHECKBOX
HANDLE CreateSidCacheMgr(IN HANDLE Heap, IN LPCWSTR SystemName)
VOID DereferenceSidReqResult(IN HANDLE SidCacheMgr, IN PSIDREQRESULT ReqResult)
BOOL LookupSidCache(IN HANDLE SidCacheMgr, IN PSID pSid, IN PSIDREQCOMPLETIONPROC CompletionProc, IN PVOID Context)
#define IDC_REMOVE_PRINCIPAL
#define IDC_LABEL_PERMISSIONS_FOR
#define IDS_USERDOMAINFORMAT
#define IDS_PERMISSIONS_FOR
#define IDS_SPECIAL_PERMISSIONS
#define IDC_ADD_PRINCIPAL
#define IDC_LABEL_ADVANCED
#define IDC_ACE_CHECKLIST
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
DWORD WINAPI GetLengthSid(PSID pSid)
BOOL WINAPI EqualSid(PSID pSid1, PSID pSid2)
BOOL WINAPI GetAce(PACL pAcl, DWORD dwAceIndex, LPVOID *pAce)
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
#define ERROR_INVALID_PARAMETER
#define DLL_PROCESS_ATTACH
#define DLL_PROCESS_DETACH
#define HeapFree(x, y, z)
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
static LPDATABLOCK_HEADER NextItem(LPDBLIST lpList)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
static IN DWORD IN LPVOID lpvReserved
struct _PSP * HPROPSHEETPAGE
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
_In_opt_ PSID _In_opt_ BOOLEAN OwnerDefaulted
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
_In_ BOOLEAN _In_opt_ PACL _In_opt_ BOOLEAN DaclDefaulted
#define CreatePropertySheetPage
#define ListView_InsertItem(hwnd, pitem)
#define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)
#define ListView_InsertColumn(hwnd, iCol, pcol)
#define ListView_SetImageList(hwnd, himl, iImageList)
#define LVS_EX_FULLROWSELECT
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
struct tagNMLISTVIEW * LPNMLISTVIEW
#define ListView_SetItem(hwnd, pitem)
#define ListView_SetColumn(hwnd, iCol, pcol)
#define ListView_FindItem(hwnd, iStart, plvfi)
#define ConvertSidToStringSid
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL *pDacl, LPBOOL lpbDaclDefaulted)
BOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pOwner, LPBOOL lpbOwnerDefaulted)
PULONG MinorVersion OPTIONAL
struct _SIDREQRESULT * SidReqResult
struct _PRINCIPAL_LISTITEM * Next
SI_OBJECT_INFO ObjectInfo
PSIDREQRESULT SidRequestResult
#define FIELD_OFFSET(t, f)
#define CONTAINING_RECORD(address, type, field)
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
_In_ HFONT _Out_ PUINT Height
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define IS_INTRESOURCE(i)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
int WINAPI GetSystemMetrics(_In_ int)
HDWP WINAPI BeginDeferWindowPos(_In_ int)
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
#define ACCESS_DENIED_CALLBACK_ACE_TYPE
#define DACL_SECURITY_INFORMATION
#define ACCESS_ALLOWED_ACE_TYPE
#define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE
#define OWNER_SECURITY_INFORMATION
#define ACCESS_DENIED_ACE_TYPE
#define ACCESS_ALLOWED_OBJECT_ACE_TYPE
#define ACCESS_ALLOWED_CALLBACK_ACE_TYPE
#define SYSTEM_AUDIT_OBJECT_ACE_TYPE
#define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE