aclui: Add icons to the users list.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Müller 2021-02-28 10:27:47 -06:00 committed by Alexandre Julliard
parent f57356ad44
commit fe7d44dfa3
4 changed files with 39 additions and 2 deletions

View File

@ -1,6 +1,6 @@
MODULE = aclui.dll MODULE = aclui.dll
IMPORTLIB = aclui IMPORTLIB = aclui
IMPORTS = comctl32 user32 advapi32 IMPORTS = comctl32 user32 advapi32 gdi32
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native

View File

@ -40,3 +40,8 @@ BEGIN
| WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP,
5, 115, 230, 95, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE 5, 115, 230, 95, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
END END
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: user_icons.bmp */
IDB_USER_ICONS BITMAP user_icons.bmp

View File

@ -55,6 +55,7 @@ struct security_page
unsigned int user_count; unsigned int user_count;
HWND dialog; HWND dialog;
HIMAGELIST image_list;
}; };
static HINSTANCE aclui_instance; static HINSTANCE aclui_instance;
@ -110,11 +111,12 @@ static void add_user(struct security_page *page, PSID sid)
user->name = name; user->name = name;
user->sid = sid; user->sid = sid;
item.mask = LVIF_PARAM | LVIF_TEXT; item.mask = LVIF_PARAM | LVIF_TEXT | LVIF_IMAGE;
item.iItem = -1; item.iItem = -1;
item.iSubItem = 0; item.iSubItem = 0;
item.pszText = name; item.pszText = name;
item.lParam = (LPARAM)user; item.lParam = (LPARAM)user;
item.iImage = (sid_type == SidTypeGroup || sid_type == SidTypeWellKnownGroup) ? 0 : 1;
SendMessageW(GetDlgItem(page->dialog, IDC_USERS), LVM_INSERTITEMW, 0, (LPARAM)&item); SendMessageW(GetDlgItem(page->dialog, IDC_USERS), LVM_INSERTITEMW, 0, (LPARAM)&item);
} }
@ -160,6 +162,30 @@ static void init_users(struct security_page *page)
} }
} }
static HIMAGELIST create_image_list(UINT resource, UINT width, UINT height, UINT count, COLORREF mask_color)
{
HIMAGELIST image_list;
HBITMAP image;
INT ret;
if (!(image_list = ImageList_Create(width, height, ILC_COLOR32 | ILC_MASK, 0, count)))
return NULL;
if (!(image = LoadBitmapW(aclui_instance, MAKEINTRESOURCEW(resource))))
{
ImageList_Destroy(image_list);
return NULL;
}
ret = ImageList_AddMasked(image_list, image, mask_color);
DeleteObject(image);
if (ret == -1)
{
ImageList_Destroy(image_list);
return NULL;
}
return image_list;
}
static void security_page_free(struct security_page *page) static void security_page_free(struct security_page *page)
{ {
unsigned int i; unsigned int i;
@ -169,6 +195,8 @@ static void security_page_free(struct security_page *page)
free(page->users); free(page->users);
LocalFree(page->sd); LocalFree(page->sd);
if (page->image_list)
ImageList_Destroy(page->image_list);
if (page->security) if (page->security)
ISecurityInformation_Release(page->security); ISecurityInformation_Release(page->security);
free(page); free(page);
@ -199,6 +227,10 @@ static void security_page_init_dlg(HWND hwnd, struct security_page *page)
column.cx = rect.right - rect.left; column.cx = rect.right - rect.left;
SendMessageW(control, LVM_INSERTCOLUMNW, 0, (LPARAM)&column); SendMessageW(control, LVM_INSERTCOLUMNW, 0, (LPARAM)&column);
if (!(page->image_list = create_image_list(IDB_USER_ICONS, 18, 18, 2, RGB(255, 0, 255))))
return;
SendMessageW(control, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)page->image_list);
init_users(page); init_users(page);
if (page->user_count) if (page->user_count)

BIN
dlls/aclui/user_icons.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB