ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/StayConnectified/StayConnectified.cpp
(Generate patch)

Comparing StayConnectified/StayConnectified.cpp (file contents):
Revision 446 by douglas, 2005-05-14T04:06:03-07:00 vs.
Revision 447 by douglas, 2005-05-14T04:59:06-07:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 #include <iostream>
8 #include <string>
9 #include <vector>
10
7   #include <windows.h>
8   #include <shellapi.h>
9   #include <ras.h>
# Line 32 | Line 28 | Type check(Type code)
28  
29   int main(int argc, char** argv)
30   {
31 <        for (int index(1); index != argc; ++index)
32 <                std::wcerr << argv[index] << std::endl;
37 <
38 <        std::vector<RASENTRYNAME> entries(1);
39 <
40 <        entries.front().dwSize = sizeof (RASENTRYNAME);
41 <
42 <        unsigned long size(entries.size() * sizeof (RASENTRYNAME)), count;
43 <
44 <        loop: try
45 <        {
46 <                check(RasEnumEntries(NULL, NULL, &entries.front(), &size, &count));
47 <        }
48 <        catch (const Exception& exception)
49 <        {
50 <                if (exception.code == ERROR_BUFFER_TOO_SMALL)
51 <                {
52 <                        entries.resize(entries.size() + size / sizeof (RASENTRYNAME));
53 <
54 <                        size = entries.size() * sizeof (RASENTRYNAME);
31 >        RASDIALPARAMS params = { sizeof (RASDIALPARAMS), L"NETHOME Intranet VPN" };
32 >        int password;
33  
34 <                        goto loop;
57 <                }
58 <                else
59 <                        throw exception;
60 <        }
34 >        check(RasGetEntryDialParams(NULL, &params, &password));
35  
36 <        entries.resize(count);
36 >        HRASCONN connection(NULL);
37  
38 <        for (std::vector<RASENTRYNAME>::iterator entry(entries.begin()); entry != entries.end(); ++entry)
65 <                std::wcout << entry->szEntryName << std::endl;
38 >        check(RasDial(NULL, NULL, &params, -1, NULL, &connection));
39  
40          return 0;
41   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines