From 8fa77f76c91faf4b3c201bf47ad61d1708dc73d3 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Tue, 10 Aug 2004 15:47:54 +0000 Subject: [PATCH] implemented EditSecurity() svn path=/trunk/; revision=10478 --- reactos/lib/aclui/Makefile | 4 +- reactos/lib/aclui/aclui.c | 80 ++++++++++++++++++++++++++++++++++- reactos/lib/aclui/aclui.rc | 1 + reactos/lib/aclui/aclui_En.rc | 11 +++++ reactos/lib/aclui/internal.h | 3 ++ reactos/lib/aclui/resource.h | 2 + reactos/lib/aclui/stubs.c | 12 +----- 7 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 reactos/lib/aclui/aclui_En.rc diff --git a/reactos/lib/aclui/Makefile b/reactos/lib/aclui/Makefile index 7ce91a3f23e..3e372d2836b 100644 --- a/reactos/lib/aclui/Makefile +++ b/reactos/lib/aclui/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 2004/08/10 00:09:40 weiden Exp $ +# $Id: Makefile,v 1.2 2004/08/10 15:47:54 weiden Exp $ PATH_TO_TOP = ../.. @@ -24,7 +24,7 @@ TARGET_CFLAGS = \ TARGET_LFLAGS = -nostartfiles -nostdlib -TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a user32.a +TARGET_SDKLIBS = ntdll.a rosrtl.a kernel32.a comctl32.a user32.a TARGET_GCCLIBS = gcc diff --git a/reactos/lib/aclui/aclui.c b/reactos/lib/aclui/aclui.c index 36faee3c414..b26b46981e4 100644 --- a/reactos/lib/aclui/aclui.c +++ b/reactos/lib/aclui/aclui.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: aclui.c,v 1.2 2004/08/10 00:12:31 weiden Exp $ +/* $Id: aclui.c,v 1.3 2004/08/10 15:47:54 weiden Exp $ * * PROJECT: ReactOS Access Control List Editor * FILE: lib/aclui/aclui.c @@ -28,7 +28,9 @@ */ #define INITGUID #include +#include #include +#include #include "internal.h" #include "resource.h" @@ -56,3 +58,79 @@ DllMain(HINSTANCE hinstDLL, return TRUE; } +/* + * EditSecurity EXPORTED + * + * @implemented + */ +BOOL +WINAPI +EditSecurity(HWND hwndOwner, LPSECURITYINFO psi) +{ + HRESULT hRet; + SI_OBJECT_INFO ObjectInfo; + PROPSHEETHEADER psh; + HPROPSHEETPAGE hPages[1]; + LPWSTR lpCaption; + BOOL Ret; + + if(psi == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + + DPRINT("No ISecurityInformation class passed!\n"); + return FALSE; + } + + /* get the object information from the client interface */ + hRet = psi->lpVtbl->GetObjectInformation(psi, &ObjectInfo); + + if(FAILED(hRet)) + { + SetLastError(hRet); + + DPRINT("GetObjectInformation() failed!\n"); + return FALSE; + } + + /* create the page */ + hPages[0] = CreateSecurityPage(psi); + if(hPages[0] == NULL) + { + DPRINT("CreateSecurityPage(), couldn't create property sheet!\n"); + return FALSE; + } + + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_DEFAULT; + psh.hwndParent = hwndOwner; + psh.hInstance = hDllInstance; + if((ObjectInfo.dwFlags & SI_PAGE_TITLE) != 0 && + 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; + 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. */ + RosLoadAndFormatStr(hDllInstance, IDS_PSP_TITLE, &lpCaption, ObjectInfo.pszObjectName); + psh.pszCaption = lpCaption; + } + psh.nPages = sizeof(hPages) / sizeof(HPROPSHEETPAGE); + psh.nStartPage = 0; + psh.phpage = hPages; + + Ret = (PropertySheet(&psh) != -1); + + if(lpCaption != NULL) + { + LocalFree((HLOCAL)lpCaption); + } + + return Ret; +} + diff --git a/reactos/lib/aclui/aclui.rc b/reactos/lib/aclui/aclui.rc index 581091e27a2..7235e0b0502 100644 --- a/reactos/lib/aclui/aclui.rc +++ b/reactos/lib/aclui/aclui.rc @@ -37,4 +37,5 @@ BEGIN END END +#include "aclui_En.rc" diff --git a/reactos/lib/aclui/aclui_En.rc b/reactos/lib/aclui/aclui_En.rc new file mode 100644 index 00000000000..392d65a4643 --- /dev/null +++ b/reactos/lib/aclui/aclui_En.rc @@ -0,0 +1,11 @@ +#include +#include +#include "resource.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +{ + IDS_PSP_TITLE "Permissions for %1" +} + diff --git a/reactos/lib/aclui/internal.h b/reactos/lib/aclui/internal.h index 583b3eac633..62ea36faa88 100644 --- a/reactos/lib/aclui/internal.h +++ b/reactos/lib/aclui/internal.h @@ -1,6 +1,9 @@ #ifndef __ACLUI_INTERNAL_H #define __ACLUI_INTERNAL_H +ULONG DbgPrint(PCH Format,...); +#define DPRINT DbgPrint + extern HINSTANCE hDllInstance; #endif /* __ACLUI_INTERNAL_H */ diff --git a/reactos/lib/aclui/resource.h b/reactos/lib/aclui/resource.h index 33079ef23dd..7899f65293a 100644 --- a/reactos/lib/aclui/resource.h +++ b/reactos/lib/aclui/resource.h @@ -3,6 +3,8 @@ #define IDI_DEVMGR 100 +#define IDS_PSP_TITLE 1001 + #endif /* __ACLUI_RESOURCE_H */ /* EOF */ diff --git a/reactos/lib/aclui/stubs.c b/reactos/lib/aclui/stubs.c index a89f0b0b4b2..4bb9fc99de4 100644 --- a/reactos/lib/aclui/stubs.c +++ b/reactos/lib/aclui/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.2 2004/08/10 00:12:31 weiden Exp $ +/* $Id: stubs.c,v 1.3 2004/08/10 15:47:54 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS Access Control List Editor @@ -14,8 +14,6 @@ #include #include "internal.h" -ULONG DbgPrint(PCH Format,...); - #define UNIMPLEMENTED \ DbgPrint("ACLUI: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__) @@ -28,12 +26,4 @@ CreateSecurityPage(LPSECURITYINFO psi) return NULL; } -BOOL -WINAPI -EditSecurity(HWND hwndOwner, LPSECURITYINFO psi) -{ - UNIMPLEMENTED; - return FALSE; -} - /* EOF */