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

When I try simply to use Win32::NetResource (part of the standard distribution on Win32 perls), on Win98, I get the following response:
>.\perl -MWin32::NetResource -e "print 1" Can't load 'D:/programs/indigoperl/site/lib/auto/Win32/NetResource/Net +Resource.d ll' for module Win32::NetResource: load_file:A device attached to the +system is not functioning at D:/programs/indigoperl/lib/DynaLoader.pm line 206. at -e line 0 Compilation failed in require. BEGIN failed--compilation aborted.
This is IndigoPerl 5.6.1. I get an almost identical result on the other perls, ActivePerl 5.6.1 build 631 and 5.8.3 build 809.

My network seems to be working OK, I can browse the shares and open files in Perl scripts, both with a mapped drive letter and with an UNC path.

It works on my other computer (an XP laptop). What can I do about it?

All I want is to use the Win32 API call NetShareGetInfo(), and maybe GetUNCName(). If anybody knows about a less sensitive module than this one, to achieve the same task, suggestions are welcome.

Replies are listed 'Best First'.
Re: Failure to load Win32::NetResource
by BrowserUk (Patriarch) on Sep 13, 2004 at 21:19 UTC

    From a cursory scan of the MSDN pages for the API's imported by NetResource.dll, it looks like they should all be available under '98. However, if you are passing in strings that contain wide chars, then the code will be trying to use the xxxW versions of the APIs and these are only available under '98 if you have installed MS Layer for Unicode.

    You might be able to bypass the problem by using Win32::Api to use the ascii suffix versions of the apis directly, but if your UNC contain wide chars, that may not help.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
      Well I tried the alternative route, as per your suggestion:
      use Win32::API; my $netShareGetInfo = Win32::API->new('NETAPI32', 'NetShareGetInfo', ' +PPNP', 'N') or die "Can't initialize function";
      Again, this loads fine on XP and fails on Win98. NETAPI32.DLL does exist, in Windows's system directory.

        Maybe this is the cause?

        Platform SDK: Network Management NetShareGetInfo The NetShareGetInfo function retrieves information about a particular shared resource on a server. Windows Me/98/95: The parameters for this function are different from those listed in the syntax block. For more information and syntax, see the Windows Me/98/95 information in the Remarks section.

        There is more information + a link to some sample code via the link above.

        HTH.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon