ReactOS 0.4.16-dev-340-g0540c21
aclui.c File Reference
#include "precomp.h"
#include <sddl.h>
#include <debug.h>
#include "resource.h"
Include dependency graph for aclui.c:

Go to the source code of this file.

Classes

struct  _SIDLOOKUPNOTIFYINFO
 

Macros

#define NDEBUG
 
#define SIDN_LOOKUPSUCCEEDED   (0x101)
 

Typedefs

typedef struct _SIDLOOKUPNOTIFYINFO SIDLOOKUPNOTIFYINFO
 
typedef struct _SIDLOOKUPNOTIFYINFOPSIDLOOKUPNOTIFYINFO
 

Functions

static PSID AceHeaderToSID (IN PACE_HEADER AceHeader)
 
static VOID DestroySecurityPage (IN PSECURITY_PAGE sp)
 
static VOID FreePrincipalsList (IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM *PrincipalsListHead)
 
static PACE_ENTRY AddAceToPrincipal (IN PPRINCIPAL_LISTITEM Principal, IN PACE_HEADER AceHeader)
 
static PPRINCIPAL_LISTITEM FindSidInPrincipalsListAddAce (IN PPRINCIPAL_LISTITEM PrincipalsListHead, IN PSID Sid, IN PACE_HEADER AceHeader)
 
static VOID SidLookupCompletion (IN HANDLE SidCacheMgr, IN PSID Sid, IN PSIDREQRESULT SidRequestResult, IN PVOID Context)
 
static PPRINCIPAL_LISTITEM AddPrincipalToList (IN PSECURITY_PAGE sp, IN PSID Sid, IN PACE_HEADER AceHeader, OUT BOOL *LookupDeferred OPTIONAL)
 
static LPWSTR GetDisplayStringFromSidRequestResult (IN PSIDREQRESULT SidReqResult)
 
static LPWSTR GetPrincipalDisplayString (IN PPRINCIPAL_LISTITEM PrincipalListItem)
 
static LPWSTR GetPrincipalAccountNameString (IN PPRINCIPAL_LISTITEM PrincipalListItem)
 
static VOID CreatePrincipalListItem (OUT LVITEM *li, IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN INT Index, IN BOOL Selected)
 
static INT AddPrincipalListEntry (IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN INT Index, IN BOOL Selected)
 
static int CALLBACK PrincipalCompare (IN LPARAM lParam1, IN LPARAM lParam2, IN LPARAM lParamSort)
 
static VOID UpdatePrincipalListItem (IN PSECURITY_PAGE sp, IN INT PrincipalIndex, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN PSIDREQRESULT SidReqResult)
 
static VOID ReloadPrincipalsList (IN PSECURITY_PAGE sp)
 
static VOID UpdateControlStates (IN PSECURITY_PAGE sp)
 
static void UpdatePrincipalInfo (IN PSECURITY_PAGE sp, IN PSIDLOOKUPNOTIFYINFO LookupInfo)
 
static UINT CALLBACK SecurityPageCallback (IN HWND hwnd, IN UINT uMsg, IN LPPROPSHEETPAGE ppsp)
 
static VOID SetAceCheckListColumns (IN HWND hAceCheckList, IN UINT Button, IN HWND hLabel)
 
static VOID LoadPermissionsList (IN PSECURITY_PAGE sp, IN GUID *GuidObjectType, IN DWORD dwFlags, OUT SI_ACCESS *DefaultAccess)
 
static VOID ResizeControls (IN PSECURITY_PAGE sp, IN INT Width, IN INT Height)
 
static PACE_HEADER BuildDefaultPrincipalAce (IN PSECURITY_PAGE sp, IN PSID pSid)
 
static BOOL AddSelectedPrincipal (IN IDsObjectPicker *pDsObjectPicker, IN HWND hwndParent OPTIONAL, IN PSID pSid, IN PVOID Context OPTIONAL)
 
static INT_PTR CALLBACK SecurityPageProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
HPROPSHEETPAGE WINAPI CreateSecurityPage (IN LPSECURITYINFO psi)
 
BOOL WINAPI EditSecurity (IN HWND hwndOwner, IN LPSECURITYINFO psi)
 
BOOL WINAPI DllMain (IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
 

Variables

HINSTANCE hDllInstance
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 33 of file aclui.c.

◆ SIDN_LOOKUPSUCCEEDED

#define SIDN_LOOKUPSUCCEEDED   (0x101)

Definition at line 40 of file aclui.c.

Typedef Documentation

◆ PSIDLOOKUPNOTIFYINFO

◆ SIDLOOKUPNOTIFYINFO

Function Documentation

◆ AceHeaderToSID()

static PSID AceHeaderToSID ( IN PACE_HEADER  AceHeader)
static

Definition at line 49 of file aclui.c.

50{
51 PSID Sid = NULL;
52 switch (AceHeader->AceType)
53 {
55 Sid = (PSID)&((PACCESS_ALLOWED_ACE)AceHeader)->SidStart;
56 break;
57#if 0
59 Sid = (PSID)&((PACCESS_ALLOWED_CALLBACK_ACE)AceHeader)->SidStart;
60 break;
62 Sid = (PSID)&((PACCESS_ALLOWED_CALLBACK_OBJECT_ACE)AceHeader)->SidStart;
63 break;
64#endif
66 Sid = (PSID)&((PACCESS_ALLOWED_OBJECT_ACE)AceHeader)->SidStart;
67 break;
69 Sid = (PSID)&((PACCESS_DENIED_ACE)AceHeader)->SidStart;
70 break;
71#if 0
73 Sid = (PSID)&((PACCESS_DENIED_CALLBACK_ACE)AceHeader)->SidStart;
74 break;
76 Sid = (PSID)&((PACCESS_DENIED_CALLBACK_OBJECT_ACE)AceHeader)->SidStart;
77 break;
78#endif
80 Sid = (PSID)&((PACCESS_DENIED_OBJECT_ACE)AceHeader)->SidStart;
81 break;
82 }
83
84 return Sid;
85}
#define NULL
Definition: types.h:112
struct _SID * PSID
Definition: eventlog.c:35
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1145
#define ACCESS_DENIED_CALLBACK_ACE_TYPE
Definition: setypes.h:733
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:717
#define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE
Definition: setypes.h:734
#define ACCESS_DENIED_ACE_TYPE
Definition: setypes.h:718
#define ACCESS_ALLOWED_OBJECT_ACE_TYPE
Definition: setypes.h:725
#define ACCESS_ALLOWED_CALLBACK_ACE_TYPE
Definition: setypes.h:732
#define SYSTEM_AUDIT_OBJECT_ACE_TYPE
Definition: setypes.h:727
#define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE
Definition: setypes.h:735

Referenced by ReloadPrincipalsList().

◆ AddAceToPrincipal()

static PACE_ENTRY AddAceToPrincipal ( IN PPRINCIPAL_LISTITEM  Principal,
IN PACE_HEADER  AceHeader 
)
static

Definition at line 147 of file aclui.c.

149{
150 PACE_ENTRY AceEntry, *AceLink;
151
152 AceEntry = HeapAlloc(GetProcessHeap(),
153 0,
154 sizeof(ACE_ENTRY) + AceHeader->AceSize);
155 if (AceEntry != NULL)
156 {
157 AceEntry->Next = NULL;
158
159 /* copy the ACE */
160 CopyMemory(AceEntry + 1,
161 AceHeader,
162 AceHeader->AceSize);
163
164 /* append it to the list */
165 AceLink = &Principal->ACEs;
166 while (*AceLink != NULL)
167 {
168 AceLink = &(*AceLink)->Next;
169 }
170 *AceLink = AceEntry;
171 }
172
173 return AceEntry;
174}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
Definition: precomp.h:30
struct _ACE_ENTRY * Next
Definition: precomp.h:31
#define CopyMemory
Definition: winbase.h:1735

Referenced by FindSidInPrincipalsListAddAce().

◆ AddPrincipalListEntry()

static INT AddPrincipalListEntry ( IN PSECURITY_PAGE  sp,
IN PPRINCIPAL_LISTITEM  PrincipalListItem,
IN INT  Index,
IN BOOL  Selected 
)
static

Definition at line 414 of file aclui.c.

418{
419 LVITEM li;
420 INT Ret;
421
422 if (PrincipalListItem->DisplayString != NULL)
423 {
424 LocalFree((HLOCAL)PrincipalListItem->DisplayString);
425 }
426 PrincipalListItem->DisplayString = GetPrincipalDisplayString(PrincipalListItem);
427
429 sp,
430 PrincipalListItem,
431 Index,
432 Selected);
433
434 Ret = ListView_InsertItem(sp->hWndPrincipalsList,
435 &li);
436
437 return Ret;
438}
static VOID CreatePrincipalListItem(OUT LVITEM *li, IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN INT Index, IN BOOL Selected)
Definition: aclui.c:379
static LPWSTR GetPrincipalDisplayString(IN PPRINCIPAL_LISTITEM PrincipalListItem)
Definition: aclui.c:340
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
static const WCHAR sp[]
Definition: suminfo.c:287
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2413
#define LVITEM
Definition: commctrl.h:2380
int32_t INT
Definition: typedefs.h:58
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by AddSelectedPrincipal(), ReloadPrincipalsList(), and UpdatePrincipalInfo().

◆ AddPrincipalToList()

static PPRINCIPAL_LISTITEM AddPrincipalToList ( IN PSECURITY_PAGE  sp,
IN PSID  Sid,
IN PACE_HEADER  AceHeader,
OUT BOOL *LookupDeferred  OPTIONAL 
)
static

Definition at line 234 of file aclui.c.

238{
239 PPRINCIPAL_LISTITEM PrincipalListItem = NULL, *PrincipalLink;
240 PACE_ENTRY AceEntry;
241 BOOL Deferred = FALSE;
242
243 if (!FindSidInPrincipalsListAddAce(sp->PrincipalsListHead,
244 Sid,
245 AceHeader))
246 {
247 DWORD SidLength;
248
249 PrincipalLink = &sp->PrincipalsListHead;
250 while (*PrincipalLink != NULL)
251 {
252 PrincipalLink = &(*PrincipalLink)->Next;
253 }
254
255 SidLength = GetLengthSid(Sid);
256
257 /* allocate the principal */
258 PrincipalListItem = HeapAlloc(GetProcessHeap(),
259 0,
260 sizeof(PRINCIPAL_LISTITEM) + SidLength);
261 if (PrincipalListItem != NULL)
262 {
263 PrincipalListItem->DisplayString = NULL;
264 PrincipalListItem->SidReqResult = NULL;
265
266 CopySid(SidLength,
267 (PSID)(PrincipalListItem + 1),
268 Sid);
269
270 /* allocate some memory for the ACE and copy it */
271 AceEntry = HeapAlloc(GetProcessHeap(),
272 0,
273 sizeof(ACE_ENTRY) + AceHeader->AceSize);
274 if (AceEntry != NULL)
275 {
276 AceEntry->Next = NULL;
277 CopyMemory(AceEntry + 1,
278 AceHeader,
279 AceHeader->AceSize);
280
281 /* add the ACE to the list */
282 PrincipalListItem->ACEs = AceEntry;
283
284 PrincipalListItem->Next = NULL;
285
286 /* append item to the principals list */
287 *PrincipalLink = PrincipalListItem;
288
289 /* lookup the SID now */
290 Deferred = !LookupSidCache(sp->SidCacheMgr,
291 Sid,
293 sp);
294 }
295 else
296 {
298 0,
299 PrincipalListItem);
300 PrincipalListItem = NULL;
301 }
302 }
303 }
304
305 if (PrincipalListItem != NULL && LookupDeferred != NULL)
306 {
307 *LookupDeferred = Deferred;
308 }
309
310 return PrincipalListItem;
311}
static PPRINCIPAL_LISTITEM FindSidInPrincipalsListAddAce(IN PPRINCIPAL_LISTITEM PrincipalsListHead, IN PSID Sid, IN PACE_HEADER AceHeader)
Definition: aclui.c:177
static VOID SidLookupCompletion(IN HANDLE SidCacheMgr, IN PSID Sid, IN PSIDREQRESULT SidRequestResult, IN PVOID Context)
Definition: aclui.c:205
#define FALSE
Definition: types.h:117
BOOL LookupSidCache(IN HANDLE SidCacheMgr, IN PSID pSid, IN PSIDREQCOMPLETIONPROC CompletionProc, IN PVOID Context)
Definition: sidcache.c:876
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
Definition: security.c:712
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:919
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _SIDREQRESULT * SidReqResult
Definition: precomp.h:37
struct _PRINCIPAL_LISTITEM * Next
Definition: precomp.h:36
LPWSTR DisplayString
Definition: precomp.h:39
PACE_ENTRY ACEs
Definition: precomp.h:38

Referenced by AddSelectedPrincipal(), and ReloadPrincipalsList().

◆ AddSelectedPrincipal()

static BOOL AddSelectedPrincipal ( IN IDsObjectPicker *  pDsObjectPicker,
IN HWND hwndParent  OPTIONAL,
IN PSID  pSid,
IN PVOID Context  OPTIONAL 
)
static

Definition at line 1195 of file aclui.c.

1199{
1200 PACE_HEADER AceHeader;
1202
1203 AceHeader = BuildDefaultPrincipalAce(sp,
1204 pSid);
1205 if (AceHeader != NULL)
1206 {
1207 PPRINCIPAL_LISTITEM PrincipalListItem;
1208 BOOL LookupDeferred;
1209
1210 PrincipalListItem = AddPrincipalToList(sp,
1211 pSid,
1212 AceHeader,
1213 &LookupDeferred);
1214
1215 if (PrincipalListItem != NULL && LookupDeferred)
1216 {
1218 PrincipalListItem,
1219 -1,
1220 FALSE);
1221 }
1222
1224 0,
1225 AceHeader);
1226 }
1227
1228 return TRUE;
1229}
static INT AddPrincipalListEntry(IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN INT Index, IN BOOL Selected)
Definition: aclui.c:414
static PPRINCIPAL_LISTITEM AddPrincipalToList(IN PSECURITY_PAGE sp, IN PSID Sid, IN PACE_HEADER AceHeader, OUT BOOL *LookupDeferred OPTIONAL)
Definition: aclui.c:234
static PACE_HEADER BuildDefaultPrincipalAce(IN PSECURITY_PAGE sp, IN PSID pSid)
Definition: aclui.c:1159
#define TRUE
Definition: types.h:120
struct _SECURITY_PAGE * PSECURITY_PAGE
static PSID pSid
Definition: security.c:74

Referenced by SecurityPageProc().

◆ BuildDefaultPrincipalAce()

static PACE_HEADER BuildDefaultPrincipalAce ( IN PSECURITY_PAGE  sp,
IN PSID  pSid 
)
static

Definition at line 1159 of file aclui.c.

1161{
1163 DWORD SidLen;
1164 WORD AceSize;
1165
1166 SidLen = GetLengthSid(pSid);
1168 SidStart) + (WORD)SidLen;
1170 0,
1171 AceSize);
1172 if (Ace != NULL)
1173 {
1174 Ace->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
1175 Ace->Header.AceFlags = 0; /* FIXME */
1176 Ace->Header.AceSize = AceSize;
1177 Ace->Mask = sp->DefaultAccess.mask;
1178
1179 if (CopySid(SidLen,
1180 (PSID)&Ace->SidStart,
1181 pSid))
1182 {
1183 return &Ace->Header;
1184 }
1185
1187 0,
1188 Ace);
1189 }
1190
1191 return NULL;
1192}
@ Ace
Definition: card.h:12
unsigned short WORD
Definition: ntddk_ex.h:93
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by AddSelectedPrincipal().

◆ CreatePrincipalListItem()

static VOID CreatePrincipalListItem ( OUT LVITEM li,
IN PSECURITY_PAGE  sp,
IN PPRINCIPAL_LISTITEM  PrincipalListItem,
IN INT  Index,
IN BOOL  Selected 
)
static

Definition at line 379 of file aclui.c.

384{
385 INT ImageIndex = 2;
386
387 if (PrincipalListItem->SidReqResult != NULL)
388 {
389 switch (PrincipalListItem->SidReqResult->SidNameUse)
390 {
391 case SidTypeUser:
392 ImageIndex = 0;
393 break;
395 case SidTypeGroup:
396 ImageIndex = 1;
397 break;
398 default:
399 break;
400 }
401 }
402
404 li->iItem = Index;
405 li->iSubItem = 0;
406 li->state = (Selected ? LVIS_SELECTED : 0);
407 li->stateMask = LVIS_SELECTED;
408 li->pszText = PrincipalListItem->DisplayString;
409 li->iImage = ImageIndex;
410 li->lParam = (LPARAM)PrincipalListItem;
411}
@ SidTypeGroup
Definition: lsa.idl:119
@ SidTypeUser
Definition: lsa.idl:118
@ SidTypeWellKnownGroup
Definition: lsa.idl:122
#define LVIF_STATE
Definition: commctrl.h:2317
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LVIF_PARAM
Definition: commctrl.h:2316
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVIF_IMAGE
Definition: commctrl.h:2315
LONG_PTR LPARAM
Definition: windef.h:208

Referenced by AddPrincipalListEntry(), and UpdatePrincipalListItem().

◆ CreateSecurityPage()

HPROPSHEETPAGE WINAPI CreateSecurityPage ( IN LPSECURITYINFO  psi)

Definition at line 1486 of file aclui.c.

1487{
1488 PROPSHEETPAGE psp = {0};
1489 PSECURITY_PAGE sPage;
1490 SI_OBJECT_INFO ObjectInfo = {0};
1491 HANDLE SidCacheMgr;
1492 LPCWSTR SystemName = NULL;
1493 HRESULT hRet;
1494
1495 if (psi == NULL)
1496 {
1498
1499 DPRINT("No ISecurityInformation class passed!\n");
1500 return NULL;
1501 }
1502
1503 /* get the object information from the server. Zero the structure before
1504 because some applications seem to return SUCCESS but only seem to set the
1505 fields they care about. */
1506 hRet = psi->lpVtbl->GetObjectInformation(psi,
1507 &ObjectInfo);
1508
1509 if (FAILED(hRet))
1510 {
1511 SetLastError(hRet);
1512
1513 DPRINT("CreateSecurityPage() failed! Failed to query the object information!\n");
1514 return NULL;
1515 }
1516
1517 if ((ObjectInfo.dwFlags & SI_SERVER_IS_DC) &&
1518 ObjectInfo.pszServerName != NULL &&
1519 ObjectInfo.pszServerName[0] != L'\0')
1520 {
1521 SystemName = ObjectInfo.pszServerName;
1522 }
1523
1524 SidCacheMgr = CreateSidCacheMgr(GetProcessHeap(),
1525 SystemName);
1526 if (SidCacheMgr == NULL)
1527 {
1528 DPRINT("Creating the SID cache failed!\n");
1529 return NULL;
1530 }
1531
1532 hRet = CoInitialize(NULL);
1533 if (FAILED(hRet))
1534 {
1535 DestroySidCacheMgr(SidCacheMgr);
1536 DPRINT("CoInitialize failed!\n");
1537 return NULL;
1538 }
1539
1540 sPage = HeapAlloc(GetProcessHeap(),
1542 sizeof(SECURITY_PAGE));
1543 if (sPage == NULL)
1544 {
1545 DestroySidCacheMgr(SidCacheMgr);
1547
1549
1550 DPRINT("Not enough memory to allocate a SECURITY_PAGE!\n");
1551 return NULL;
1552 }
1553
1554 ZeroMemory(sPage,
1555 sizeof(*sPage));
1556
1557 sPage->psi = psi;
1558 sPage->ObjectInfo = ObjectInfo;
1559 sPage->ServerName = SystemName;
1560 sPage->SidCacheMgr = SidCacheMgr;
1561
1562 psp.dwSize = sizeof(PROPSHEETPAGE);
1563 psp.dwFlags = PSP_USECALLBACK;
1564 psp.hInstance = hDllInstance;
1565 psp.pszTemplate = MAKEINTRESOURCE(IDD_SECPAGE);
1566 psp.pfnDlgProc = SecurityPageProc;
1567 psp.lParam = (LPARAM)sPage;
1568 psp.pfnCallback = SecurityPageCallback;
1569
1570 if (ObjectInfo.dwFlags & SI_PAGE_TITLE)
1571 {
1572 psp.pszTitle = ObjectInfo.pszPageTitle;
1573
1574 if (psp.pszTitle != NULL)
1575 {
1576 psp.dwFlags |= PSP_USETITLE;
1577 }
1578 }
1579 else
1580 {
1581 psp.pszTitle = NULL;
1582 }
1583
1584 /* NOTE: the SECURITY_PAGE structure will be freed by the property page
1585 callback! */
1586
1587 return CreatePropertySheetPage(&psp);
1588}
#define SI_PAGE_TITLE
Definition: accctrl.h:125
#define SI_SERVER_IS_DC
Definition: accctrl.h:126
static UINT CALLBACK SecurityPageCallback(IN HWND hwnd, IN UINT uMsg, IN LPPROPSHEETPAGE ppsp)
Definition: aclui.c:746
static INT_PTR CALLBACK SecurityPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: aclui.c:1232
HINSTANCE hDllInstance
Definition: aclui.c:38
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
VOID DestroySidCacheMgr(IN HANDLE SidCacheMgr)
Definition: sidcache.c:676
HANDLE CreateSidCacheMgr(IN HANDLE Heap, IN LPCWSTR SystemName)
Definition: sidcache.c:596
#define IDD_SECPAGE
Definition: resource.h:3
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define FAILED(hr)
Definition: intsafe.h:51
#define L(x)
Definition: ntvdm.h:50
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSP_USETITLE
Definition: prsht.h:26
#define PSP_USECALLBACK
Definition: prsht.h:30
#define PROPSHEETPAGE
Definition: prsht.h:389
#define DPRINT
Definition: sndvol32.h:73
SI_OBJECT_INFO ObjectInfo
Definition: precomp.h:65
HANDLE SidCacheMgr
Definition: precomp.h:70
LPCWSTR ServerName
Definition: precomp.h:74
LPSECURITYINFO psi
Definition: precomp.h:64
LPWSTR pszPageTitle
Definition: accctrl.h:392
DWORD dwFlags
Definition: accctrl.h:388
LPWSTR pszServerName
Definition: accctrl.h:390
#define ZeroMemory
Definition: winbase.h:1737
#define MAKEINTRESOURCE
Definition: winuser.h:591
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by EditSecurity().

◆ DestroySecurityPage()

static VOID DestroySecurityPage ( IN PSECURITY_PAGE  sp)
static

Definition at line 88 of file aclui.c.

89{
90 DestroySidCacheMgr(sp->SidCacheMgr);
91
92 if (sp->OwnerSid != NULL)
93 LocalFree((HLOCAL)sp->OwnerSid);
94
96 0,
97 sp);
98
100}

Referenced by SecurityPageCallback().

◆ DllMain()

BOOL WINAPI DllMain ( IN HINSTANCE  hinstDLL,
IN DWORD  dwReason,
IN LPVOID  lpvReserved 
)

@DllMain

Core routine of the Utility Manager's library.

Parameters
[in]hDllInstanceThe entry point instance of the library.
[in]fdwReasonThe reason argument to indicate the motive DllMain is being called.
[in]lpvReservedReserved.
Returns
Returns TRUE when main call initialization has succeeded, FALSE otherwise.

Definition at line 1674 of file aclui.c.

1677{
1678 switch (dwReason)
1679 {
1680 case DLL_PROCESS_ATTACH:
1681 hDllInstance = hinstDLL;
1682
1683 DisableThreadLibraryCalls(hinstDLL);
1684
1685 if (!RegisterCheckListControl(hinstDLL))
1686 {
1687 DPRINT("Registering the CHECKLIST_ACLUI class failed!\n");
1688 return FALSE;
1689 }
1690 break;
1691
1692 case DLL_PROCESS_DETACH:
1694 break;
1695 }
1696
1697 return TRUE;
1698}
DWORD dwReason
Definition: misc.cpp:141
BOOL RegisterCheckListControl(IN HINSTANCE hInstance)
Definition: checklist.c:2594
VOID UnregisterCheckListControl(HINSTANCE hInstance)
Definition: checklist.c:2614
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85

◆ EditSecurity()

BOOL WINAPI EditSecurity ( IN HWND  hwndOwner,
IN LPSECURITYINFO  psi 
)

Definition at line 1598 of file aclui.c.

1600{
1601 HRESULT hRet;
1602 SI_OBJECT_INFO ObjectInfo = {0};
1603 PROPSHEETHEADER psh;
1604 HPROPSHEETPAGE hPages[1];
1605 LPWSTR lpCaption = NULL;
1606 BOOL Ret;
1607
1608 if (psi == NULL)
1609 {
1611
1612 DPRINT("No ISecurityInformation class passed!\n");
1613 return FALSE;
1614 }
1615
1616 /* get the object information from the server. Zero the structure before
1617 because some applications seem to return SUCCESS but only seem to set the
1618 fields they care about. */
1619 hRet = psi->lpVtbl->GetObjectInformation(psi,
1620 &ObjectInfo);
1621
1622 if (FAILED(hRet))
1623 {
1624 SetLastError(hRet);
1625
1626 DPRINT("GetObjectInformation() failed!\n");
1627 return FALSE;
1628 }
1629
1630 /* create the page */
1631 hPages[0] = CreateSecurityPage(psi);
1632 if (hPages[0] == NULL)
1633 {
1634 DPRINT("CreateSecurityPage(), couldn't create property sheet!\n");
1635 return FALSE;
1636 }
1637
1638 psh.dwSize = sizeof(PROPSHEETHEADER);
1639 psh.dwFlags = PSH_DEFAULT;
1640 psh.hwndParent = hwndOwner;
1641 psh.hInstance = hDllInstance;
1642
1643 /* Set the page title to the object name, make sure the format string
1644 has "%1" NOT "%s" because it uses FormatMessage() to automatically
1645 allocate the right amount of memory. */
1648 &lpCaption,
1649 ObjectInfo.pszObjectName))
1650 {
1651 psh.pszCaption = lpCaption;
1652 }
1653 else
1654 {
1655 psh.pszCaption = ObjectInfo.pszObjectName;
1656 }
1657
1658 psh.nPages = sizeof(hPages) / sizeof(HPROPSHEETPAGE);
1659 psh.nStartPage = 0;
1660 psh.phpage = hPages;
1661
1662 Ret = (PropertySheet(&psh) != -1);
1663
1664 if (lpCaption != NULL)
1665 {
1666 LocalFree((HLOCAL)lpCaption);
1667 }
1668
1669 return Ret;
1670}
HPROPSHEETPAGE WINAPI CreateSecurityPage(IN LPSECURITYINFO psi)
Definition: aclui.c:1486
DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, OUT LPTSTR *lpTarget,...)
Definition: misc.c:85
#define IDS_PSP_TITLE
Definition: resource.h:16
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PropertySheet
Definition: prsht.h:400
#define PSH_DEFAULT
Definition: prsht.h:39
LPWSTR pszObjectName
Definition: accctrl.h:391
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ FindSidInPrincipalsListAddAce()

static PPRINCIPAL_LISTITEM FindSidInPrincipalsListAddAce ( IN PPRINCIPAL_LISTITEM  PrincipalsListHead,
IN PSID  Sid,
IN PACE_HEADER  AceHeader 
)
static

Definition at line 177 of file aclui.c.

180{
181 PPRINCIPAL_LISTITEM CurItem;
182
183 for (CurItem = PrincipalsListHead;
184 CurItem != NULL;
185 CurItem = CurItem->Next)
186 {
187 if (EqualSid((PSID)(CurItem + 1),
188 Sid))
189 {
190 if (AddAceToPrincipal(CurItem,
191 AceHeader) != NULL)
192 {
193 return CurItem;
194 }
195
196 /* unable to add the ACE to the principal */
197 break;
198 }
199 }
200
201 return NULL;
202}
static PACE_ENTRY AddAceToPrincipal(IN PPRINCIPAL_LISTITEM Principal, IN PACE_HEADER AceHeader)
Definition: aclui.c:147
BOOL WINAPI EqualSid(PSID pSid1, PSID pSid2)
Definition: security.c:829

Referenced by AddPrincipalToList().

◆ FreePrincipalsList()

static VOID FreePrincipalsList ( IN PSECURITY_PAGE  sp,
IN PPRINCIPAL_LISTITEM PrincipalsListHead 
)
static

Definition at line 103 of file aclui.c.

105{
107 PACE_ENTRY AceEntry, NextAceEntry;
108
109 CurItem = *PrincipalsListHead;
110 while (CurItem != NULL)
111 {
112 /* Free all ACEs */
113 AceEntry = CurItem->ACEs;
114 while (AceEntry != NULL)
115 {
116 NextAceEntry = AceEntry->Next;
118 0,
119 AceEntry);
120 AceEntry = NextAceEntry;
121 }
122
123 /* free the SID string if present */
124 if (CurItem->SidReqResult != NULL)
125 {
126 DereferenceSidReqResult(sp->SidCacheMgr,
127 CurItem->SidReqResult);
128 }
129
130 if (CurItem->DisplayString != NULL)
131 {
132 LocalFree((HLOCAL)CurItem->DisplayString);
133 }
134
135 /* free the ACE list item */
136 NextItem = CurItem->Next;
138 0,
139 CurItem);
140 CurItem = NextItem;
141 }
142
143 *PrincipalsListHead = NULL;
144}
VOID DereferenceSidReqResult(IN HANDLE SidCacheMgr, IN PSIDREQRESULT ReqResult)
Definition: sidcache.c:855
static LPDATABLOCK_HEADER NextItem(LPDBLIST lpList)
Definition: clist.c:42

Referenced by ReloadPrincipalsList().

◆ GetDisplayStringFromSidRequestResult()

static LPWSTR GetDisplayStringFromSidRequestResult ( IN PSIDREQRESULT  SidReqResult)
static

Definition at line 314 of file aclui.c.

315{
316 LPWSTR lpDisplayString = NULL;
317
318 if (SidReqResult->SidNameUse == SidTypeUser ||
319 SidReqResult->SidNameUse == SidTypeGroup)
320 {
323 &lpDisplayString,
324 SidReqResult->AccountName,
325 SidReqResult->DomainName,
326 SidReqResult->AccountName);
327 }
328 else
329 {
332 &lpDisplayString,
333 SidReqResult->AccountName);
334 }
335
336 return lpDisplayString;
337}
#define IDS_USERFORMAT
Definition: resource.h:22
#define IDS_USERDOMAINFORMAT
Definition: resource.h:21

Referenced by GetPrincipalDisplayString(), and UpdatePrincipalInfo().

◆ GetPrincipalAccountNameString()

static LPWSTR GetPrincipalAccountNameString ( IN PPRINCIPAL_LISTITEM  PrincipalListItem)
static

Definition at line 358 of file aclui.c.

359{
360 LPWSTR lpDisplayString = NULL;
361
362 if (PrincipalListItem->SidReqResult != NULL)
363 {
366 &lpDisplayString,
367 PrincipalListItem->SidReqResult->AccountName);
368 }
369 else
370 {
371 ConvertSidToStringSid((PSID)(PrincipalListItem + 1),
372 &lpDisplayString);
373 }
374
375 return lpDisplayString;
376}
#define ConvertSidToStringSid
Definition: sddl.h:160

Referenced by UpdateControlStates().

◆ GetPrincipalDisplayString()

static LPWSTR GetPrincipalDisplayString ( IN PPRINCIPAL_LISTITEM  PrincipalListItem)
static

Definition at line 340 of file aclui.c.

341{
342 LPWSTR lpDisplayString = NULL;
343
344 if (PrincipalListItem->SidReqResult != NULL)
345 {
346 lpDisplayString = GetDisplayStringFromSidRequestResult(PrincipalListItem->SidReqResult);
347 }
348 else
349 {
350 ConvertSidToStringSidW((PSID)(PrincipalListItem + 1),
351 &lpDisplayString);
352 }
353
354 return lpDisplayString;
355}
static LPWSTR GetDisplayStringFromSidRequestResult(IN PSIDREQRESULT SidReqResult)
Definition: aclui.c:314
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3583

Referenced by AddPrincipalListEntry(), and UpdatePrincipalListItem().

◆ LoadPermissionsList()

static VOID LoadPermissionsList ( IN PSECURITY_PAGE  sp,
IN GUID GuidObjectType,
IN DWORD  dwFlags,
OUT SI_ACCESS DefaultAccess 
)
static

Definition at line 792 of file aclui.c.

796{
797 HRESULT hRet;
798 PSI_ACCESS AccessList;
799 ULONG nAccessList, DefaultAccessIndex;
800 WCHAR szSpecialPermissions[255];
801 BOOLEAN SpecialPermissionsPresent = FALSE;
802 ACCESS_MASK SpecialPermissionsMask = 0;
803
804 /* clear the permissions list */
805
806 SendMessage(sp->hAceCheckList,
807 CLM_CLEAR,
808 0,
809 0);
810
811 /* query the access rights from the server */
812 hRet = sp->psi->lpVtbl->GetAccessRights(sp->psi,
813 GuidObjectType,
814 dwFlags, /* FIXME */
815 &AccessList,
816 &nAccessList,
817 &DefaultAccessIndex);
818 if (SUCCEEDED(hRet) && nAccessList != 0)
819 {
820 LPCWSTR NameStr;
821 PSI_ACCESS CurAccess, LastAccess;
822 WCHAR NameBuffer[MAX_PATH];
823
824 /* save the default access rights to be used when adding ACEs later */
825 if (DefaultAccess != NULL)
826 {
827 *DefaultAccess = AccessList[DefaultAccessIndex];
828 }
829
830 LastAccess = AccessList + nAccessList;
831 for (CurAccess = &AccessList[0];
832 CurAccess != LastAccess;
833 CurAccess++)
834 {
835 if (CurAccess->dwFlags & dwFlags)
836 {
837 /* get the permission name, load it from a string table if necessary */
838 if (IS_INTRESOURCE(CurAccess->pszName))
839 {
840 if (!LoadString(sp->ObjectInfo.hInstance,
841 (UINT)((ULONG_PTR)CurAccess->pszName),
842 NameBuffer,
843 sizeof(NameBuffer) / sizeof(NameBuffer[0])))
844 {
847 NameBuffer,
848 sizeof(NameBuffer) / sizeof(NameBuffer[0]));
849 }
850 NameStr = NameBuffer;
851 }
852 else
853 {
854 NameStr = CurAccess->pszName;
855 }
856
857 SendMessage(sp->hAceCheckList,
859 (WPARAM)CurAccess->mask,
860 (LPARAM)NameStr);
861 }
862 else if (CurAccess->dwFlags & SI_ACCESS_SPECIFIC)
863 {
864 SpecialPermissionsPresent = TRUE;
865 SpecialPermissionsMask |= CurAccess->mask;
866 }
867 }
868 }
869
870 /* add the special permissions check item in case the specific access rights
871 aren't displayed */
872 if (SpecialPermissionsPresent &&
875 szSpecialPermissions,
876 sizeof(szSpecialPermissions) / sizeof(szSpecialPermissions[0])))
877 {
878 /* add the special permissions check item */
879 sp->SpecialPermCheckIndex = (INT)SendMessage(sp->hAceCheckList,
881 (WPARAM)SpecialPermissionsMask,
882 (LPARAM)szSpecialPermissions);
883 if (sp->SpecialPermCheckIndex != -1)
884 {
885 SendMessage(sp->hAceCheckList,
887 (WPARAM)sp->SpecialPermCheckIndex,
889 }
890 }
891}
unsigned char BOOLEAN
#define SI_ACCESS_SPECIFIC
Definition: accctrl.h:138
#define IDS_UNKNOWN
Definition: resource.h:7
#define CIS_NONE
Definition: precomp.h:119
#define CIS_ALLOWDISABLED
Definition: precomp.h:115
#define CLM_ADDITEM
Definition: precomp.h:127
#define CLM_SETITEMSTATE
Definition: precomp.h:134
#define CLM_CLEAR
Definition: precomp.h:130
#define CIS_DENYDISABLED
Definition: precomp.h:113
#define IDS_SPECIAL_PERMISSIONS
Definition: resource.h:18
#define MAX_PATH
Definition: compat.h:34
#define SUCCEEDED(hr)
Definition: intsafe.h:50
unsigned int UINT
Definition: ndis.h:50
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define INT
Definition: polytest.cpp:20
ACCESS_MASK mask
Definition: accctrl.h:399
DWORD dwFlags
Definition: accctrl.h:401
LPCWSTR pszName
Definition: accctrl.h:400
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
UINT_PTR WPARAM
Definition: windef.h:207
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define SendMessage
Definition: winuser.h:5855
#define LoadString
Definition: winuser.h:5831
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by SecurityPageProc().

◆ PrincipalCompare()

static int CALLBACK PrincipalCompare ( IN LPARAM  lParam1,
IN LPARAM  lParam2,
IN LPARAM  lParamSort 
)
static

Definition at line 441 of file aclui.c.

444{
447
448 if (Item1->DisplayString != NULL && Item2->DisplayString != NULL)
449 {
450 return wcscmp(Item1->DisplayString,
451 Item2->DisplayString);
452 }
453
454 return 0;
455}
struct _PRINCIPAL_LISTITEM * PPRINCIPAL_LISTITEM
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by UpdatePrincipalListItem().

◆ ReloadPrincipalsList()

static VOID ReloadPrincipalsList ( IN PSECURITY_PAGE  sp)
static

Definition at line 503 of file aclui.c.

504{
507 PACL Dacl = NULL;
508 PSID OwnerSid = NULL;
509 LPTSTR OwnerSidString;
510 DWORD SidLen;
511 HRESULT hRet;
512
513 /* delete the cached ACL */
515 &sp->PrincipalsListHead);
516
517 /* query the ACL */
518 hRet = sp->psi->lpVtbl->GetSecurity(sp->psi,
521 FALSE);
522 if (SUCCEEDED(hRet) && SecurityDescriptor != NULL)
523 {
525 &OwnerSid,
527 {
528 sp->OwnerDefaulted = OwnerDefaulted;
529 if (sp->OwnerSid != NULL)
530 {
531 LocalFree((HLOCAL)sp->OwnerSid);
532 sp->OwnerSid = NULL;
533 }
534
535 SidLen = GetLengthSid(OwnerSid);
536 if (SidLen == 0)
537 goto ClearOwner;
538
539 sp->OwnerSid = (PSID)LocalAlloc(LMEM_FIXED,
540 SidLen);
541 if (sp->OwnerSid != NULL)
542 {
543 if (CopySid(SidLen,
544 sp->OwnerSid,
545 OwnerSid))
546 {
547 /* Lookup the SID now */
548 if (!LookupSidCache(sp->SidCacheMgr,
549 sp->OwnerSid,
551 sp))
552 {
553 /* Lookup was deferred */
554 if (ConvertSidToStringSid(sp->OwnerSid,
555 &OwnerSidString))
556 {
557 SetDlgItemText(sp->hWnd,
558 IDC_OWNER,
559 OwnerSidString);
560 LocalFree((HLOCAL)OwnerSidString);
561 }
562 else
563 goto ClearOwner;
564 }
565 }
566 else
567 goto ClearOwner;
568 }
569 else
570 goto ClearOwner;
571 }
572 else
573 {
574ClearOwner:
575 SetDlgItemText(sp->hWnd,
576 IDC_OWNER,
577 NULL);
578 }
579
582 &Dacl,
583 &DaclDefaulted) &&
584 DaclPresent && Dacl != NULL)
585 {
586 PSID Sid;
587 PACE_HEADER AceHeader;
589
590 for (AceIndex = 0;
591 AceIndex < Dacl->AceCount;
592 AceIndex++)
593 {
594 if (GetAce(Dacl,
595 AceIndex,
596 (LPVOID*)&AceHeader) &&
597 AceHeader != NULL)
598 {
599 BOOL LookupDeferred;
600 PPRINCIPAL_LISTITEM PrincipalListItem;
601
602 Sid = AceHeaderToSID(AceHeader);
603
604 PrincipalListItem = AddPrincipalToList(sp,
605 Sid,
606 AceHeader,
607 &LookupDeferred);
608
609 if (PrincipalListItem != NULL && LookupDeferred)
610 {
612 PrincipalListItem,
613 -1,
614 FALSE);
615 }
616 }
617 }
618 }
620 }
621}
static VOID FreePrincipalsList(IN PSECURITY_PAGE sp, IN PPRINCIPAL_LISTITEM *PrincipalsListHead)
Definition: aclui.c:103
static PSID AceHeaderToSID(IN PACE_HEADER AceHeader)
Definition: aclui.c:49
#define IDC_OWNER
Definition: resource.h:14
BOOL WINAPI GetAce(PACL pAcl, DWORD dwAceIndex, LPVOID *pAce)
Definition: security.c:1186
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1605
_In_ BOOLEAN DaclPresent
Definition: rtlfuncs.h:1647
_In_opt_ PSID _In_opt_ BOOLEAN OwnerDefaulted
Definition: rtlfuncs.h:1684
_In_ BOOLEAN _In_opt_ PACL _In_opt_ BOOLEAN DaclDefaulted
Definition: rtlfuncs.h:1650
BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL *pDacl, LPBOOL lpbDaclDefaulted)
Definition: sec.c:45
BOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pOwner, LPBOOL lpbOwnerDefaulted)
Definition: sec.c:103
#define LMEM_FIXED
Definition: winbase.h:394
#define SetDlgItemText
Definition: winuser.h:5861
_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
Definition: wsk.h:191
_In_ ULONG AceIndex
Definition: rtlfuncs.h:1879
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define OWNER_SECURITY_INFORMATION
Definition: setypes.h:123
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by SecurityPageProc().

◆ ResizeControls()

static VOID ResizeControls ( IN PSECURITY_PAGE  sp,
IN INT  Width,
IN INT  Height 
)
static

Definition at line 894 of file aclui.c.

897{
898 HWND hWndAllow, hWndDeny, hWndOwnerEdit;
899 RECT rcControl, rcControl2, rcControl3, rcWnd;
900 INT cxWidth, cxEdge, btnSpacing;
901 POINT pt, pt2;
902 HDWP dwp;
903 INT nControls = 8;
904 LVCOLUMN lvc;
905
906 hWndAllow = GetDlgItem(sp->hWnd,
908 hWndDeny = GetDlgItem(sp->hWnd,
910
911 GetWindowRect(sp->hWnd,
912 &rcWnd);
913
914 cxEdge = GetSystemMetrics(SM_CXEDGE);
915
916 /* use the left margin of the principal list view control for all control
917 margins */
918 pt.x = 0;
919 pt.y = 0;
920 MapWindowPoints(sp->hWndPrincipalsList,
921 sp->hWnd,
922 &pt,
923 1);
924 cxWidth = Width - (2 * pt.x);
925
926 if (sp->ObjectInfo.dwFlags & SI_ADVANCED)
927 {
928 nControls += 2;
929 }
930
931 if ((dwp = BeginDeferWindowPos(nControls)))
932 {
933 /* resize the owner edit field */
934 hWndOwnerEdit = GetDlgItem(sp->hWnd,
935 IDC_OWNER);
936 GetWindowRect(hWndOwnerEdit,
937 &rcControl);
938 pt2.x = 0;
939 pt2.y = 0;
940 MapWindowPoints(hWndOwnerEdit,
941 sp->hWnd,
942 &pt2,
943 1);
944 if (!(dwp = DeferWindowPos(dwp,
945 hWndOwnerEdit,
946 NULL,
947 0,
948 0,
949 Width - pt.x - pt2.x,
950 rcControl.bottom - rcControl.top,
952 {
953 goto EndDeferWnds;
954 }
955
956 /* resize the Principal list view */
957 GetWindowRect(sp->hWndPrincipalsList,
958 &rcControl);
959 if (!(dwp = DeferWindowPos(dwp,
960 sp->hWndPrincipalsList,
961 NULL,
962 0,
963 0,
964 cxWidth,
965 rcControl.bottom - rcControl.top,
967 {
968 goto EndDeferWnds;
969 }
970
971 /* move the Add Principal button */
972 GetWindowRect(sp->hBtnAdd,
973 &rcControl);
974 GetWindowRect(sp->hBtnRemove,
975 &rcControl2);
976 btnSpacing = rcControl2.left - rcControl.right;
977 pt2.x = 0;
978 pt2.y = 0;
979 MapWindowPoints(sp->hBtnAdd,
980 sp->hWnd,
981 &pt2,
982 1);
983 if (!(dwp = DeferWindowPos(dwp,
984 sp->hBtnAdd,
985 NULL,
986 pt.x + cxWidth - (rcControl2.right - rcControl2.left) -
987 (rcControl.right - rcControl.left) -
988 btnSpacing - cxEdge,
989 pt2.y,
990 0,
991 0,
993 {
994 goto EndDeferWnds;
995 }
996
997 /* move the Delete Principal button */
998 pt2.x = 0;
999 pt2.y = 0;
1000 MapWindowPoints(sp->hBtnRemove,
1001 sp->hWnd,
1002 &pt2,
1003 1);
1004 if (!(dwp = DeferWindowPos(dwp,
1005 sp->hBtnRemove,
1006 NULL,
1007 pt.x + cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
1008 pt2.y,
1009 0,
1010 0,
1012 {
1013 goto EndDeferWnds;
1014 }
1015
1016 /* move the Permissions For label */
1017 GetWindowRect(hWndAllow,
1018 &rcControl);
1019 GetWindowRect(hWndDeny,
1020 &rcControl2);
1021 GetWindowRect(sp->hPermissionsForLabel,
1022 &rcControl3);
1023 pt2.x = 0;
1024 pt2.y = 0;
1025 MapWindowPoints(sp->hPermissionsForLabel,
1026 sp->hWnd,
1027 &pt2,
1028 1);
1029 if (!(dwp = DeferWindowPos(dwp,
1030 sp->hPermissionsForLabel,
1031 NULL,
1032 0,
1033 0,
1034 cxWidth - (rcControl2.right - rcControl2.left) -
1035 (rcControl.right - rcControl.left) -
1036 (2 * btnSpacing) - cxEdge,
1037 rcControl3.bottom - rcControl3.top,
1039 {
1040 goto EndDeferWnds;
1041 }
1042
1043 /* move the Allow label */
1044 pt2.x = 0;
1045 pt2.y = 0;
1046 MapWindowPoints(hWndAllow,
1047 sp->hWnd,
1048 &pt2,
1049 1);
1050 if (!(dwp = DeferWindowPos(dwp,
1051 hWndAllow,
1052 NULL,
1053 cxWidth - (rcControl2.right - rcControl2.left) -
1054 (rcControl.right - rcControl.left) -
1055 btnSpacing - cxEdge,
1056 pt2.y,
1057 0,
1058 0,
1060 {
1061 goto EndDeferWnds;
1062 }
1063
1064 /* move the Deny label */
1065 pt2.x = 0;
1066 pt2.y = 0;
1067 MapWindowPoints(hWndDeny,
1068 sp->hWnd,
1069 &pt2,
1070 1);
1071 if (!(dwp = DeferWindowPos(dwp,
1072 hWndDeny,
1073 NULL,
1074 cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
1075 pt2.y,
1076 0,
1077 0,
1079 {
1080 goto EndDeferWnds;
1081 }
1082
1083 /* resize the Permissions check list box */
1084 GetWindowRect(sp->hAceCheckList,
1085 &rcControl);
1086 GetWindowRect(sp->hBtnAdvanced,
1087 &rcControl2);
1090 &rcControl3);
1091 if (!(dwp = DeferWindowPos(dwp,
1092 sp->hAceCheckList,
1093 NULL,
1094 0,
1095 0,
1096 cxWidth,
1097 ((sp->ObjectInfo.dwFlags & SI_ADVANCED) ?
1098 Height - (rcControl.top - rcWnd.top) -
1099 (rcControl3.bottom - rcControl3.top) - pt.x - btnSpacing :
1100 Height - (rcControl.top - rcWnd.top) - pt.x),
1102 {
1103 goto EndDeferWnds;
1104 }
1105
1106 if (sp->ObjectInfo.dwFlags & SI_ADVANCED)
1107 {
1108 /* move and resize the Advanced label */
1109 if (!(dwp = DeferWindowPos(dwp,
1110 GetDlgItem(sp->hWnd,
1112 NULL,
1113 pt.x,
1114 Height - (rcControl3.bottom - rcControl3.top) - pt.x,
1115 cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
1116 rcControl3.bottom - rcControl3.top,
1117 SWP_NOZORDER)))
1118 {
1119 goto EndDeferWnds;
1120 }
1121
1122 /* move and resize the Advanced button */
1123 if (!(dwp = DeferWindowPos(dwp,
1124 sp->hBtnAdvanced,
1125 NULL,
1126 cxWidth - (rcControl2.right - rcControl2.left) + pt.x,
1127 Height - (rcControl2.bottom - rcControl2.top) - pt.x,
1128 0,
1129 0,
1131 {
1132 goto EndDeferWnds;
1133 }
1134 }
1135
1136 EndDeferWindowPos(dwp);
1137 }
1138
1139EndDeferWnds:
1140 /* update the width of the principal list view column */
1141 GetClientRect(sp->hWndPrincipalsList,
1142 &rcControl);
1143 lvc.mask = LVCF_WIDTH;
1144 lvc.cx = rcControl.right;
1145 (void)ListView_SetColumn(sp->hWndPrincipalsList,
1146 0,
1147 &lvc);
1148
1149 /* calculate the columns of the allow/deny checkboxes */
1150 SetAceCheckListColumns(sp->hAceCheckList,
1151 CLB_ALLOW,
1152 hWndAllow);
1153 SetAceCheckListColumns(sp->hAceCheckList,
1154 CLB_DENY,
1155 hWndDeny);
1156}
#define SI_ADVANCED
Definition: accctrl.h:118
static VOID SetAceCheckListColumns(IN HWND hAceCheckList, IN UINT Button, IN HWND hLabel)
Definition: aclui.c:769
#define CLB_DENY
Definition: precomp.h:123
#define CLB_ALLOW
Definition: precomp.h:122
#define IDC_LABEL_ADVANCED
Definition: resource.h:12
#define IDC_LABEL_DENY
Definition: resource.h:10
#define IDC_LABEL_ALLOW
Definition: resource.h:9
#define pt(x, y)
Definition: drawing.c:79
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define ListView_SetColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2634
#define LVCOLUMN
Definition: commctrl.h:2586
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
#define SM_CXEDGE
Definition: winuser.h:1011
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SWP_NOMOVE
Definition: winuser.h:1247
#define SWP_NOSIZE
Definition: winuser.h:1248
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)
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOZORDER
Definition: winuser.h:1250
int WINAPI GetSystemMetrics(_In_ int)
HDWP WINAPI BeginDeferWindowPos(_In_ int)

Referenced by SecurityPageProc().

◆ SecurityPageCallback()

static UINT CALLBACK SecurityPageCallback ( IN HWND  hwnd,
IN UINT  uMsg,
IN LPPROPSHEETPAGE  ppsp 
)
static

Definition at line 746 of file aclui.c.

749{
750 PSECURITY_PAGE sp = (PSECURITY_PAGE)ppsp->lParam;
751
752 switch (uMsg)
753 {
754 case PSPCB_CREATE:
755 {
756 return TRUE;
757 }
758 case PSPCB_RELEASE:
759 {
761 return FALSE;
762 }
763 }
764
765 return FALSE;
766}
static VOID DestroySecurityPage(IN PSECURITY_PAGE sp)
Definition: aclui.c:88
switch(r->id)
Definition: btrfs.c:3046
#define PSPCB_CREATE
Definition: prsht.h:38
#define PSPCB_RELEASE
Definition: prsht.h:37

Referenced by CreateSecurityPage().

◆ SecurityPageProc()

static INT_PTR CALLBACK SecurityPageProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1232 of file aclui.c.

1236{
1238 INT_PTR Ret = FALSE;
1239
1241 if (sp != NULL || uMsg == WM_INITDIALOG)
1242 {
1243 switch (uMsg)
1244 {
1245 case WM_NOTIFY:
1246 {
1247 NMHDR *pnmh = (NMHDR*)lParam;
1248
1249 if (pnmh->hwndFrom == sp->hWndPrincipalsList)
1250 {
1251 switch (pnmh->code)
1252 {
1253 case LVN_ITEMCHANGED:
1254 {
1256
1257 if ((pnmv->uChanged & LVIF_STATE) &&
1258 ((pnmv->uOldState & (LVIS_FOCUSED | LVIS_SELECTED)) ||
1259 (pnmv->uNewState & (LVIS_FOCUSED | LVIS_SELECTED))))
1260 {
1262 }
1263 break;
1264 }
1265 }
1266 }
1267 else if (pnmh->hwndFrom == sp->hAceCheckList)
1268 {
1269 switch (pnmh->code)
1270 {
1272 {
1274
1275 /* make sure only one of both checkboxes is only checked
1276 at the same time */
1277 if (pcicb->Checked)
1278 {
1279 pcicb->NewState &= ~((pcicb->CheckBox != CLB_DENY) ? CIS_DENY : CIS_ALLOW);
1280 }
1281 break;
1282 }
1283 }
1284 }
1285 else if (pnmh->hwndFrom == sp->hWnd)
1286 {
1287 switch(pnmh->code)
1288 {
1290 {
1293 nmh);
1294
1295 /* a SID lookup succeeded, update the information */
1297 LookupInfo);
1298 break;
1299 }
1300 }
1301 }
1302 break;
1303 }
1304
1305 case WM_COMMAND:
1306 {
1307 switch (LOWORD(wParam))
1308 {
1309 case IDC_ADD_PRINCIPAL:
1310 {
1311 HRESULT hRet;
1312
1313 hRet = InitializeObjectPicker(sp->ServerName,
1314 &sp->ObjectInfo,
1315 &sp->pDsObjectPicker);
1316 if (SUCCEEDED(hRet))
1317 {
1318 hRet = InvokeObjectPickerDialog(sp->pDsObjectPicker,
1319 hwndDlg,
1321 sp);
1322 if (FAILED(hRet))
1323 {
1324 MessageBox(hwndDlg, L"InvokeObjectPickerDialog failed!\n", NULL, 0);
1325 }
1326
1327 /* delete the instance */
1328 FreeObjectPicker(sp->pDsObjectPicker);
1329 }
1330 else
1331 {
1332 MessageBox(hwndDlg, L"InitializeObjectPicker failed!\n", NULL, 0);
1333 }
1334 break;
1335 }
1336
1338 {
1339 PPRINCIPAL_LISTITEM SelectedPrincipal;
1340
1341 SelectedPrincipal = (PPRINCIPAL_LISTITEM)ListViewGetSelectedItemData(sp->hWndPrincipalsList);
1342 if (SelectedPrincipal != NULL)
1343 {
1344 /* FIXME */
1345 }
1346 break;
1347 }
1348 }
1349 break;
1350 }
1351
1352 case WM_SIZE:
1353 {
1355 (INT)LOWORD(lParam),
1356 (INT)HIWORD(lParam));
1357 break;
1358 }
1359
1360 case WM_INITDIALOG:
1361 {
1363 if(sp != NULL)
1364 {
1365 LV_COLUMN lvc;
1366 RECT rcLvClient;
1367
1368 sp->hWnd = hwndDlg;
1369 sp->hWndPrincipalsList = GetDlgItem(hwndDlg, IDC_PRINCIPALS);
1370 sp->hBtnAdd = GetDlgItem(hwndDlg, IDC_ADD_PRINCIPAL);
1371 sp->hBtnRemove = GetDlgItem(hwndDlg, IDC_REMOVE_PRINCIPAL);
1372 sp->hBtnAdvanced = GetDlgItem(hwndDlg, IDC_ADVANCED);
1373 sp->hAceCheckList = GetDlgItem(hwndDlg, IDC_ACE_CHECKLIST);
1374 sp->hPermissionsForLabel = GetDlgItem(hwndDlg, IDC_LABEL_PERMISSIONS_FOR);
1375
1376 sp->SpecialPermCheckIndex = -1;
1377
1378 /* save the pointer to the structure */
1380
1381 (void)ListView_SetExtendedListViewStyleEx(sp->hWndPrincipalsList,
1384
1385 sp->hiPrincipals = ImageList_Create(16,
1386 16,
1388 0,
1389 3);
1390 if (sp->hiPrincipals != NULL)
1391 {
1392 HBITMAP hbmImages;
1393
1394 hbmImages = LoadBitmap(hDllInstance,
1396 if (hbmImages != NULL)
1397 {
1398 ImageList_AddMasked(sp->hiPrincipals,
1399 hbmImages,
1400 RGB(255,
1401 0,
1402 255));
1403
1404 DeleteObject(hbmImages);
1405 }
1406 }
1407
1408 /* setup the listview control */
1409 if (sp->hiPrincipals != NULL)
1410 {
1411 (void)ListView_SetImageList(sp->hWndPrincipalsList,
1412 sp->hiPrincipals,
1413 LVSIL_SMALL);
1414 }
1415
1416 GetClientRect(sp->hWndPrincipalsList,
1417 &rcLvClient);
1418
1419 /* add a column to the list view */
1420 lvc.mask = LVCF_FMT | LVCF_WIDTH;
1421 lvc.fmt = LVCFMT_LEFT;
1422 lvc.cx = rcLvClient.right;
1423 (void)ListView_InsertColumn(sp->hWndPrincipalsList,
1424 0,
1425 &lvc);
1426
1428
1429 ListViewSelectItem(sp->hWndPrincipalsList,
1430 0);
1431
1432 /* calculate the columns of the allow/deny checkboxes */
1433 SetAceCheckListColumns(sp->hAceCheckList,
1434 CLB_ALLOW,
1435 GetDlgItem(hwndDlg, IDC_LABEL_ALLOW));
1436 SetAceCheckListColumns(sp->hAceCheckList,
1437 CLB_DENY,
1438 GetDlgItem(hwndDlg, IDC_LABEL_DENY));
1439
1441 NULL,
1443 ((sp->ObjectInfo.dwFlags & SI_CONTAINER) ? SI_ACCESS_CONTAINER : 0),
1444 &sp->DefaultAccess);
1445
1446 /* hide controls in case the flags aren't present */
1447 if (sp->ObjectInfo.dwFlags & SI_ADVANCED)
1448 {
1449 /* editing the permissions is least the user can do when
1450 the advanced button is showed */
1451 sp->ObjectInfo.dwFlags |= SI_EDIT_PERMS;
1452 }
1453 else
1454 {
1455 ShowWindow(sp->hBtnAdvanced,
1456 SW_HIDE);
1458 SW_HIDE);
1459 }
1460
1461 /* enable quicksearch for the permissions checklist control */
1462 SendMessage(sp->hAceCheckList,
1464 TRUE,
1465 0);
1466
1468 }
1469
1470 Ret = TRUE;
1471 break;
1472 }
1473 }
1474 }
1475 return Ret;
1476}
#define SI_CONTAINER
Definition: accctrl.h:116
#define SI_ACCESS_CONTAINER
Definition: accctrl.h:140
#define SI_ACCESS_GENERAL
Definition: accctrl.h:139
#define SI_EDIT_PERMS
Definition: accctrl.h:113
static VOID ReloadPrincipalsList(IN PSECURITY_PAGE sp)
Definition: aclui.c:503
static VOID LoadPermissionsList(IN PSECURITY_PAGE sp, IN GUID *GuidObjectType, IN DWORD dwFlags, OUT SI_ACCESS *DefaultAccess)
Definition: aclui.c:792
static void UpdatePrincipalInfo(IN PSECURITY_PAGE sp, IN PSIDLOOKUPNOTIFYINFO LookupInfo)
Definition: aclui.c:675
static VOID UpdateControlStates(IN PSECURITY_PAGE sp)
Definition: aclui.c:624
#define SIDN_LOOKUPSUCCEEDED
Definition: aclui.c:40
static BOOL AddSelectedPrincipal(IN IDsObjectPicker *pDsObjectPicker, IN HWND hwndParent OPTIONAL, IN PSID pSid, IN PVOID Context OPTIONAL)
Definition: aclui.c:1195
static VOID ResizeControls(IN PSECURITY_PAGE sp, IN INT Width, IN INT Height)
Definition: aclui.c:894
static VOID FreeObjectPicker(IN IDsObjectPicker *pDsObjectPicker)
Definition: framewnd.c:1119
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HRESULT InitializeObjectPicker(IN PCWSTR ServerName, IN PSI_OBJECT_INFO ObjectInfo, OUT IDsObjectPicker **pDsObjectPicker)
Definition: misc.c:176
BOOL ListViewSelectItem(IN HWND hwnd, IN INT Index)
Definition: misc.c:160
HRESULT InvokeObjectPickerDialog(IN IDsObjectPicker *pDsObjectPicker, IN HWND hwndParent OPTIONAL, IN POBJPICK_SELECTED_SID SelectedSidCallback, IN PVOID Context OPTIONAL)
Definition: misc.c:249
LPARAM ListViewGetSelectedItemData(IN HWND hwnd)
Definition: misc.c:134
#define CIS_ALLOW
Definition: precomp.h:117
struct _NMCHANGEITEMCHECKBOX * PNMCHANGEITEMCHECKBOX
#define CLM_ENABLEQUICKSEARCH
Definition: precomp.h:135
#define CIS_DENY
Definition: precomp.h:118
#define CLN_CHANGINGITEMCHECKBOX
Definition: precomp.h:140
#define IDC_PRINCIPALS
Definition: resource.h:5
#define IDC_REMOVE_PRINCIPAL
Definition: resource.h:7
#define IDC_LABEL_PERMISSIONS_FOR
Definition: resource.h:13
#define IDC_ADVANCED
Definition: resource.h:11
#define IDC_ADD_PRINCIPAL
Definition: resource.h:6
#define IDB_USRGRPIMAGES
Definition: resource.h:24
#define IDC_ACE_CHECKLIST
Definition: resource.h:8
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define RGB(r, g, b)
Definition: precomp.h:71
pKey DeleteObject()
static HBITMAP
Definition: button.c:44
#define LOWORD(l)
Definition: pedump.c:82
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define LVSIL_SMALL
Definition: commctrl.h:2304
#define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)
Definition: commctrl.h:2731
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2309
#define ILC_COLOR32
Definition: commctrl.h:358
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2739
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define ILC_MASK
Definition: commctrl.h:351
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
#define LVIS_FOCUSED
Definition: commctrl.h:2323
#define LV_COLUMN
Definition: commctrl.h:2552
#define WM_NOTIFY
Definition: richedit.h:61
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
UINT uNewState
Definition: commctrl.h:3041
UINT uOldState
Definition: commctrl.h:3042
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define HIWORD(l)
Definition: typedefs.h:247
#define SW_HIDE
Definition: winuser.h:771
#define DWLP_USER
Definition: winuser.h:875
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WM_SIZE
Definition: winuser.h:1614
#define LoadBitmap
Definition: winuser.h:5823
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
#define MessageBox
Definition: winuser.h:5834

Referenced by CreateSecurityPage().

◆ SetAceCheckListColumns()

static VOID SetAceCheckListColumns ( IN HWND  hAceCheckList,
IN UINT  Button,
IN HWND  hLabel 
)
static

Definition at line 769 of file aclui.c.

772{
773 POINT pt;
774 RECT rcLabel;
775
776 GetWindowRect(hLabel,
777 &rcLabel);
778 pt.y = 0;
779 pt.x = (rcLabel.right - rcLabel.left) / 2;
780 MapWindowPoints(hLabel,
781 hAceCheckList,
782 &pt,
783 1);
784
785 SendMessage(hAceCheckList,
787 Button,
788 pt.x);
789}
#define CLM_SETCHECKBOXCOLUMN
Definition: precomp.h:131
Definition: window.h:573

Referenced by ResizeControls(), and SecurityPageProc().

◆ SidLookupCompletion()

static VOID SidLookupCompletion ( IN HANDLE  SidCacheMgr,
IN PSID  Sid,
IN PSIDREQRESULT  SidRequestResult,
IN PVOID  Context 
)
static

Definition at line 205 of file aclui.c.

209{
211
212 /* NOTE: this routine may be executed in a different thread
213 than the GUI! */
214
215 if (SidRequestResult != NULL)
216 {
217 SIDLOOKUPNOTIFYINFO LookupInfo;
218
219 LookupInfo.nmh.hwndFrom = sp->hWnd;
220 LookupInfo.nmh.idFrom = 0;
221 LookupInfo.nmh.code = SIDN_LOOKUPSUCCEEDED;
222 LookupInfo.Sid = Sid;
223 LookupInfo.SidRequestResult = SidRequestResult;
224
225 /* notify the page that the sid lookup succeeded */
226 SendMessage(sp->hWnd,
227 WM_NOTIFY,
228 (WPARAM)LookupInfo.nmh.idFrom,
229 (LPARAM)&LookupInfo.nmh);
230 }
231}
PSIDREQRESULT SidRequestResult
Definition: aclui.c:45
UINT_PTR idFrom
Definition: winuser.h:3161

Referenced by AddPrincipalToList(), and ReloadPrincipalsList().

◆ UpdateControlStates()

static VOID UpdateControlStates ( IN PSECURITY_PAGE  sp)
static

Definition at line 624 of file aclui.c.

625{
627
628 EnableWindow(sp->hBtnRemove,
629 Selected != NULL);
630 EnableWindow(sp->hAceCheckList,
631 Selected != NULL);
632
633 if (Selected != NULL)
634 {
635 LPWSTR szLabel;
636 LPWSTR szDisplayString;
637
638 szDisplayString = GetPrincipalAccountNameString(Selected);
641 &szLabel,
642 szDisplayString))
643 {
644 SetWindowText(sp->hPermissionsForLabel,
645 szLabel);
646
647 LocalFree((HLOCAL)szLabel);
648 }
649
650 LocalFree((HLOCAL)szDisplayString);
651
652 /* FIXME - update the checkboxes */
653 }
654 else
655 {
656 WCHAR szPermissions[255];
657
660 szPermissions,
661 sizeof(szPermissions) / sizeof(szPermissions[0])))
662 {
663 SetWindowText(sp->hPermissionsForLabel,
664 szPermissions);
665 }
666
667 SendMessage(sp->hAceCheckList,
669 0,
670 0);
671 }
672}
static LPWSTR GetPrincipalAccountNameString(IN PPRINCIPAL_LISTITEM PrincipalListItem)
Definition: aclui.c:358
#define CLM_CLEARCHECKBOXES
Definition: precomp.h:133
#define IDS_PERMISSIONS_FOR
Definition: resource.h:19
#define IDS_PERMISSIONS
Definition: resource.h:20
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SetWindowText
Definition: winuser.h:5869

Referenced by SecurityPageProc(), and UpdatePrincipalInfo().

◆ UpdatePrincipalInfo()

static void UpdatePrincipalInfo ( IN PSECURITY_PAGE  sp,
IN PSIDLOOKUPNOTIFYINFO  LookupInfo 
)
static

Definition at line 675 of file aclui.c.

677{
678 PPRINCIPAL_LISTITEM CurItem;
679 LPWSTR DisplayName;
680
681 if (sp->OwnerSid != NULL &&
682 EqualSid(sp->OwnerSid,
683 LookupInfo->Sid))
684 {
685 if (LookupInfo->SidRequestResult != NULL)
686 DisplayName = GetDisplayStringFromSidRequestResult(LookupInfo->SidRequestResult);
687 else if (!ConvertSidToStringSidW(LookupInfo->Sid,
688 &DisplayName))
689 {
690 DisplayName = NULL;
691 }
692
693 if (DisplayName != NULL)
694 {
695 SetDlgItemTextW(sp->hWnd,
696 IDC_OWNER,
697 DisplayName);
698
699 LocalFree((HLOCAL)DisplayName);
700 }
701 }
702
703 for (CurItem = sp->PrincipalsListHead;
704 CurItem != NULL;
705 CurItem = CurItem->Next)
706 {
707 if (EqualSid((PSID)(CurItem + 1),
708 LookupInfo->Sid))
709 {
710 INT PrincipalIndex;
711 LVFINDINFO lvfi;
712
713 /* find the principal in the list */
714 lvfi.flags = LVFI_PARAM;
715 lvfi.lParam = (LPARAM)CurItem;
716 PrincipalIndex = ListView_FindItem(sp->hWndPrincipalsList,
717 -1,
718 &lvfi);
719
720 if (PrincipalIndex != -1)
721 {
722 /* update the principal in the list view control */
724 PrincipalIndex,
725 CurItem,
726 LookupInfo->SidRequestResult);
727
728 if (ListViewGetSelectedItemData(sp->hWndPrincipalsList) == (LPARAM)CurItem)
729 {
731 }
732 }
733 else
734 {
736 CurItem,
737 -1,
738 FALSE);
739 }
740 break;
741 }
742 }
743}
static VOID UpdatePrincipalListItem(IN PSECURITY_PAGE sp, IN INT PrincipalIndex, IN PPRINCIPAL_LISTITEM PrincipalListItem, IN PSIDREQRESULT SidReqResult)
Definition: aclui.c:458
#define LVFINDINFO
Definition: commctrl.h:2468
#define LVFI_PARAM
Definition: commctrl.h:2441
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2475
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)

Referenced by SecurityPageProc().

◆ UpdatePrincipalListItem()

static VOID UpdatePrincipalListItem ( IN PSECURITY_PAGE  sp,
IN INT  PrincipalIndex,
IN PPRINCIPAL_LISTITEM  PrincipalListItem,
IN PSIDREQRESULT  SidReqResult 
)
static

Definition at line 458 of file aclui.c.

462{
463 LVITEM li;
464
465 /* replace the request result structure */
466 if (PrincipalListItem->SidReqResult != NULL)
467 {
468 DereferenceSidReqResult(sp->SidCacheMgr,
469 PrincipalListItem->SidReqResult);
470 }
471
472 ReferenceSidReqResult(sp->SidCacheMgr,
473 SidReqResult);
474 PrincipalListItem->SidReqResult = SidReqResult;
475
476 /* update the display string */
477 if (PrincipalListItem->DisplayString != NULL)
478 {
479 LocalFree((HLOCAL)PrincipalListItem->DisplayString);
480 }
481 PrincipalListItem->DisplayString = GetPrincipalDisplayString(PrincipalListItem);
482
483 /* update the list item */
485 sp,
486 PrincipalListItem,
487 PrincipalIndex,
488 FALSE);
489
490 /* don't change the list item state */
491 li.mask &= ~(LVIF_STATE | LVIF_PARAM);
492
493 (void)ListView_SetItem(sp->hWndPrincipalsList,
494 &li);
495
496 /* sort the principals list view again */
497 (void)ListView_SortItems(sp->hWndPrincipalsList,
499 (LPARAM)sp);
500}
static int CALLBACK PrincipalCompare(IN LPARAM lParam1, IN LPARAM lParam2, IN LPARAM lParamSort)
Definition: aclui.c:441
VOID ReferenceSidReqResult(IN HANDLE SidCacheMgr, IN PSIDREQRESULT ReqResult)
Definition: sidcache.c:839
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2708
#define ListView_SetItem(hwnd, pitem)
Definition: commctrl.h:2406

Referenced by UpdatePrincipalInfo().

Variable Documentation

◆ hDllInstance