minor fixes

svn path=/trunk/; revision=19715
This commit is contained in:
Thomas Bluemel 2005-11-28 01:10:49 +00:00
parent ce6ccd9bb5
commit 7c2d655e6c
3 changed files with 181 additions and 154 deletions

View file

@ -1077,16 +1077,18 @@ SecurityPageProc(IN HWND hwndDlg,
IN LPARAM lParam) IN LPARAM lParam)
{ {
PSECURITY_PAGE sp; PSECURITY_PAGE sp;
INT_PTR Ret = FALSE;
switch (uMsg) sp = (PSECURITY_PAGE)GetWindowLongPtr(hwndDlg,
DWL_USER);
if (sp != NULL || uMsg == WM_INITDIALOG)
{ {
case WM_NOTIFY: switch (uMsg)
{ {
NMHDR *pnmh = (NMHDR*)lParam; case WM_NOTIFY:
sp = (PSECURITY_PAGE)GetWindowLongPtr(hwndDlg,
DWL_USER);
if (sp != NULL)
{ {
NMHDR *pnmh = (NMHDR*)lParam;
if (pnmh->hwndFrom == sp->hWndPrincipalsList) if (pnmh->hwndFrom == sp->hWndPrincipalsList)
{ {
switch (pnmh->code) switch (pnmh->code)
@ -1123,170 +1125,179 @@ SecurityPageProc(IN HWND hwndDlg,
} }
} }
} }
break;
} }
break;
} case WM_COMMAND:
case WM_COMMAND:
{
switch (LOWORD(wParam))
{ {
case IDC_ADD_PRINCIPAL: switch (LOWORD(wParam))
{ {
HRESULT hRet; case IDC_ADD_PRINCIPAL:
sp = (PSECURITY_PAGE)GetWindowLongPtr(hwndDlg,
DWL_USER);
hRet = InitializeObjectPicker(sp->ServerName,
&sp->ObjectInfo,
&sp->pDsObjectPicker);
if (SUCCEEDED(hRet))
{ {
hRet = InvokeObjectPickerDialog(sp->pDsObjectPicker, HRESULT hRet;
hwndDlg,
AddSelectedPrincipal, hRet = InitializeObjectPicker(sp->ServerName,
sp); &sp->ObjectInfo,
if (FAILED(hRet)) &sp->pDsObjectPicker);
if (SUCCEEDED(hRet))
{ {
MessageBox(hwndDlg, L"InvokeObjectPickerDialog failed!\n", NULL, 0); hRet = InvokeObjectPickerDialog(sp->pDsObjectPicker,
hwndDlg,
AddSelectedPrincipal,
sp);
if (FAILED(hRet))
{
MessageBox(hwndDlg, L"InvokeObjectPickerDialog failed!\n", NULL, 0);
}
/* delete the instance */
FreeObjectPicker(sp->pDsObjectPicker);
/* reload the principal list */
FillPrincipalsList(sp);
} }
else
/* delete the instance */ {
FreeObjectPicker(sp->pDsObjectPicker); MessageBox(hwndDlg, L"InitializeObjectPicker failed!\n", NULL, 0);
}
/* reload the principal list */ break;
FillPrincipalsList(sp);
} }
else
case IDC_REMOVE_PRINCIPAL:
{ {
MessageBox(hwndDlg, L"InitializeObjectPicker failed!\n", NULL, 0); PPRINCIPAL_LISTITEM SelectedPrincipal;
SelectedPrincipal = (PPRINCIPAL_LISTITEM)ListViewGetSelectedItemData(sp->hWndPrincipalsList);
if (SelectedPrincipal != NULL)
{
/* FIXME */
}
break;
} }
break;
} }
break;
} }
break;
} case WM_SIZE:
case WM_SIZE:
{
sp = (PSECURITY_PAGE)GetWindowLongPtr(hwndDlg,
DWL_USER);
ResizeControls(sp,
(INT)LOWORD(lParam),
(INT)HIWORD(lParam));
break;
}
case WM_INITDIALOG:
{
sp = (PSECURITY_PAGE)((LPPROPSHEETPAGE)lParam)->lParam;
if(sp != NULL)
{ {
LV_COLUMN lvc; ResizeControls(sp,
RECT rcLvClient; (INT)LOWORD(lParam),
(INT)HIWORD(lParam));
sp->hWnd = hwndDlg; break;
sp->hWndPrincipalsList = GetDlgItem(hwndDlg, IDC_PRINCIPALS); }
sp->hBtnAdd = GetDlgItem(hwndDlg, IDC_ADD_PRINCIPAL);
sp->hBtnRemove = GetDlgItem(hwndDlg, IDC_REMOVE_PRINCIPAL); case WM_INITDIALOG:
sp->hBtnAdvanced = GetDlgItem(hwndDlg, IDC_ADVANCED); {
sp->hAceCheckList = GetDlgItem(hwndDlg, IDC_ACE_CHECKLIST); sp = (PSECURITY_PAGE)((LPPROPSHEETPAGE)lParam)->lParam;
sp->hPermissionsForLabel = GetDlgItem(hwndDlg, IDC_LABEL_PERMISSIONS_FOR); if(sp != NULL)
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; LV_COLUMN lvc;
} RECT rcLvClient;
sp->hWnd = hwndDlg;
sp->hWndPrincipalsList = GetDlgItem(hwndDlg, IDC_PRINCIPALS);
sp->hBtnAdd = GetDlgItem(hwndDlg, IDC_ADD_PRINCIPAL);
sp->hBtnRemove = GetDlgItem(hwndDlg, IDC_REMOVE_PRINCIPAL);
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 */ /* save the pointer to the structure */
SetWindowLongPtr(hwndDlg, SetWindowLongPtr(hwndDlg,
DWL_USER, DWL_USER,
(DWORD_PTR)sp); (DWORD_PTR)sp);
sp->hiPrincipals = ImageList_LoadBitmap(hDllInstance,
MAKEINTRESOURCE(IDB_USRGRPIMAGES),
16,
3,
RGB(255,
0,
255));
/* setup the listview control */
if (sp->hiPrincipals != NULL)
{
ListView_SetExtendedListViewStyleEx(sp->hWndPrincipalsList, ListView_SetExtendedListViewStyleEx(sp->hWndPrincipalsList,
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT,
LVS_EX_FULLROWSELECT); LVS_EX_FULLROWSELECT);
ListView_SetImageList(sp->hWndPrincipalsList,
sp->hiPrincipals, sp->hiPrincipals = ImageList_LoadBitmap(hDllInstance,
LVSIL_SMALL); MAKEINTRESOURCE(IDB_USRGRPIMAGES),
16,
3,
RGB(255,
0,
255));
/* setup the listview control */
if (sp->hiPrincipals != NULL)
{
ListView_SetImageList(sp->hWndPrincipalsList,
sp->hiPrincipals,
LVSIL_SMALL);
}
GetClientRect(sp->hWndPrincipalsList,
&rcLvClient);
/* add a column to the list view */
lvc.mask = LVCF_FMT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
lvc.cx = rcLvClient.right;
ListView_InsertColumn(sp->hWndPrincipalsList,
0,
&lvc);
ReloadPrincipalsList(sp);
FillPrincipalsList(sp);
ListViewSelectItem(sp->hWndPrincipalsList,
0);
/* calculate the columns of the allow/deny checkboxes */
SetAceCheckListColumns(sp->hAceCheckList,
CLB_ALLOW,
GetDlgItem(hwndDlg, IDC_LABEL_ALLOW));
SetAceCheckListColumns(sp->hAceCheckList,
CLB_DENY,
GetDlgItem(hwndDlg, IDC_LABEL_DENY));
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)
{
/* editing the permissions is least the user can do when
the advanced button is showed */
sp->ObjectInfo.dwFlags |= SI_EDIT_PERMS;
}
else
{
ShowWindow(sp->hBtnAdvanced,
SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_LABEL_ADVANCED),
SW_HIDE);
}
/* enable quicksearch for the permissions checklist control */
SendMessage(sp->hAceCheckList,
CLM_ENABLEQUICKSEARCH,
TRUE,
0);
UpdateControlStates(sp);
} }
GetClientRect(sp->hWndPrincipalsList, Ret = TRUE;
&rcLvClient); break;
/* add a column to the list view */
lvc.mask = LVCF_FMT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
lvc.cx = rcLvClient.right;
ListView_InsertColumn(sp->hWndPrincipalsList,
0,
&lvc);
ReloadPrincipalsList(sp);
FillPrincipalsList(sp);
ListViewSelectItem(sp->hWndPrincipalsList,
0);
/* calculate the columns of the allow/deny checkboxes */
SetAceCheckListColumns(sp->hAceCheckList,
CLB_ALLOW,
GetDlgItem(hwndDlg, IDC_LABEL_ALLOW));
SetAceCheckListColumns(sp->hAceCheckList,
CLB_DENY,
GetDlgItem(hwndDlg, IDC_LABEL_DENY));
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)
{
/* editing the permissions is least the user can do when
the advanced button is showed */
sp->ObjectInfo.dwFlags |= SI_EDIT_PERMS;
}
else
{
ShowWindow(sp->hBtnAdvanced,
SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_LABEL_ADVANCED),
SW_HIDE);
}
/* enable quicksearch for the permissions checklist control */
SendMessage(sp->hAceCheckList,
CLM_ENABLEQUICKSEARCH,
TRUE,
0);
UpdateControlStates(sp);
} }
break;
} }
} }
return 0; return Ret;
} }

View file

@ -1498,14 +1498,17 @@ CheckListWndProc(IN HWND hwnd,
{ {
hdc = (wParam != 0 ? (HDC)wParam : BeginPaint(hwnd, &ps)); hdc = (wParam != 0 ? (HDC)wParam : BeginPaint(hwnd, &ps));
PaintControl(infoPtr, if (hdc != NULL)
hdc,
&rcUpdate);
if (wParam == 0)
{ {
EndPaint(hwnd, PaintControl(infoPtr,
&ps); hdc,
&rcUpdate);
if (wParam == 0)
{
EndPaint(hwnd,
&ps);
}
} }
} }
break; break;

View file

@ -338,6 +338,19 @@ InvokeObjectPickerDialog(IN IDsObjectPicker *pDsObjectPicker,
} }
GlobalUnlock(stm.hGlobal); GlobalUnlock(stm.hGlobal);
if (SUCCEEDED(hRet))
{
/* return S_OK instead of possible other success codes if
everything went well */
hRet = S_OK;
}
}
else
{
/* unable to translate the selection pointer handle, indicate
failure */
hRet = E_FAIL;
} }
ReleaseStgMedium(&stm); ReleaseStgMedium(&stm);