http://qs321.pair.com?node_id=204658

rgold has asked for the wisdom of the Perl Monks concerning the following question:

I'm attempting to add a user to a security object using the Win32::Perms package, but have not had any success.

I'm using IndigoPerl, on a Win2K system, rather than ActiveState's Perl. I was able to install the Win32::Perms package using IndioPerl's Package Manager. I obtained the package directly from http://www.roth.net/perl/packages/win32-perms.ppd. The version of IndigoPerl is perl, v5.6.1 built for MSWin32-x86-multi-thread.

The following is a code fragment from my Perl script.

$path = "F:\Test"; $sd = new Win32::Perms($path); $result = $sd -> Allow( "SYSTEM", FULL ); if ($result == 0) { print "Win32 error number: $Win32Error\n"; print "Win32 error message: ", Win32::FormatMessage ($Win32Error), "\n"; }
This code always fails. The Win32 error number is 53 which is "The network path was not found". I get the same error if I use a different user (e.g., SYSTEM) or if I use the sd -> Add() instead of Allow().

Note: I've been able to dump the contents of a security descriptor (using Dump() or Get()) and remove a user account from the security descriptor. Also, I've been able to copy a set of permissions from one study descriptor to another.

What am I doing wrong? Or doesn't the Win32::Perms package work with any other Perl except ActiveState?

Thanks,

Rob

Replies are listed 'Best First'.
Re: Problem using Win32::Perms
by hiseldl (Priest) on Oct 11, 2002 at 22:50 UTC

    You may need double backslashes, e.g. $path = "F:\\Test";

    --
    hiseldl
    What time is it? It's Camel Time!

Re: Problem using Win32::Perms
by VSarkiss (Monsignor) on Oct 11, 2002 at 20:59 UTC

    Use either: $path = 'F:\Test';or $path = "F:/Test";In other words, either forward slashes or single quotes.

      I tried both, but I'm getting the same error.