diff --git a/reactos/lib/aclui/aclui.c b/reactos/lib/aclui/aclui.c index 710e7d9af8d..4bc57878c20 100644 --- a/reactos/lib/aclui/aclui.c +++ b/reactos/lib/aclui/aclui.c @@ -460,6 +460,77 @@ SetAceCheckListColumns(IN HWND hAceCheckList, pt.x); } +static VOID +LoadPermissionsList(IN PSECURITY_PAGE sp, + IN GUID *GuidObjectType, + IN DWORD dwFlags, + OUT SI_ACCESS *DefaultAccess) +{ + HRESULT hRet; + PSI_ACCESS AccessList; + ULONG nAccessList, DefaultAccessIndex; + + /* clear the permissions list */ + + SendMessage(sp->hAceCheckList, + CLM_CLEAR, + 0, + 0); + + /* query the access rights from the server */ + hRet = sp->psi->lpVtbl->GetAccessRights(sp->psi, + GuidObjectType, + dwFlags, + &AccessList, + &nAccessList, + &DefaultAccessIndex); + if (SUCCEEDED(hRet) && nAccessList != 0) + { + LPCWSTR NameStr; + PSI_ACCESS CurAccess, LastAccess; + WCHAR NameBuffer[MAX_PATH]; + + /* save the default access rights to be used when adding ACEs later */ + if (DefaultAccess != NULL) + { + *DefaultAccess = AccessList[DefaultAccessIndex]; + } + + LastAccess = AccessList + nAccessList; + for (CurAccess = &AccessList[0]; + CurAccess != LastAccess; + CurAccess++) + { + if (CurAccess->dwFlags & dwFlags) + { + /* get the permission name, load it from a string table if necessary */ + if (IS_INTRESOURCE(CurAccess->pszName)) + { + if (!LoadString(sp->ObjectInfo.hInstance, + (UINT)((ULONG_PTR)CurAccess->pszName), + NameBuffer, + sizeof(NameBuffer) / sizeof(NameBuffer[0]))) + { + LoadString(hDllInstance, + IDS_UNKNOWN, + NameBuffer, + sizeof(NameBuffer) / sizeof(NameBuffer[0])); + } + NameStr = NameBuffer; + } + else + { + NameStr = CurAccess->pszName; + } + + SendMessage(sp->hAceCheckList, + CLM_ADDITEM, + CIS_DISABLED | CIS_NONE, + (LPARAM)NameStr); + } + } + } +} static INT_PTR CALLBACK SecurityPageProc(IN HWND hwndDlg, @@ -547,6 +618,12 @@ SecurityPageProc(IN HWND hwndDlg, GetDlgItem(hwndDlg, IDC_LABEL_DENY)); /* FIXME - hide controls in case the flags aren't present */ + + LoadPermissionsList(sp, + NULL, + SI_ACCESS_GENERAL | + ((sp->ObjectInfo.dwFlags & SI_CONTAINER) ? SI_ACCESS_CONTAINER : 0), + &sp->DefaultAccess); } break; } @@ -607,6 +684,8 @@ CreateSecurityPage(IN LPSECURITYINFO psi) sPage->psi = psi; sPage->ObjectInfo = ObjectInfo; + ZeroMemory(&psp, sizeof(psp)); + psp.dwSize = sizeof(PROPSHEETPAGE); psp.dwFlags = PSP_USECALLBACK; psp.hInstance = hDllInstance; @@ -683,6 +762,7 @@ EditSecurity(IN HWND hwndOwner, { /* Set the page title if the flag is present and the string isn't empty */ psh.pszCaption = ObjectInfo.pszPageTitle; + psh.dwFlags |= PSH_PROPTITLE; lpCaption = NULL; } else diff --git a/reactos/lib/aclui/aclui_De.rc b/reactos/lib/aclui/aclui_De.rc index 0e8d48ba36e..0df33a0bf2f 100644 --- a/reactos/lib/aclui/aclui_De.rc +++ b/reactos/lib/aclui/aclui_De.rc @@ -17,4 +17,5 @@ END STRINGTABLE DISCARDABLE { IDS_PSP_TITLE "Berechtigungen für %1" + IDS_UNKNOWN "Unbekannt" } diff --git a/reactos/lib/aclui/aclui_En.rc b/reactos/lib/aclui/aclui_En.rc index d19f0d56bde..2d8925b253e 100644 --- a/reactos/lib/aclui/aclui_En.rc +++ b/reactos/lib/aclui/aclui_En.rc @@ -17,5 +17,6 @@ END STRINGTABLE DISCARDABLE { IDS_PSP_TITLE "Permissions for %1" + IDS_UNKNOWN "Unknown" } diff --git a/reactos/lib/aclui/aclui_Sv.rc b/reactos/lib/aclui/aclui_Sv.rc index 0a663e809ab..4d03578cb93 100644 --- a/reactos/lib/aclui/aclui_Sv.rc +++ b/reactos/lib/aclui/aclui_Sv.rc @@ -35,5 +35,6 @@ END STRINGTABLE DISCARDABLE { IDS_PSP_TITLE "Behörigheter för %1" + IDS_UNKNOWN "Unknown" } diff --git a/reactos/lib/aclui/acluilib.h b/reactos/lib/aclui/acluilib.h index 34fa450e92b..82bcd21c1e6 100644 --- a/reactos/lib/aclui/acluilib.h +++ b/reactos/lib/aclui/acluilib.h @@ -44,6 +44,8 @@ typedef struct _SECURITY_PAGE LPSECURITYINFO psi; SI_OBJECT_INFO ObjectInfo; + + SI_ACCESS DefaultAccess; } SECURITY_PAGE, *PSECURITY_PAGE; /* MISC ***********************************************************************/ @@ -68,10 +70,11 @@ ListViewSelectItem(IN HWND hwnd, /* CHECKLIST CONTROL **********************************************************/ -#define CIS_DISABLED (0x2) +#define CIS_DISABLED (0x4) #define CIS_ENABLED (0x0) -#define CIS_ALLOW (0x1) -#define CIS_DENY (0x0) +#define CIS_ALLOW (0x2) +#define CIS_DENY (0x1) +#define CIS_NONE (0x0) #define CLB_ALLOW (0x1) #define CLB_DENY (0x0) diff --git a/reactos/lib/aclui/checklist.c b/reactos/lib/aclui/checklist.c index 2e04f6b82a3..b04ae4becab 100644 --- a/reactos/lib/aclui/checklist.c +++ b/reactos/lib/aclui/checklist.c @@ -281,12 +281,11 @@ PaintControl(IN PCHECKLISTWND infoPtr, ScrollPos + VisibleFirstIndex); if (FirstItem != NULL) { - RECT TextRect, ItemRect; + RECT TextRect, ItemRect, CheckBox; HFONT hOldFont; DWORD CurrentIndex; COLORREF OldTextColor; BOOL Enabled, PrevEnabled; - POINT ptOld; Enabled = IsWindowEnabled(infoPtr->hSelf); PrevEnabled = Enabled; @@ -299,11 +298,6 @@ PaintControl(IN PCHECKLISTWND infoPtr, TextRect.right = ItemRect.right - 6; TextRect.top = ItemRect.top + 2; - MoveToEx(hDC, - infoPtr->CheckBoxLeft[CLB_ALLOW], - ItemRect.top, - &ptOld); - OldTextColor = SetTextColor(hDC, infoPtr->TextColor[Enabled]); @@ -324,26 +318,34 @@ PaintControl(IN PCHECKLISTWND infoPtr, infoPtr->TextColor[PrevEnabled]); } + /* draw the text */ DrawText(hDC, Item->Name, -1, &TextRect, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); - MoveToEx(hDC, - infoPtr->CheckBoxLeft[CLB_ALLOW], - TextRect.top - 6, - NULL); - LineTo(hDC, - infoPtr->CheckBoxLeft[CLB_ALLOW], - TextRect.bottom - 6); - MoveToEx(hDC, - infoPtr->CheckBoxLeft[CLB_DENY], - TextRect.top - 6, - NULL); - LineTo(hDC, - infoPtr->CheckBoxLeft[CLB_DENY], - TextRect.bottom - 6); + /* draw the Allow checkbox */ + CheckBox.left = infoPtr->CheckBoxLeft[CLB_ALLOW] - ((TextRect.bottom - TextRect.top) / 2); + CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - 4; + CheckBox.top = TextRect.top; + CheckBox.bottom = CheckBox.top + (TextRect.bottom - TextRect.top) - 4; + DrawFrameControl(hDC, + &CheckBox, + DFC_BUTTON, + DFCS_BUTTONCHECK | DFCS_FLAT | + ((Item->State & CIS_DISABLED) && Enabled ? DFCS_INACTIVE : 0) | + ((Item->State & CIS_ALLOW) ? DFCS_CHECKED : 0)); + + /* draw the Deny checkbox */ + CheckBox.left = infoPtr->CheckBoxLeft[CLB_DENY] - ((TextRect.bottom - TextRect.top) / 2); + CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - 4; + DrawFrameControl(hDC, + &CheckBox, + DFC_BUTTON, + DFCS_BUTTONCHECK | DFCS_FLAT | + ((Item->State & CIS_DISABLED) && Enabled ? DFCS_INACTIVE : 0) | + ((Item->State & CIS_DENY) ? DFCS_CHECKED : 0)); TextRect.top += infoPtr->ItemHeight; } @@ -353,11 +355,6 @@ PaintControl(IN PCHECKLISTWND infoPtr, SetTextColor(hDC, OldTextColor); - - MoveToEx(hDC, - ptOld.x, - ptOld.y, - NULL); } } diff --git a/reactos/lib/aclui/resource.h b/reactos/lib/aclui/resource.h index 2441eaa36a0..536390f9ede 100644 --- a/reactos/lib/aclui/resource.h +++ b/reactos/lib/aclui/resource.h @@ -13,6 +13,7 @@ #define IDI_DEVMGR 100 #define IDS_PSP_TITLE 1001 +#define IDS_UNKNOWN 1002 #define IDB_USRGRPIMAGES 1001