- query the domain server if specified by the server
- fixed some minor bugs
Modified: trunk/reactos/lib/aclui/aclui.c
Modified: trunk/reactos/lib/aclui/aclui_De.rc
Modified: trunk/reactos/lib/aclui/aclui_En.rc
Modified: trunk/reactos/lib/aclui/aclui_Sv.rc
Modified: trunk/reactos/lib/aclui/acluilib.h
Modified: trunk/reactos/lib/aclui/checklist.c
Modified: trunk/reactos/lib/aclui/misc.c
Modified: trunk/reactos/lib/aclui/resource.h
_____
Modified: trunk/reactos/lib/aclui/aclui.c
--- trunk/reactos/lib/aclui/aclui.c 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/aclui.c 2005-07-02 13:49:23 UTC (rev
16378)
@@ -140,7 +140,7 @@
DomainNameSize = 0;
/* calculate the size of the buffer we need to
calculate */
- LookupAccountSid(NULL, /* FIXME */
+ LookupAccountSid(sp->ServerName,
Sid,
NULL,
&AccountNameSize,
@@ -164,7 +164,7 @@
Sid);
LookupResult = ERROR_SUCCESS;
- if (!LookupAccountSid(NULL, /* FIXME */
+ if (!LookupAccountSid(sp->ServerName,
Sid,
AceListItem->AccountName,
&AccountNameSize,
@@ -208,7 +208,7 @@
AceListItem->DisplayString = NULL;
/* read the domain of the SID */
- if (OpenLSAPolicyHandle(NULL, /* FIXME */
+ if (OpenLSAPolicyHandle(sp->ServerName,
POLICY_LOOKUP_NAMES
| POLICY_VIEW_LOCAL_INFORMATION,
&LsaHandle))
{
@@ -310,6 +310,7 @@
default:
{
+ DPRINT("Unhandled SID type:
0x%x\n", Names->Use);
break;
}
}
@@ -406,11 +407,37 @@
static VOID
UpdateControlStates(IN PSECURITY_PAGE sp)
{
- BOOL UserOrGroupSelected;
+ PACE_LISTITEM Selected =
(PACE_LISTITEM)ListViewGetSelectedItemData(sp->hWndAceList);
+
+ EnableWindow(sp->hBtnRemove, Selected != NULL);
+ EnableWindow(sp->hAceCheckList, Selected != NULL);
- UserOrGroupSelected = (ListViewGetSelectedItemData(sp->hWndAceList)
!= 0);
+ if (Selected != NULL)
+ {
+ LPWSTR szLabel;
- EnableWindow(sp->hBtnRemove, UserOrGroupSelected);
+ LoadAndFormatString(hDllInstance,
+ IDS_PERMISSIONS_FOR,
+ &szLabel,
+ Selected->AccountName);
+
+ SetWindowText(sp->hPermissionsForLabel,
+ szLabel);
+
+ LocalFree((HLOCAL)szLabel);
+
+ /* FIXME - update the checkboxes */
+ }
+ else
+ {
+ SetWindowText(sp->hPermissionsForLabel,
+ NULL);
+
+ SendMessage(sp->hAceCheckList,
+ CLM_CLEARCHECKBOXES,
+ 0,
+ 0);
+ }
}
static UINT CALLBACK
@@ -555,7 +582,14 @@
{
case LVN_ITEMCHANGED:
{
- UpdateControlStates(sp);
+ LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam;
+
+ if ((pnmv->uChanged & LVIF_STATE) &&
+ ((pnmv->uOldState & (LVIS_FOCUSED |
LVIS_SELECTED)) ||
+ (pnmv->uNewState & (LVIS_FOCUSED |
LVIS_SELECTED))))
+ {
+ UpdateControlStates(sp);
+ }
break;
}
}
@@ -575,7 +609,18 @@
sp->hWnd = hwndDlg;
sp->hWndAceList = GetDlgItem(hwndDlg, IDC_ACELIST);
sp->hBtnRemove = GetDlgItem(hwndDlg,
IDC_ACELIST_REMOVE);
+ sp->hBtnAdvanced = GetDlgItem(hwndDlg, IDC_ADVANCED);
sp->hAceCheckList = GetDlgItem(hwndDlg,
IDC_ACE_CHECKLIST);
+ sp->hPermissionsForLabel = GetDlgItem(hwndDlg,
IDC_LABEL_PERMISSIONS_FOR);
+
+ sp->SpecialPermCheckIndex = -1;
+
+ if ((sp->ObjectInfo.dwFlags & SI_SERVER_IS_DC) &&
+ sp->ObjectInfo.pszServerName != NULL &&
+ sp->ObjectInfo.pszServerName[0] != L'\0')
+ {
+ sp->ServerName = sp->ObjectInfo.pszServerName;
+ }
/* save the pointer to the structure */
SetWindowLongPtr(hwndDlg,
@@ -617,13 +662,40 @@
CLB_DENY,
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);
+
+ /* hide controls in case the flags aren't present */
+ if (sp->ObjectInfo.dwFlags & SI_ADVANCED)
+ {
+ WCHAR szSpecialPermissions[255];
+
+ /* editing the permissions is least the user can do
when
+ the advanced button is showed */
+ sp->ObjectInfo.dwFlags |= SI_EDIT_PERMS;
+
+ if (LoadString(hDllInstance,
+ IDS_SPECIAL_PERMISSIONS,
+ szSpecialPermissions,
+ sizeof(szSpecialPermissions) /
sizeof(szSpecialPermissions[0])))
+ {
+ /* add the special permissions check item */
+ sp->SpecialPermCheckIndex =
(INT)SendMessage(sp->hAceCheckList,
+
CLM_ADDITEM,
+
CIS_DISABLED | CIS_NONE,
+
(LPARAM)szSpecialPermissions);
+ }
+ }
+ else
+ {
+ ShowWindow(sp->hBtnAdvanced,
+ SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_LABEL_ADVANCED),
+ SW_HIDE);
+ }
}
break;
}
@@ -654,7 +726,10 @@
return NULL;
}
- /* get the object information from the server interface */
+ /* get the object information from the server. Zero the structure
before
+ because some applications seem to return SUCCESS but only seem
to set the
+ fields they care about. */
+ ZeroMemory(&ObjectInfo, sizeof(ObjectInfo));
hRet = psi->lpVtbl->GetObjectInformation(psi, &ObjectInfo);
if(FAILED(hRet))
@@ -694,13 +769,19 @@
psp.lParam = (LPARAM)sPage;
psp.pfnCallback = SecurityPageCallback;
- if((ObjectInfo.dwFlags & SI_PAGE_TITLE) &&
- ObjectInfo.pszPageTitle != NULL && ObjectInfo.pszPageTitle[0] !=
L'\0')
+ if(ObjectInfo.dwFlags & SI_PAGE_TITLE)
{
- /* Set the page title if the flag is present and the string
isn't empty */
psp.pszTitle = ObjectInfo.pszPageTitle;
- psp.dwFlags |= PSP_USETITLE;
+
+ if (psp.pszTitle != NULL)
+ {
+ psp.dwFlags |= PSP_USETITLE;
+ }
}
+ else
+ {
+ psp.pszTitle = NULL;
+ }
/* NOTE: the SECURITY_PAGE structure will be freed by the property
page
callback! */
@@ -734,7 +815,10 @@
return FALSE;
}
- /* get the object information from the server interface */
+ /* get the object information from the server. Zero the structure
before
+ because some applications seem to return SUCCESS but only seem
to set the
+ fields they care about. */
+ ZeroMemory(&ObjectInfo, sizeof(ObjectInfo));
hRet = psi->lpVtbl->GetObjectInformation(psi, &ObjectInfo);
if(FAILED(hRet))
@@ -757,26 +841,16 @@
psh.dwFlags = PSH_DEFAULT;
psh.hwndParent = hwndOwner;
psh.hInstance = hDllInstance;
- if((ObjectInfo.dwFlags & SI_PAGE_TITLE) &&
- ObjectInfo.pszPageTitle != NULL && ObjectInfo.pszPageTitle[0] !=
L'\0')
- {
- /* 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
- {
- /* Set the page title to the object name, make sure the format
string
- has "%1" NOT "%s" because it uses FormatMessage() to
automatically
- allocate the right amount of memory. */
- LoadAndFormatString(hDllInstance,
- IDS_PSP_TITLE,
- &lpCaption,
- ObjectInfo.pszObjectName);
- psh.pszCaption = lpCaption;
- }
+ /* Set the page title to the object name, make sure the format
string
+ has "%1" NOT "%s" because it uses FormatMessage() to
automatically
+ allocate the right amount of memory. */
+ LoadAndFormatString(hDllInstance,
+ IDS_PSP_TITLE,
+ &lpCaption,
+ ObjectInfo.pszObjectName);
+ psh.pszCaption = lpCaption;
+
psh.nPages = sizeof(hPages) / sizeof(HPROPSHEETPAGE);
psh.nStartPage = 0;
psh.phpage = hPages;
_____
Modified: trunk/reactos/lib/aclui/aclui_De.rc
--- trunk/reactos/lib/aclui/aclui_De.rc 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/aclui_De.rc 2005-07-02 13:49:23 UTC (rev
16378)
@@ -9,13 +9,18 @@
CONTROL "", IDC_ACELIST, "SysListView32", LVS_REPORT |
LVS_SINGLESEL
| LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER |
LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7,
17, 213, 66, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
PUSHBUTTON "&Hinzuf³gen...", IDC_ACELIST_ADD, 116, 87, 50, 14
PUSHBUTTON "&Entfernen", IDC_ACELIST_REMOVE, 170, 87, 50, 14
+ LTEXT "", IDC_LABEL_PERMISSIONS_FOR, 7, 107, 105, 8, SS_LEFT |
SS_NOPREFIX
LTEXT "Erlauben", IDC_LABEL_ALLOW, 135, 107, 32, 8, SS_CENTER
LTEXT "Verbieten", IDC_LABEL_DENY, 176, 107, 32, 8, SS_CENTER
CONTROL "", IDC_ACE_CHECKLIST, "CHECKLIST_ACLUI", WS_CHILD |
WS_VISIBLE | WS_TABSTOP, 7, 117, 213, 72, WS_EX_CLIENTEDGE
+ LTEXT "Klicken Sie auf \"Erweitert\", um spezielle Berechtigungen
oder erweiterte Einstellungen anzuzeigen.", IDC_LABEL_ADVANCED, 7, 194,
153, 16, SS_LEFT
+ PUSHBUTTON "Er&weitert", IDC_ADVANCED, 165, 194, 55, 14
END
STRINGTABLE DISCARDABLE
{
IDS_PSP_TITLE "Berechtigungen f³r %1"
IDS_UNKNOWN "Unbekannt"
+ IDS_SPECIAL_PERMISSIONS "Spezielle Berechtigungen"
+ IDS_PERMISSIONS_FOR "Berechtigungen f³r %1"
}
_____
Modified: trunk/reactos/lib/aclui/aclui_En.rc
--- trunk/reactos/lib/aclui/aclui_En.rc 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/aclui_En.rc 2005-07-02 13:49:23 UTC (rev
16378)
@@ -9,14 +9,19 @@
CONTROL "", IDC_ACELIST, "SysListView32", LVS_REPORT |
LVS_SINGLESEL
| LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER |
LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7,
17, 213, 66, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
PUSHBUTTON "A&dd...", IDC_ACELIST_ADD, 116, 87, 50, 14
PUSHBUTTON "&Remove", IDC_ACELIST_REMOVE, 170, 87, 50, 14
+ LTEXT "", IDC_LABEL_PERMISSIONS_FOR, 7, 107, 105, 8, SS_LEFT |
SS_NOPREFIX
LTEXT "Allow", IDC_LABEL_ALLOW, 135, 107, 32, 8, SS_CENTER
LTEXT "Deny", IDC_LABEL_DENY, 176, 107, 32, 8, SS_CENTER
CONTROL "", IDC_ACE_CHECKLIST, "CHECKLIST_ACLUI", WS_CHILD |
WS_VISIBLE | WS_TABSTOP, 7, 117, 213, 72, WS_EX_CLIENTEDGE
+ LTEXT "For special permissions or for advanced settings, click
Advanced.", IDC_LABEL_ADVANCED, 7, 194, 153, 16, SS_LEFT
+ PUSHBUTTON "Ad&vanced", IDC_ADVANCED, 165, 194, 55, 14
END
STRINGTABLE DISCARDABLE
{
IDS_PSP_TITLE "Permissions for %1"
IDS_UNKNOWN "Unknown"
+ IDS_SPECIAL_PERMISSIONS "Special Permissions"
+ IDS_PERMISSIONS_FOR "Permissions for %1"
}
_____
Modified: trunk/reactos/lib/aclui/aclui_Sv.rc
--- trunk/reactos/lib/aclui/aclui_Sv.rc 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/aclui_Sv.rc 2005-07-02 13:49:23 UTC (rev
16378)
@@ -27,14 +27,19 @@
CONTROL "", IDC_ACELIST, "SysListView32", LVS_REPORT |
LVS_SINGLESEL
| LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER |
LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7,
17, 213, 66, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
PUSHBUTTON "&Lõgg till...", IDC_ACELIST_ADD, 116, 87, 50, 14
PUSHBUTTON "&Ta bort", IDC_ACELIST_REMOVE, 170, 87, 50, 14
+ LTEXT "", IDC_LABEL_PERMISSIONS_FOR, 7, 107, 105, 8, SS_LEFT |
SS_NOPREFIX
LTEXT "TillÕt", IDC_LABEL_ALLOW, 135, 107, 32, 8, SS_CENTER
LTEXT "Neka", IDC_LABEL_DENY, 176, 107, 32, 8, SS_CENTER
CONTROL "", IDC_ACE_CHECKLIST, "CHECKLIST_ACLUI", WS_CHILD |
WS_VISIBLE | WS_TABSTOP, 7, 117, 213, 72, WS_EX_CLIENTEDGE
+ LTEXT "For special permissions or for advanced settings, click
Advanced.", IDC_LABEL_ADVANCED, 7, 194, 153, 16, SS_LEFT
+ PUSHBUTTON "Ad&vanced", IDC_ADVANCED, 165, 194, 55, 14
END
STRINGTABLE DISCARDABLE
{
IDS_PSP_TITLE "Beh÷righeter f÷r %1"
IDS_UNKNOWN "Unknown"
+ IDS_SPECIAL_PERMISSIONS "Special Permissions"
+ IDS_PERMISSIONS_FOR "Permissions for %1"
}
_____
Modified: trunk/reactos/lib/aclui/acluilib.h
--- trunk/reactos/lib/aclui/acluilib.h 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/acluilib.h 2005-07-02 13:49:23 UTC (rev
16378)
@@ -34,11 +34,15 @@
{
HWND hWnd;
HWND hBtnRemove;
+ HWND hBtnAdvanced;
HWND hAceCheckList;
+ HWND hPermissionsForLabel;
/* Main ACE List */
HWND hWndAceList;
PACE_LISTITEM AceListHead;
+
+ INT SpecialPermCheckIndex;
HIMAGELIST hiUsrs;
@@ -46,12 +50,14 @@
SI_OBJECT_INFO ObjectInfo;
SI_ACCESS DefaultAccess;
+
+ LPWSTR ServerName;
} SECURITY_PAGE, *PSECURITY_PAGE;
/* MISC
***********************************************************************/
BOOL
-OpenLSAPolicyHandle(IN WCHAR *SystemName,
+OpenLSAPolicyHandle(IN LPWSTR SystemName,
IN ACCESS_MASK DesiredAccess,
OUT PLSA_HANDLE PolicyHandle);
@@ -87,6 +93,8 @@
#define CLM_CLEAR (WM_USER + 4)
#define CLM_SETCHECKBOXCOLUMN (WM_USER + 5)
#define CLM_GETCHECKBOXCOLUMN (WM_USER + 6)
+#define CLM_CLEARCHECKBOXES (WM_USER + 7)
+#define CLM_SETITEMSTATE (WM_USER + 8)
BOOL
RegisterCheckListControl(HINSTANCE hInstance);
_____
Modified: trunk/reactos/lib/aclui/checklist.c
--- trunk/reactos/lib/aclui/checklist.c 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/checklist.c 2005-07-02 13:49:23 UTC (rev
16378)
@@ -123,20 +123,23 @@
static PCHECKITEM
AddCheckItem(IN PCHECKLISTWND infoPtr,
IN LPWSTR Name,
- IN DWORD State)
+ IN DWORD State,
+ OUT INT *Index)
{
PCHECKITEM CurItem;
+ INT i;
PCHECKITEM *PrevPtr = &infoPtr->CheckItemListHead;
PCHECKITEM Item = HeapAlloc(GetProcessHeap(),
0,
sizeof(CHECKITEM) + (wcslen(Name) *
sizeof(WCHAR)));
if (Item != NULL)
{
- for (CurItem = infoPtr->CheckItemListHead;
+ for (CurItem = infoPtr->CheckItemListHead, i = 0;
CurItem != NULL;
CurItem = CurItem->Next)
{
PrevPtr = &CurItem->Next;
+ i++;
}
Item->Next = NULL;
@@ -146,11 +149,36 @@
*PrevPtr = Item;
infoPtr->CheckItemCount++;
+
+ if (Index != NULL)
+ {
+ *Index = i;
+ }
}
return Item;
}
+static UINT
+ClearCheckBoxes(IN PCHECKLISTWND infoPtr)
+{
+ PCHECKITEM CurItem;
+ UINT nUpdated = 0;
+
+ for (CurItem = infoPtr->CheckItemListHead;
+ CurItem != NULL;
+ CurItem = CurItem->Next)
+ {
+ if (CurItem->State & (CIS_ALLOW | CIS_DENY))
+ {
+ CurItem->State &= ~(CIS_ALLOW | CIS_DENY);
+ nUpdated++;
+ }
+ }
+
+ return nUpdated;
+}
+
static VOID
UpdateControl(IN PCHECKLISTWND infoPtr,
IN BOOL AllowChangeStyle)
@@ -511,14 +539,21 @@
case CLM_ADDITEM:
{
- Ret = (AddCheckItem(infoPtr,
- (LPWSTR)lParam,
- (DWORD)wParam) != NULL);
- if (Ret)
+ INT Index = -1;
+ PCHECKITEM Item = AddCheckItem(infoPtr,
+ (LPWSTR)lParam,
+ (DWORD)wParam,
+ &Index);
+ if (Item != NULL)
{
UpdateControl(infoPtr,
TRUE);
+ Ret = (LRESULT)Index;
}
+ else
+ {
+ Ret = (LRESULT)-1;
+ }
break;
}
@@ -543,6 +578,29 @@
break;
}
+ case CLM_SETITEMSTATE:
+ {
+ PCHECKITEM Item = FindCheckItemByIndex(infoPtr,
+ wParam);
+ if (Item != NULL)
+ {
+ DWORD OldState = Item->State;
+ Item->State = (DWORD)lParam & CIS_MASK;
+
+ if (Item->State != OldState)
+ {
+ UpdateControl(infoPtr,
+ TRUE);
+ }
+ Ret = TRUE;
+ }
+ else
+ {
+ Ret = FALSE;
+ }
+ break;
+ }
+
case CLM_GETITEMCOUNT:
{
Ret = infoPtr->CheckItemCount;
@@ -570,6 +628,17 @@
break;
}
+ case CLM_CLEARCHECKBOXES:
+ {
+ Ret = (LRESULT)ClearCheckBoxes(infoPtr);
+ if (Ret)
+ {
+ UpdateControl(infoPtr,
+ TRUE);
+ }
+ break;
+ }
+
case WM_SETFONT:
{
Ret = (LRESULT)RetChangeControlFont(infoPtr,
@@ -674,7 +743,6 @@
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
- case WM_XBUTTONDOWN:
{
if (!infoPtr->HasFocus && IsWindowEnabled(hwnd))
{
_____
Modified: trunk/reactos/lib/aclui/misc.c
--- trunk/reactos/lib/aclui/misc.c 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/misc.c 2005-07-02 13:49:23 UTC (rev
16378)
@@ -127,7 +127,7 @@
}
BOOL
-OpenLSAPolicyHandle(IN WCHAR *SystemName,
+OpenLSAPolicyHandle(IN LPWSTR SystemName,
IN ACCESS_MASK DesiredAccess,
OUT PLSA_HANDLE PolicyHandle)
{
_____
Modified: trunk/reactos/lib/aclui/resource.h
--- trunk/reactos/lib/aclui/resource.h 2005-07-02 13:45:23 UTC (rev
16377)
+++ trunk/reactos/lib/aclui/resource.h 2005-07-02 13:49:23 UTC (rev
16378)
@@ -9,11 +9,16 @@
#define IDC_ACE_CHECKLIST 1004
#define IDC_LABEL_ALLOW 1005
#define IDC_LABEL_DENY 1006
+#define IDC_ADVANCED 1007
+#define IDC_LABEL_ADVANCED 1008
+#define IDC_LABEL_PERMISSIONS_FOR 1009
#define IDI_DEVMGR 100
#define IDS_PSP_TITLE 1001
#define IDS_UNKNOWN 1002
+#define IDS_SPECIAL_PERMISSIONS 1003
+#define IDS_PERMISSIONS_FOR 1004
#define IDB_USRGRPIMAGES 1001