Solved

InternetOpen proxy server configuration question for services

Posted on 2006-11-28
5
1,577 Views
Last Modified: 2012-06-21
I have a windows service that uses the LocalAdmin account for authentication.  It generates HTTPS (SSL) requests every 24 hours to verify/validate license information.

It currently uses INTERNET_OPEN_TYPE_DIRECT for its queries:

   InternetOpen("AppName Here", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

This works fine for users with firewalls, but does not work for companies that use proxy type firewalls.

So there's really two questions that need to be answered:

1) What AccessType should be used in the InternetOpen function call so it will work with proxy firewalls?

2) Will this AccessType work for a service that runs in the background (no user context or HKEY_CURRENT_USER registry entries for proxy information).
0
Comment
Question by:ttitus
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 18034199
You should use 'INTERNET_OPEN_TYPE_PROXY', as listed in http:://msdn.microsoft.com/library/en-us/wininet/wininet/internetopen.asp

That will/should work for any user account a service runs under except LocalSystem (given that the user in question has that proxy set - even services have a HKEY_CURRENT_USER).
0
 

Author Comment

by:ttitus
ID: 18034213
Sorry, I should have mentioned that this account DOES run under LocalSystem.  What needs to happen then?
0
 
LVL 86

Expert Comment

by:jkr
ID: 18034554
You would need to have to assign the network access privileges to that account also.
0
 

Author Comment

by:ttitus
ID: 18038576
Ok, one list question:  Will INTERNET_OPEN_TYPE_PROXY revert to INTERNET_OPEN_TYPE_DIRECT if there is no proxy configured for that user?
0
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 18038733
In that case, you should use INTERNET_OPEN_TYPE_PRECONFIG - see http://msdn.microsoft.com/library/en-us/wininet/wininet/enabling_internet_functionality.asp ("Enabling Internet Functionality"):

INTERNET_OPEN_TYPE_PRECONFIG looks at the registry values ProxyEnable, ProxyServer, and ProxyOverride. These values are located under "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings".

If ProxyEnable is zero, the application uses INTERNET_OPEN_TYPE_DIRECT. Otherwise, the application uses INTERNET_OPEN_TYPE_PROXY and uses the ProxyServer and ProxyOverride information

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question