- improved control resizing handling

- don't fail when querying the account name length

svn path=/trunk/; revision=18173
This commit is contained in:
Thomas Bluemel 2005-09-30 18:54:48 +00:00
parent 39d1d2d86c
commit 2357be7820
2 changed files with 187 additions and 184 deletions

View file

@ -115,7 +115,8 @@ AddPrincipalToList(IN PSECURITY_PAGE sp,
&SidNameUse)) &SidNameUse))
{ {
LookupResult = GetLastError(); LookupResult = GetLastError();
if (LookupResult != ERROR_NONE_MAPPED) if (LookupResult != ERROR_NONE_MAPPED &&
LookupResult != ERROR_INSUFFICIENT_BUFFER)
{ {
return FALSE; return FALSE;
} }
@ -375,7 +376,9 @@ AddPrincipalListEntry(IN PSECURITY_PAGE sp,
li.iSubItem = 0; li.iSubItem = 0;
li.state = (Selected ? LVIS_SELECTED : 0); li.state = (Selected ? LVIS_SELECTED : 0);
li.stateMask = LVIS_SELECTED; li.stateMask = LVIS_SELECTED;
li.pszText = (PrincipalListItem->DisplayString != NULL ? PrincipalListItem->DisplayString : PrincipalListItem->AccountName); li.pszText = (PrincipalListItem->DisplayString != NULL ?
PrincipalListItem->DisplayString :
PrincipalListItem->AccountName);
switch (PrincipalListItem->SidNameUse) switch (PrincipalListItem->SidNameUse)
{ {
@ -632,192 +635,192 @@ ResizeControls(IN PSECURITY_PAGE sp,
nControls += 2; nControls += 2;
} }
if (!(dwp = BeginDeferWindowPos(nControls))) if ((dwp = BeginDeferWindowPos(nControls)))
{ {
return; /* resize the Principal list view */
} GetWindowRect(sp->hWndPrincipalsList,
&rcControl);
/* resize the Principal list view */
GetWindowRect(sp->hWndPrincipalsList,
&rcControl);
if (!(dwp = DeferWindowPos(dwp,
sp->hWndPrincipalsList,
NULL,
0,
0,
cxWidth,
rcControl.bottom - rcControl.top,
SWP_NOMOVE | SWP_NOZORDER)))
{
return;
}
/* move the Add Principal button */
GetWindowRect(sp->hBtnAdd,
&rcControl);
GetWindowRect(sp->hBtnRemove,
&rcControl2);
btnSpacing = rcControl2.left - rcControl.right;
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(sp->hBtnAdd,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
sp->hBtnAdd,
NULL,
pt.x + cxWidth - (rcControl2.right - rcControl2.left) -
(rcControl.right - rcControl.left) -
btnSpacing - cxEdge,
pt2.y,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
return;
}
/* move the Delete Principal button */
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(sp->hBtnRemove,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
sp->hBtnRemove,
NULL,
pt.x + cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
pt2.y,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
return;
}
/* move the Permissions For label */
GetWindowRect(hWndAllow,
&rcControl);
GetWindowRect(hWndDeny,
&rcControl2);
GetWindowRect(sp->hPermissionsForLabel,
&rcControl3);
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(sp->hPermissionsForLabel,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
sp->hPermissionsForLabel,
NULL,
0,
0,
cxWidth - (rcControl2.right - rcControl2.left) -
(rcControl.right - rcControl.left) -
(2 * btnSpacing) - cxEdge,
rcControl3.bottom - rcControl3.top,
SWP_NOMOVE | SWP_NOZORDER)))
{
return;
}
/* move the Allow label */
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(hWndAllow,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
hWndAllow,
NULL,
cxWidth - (rcControl2.right - rcControl2.left) -
(rcControl.right - rcControl.left) -
btnSpacing - cxEdge,
pt2.y,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
return;
}
/* move the Deny label */
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(hWndDeny,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
hWndDeny,
NULL,
cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
pt2.y,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
return;
}
/* resize the Permissions check list box */
GetWindowRect(sp->hAceCheckList,
&rcControl);
GetWindowRect(sp->hBtnAdvanced,
&rcControl2);
GetWindowRect(GetDlgItem(sp->hWnd,
IDC_LABEL_ADVANCED),
&rcControl3);
if (!(dwp = DeferWindowPos(dwp,
sp->hAceCheckList,
NULL,
0,
0,
cxWidth,
((sp->ObjectInfo.dwFlags & SI_ADVANCED) ?
Height - (rcControl.top - rcWnd.top) - (rcControl3.bottom - rcControl3.top) - pt.x - btnSpacing :
Height - (rcControl.top - rcWnd.top) - pt.x),
SWP_NOMOVE | SWP_NOZORDER)))
{
return;
}
if (sp->ObjectInfo.dwFlags & SI_ADVANCED)
{
/* move and resize the Advanced label */
if (!(dwp = DeferWindowPos(dwp, if (!(dwp = DeferWindowPos(dwp,
GetDlgItem(sp->hWnd, sp->hWndPrincipalsList,
IDC_LABEL_ADVANCED),
NULL, NULL,
pt.x, 0,
Height - (rcControl3.bottom - rcControl3.top) - pt.x, 0,
cxWidth - (rcControl2.right - rcControl2.left) - cxEdge, cxWidth,
rcControl3.bottom - rcControl3.top, rcControl.bottom - rcControl.top,
SWP_NOZORDER))) SWP_NOMOVE | SWP_NOZORDER)))
{ {
return; goto EndDeferWnds;
} }
/* move and resize the Advanced button */ /* move the Add Principal button */
GetWindowRect(sp->hBtnAdd,
&rcControl);
GetWindowRect(sp->hBtnRemove,
&rcControl2);
btnSpacing = rcControl2.left - rcControl.right;
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(sp->hBtnAdd,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp, if (!(dwp = DeferWindowPos(dwp,
sp->hBtnAdvanced, sp->hBtnAdd,
NULL, NULL,
cxWidth - (rcControl2.right - rcControl2.left) + pt.x, pt.x + cxWidth - (rcControl2.right - rcControl2.left) -
Height - (rcControl2.bottom - rcControl2.top) - pt.x, (rcControl.right - rcControl.left) -
btnSpacing - cxEdge,
pt2.y,
0, 0,
0, 0,
SWP_NOSIZE | SWP_NOZORDER))) SWP_NOSIZE | SWP_NOZORDER)))
{ {
return; goto EndDeferWnds;
} }
/* move the Delete Principal button */
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(sp->hBtnRemove,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
sp->hBtnRemove,
NULL,
pt.x + cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
pt2.y,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
goto EndDeferWnds;
}
/* move the Permissions For label */
GetWindowRect(hWndAllow,
&rcControl);
GetWindowRect(hWndDeny,
&rcControl2);
GetWindowRect(sp->hPermissionsForLabel,
&rcControl3);
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(sp->hPermissionsForLabel,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
sp->hPermissionsForLabel,
NULL,
0,
0,
cxWidth - (rcControl2.right - rcControl2.left) -
(rcControl.right - rcControl.left) -
(2 * btnSpacing) - cxEdge,
rcControl3.bottom - rcControl3.top,
SWP_NOMOVE | SWP_NOZORDER)))
{
goto EndDeferWnds;
}
/* move the Allow label */
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(hWndAllow,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
hWndAllow,
NULL,
cxWidth - (rcControl2.right - rcControl2.left) -
(rcControl.right - rcControl.left) -
btnSpacing - cxEdge,
pt2.y,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
goto EndDeferWnds;
}
/* move the Deny label */
pt2.x = 0;
pt2.y = 0;
MapWindowPoints(hWndDeny,
sp->hWnd,
&pt2,
1);
if (!(dwp = DeferWindowPos(dwp,
hWndDeny,
NULL,
cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
pt2.y,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
goto EndDeferWnds;
}
/* resize the Permissions check list box */
GetWindowRect(sp->hAceCheckList,
&rcControl);
GetWindowRect(sp->hBtnAdvanced,
&rcControl2);
GetWindowRect(GetDlgItem(sp->hWnd,
IDC_LABEL_ADVANCED),
&rcControl3);
if (!(dwp = DeferWindowPos(dwp,
sp->hAceCheckList,
NULL,
0,
0,
cxWidth,
((sp->ObjectInfo.dwFlags & SI_ADVANCED) ?
Height - (rcControl.top - rcWnd.top) -
(rcControl3.bottom - rcControl3.top) - pt.x - btnSpacing :
Height - (rcControl.top - rcWnd.top) - pt.x),
SWP_NOMOVE | SWP_NOZORDER)))
{
goto EndDeferWnds;
}
if (sp->ObjectInfo.dwFlags & SI_ADVANCED)
{
/* move and resize the Advanced label */
if (!(dwp = DeferWindowPos(dwp,
GetDlgItem(sp->hWnd,
IDC_LABEL_ADVANCED),
NULL,
pt.x,
Height - (rcControl3.bottom - rcControl3.top) - pt.x,
cxWidth - (rcControl2.right - rcControl2.left) - cxEdge,
rcControl3.bottom - rcControl3.top,
SWP_NOZORDER)))
{
goto EndDeferWnds;
}
/* move and resize the Advanced button */
if (!(dwp = DeferWindowPos(dwp,
sp->hBtnAdvanced,
NULL,
cxWidth - (rcControl2.right - rcControl2.left) + pt.x,
Height - (rcControl2.bottom - rcControl2.top) - pt.x,
0,
0,
SWP_NOSIZE | SWP_NOZORDER)))
{
goto EndDeferWnds;
}
}
EndDeferWindowPos(dwp);
} }
EndDeferWindowPos(dwp); EndDeferWnds:
/* update the width of the principal list view column */ /* update the width of the principal list view column */
GetClientRect(sp->hWndPrincipalsList, GetClientRect(sp->hWndPrincipalsList,
&rcControl); &rcControl);

View file

@ -233,7 +233,7 @@ InitializeObjectPicker(IN PCWSTR ServerName,
sizeof(DSOP_SCOPE_INIT_INFO), sizeof(DSOP_SCOPE_INIT_INFO),
DSOP_SCOPE_TYPE_TARGET_COMPUTER, DSOP_SCOPE_TYPE_TARGET_COMPUTER,
DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS | DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS | DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS | DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS |
DSOP_SCOPE_FLAG_STARTING_SCOPE, DSOP_SCOPE_FLAG_STARTING_SCOPE,
{ {
{ {
0, 0,
@ -241,7 +241,7 @@ InitializeObjectPicker(IN PCWSTR ServerName,
0 0
}, },
DSOP_DOWNLEVEL_FILTER_USERS | DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS | DSOP_DOWNLEVEL_FILTER_USERS | DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS |
DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS | DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS | DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS
}, },
NULL, NULL,
NULL, NULL,