Martin,

As you asked, this is just a browse, but two things strike me:

* The line that fails probably isn't setting anything, because you do not
appear to have assigned $Dir a value. You _have_ assigned $dir a value, but
Perl is case-sensitive, so that does you no good.

* The value you are assigning to $dir is not a valid Windows file
specification. Because you used the so-called double-quote character, Perl
did interpolation on the string. It saw the "\t" and said "Oh, he wants me
to insert a tab character here." So it did, and $dir ends up containing "c:
test". The ways to fix this are either by doubling the backslash, changing
it to a front slash, or using the single-quote character.

You could have found both of these yourself by displaying the values of the
variables, rather than simply assuming that they contained what you thought
they contained. This is (_almost_ always!) the first thing I do when any
program in any language doesn't behave as I think it should. The Perl
compiler would have told you about $Dir if you had a "use strict;" at the
top, though of course this implies other changes.

Tom Wyant

PS to the list again - I haven't seen my previous post come through, so I
don't know if I still have the multiple disclaimer problem. My apologies if
it persists. Sigh. - TRW





"Martin Wheldon" <[EMAIL PROTECTED]>@listserv.ActiveState.com
on 10/08/2002 10:22:46 AM

Sent by:    [EMAIL PROTECTED]


To:    <[EMAIL PROTECTED]>
cc:
Subject:    Win32::Perms problem


Hi,

Could anyone have a browse over the following code and hopefully tell me
where I'm going wrong.
I'm running Win2k pro and Actvive perl 5.6.1 build 631

use Win32::Perms;

# Directory to set permissions on
$dir = "c:\test";

#create NULL security descriptor or die
$secdesc = new Win32::Perms() || die;

#import the current permissions into newly created security descriptor
$secdesc->Import($Dir);

#Allow user martin rights to directory in Discretionary ACL
$secdesc->Allow('Martin', READ, CONTAINER_INHERIT_ACE);
$secdesc->Allow('Martin', READ, OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE);

#print info for security descriptor
$secdesc->Dump;

#all works fine to this point the last line returns a fail
#assign security descriptor to directory
$secdesc->Set($Dir);

Thanks in advance


Martin Wheldon

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs





This communication is for use by the intended recipient and contains 
information that may be privileged, confidential or copyrighted under
applicable law.  If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited.  Please notify the sender
by return e-mail and delete this e-mail from your system.  Unless
explicitly and conspicuously designated as "E-Contract Intended",
this e-mail does not constitute a contract offer, a contract amendment,
or an acceptance of a contract offer.  This e-mail does not constitute
a consent to the use of sender's contact information for direct marketing
purposes or for transfers of data to third parties.

 Francais Deutsch Italiano  Espanol  Portuges  Japanese  Chinese  Korean

            http://www.DuPont.com/corp/email_disclaimer.html


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to