Welcome to MSDN Blogs Sign in | Join | Help

HTTP/Internet Proxy Detection - Using WINCE API

 

SqlCeReplication and SqlCeRemoteDataAccess have InternetProxyServer, InternetProxyLogin, InternetProxyPassword properties which the application can set to make these sync protocols communicate via/thru the desired proxy.

 

However, then the question comes on how to programmatically detect the HTTP/Internet proxy settings from the app to set the properties on SQL CE classes.  Here is the short story of how to detect the settings on Windows CE/Mobile devices.

 

DLL/Module Name and Reference

API

Data Structures

CellCore.dll

Connection Manager API

ConnMgrMapURL

ConnMgrEstablishConnectionSync

ConnMgrProviderMessage

ConnMgrReleaseConnection

CONNMGR_CONNECTIONINFO

PROXY_CONFIG

 

 

1)      Call ConnMgrMapURL function to map the InternetUrl to a network Guid and an index

a.       This function takes the URL you specify and determines the best network connection to use to access that URL.

2)      Fill CONNMGR_CONNECTIONINFO with the retrieved network Guid

a.       dwParam: CONNMGR_PARAM_GUIDDESTNET

b.      dwPriority: CONNMGR_PRIORITY_USERINTERACTIVE

3)      Call ConnMgrEstablishConnectionSync with the above filled structure to get a connection HANDLE

a.       This function uses ConnMgrEstablishConnection and ConnMgrConnectionStatus  internally to attempt to fully establish a connection before returning to the caller. The ConnMgrEstablishConnectionSync function does not provide an internal message pump; therefore, the message queues of any user interface threads that call into this function are blocked until the function returns.

4)      Call ConnMgrProviderMessage with the received connection handle and Guid provider as IID_ConnPrv_IProxyExtension, to get PROXY_CONFIG

a.       Make sure to set PROXY_CONFIG.dwType: CONNMGR_FLAG_PROXY_HTTP before calling

5)      Call ConnMgrReleaseConnection to close the connection HANDLE

Now, PROXY_CONFIG has all the required details of the HTTP/Internet Proxy for ready use. 

 

Thanks,

Laxmi Narsimha Rao ORUGANTI

 

Published Tuesday, June 19, 2007 9:28 PM by SQLCEBLOG
Filed under: ,

Comments

# re: HTTP/Internet Proxy Detection - Using WINCE API

Hi Laxmi,

Is it possible to achieve this in Manage Code.

Regards

Ben

Wednesday, June 20, 2007 2:30 PM by nabeelfarid

# re: HTTP/Internet Proxy Detection - Using WINCE API

Laxmi,

This relies on the ConnectionManager API in Windows Mobile 5.  Does this mean that this technique will not work on a Windows CE (not Windows Mobile) device?

Thanks,

Steve

Thursday, July 19, 2007 5:41 PM by sjstone1

# re: HTTP/Internet Proxy Detection - Using WINCE API

Hey Ben & Steve,

Ben: I am sorry to say that I do not have an idea of on how to achieve this in C#/.NET.  I

Steve: Windows Mobile is nothing but Windows CE + other stuff.  So, this story holds good for Windows Mobile too.

Thanks,

Laxmi

Monday, December 31, 2007 2:31 AM by SQLCEBLOG
New Comments to this post are disabled
 
Page view tracker