Solved

InternetOpen proxy server configuration question for services

Posted on 2006-11-28
5
1,548 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now