Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. RasDial() howto

RasDial() howto

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminhelpquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eusto
    wrote on last edited by
    #1

    I'm trying to use RasDial to connect through a modem to a network my code:

    RASDIALPARAMS rdParams;
    rdParams.dwSize = sizeof(RASDIALPARAMS);
    rdParams.szEntryName\[0\] = '\\0';
    lstrcpy(rdParams.szPhoneNumber, strPhoneNr);
    rdParams.szCallbackNumber\[0\] = '\\0';
    lstrcpy( rdParams.szUserName, strUserNr);
    lstrcpy( rdParams.szPassword, strPassword);    
    rdParams.szDomain\[0\] = '\\0';
    
    HRASCONN hRasConn = NULL;
    dwRet = RasDial( NULL, NULL, &rdParams, NULL, NULL, &hRasConn );
    

    The RasDial call results in a XP bluescreen. Anybody ever got this error? What should i check for? Thanks

    D 1 Reply Last reply
    0
    • E eusto

      I'm trying to use RasDial to connect through a modem to a network my code:

      RASDIALPARAMS rdParams;
      rdParams.dwSize = sizeof(RASDIALPARAMS);
      rdParams.szEntryName\[0\] = '\\0';
      lstrcpy(rdParams.szPhoneNumber, strPhoneNr);
      rdParams.szCallbackNumber\[0\] = '\\0';
      lstrcpy( rdParams.szUserName, strUserNr);
      lstrcpy( rdParams.szPassword, strPassword);    
      rdParams.szDomain\[0\] = '\\0';
      
      HRASCONN hRasConn = NULL;
      dwRet = RasDial( NULL, NULL, &rdParams, NULL, NULL, &hRasConn );
      

      The RasDial call results in a XP bluescreen. Anybody ever got this error? What should i check for? Thanks

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      eusto wrote:

      The RasDial call results in a XP bluescreen.

      Does this mean that RasDial() is not returning?

      "Love people and use things, not love things and use people." - Unknown

      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

      E 1 Reply Last reply
      0
      • D David Crow

        eusto wrote:

        The RasDial call results in a XP bluescreen.

        Does this mean that RasDial() is not returning?

        "Love people and use things, not love things and use people." - Unknown

        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

        E Offline
        E Offline
        eusto
        wrote on last edited by
        #3

        Yes, it is not returning. My whole computer dies. The fix for me is to use the phone book feature of windows:

        RASDIALPARAMS rdParams;
        rdParams.dwSize = sizeof(RASDIALPARAMS);
        
        //set the szEntryName to an already defined connection 
        lstrcpy(rdParams.szEntryName,strPredefinedConnectionName);
        //not using these features because they're already defined in that connection
        rdParams.szPhoneNumber\[0\] = 0;
        rdParams.szPhoneNumber\[0\] = 0;
        rdParams.szUserName\[0\] = 0;
        rdParams.szPassword\[0\] = 0;
        rdParams.szCallbackNumber\[0\] = '\\0';
        rdParams.szDomain\[0\] = '\\0';
        
        HRASCONN hRasConn = NULL;
        dwRet = RasDial( NULL,
            "C:\\\\Documents and Settings\\\\"
                "All Users\\\\Application Data\\\\"
                "Microsoft\\\\Network\\\\Connections\\\\Pbk\\\\rasphone.pbk", //the system path to the phone book
                &rdParams, 
                NULL, 
                NULL, 
                &hRasConn 
                );
        

        It's a bit frustrating that i can't use this to work with "on the fly" dialup connections. The windows blue screen really scares me :sigh:

        D 1 Reply Last reply
        0
        • E eusto

          Yes, it is not returning. My whole computer dies. The fix for me is to use the phone book feature of windows:

          RASDIALPARAMS rdParams;
          rdParams.dwSize = sizeof(RASDIALPARAMS);
          
          //set the szEntryName to an already defined connection 
          lstrcpy(rdParams.szEntryName,strPredefinedConnectionName);
          //not using these features because they're already defined in that connection
          rdParams.szPhoneNumber\[0\] = 0;
          rdParams.szPhoneNumber\[0\] = 0;
          rdParams.szUserName\[0\] = 0;
          rdParams.szPassword\[0\] = 0;
          rdParams.szCallbackNumber\[0\] = '\\0';
          rdParams.szDomain\[0\] = '\\0';
          
          HRASCONN hRasConn = NULL;
          dwRet = RasDial( NULL,
              "C:\\\\Documents and Settings\\\\"
                  "All Users\\\\Application Data\\\\"
                  "Microsoft\\\\Network\\\\Connections\\\\Pbk\\\\rasphone.pbk", //the system path to the phone book
                  &rdParams, 
                  NULL, 
                  NULL, 
                  &hRasConn 
                  );
          

          It's a bit frustrating that i can't use this to work with "on the fly" dialup connections. The windows blue screen really scares me :sigh:

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          So the only difference is the second argument? MSDN states that if this parameter is NULL, the function uses the current default phone-book file. The default phone-book file is the one selected by the user in the User Preferences property sheet of the Dial-Up Networking dialog box. Do you have this set up?

          "Love people and use things, not love things and use people." - Unknown

          "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

          E 1 Reply Last reply
          0
          • D David Crow

            So the only difference is the second argument? MSDN states that if this parameter is NULL, the function uses the current default phone-book file. The default phone-book file is the one selected by the user in the User Preferences property sheet of the Dial-Up Networking dialog box. Do you have this set up?

            "Love people and use things, not love things and use people." - Unknown

            "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

            E Offline
            E Offline
            eusto
            wrote on last edited by
            #5

            The difference is in the way i specify the connection to use. I'm telling RasDial to use the strPredefinedConnectionName (ex: a connection named MyDialup that appears in network connections) from the specified phone book. I've read that in MSDN also but i couldn't find the dialog for this setting. Do you think that the blue screen error is caused by the fact that my default user does not have a phonebook configured?

            D 1 Reply Last reply
            0
            • E eusto

              The difference is in the way i specify the connection to use. I'm telling RasDial to use the strPredefinedConnectionName (ex: a connection named MyDialup that appears in network connections) from the specified phone book. I've read that in MSDN also but i couldn't find the dialog for this setting. Do you think that the blue screen error is caused by the fact that my default user does not have a phonebook configured?

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              eusto wrote:

              Do you think that the blue screen error is caused by the fact that my default user does not have a phonebook configured?

              I would hope not. The BSOD is when Windows has gotten really angry and something totally unexpected has happened in some code. Telling Windows to use a file that does not exist should simply result in a normal "error" message box (i.e., failing gracefully). I'm sorry I do not have any better suggestions.

              "Love people and use things, not love things and use people." - Unknown

              "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

              E 1 Reply Last reply
              0
              • D David Crow

                eusto wrote:

                Do you think that the blue screen error is caused by the fact that my default user does not have a phonebook configured?

                I would hope not. The BSOD is when Windows has gotten really angry and something totally unexpected has happened in some code. Telling Windows to use a file that does not exist should simply result in a normal "error" message box (i.e., failing gracefully). I'm sorry I do not have any better suggestions.

                "Love people and use things, not love things and use people." - Unknown

                "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                E Offline
                E Offline
                eusto
                wrote on last edited by
                #7

                Thanks man. I'll try to read further on this matter and i'll post my answer here

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups