[PATCH v2 1/5] aclui: Add an empty ACE editor dialog.

Zebediah Figura z.figura12 at gmail.com
Sun Feb 28 10:27:45 CST 2021


From: Michael Müller <michael at fds-team.de>

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/aclui/Makefile.in  |   3 ++
 dlls/aclui/aclui.rc     |  38 ++++++++++++++
 dlls/aclui/aclui_main.c | 106 ++++++++++++++++++++++++++++++++++++++--
 dlls/aclui/resource.h   |  36 ++++++++++++++
 4 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 dlls/aclui/aclui.rc
 create mode 100644 dlls/aclui/resource.h

diff --git a/dlls/aclui/Makefile.in b/dlls/aclui/Makefile.in
index e79b3fe9e33..da3aa00084e 100644
--- a/dlls/aclui/Makefile.in
+++ b/dlls/aclui/Makefile.in
@@ -1,6 +1,9 @@
 MODULE    = aclui.dll
 IMPORTLIB = aclui
+IMPORTS   = comctl32 user32
 
 EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
 
 C_SRCS = aclui_main.c
+
+RC_SRCS = aclui.rc
diff --git a/dlls/aclui/aclui.rc b/dlls/aclui/aclui.rc
new file mode 100644
index 00000000000..3a03b0550e9
--- /dev/null
+++ b/dlls/aclui/aclui.rc
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "resource.h"
+#include "winresrc.h"
+
+#pragma makedep po
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+
+IDD_SECURITY_PROPERTIES DIALOGEX 0, 0, 240, 215
+STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION
+CAPTION "Security"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "&Group or user names:", -1, 5, 5, 230, 10
+    CONTROL "", IDC_USERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | LVS_SORTASCENDING | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 5, 17, 230, 63, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
+
+    LTEXT "", IDC_ACE_USER, 5, 105, 110, 10
+    LTEXT "Allow", -1, 120, 105, 55, 10, SS_CENTER
+    LTEXT "Deny",  -1, 180, 105, 55, 10, SS_CENTER
+    CONTROL "", IDC_ACE, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER |  LVS_SINGLESEL | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 5, 115, 230, 95, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
+END
diff --git a/dlls/aclui/aclui_main.c b/dlls/aclui/aclui_main.c
index 1a03f30df24..3989c3017aa 100644
--- a/dlls/aclui/aclui_main.c
+++ b/dlls/aclui/aclui_main.c
@@ -19,22 +19,110 @@
  */
 
 #include <stdarg.h>
-
+#define COBJMACROS
 #include "initguid.h"
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
 #include "winnt.h"
 #include "aclui.h"
+#include "resource.h"
 
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(aclui);
 
-HPROPSHEETPAGE WINAPI CreateSecurityPage(LPSECURITYINFO psi)
+/* the aclui.h files does not contain the necessary COBJMACROS */
+#define ISecurityInformation_AddRef(This) (This)->lpVtbl->AddRef(This)
+#define ISecurityInformation_Release(This) (This)->lpVtbl->Release(This)
+#define ISecurityInformation_GetObjectInformation(This, obj) (This)->lpVtbl->GetObjectInformation(This, obj)
+#define ISecurityInformation_GetSecurity(This, info, sd, def) (This)->lpVtbl->GetSecurity(This, info, sd, def)
+#define ISecurityInformation_GetAccessRights(This, type, flags, access, count, def) (This)->lpVtbl->GetAccessRights(This, type, flags, access, count, def)
+
+struct security_page
+{
+    SI_OBJECT_INFO info;
+
+    HWND dialog;
+};
+
+static HINSTANCE aclui_instance;
+
+static void security_page_free(struct security_page *page)
+{
+    free(page);
+}
+
+static void security_page_init_dlg(HWND hwnd, struct security_page *page)
+{
+    page->dialog = hwnd;
+}
+
+static INT_PTR CALLBACK security_page_proc(HWND dialog, UINT msg, WPARAM wparam, LPARAM lparam)
 {
-    FIXME("(%p): stub\n", psi);
-    return NULL;
+    switch (msg)
+    {
+        case WM_INITDIALOG:
+        {
+            PROPSHEETPAGEW *propsheet = (PROPSHEETPAGEW *)lparam;
+            security_page_init_dlg(dialog, (struct security_page *)propsheet->lParam);
+            break;
+        }
+    }
+    return FALSE;
+}
+
+static UINT CALLBACK security_page_callback(HWND hwnd, UINT msg, PROPSHEETPAGEW *ppsp)
+{
+    struct security_page *page = (struct security_page *)ppsp->lParam;
+
+    if (msg == PSPCB_RELEASE)
+        security_page_free(page);
+
+    return 1;
+}
+
+HPROPSHEETPAGE WINAPI CreateSecurityPage(ISecurityInformation *security)
+{
+    struct security_page *page;
+    PROPSHEETPAGEW propsheet;
+    HPROPSHEETPAGE ret;
+
+    TRACE("%p\n", security);
+
+    InitCommonControls();
+
+    if (!(page = calloc(1, sizeof(*page))))
+        return NULL;
+
+    if (FAILED(ISecurityInformation_GetObjectInformation(security, &page->info)))
+    {
+        free(page);
+        return NULL;
+    }
+
+    memset(&propsheet, 0, sizeof(propsheet));
+    propsheet.dwSize        = sizeof(propsheet);
+    propsheet.dwFlags       = PSP_DEFAULT | PSP_USECALLBACK;
+    propsheet.hInstance     = aclui_instance;
+    propsheet.pszTemplate   = (WCHAR *)MAKEINTRESOURCE(IDD_SECURITY_PROPERTIES);
+    propsheet.pfnDlgProc    = security_page_proc;
+    propsheet.pfnCallback   = security_page_callback;
+    propsheet.lParam        = (LPARAM)page;
+
+    if (page->info.dwFlags & SI_PAGE_TITLE)
+    {
+        propsheet.pszTitle = page->info.pszPageTitle;
+        propsheet.dwFlags |= PSP_USETITLE;
+    }
+
+    if (!(ret = CreatePropertySheetPageW(&propsheet)))
+    {
+        ERR("Failed to create property sheet page.\n");
+        free(page);
+        return NULL;
+    }
+    return ret;
 }
 
 BOOL WINAPI EditSecurity(HWND owner, LPSECURITYINFO psi)
@@ -42,3 +130,13 @@ BOOL WINAPI EditSecurity(HWND owner, LPSECURITYINFO psi)
     FIXME("(%p, %p): stub\n", owner, psi);
     return FALSE;
 }
+
+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
+{
+    if (reason == DLL_PROCESS_ATTACH)
+    {
+        aclui_instance = instance;
+        DisableThreadLibraryCalls(instance);
+    }
+    return TRUE;
+}
diff --git a/dlls/aclui/resource.h b/dlls/aclui/resource.h
new file mode 100644
index 00000000000..f92d99692c7
--- /dev/null
+++ b/dlls/aclui/resource.h
@@ -0,0 +1,36 @@
+/*
+ * Definitions for aclui dialog controls
+ *
+ * Copyright (c) 2017 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_ACLUI__
+#define __WINE_ACLUI__
+
+#define IDD_SECURITY_PROPERTIES  100
+
+#define IDC_USERS          101
+
+#define IDC_ACE_USER       110
+#define IDC_ACE            111
+
+#define IDS_PERMISSION_FOR 1000
+
+#define IDB_USER_ICONS     2000
+#define IDB_CHECKBOX       2001
+
+#endif /* __WINE_ACLUI__ */
-- 
2.30.1




More information about the wine-devel mailing list