f



Win32-FileOp and Map

Hi Folks,

I know, thats not the right place for this question, but I hope someone can help me.

I want to map a network drive with Win32-FileOp->Map. With the version 0.14.1 under WinXP it works. Under Win7 with the version 0.16.02 it doesn't work.

Any idea ?

Thanks
Pit 
0
pit
12/9/2014 2:42:48 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

3 Replies
652 Views

Similar Articles

[PageSpeed] 48

On 12/9/2014 06:42, pit wrote:
> Hi Folks,
>
> I know, thats not the right place for this question, but I hope someone can help me.
>
> I want to map a network drive with Win32-FileOp->Map. With the version 0.14.1 under WinXP it works. Under Win7 with the version 0.16.02 it doesn't work.
>
> Any idea ?

How about a bit more info.  Which croak is it hitting?  Debug it
if you have to to see where it's erring off.  Also what arguments
did you call it with?  A very small failing script snippet would
be in order for others to try.
0
Bill
12/9/2014 8:00:24 PM
Am Dienstag, 9. Dezember 2014 21:00:30 UTC+1 schrieb $Bill:
> On 12/9/2014 06:42, pit wrote:
> > Hi Folks,
> >
> > I know, thats not the right place for this question, but I hope someone can help me.
> >
> > I want to map a network drive with Win32-FileOp->Map. With the version 0.14.1 under WinXP it works. Under Win7 with the version 0.16.02 it doesn't work.
> >
> > Any idea ?
> 
> How about a bit more info.  Which croak is it hitting?  Debug it
> if you have to to see where it's erring off.  Also what arguments
> did you call it with?  A very small failing script snippet would
> be in order for others to try.

Here my code snippet

$map = Win32::FileOp::Map($drive => $share, {persistent=>0,overwrite=>0});

$drive = "T:"
$share = "\\phlinux\usr2\"

after that $map is undefined.

Pit
0
pit
12/10/2014 9:22:01 AM
On 12/10/2014 01:22, pit wrote:
>
> Here my code snippet
>
> $map = Win32::FileOp::Map($drive => $share, {persistent=>0,overwrite=>0});
>
> $drive = "T:"
> $share = "\\phlinux\usr2\"
>
> after that $map is undefined.


That's not an actual code snippet that's been run and failed.

I tried a similar script and got undef returned (see below):
------------------------------------------------------------
use strict;
use warnings;
use Win32::FileOp;

my $drive = "T:";
# my $share = "\\phlinux\usr2\";	# not proper quoting
my $share = "//home/dbe";
my $map = Win32::FileOp::Map($drive => $share, { persistent => 0,
   overwrite => 0} );
printf "map='%s' GLE='%s' ($^E)\n", $map || 'undef', Win32::GetLastError();

__END__
------------------------------------------------------------

Then I looked at the Map sub and changed line 1432 from:
         return;
to:
         return $res;

And I got the following output from above script:

map='66' GLE='66' (The network resource type is not correct)

So that looks like a bug.

The problem is I don't have the 0.16.02 version, I have the 0.14.1 version
which appears to have the above bug in it - which you could always change
like I just did.

Check the code in your newer version and see what this part looks like
(starting around line 1423):

  if ($res = $Win32::FileOp::WNetAddConnection3->Call( $handle, $struct, $passwd, $username, $options)) {
     if (($res == 1202 or $res == 85) and ($opt->{overwrite} or $opt->{force_overwrite})) {
         Unmap($disk,{force => $opt->{force_overwrite}})
			or return;
		$Win32::FileOp::WNetAddConnection3->Call( $handle, $struct, $passwd, $username, $options)
			and return;
	} elsif ($res == 997) { # Overlapped I/O operation is in progress.
		return 1;
     } else {
         return $res;		# line I changed $Bill 1432 - looks like 1581 in 0.16.02
     }
  }

If it has the same line at what looks like 1581 on CPAN, try changing it like I did
and see what you get.  This time use a real test script that has code that actually
was run and failed like mine.


0
Bill
12/11/2014 12:33:19 AM
Reply: