Author: hpoussin
Date: Fri Oct 13 23:50:02 2006
New Revision: 24505
URL:
http://svn.reactos.org/svn/reactos?rev=24505&view=rev
Log:
Set file security information (if provided in .inf file)
Modified:
trunk/reactos/dll/win32/setupapi/queue.c
trunk/reactos/dll/win32/setupapi/setupapi_private.h
Modified: trunk/reactos/dll/win32/setupapi/queue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/queue.c…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/queue.c (original)
+++ trunk/reactos/dll/win32/setupapi/queue.c Fri Oct 13 23:50:02 2006
@@ -35,15 +35,16 @@
struct file_op
{
- struct file_op *next;
- UINT style;
- WCHAR *src_root;
- WCHAR *src_path;
- WCHAR *src_file;
- WCHAR *src_descr;
- WCHAR *src_tag;
- WCHAR *dst_path;
- WCHAR *dst_file;
+ struct file_op *next;
+ UINT style;
+ WCHAR *src_root;
+ WCHAR *src_path;
+ WCHAR *src_file;
+ WCHAR *src_descr;
+ WCHAR *src_tag;
+ WCHAR *dst_path;
+ WCHAR *dst_file;
+ PSECURITY_DESCRIPTOR dst_sd;
};
struct file_op_queue
@@ -121,6 +122,7 @@
HeapFree( GetProcessHeap(), 0, op->src_descr );
HeapFree( GetProcessHeap(), 0, op->src_tag );
HeapFree( GetProcessHeap(), 0, op->dst_path );
+ if (op->dst_sd) LocalFree( op->dst_sd);
if (op->dst_file != op->src_file) HeapFree( GetProcessHeap(), 0,
op->dst_file );
t = op;
op = op->next;
@@ -490,8 +492,9 @@
op->src_tag = strdupW( params->SourceTagfile );
op->dst_path = strdupW( params->TargetDirectory );
op->dst_file = strdupW( params->TargetFilename );
+ op->dst_sd = NULL;
if (params->SecurityDescriptor)
- FIXME( "Need to apply %s to %s\n", debugstr_w(
params->SecurityDescriptor ), debugstr_w( op->dst_file ));
+ ConvertStringSecurityDescriptorToSecurityDescriptorW(
params->SecurityDescriptor, SDDL_REVISION_1, &op->dst_sd, NULL );
/* some defaults */
if (!op->src_file) op->src_file = op->dst_file;
@@ -1209,6 +1212,25 @@
op_result = handler( context, SPFILENOTIFY_COPYERROR,
(UINT_PTR)&paths, (UINT_PTR)newpath );
if (op_result == FILEOP_ABORT) goto done;
+ }
+ if (op->dst_sd)
+ {
+ PSID psidOwner = NULL, psidGroup = NULL;
+ PACL pDacl = NULL, pSacl = NULL;
+ SECURITY_INFORMATION security_info = 0;
+ BOOL present, dummy;
+
+ if (GetSecurityDescriptorOwner( op->dst_sd, &psidOwner, &dummy
) && psidOwner)
+ security_info |= OWNER_SECURITY_INFORMATION;
+ if (GetSecurityDescriptorGroup( op->dst_sd, &psidGroup, &dummy
) && psidGroup)
+ security_info |= GROUP_SECURITY_INFORMATION;
+ if (GetSecurityDescriptorDacl( op->dst_sd, &present, &pDacl,
&dummy ))
+ security_info |= DACL_SECURITY_INFORMATION;
+ if (GetSecurityDescriptorSacl( op->dst_sd, &present, &pSacl,
&dummy ))
+ security_info |= DACL_SECURITY_INFORMATION;
+ SetNamedSecurityInfoW( (LPWSTR)paths.Target, SE_FILE_OBJECT,
security_info,
+ psidOwner, psidGroup, pDacl, pSacl );
+ /* Yes, ignore the return code... */
}
handler( context, SPFILENOTIFY_ENDCOPY, (UINT_PTR)&paths, 0 );
}
Modified: trunk/reactos/dll/win32/setupapi/setupapi_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi_private.h (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi_private.h Fri Oct 13 23:50:02 2006
@@ -29,6 +29,7 @@
#define WIN32_NO_STATUS
#include <windows.h>
+#include <aclapi.h>
#include <cfgmgr32.h>
#include <fdi.h>
#include <regstr.h>