Announcement

Collapse
No announcement yet.

RAS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RAS

    I need to dial a server on an 800 number from an application.

    Anyone who is familiar with RAS, can you tell me if I can dial a number and connect to a server if there is not an existing dialup entry.

    --Dave


    -------------
    Home of the BASIC Gurus
    www.basicguru.com
    Home of the BASIC Gurus
    www.basicguru.com

  • #2
    Dave,

    I have done RAS with VB and I have always had to make sure there was a dial up entry. It can contain all the defaults, even a fake phone number. You can then set the ph number at runtime.

    Hope This Helps.

    ------------------

    Comment


    • #3
      Dave,

      I've only used RAS with existing entries, but I believe that it can be done "from scratch" with the RasDial function. This function references a RASDIALPARAMS structure which you can populate with a phone number and entry name, among other details. If the entry name is set to an empty string, the phone number is used.
      You'll find the declares/constants for this in Don Dickinson's ras32b.inc file, if you don't already have them.


      ------------------
      Peter Amick
      Baybuild Solutions
      Peter Amick
      Baybuild Solutions

      Comment


      • #4
        I was going to reply with the same thing as Peter, but I had a quick look at some FTP client coding I did for a customer, and although I could set all the properties of the RASDIALPARAMS, I couldn't see where the modem Comm port was set.

        Like everyone else, I think that you need to create an entry which has fake values APART from the modem, and set everything else with RASDIALPARAMS. Maybe a workaround would be to call the API's needed to create a RAS entry at runtime, populate it, and then destroy it at program termination.

        Just my ramblings....

        Dorian.

        ------------------

        Comment


        • #5
          Thanks guys! I'll let you know how it works out.

          --Dave


          ------------------
          Home of the BASIC Gurus
          www.basicguru.com
          Home of the BASIC Gurus
          www.basicguru.com

          Comment


          • #6
            Check out this site: http://www.gsat.edu.au/~billmcc/PlatformVB/

            You can find a lot of ras examples, although in VB but very usefull I think.

            ------------------

            Comment


            • #7
              Erwin,

              I tried the URL you recommend, but got the following when connecting to DUN (= dial up networking, I assume): "You are not autorized to view this page"

              ------------------

              Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
              http://zijlema.basicguru.eu
              *** Opinions expressed here are not necessarily untrue ***

              Comment


              • #8
                I think the url you want is http://home.iprimus.com.au/billmcc/platformvb/.
                Some very good RAS stuff there. I'm trying out some sample code from this site right now for a project I'm working on.

                ------------------
                Peter Amick
                Baybuild Solutions
                Peter Amick
                Baybuild Solutions

                Comment


                • #9
                  Just another thought on this. Most of the RAS API calls allows you to specify a path to a phonebook. Why not just create a custom phone book that contains the necessary information, ship it with the software and install it in the subdirectory that the software gets installed in. It's then easy enough for you to enumerate the default phonebook, see what modem is installed and determine it's characteristics (phonebook.pbk is an .INI file, after all) and alter your phonebook to use the installed modem. The entries you'd be intrested in would be:

                  MEDIA=
                  Port=
                  OtherPortOk=
                  Device=
                  ConnectBPS=



                  ------------------

                  Comment


                  • #10
                    I have a headache...

                    If you add up all of the member sizes in RASENTRY, the size should be 1768 bytes. Yet I keep coming up with 1766 bytes (two bytes short!).
                    Code:
                    TYPE RASENTRY
                      dwSize AS DWORD
                      dwfOptions AS DWORD
                     
                      'Location/phone number
                      dwCountryID AS DWORD
                      dwCountryCode AS DWORD
                      szAreaCode AS ASCIIZ * %RAS_MAXAREACODE + 1
                      szLocalPhoneNumber AS ASCIIZ * %RAS_MAXPHONENUMBER + 1
                      dwAlternateOffset AS DWORD
                     
                      ' PPP/ip
                      ipaddr AS LONG 'RASIPADDR
                      ipaddrDns AS LONG 'RASIPADDR
                      ipaddrDnsAlt AS LONG 'RASIPADDR
                      ipaddrWins AS LONG 'RASIPADDR
                      ipaddrWinsAlt AS LONG 'RASIPADDR
                     
                      ' Framing
                      dwFrameSize AS DWORD
                      dwfNetProtocols AS DWORD
                      dwFramingProtocol AS DWORD
                     
                      ' Scripting
                      szScript AS ASCIIZ * %MAX_PATH
                     
                      ' Autodial
                      szAutoDialDll AS ASCIIZ * %MAX_PATH
                      szAutoDialFunc AS ASCIIZ * %MAX_PATH
                     
                      ' Device
                      szDeviceType AS ASCIIZ * %RAS_MAXDEVICETYPE + 1
                      szDeviceName AS ASCIIZ * %RAS_MAXDEVICENAME + 1
                     
                      ' X.25
                      szX25PadType AS ASCIIZ * %RAS_MAXPADTYPE + 1
                      szX25Address AS ASCIIZ * %RAS_MAXX25ADDRESS + 1
                      szX25Facilities AS ASCIIZ * %RAS_MAXFACILITIES + 1
                      szX25UserData AS ASCIIZ * %RAS_MAXUSERDATA + 1
                      dwChannels AS DWORD
                     
                      ' Reserved
                      dwReserved1 AS DWORD
                      dwReserved2 AS DWORD
                    END TYPE
                    My copy of RAS.H has RAS_MaxDeviceName as 128. The web site http://home.iprimus.com.au/billmcc/platformvb/ that you guys recommended says that it should be 256 in Windows 95/98, but that makes things worse, not better.

                    I can't find anything in the knowledge base about this problem and I'm all out of hair to pull out.

                    --Dave

                    ------------------
                    Home of the BASIC Gurus
                    www.basicguru.com
                    Home of the BASIC Gurus
                    www.basicguru.com

                    Comment


                    • #11
                      Hi Dave

                      looking at my copy of RAS.H I get the same results as you - and
                      RAS_MAXDEVICENAME is defined as 128.

                      However I think the solution to the problem would be to add
                      a 2 byte padding to the structure since RAS.H includes the
                      file pshpack4.h.

                      This is the abstract from the file
                      Abstract:

                      This file turns 4 byte packing of structures on. (That is, it disables
                      automatic alignment of structure fields.) An include file is needed
                      because various compilers do this in different ways. For Microsoft
                      compatible compilers, this files uses the push option to the pack pragma
                      so that the poppack.h include file can restore the previous packing
                      reliably.
                      The file defines #pragma pack(4) which in effect tells the compiler
                      to store each structure member after the first on "the smaller member
                      type or n-byte boundary".

                      Cheers

                      Florent

                      ------------------


                      [This message has been edited by Florent Heyworth (edited July 07, 2000).]

                      Comment


                      • #12
                        Thanks Florent. I discovered that info after hours of frustration. Why they just don't document it in the SDK is beyond me.

                        I can now call RasGetEntryProperties() to get the data for any existing RAS entry.

                        However, RasSetEntryProperties() will not create an entry as its supposed to. I keep getting an error code 1784 which isn't defined anywhere.

                        --Dave


                        ------------------
                        Home of the BASIC Gurus
                        www.basicguru.com
                        Home of the BASIC Gurus
                        www.basicguru.com

                        Comment


                        • #13
                          C conversion note:

                          If the .H header contains a line like
                          Code:
                          #include <pshpack4.h>
                          or
                          Code:
                          #pragma pack(4)
                          the digit involved describes the default structure packing. Typically, this will be a small power of two. A 1 indicates BYTE packing, a 2 indicates WORD packing, and a 4 indicates DWORD packing. When translating to PowerBASIC, use the appropriate packing qualifier when creating your TYPE.

                          In this particular case, rather than
                          Code:
                          TYPE RASENTRY
                          (which defaults to BYTE packing), you need to specify DWORD packing:
                          Code:
                          TYPE RASENTRY DWORD

                          ------------------
                          Tom Hanlin
                          PowerBASIC Staff

                          Comment


                          • #14
                            Hi Tom

                            in general you're right however not in this particular case unless
                            I'm missing something:

                            the pragma pack(4) directive does specify alignment on member
                            boundaries however if you read the description attentively:

                            the pragma pack(n) directive aligns each member after the first
                            on "THE SMALLER MEMBER TYPE OR N-BYTE BOUNDARY" - which is not
                            quite the same as what PowerBASIC's TYPE DWORD does.

                            From the PowerBASIC help file:
                            TYPE DWORD: Each member will be aligned on a DWORD boundary.
                            Up to three bytes will be skipped to accomplish this
                            alignment
                            In this case the structure alignment using TYPE DWORD would result
                            in a SIZEOF(RASENTRY) of 1788 instead of the desired 1768.

                            Dave

                            glad it's working, they certainly buried that one - a propos your
                            ERROR 1784: this corresponds to ERROR_INVALID_USER_BUFFER - something's
                            not initialised properly (kind of vague 8-).

                            Cheers

                            Florent




                            ------------------

                            Comment


                            • #15
                              >> glad it's working, they certainly buried that one - a propos your ERROR 1784: this corresponds to ERROR_INVALID_USER_BUFFER - something's not initialised properly (kind of vague 8-). <<

                              Which is strange since I am getting the buffer from Windows 98 and passing it right back with a new name. If I modify the phone number and pass it back with the same name, it does get modified and no error occurs.

                              I think I'm ready to fly out to Redmond and start kicking some booty.

                              ----

                              Tom,

                              TYPE RASENTRY DWORD does not work the same way and does not work. You have to manually add two dummy bytes to the buffer to get things working.

                              --Dave


                              ------------------
                              Home of the BASIC Gurus
                              www.basicguru.com
                              Home of the BASIC Gurus
                              www.basicguru.com

                              Comment


                              • #16
                                Hi Dave

                                did you try calling the RasValidateEntryName prior to passing the
                                RASENTRY structure to RasSetEntryProperties?

                                Just a shot in the dark

                                Florent

                                ------------------

                                Comment


                                • #17
                                  Yeah, I saw that in the SDK docs and tried calling it. But it still doesn't help.

                                  No matter what I try, I can't seem to create an entry. But I can modify existing entries without any problems.

                                  --Dave


                                  ------------------
                                  Home of the BASIC Gurus
                                  www.basicguru.com
                                  Home of the BASIC Gurus
                                  www.basicguru.com

                                  Comment


                                  • #18
                                    Originally posted by Dave Navarro:

                                    But I can modify existing entries without any problems.

                                    --Dave

                                    Dave, are you able to modify the password? I've been having some trouble with that. Whatever I do seems to set the password to a blank string.



                                    ------------------
                                    Peter Amick
                                    Baybuild Solutions
                                    Peter Amick
                                    Baybuild Solutions

                                    Comment


                                    • #19
                                      Dial up networking entries don't store the name or password.

                                      That's stored elsewhere and can be set when you call RasDial (or so it seems, I'll let you know as soon as I have some actual working code for my custom dialer).

                                      --Dave


                                      ------------------
                                      Home of the BASIC Gurus
                                      www.basicguru.com
                                      Home of the BASIC Gurus
                                      www.basicguru.com

                                      Comment


                                      • #20
                                        Man do I feel really stupid.

                                        After fighting with this thing for over a week, I finally discovered that it was a problem with the DECLARE in RAS32.INC

                                        That should have been the first place I looked.

                                        I hope to have an example for a complete RAS dialer replacement in the source code section within a week or two.

                                        If anyone wants my RAS32.INC, just email me at [email protected]

                                        --Dave


                                        ------------------
                                        Home of the BASIC Gurus
                                        www.basicguru.com
                                        Home of the BASIC Gurus
                                        www.basicguru.com

                                        Comment

                                        Working...
                                        X