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

Hi there. I'm attempting to use Win32::RASE to automate the creation of a dial-up connection.

I've read the docs for the module, and it seems it hasn't been updated for a while - since 2000, I believe. It only mentions successfully running on Windows NT, nothing higher.

However, it seems to be a wrapper for Win32::API calls to the rasapi32.dll functions, which in theory are supposed to work on every win32 version.

I'm trying to use it on Windows 2000; I'm getting some odd behaviour. If I use the standard syntax as described in the documentation, sometimes it creates the connectoid as indicated, but othertimes it doesn't even do that. Even if it successfully creates a connectoid, it always dies immediately after with an "application error" - saying something about an instruction at some hex address tried to reference an instruction at some other hex address, and the memory could not be "written".

I stuck some print statements into RASE.pm just to clarify, and sure enough, if I try to call the sub RaseCreateEntry() with appropriate arguments, the sub appears to be dying right after the following snippet:

$RasSetEntryProperties ||= new("rasapi32", "RasSetEntryProperties", [P +,P,P,N,P,N], N); my $ret = $RasSetEntryProperties->Call($PHONEBOOK||0, $props->{name}, $RASENTRY, length($RASENTRY),0,0);

Anyone have any thoughts on what I can try to correct this? I suppose I can experiment with using the Win32::API directly with the RAS* functions - I haven't done that before, but no time like the present to learn, I suppose :)

Replies are listed 'Best First'.
Re: Win32::RASE problems
by BrowserUk (Patriarch) on Aug 17, 2003 at 20:46 UTC

    Reporting error message as "something like..." isn't very helpful!

    The likely source of the problem is that the third parameter to RasSetEntryProperties is a RASENTRY structure. And this structure gained some new fields as of NT 5.00 (Win2K) and a few more as of NT 5.01. If the module has not been updated since 2000 and hasn't been modified for use with version later than 4.x, then it is quite probable that the structure the module is passing does not have these new fields, and when your OS attempts to access those new fields, it segfaults.

    There is no need to discard the module completely, you only need to update the structure that is being passed for parameter 3 (and check the others). You'll need the same information either way, and there's little point in throwing the baby out with the bathwater:)

    A couple of links to get you started.

    RasSetEntryProperties and RASENTRY struct


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.