Hi, recently I meet 2 strange problems when using WinHttp functions to get the configuration info of internet proxy.
1) WinHttpOpen: I create a program in WinXP 32bit/PellesC 6.5 env. with the code below, no problem when running in this env., but after I copy the execute file (32bits code) to Win7 64bits env., I always gets error "Insufficient buffer".
hs=WinHttpOpen((LPCWSTR)"GetProxyInfo",WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,WINHTTP_NO_PROXY_NAME,WINHTTP_NO_PROXY_BYPASS,0);
2) WinHttpGetProxyForUrl: I created a completed function to get all proxy info (WPAD or PAC script) by using these WinHttp functions. When I put this self-defined function at the beginning of the source code, and call it immediately at the beginning of WinMain, no problem is found and all info can be retrieved; but as my program has some other functions to get other info (all these functions run very well), if I but this self-defined function at the middle of the program, or call it at the middle of the WinMain after other calling, when running at this WinHttp function, I always get error 12166...
WinHttpGetProxyForUrl(hs,L"
http://www.microsoft.com",&ProxyOptions,&ProxyInfo);
I fully follow the instruction of MSDN and API SDK to coding. I doubt there is something wrong in the lib winhttp.lib. Does anybody have ideas of the problems?