Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Symptoms

If your computer has never run Microsoft Internet Explorer and you use the WinHttpGetIEProxyConfigForCurrentUser function in any program, you receive the following error message:

ERROR_FILE_NOT_FOUND

Cause

The WinHttpGetIEProxyConfigForCurrentUser function uses the following registry subkey:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet SettingsThis registry subkey is created the first time that Internet Explorer runs. If your computer has not run Internet Explorer, this registry subkey does not exist. When you call the WinHttpGetIEProxyConfigForCurrentUser function in a program, the function searches for this registry entry and cannot find it, and you receive the error message.

Resolution

To resolve this problem, start Internet Explorer, and then use the WinHttpGetIEProxyConfigForCurrentUser function in any program.

More Information

Steps to reproduce the problem

  1. Log on to a computer where Internet Explorer has never been used.

  2. Start Microsoft Visual Studio .NET.

  3. On the File menu, point to New, and then click Project.

  4. Under Project Types, click Visual C++ Projects.

  5. Under Templates, click Win32 Project.

  6. In the Name box, type Test, and then click OK.

  7. On the Welcome to the Win32 Application Wizard page, click Application Settings.

  8. Under Application type, click Console application, and then click Finish.

    The Test.cpp file is created.

  9. Replace the existing code in the Test.cpp file with the following code:

    #include "stdafx.h"

    #include <Windows.h>
    #include <Winhttp.h>


    using namespace std;

    void main()
    {
    WINHTTP_CURRENT_USER_IE_PROXY_CONFIG MyProxyConfig;
    if(!WinHttpGetIEProxyConfigForCurrentUser(&MyProxyConfig))
    {
    //check the error
    DWORD Err = GetLastError();
    cout << "WinHttpGetIEProxyConfigForCurrentUser failed with the following error number: " << Err << endl;
    switch (Err)
    {
    case ERROR_FILE_NOT_FOUND:
    cout << "The error is ERROR_FILE_NOT_FOUND" << endl;
    break;
    case ERROR_WINHTTP_INTERNAL_ERROR:
    cout << "ERROR_WINHTTP_INTERNAL_ERROR" << endl;
    break;
    case ERROR_NOT_ENOUGH_MEMORY:
    cout << "ERROR_NOT_ENOUGH_MEMORY" << endl;
    break;
    default:
    cout << "Look up error in header file." << endl;

    }//end switch
    }//end if
    else
    {
    //no error so check the proxy settings and free any strings
    cout << "Auto Detect is: " << MyProxyConfig.fAutoDetect << endl;
    if(NULL != MyProxyConfig.lpszAutoConfigUrl)
    {
    wcout << "AutoConfigURL is: " << MyProxyConfig.lpszAutoConfigUrl << endl;
    GlobalFree(MyProxyConfig.lpszAutoConfigUrl);
    }
    if(NULL != MyProxyConfig.lpszProxy)
    {
    wcout << "AutoConfigURL is: " << MyProxyConfig.lpszProxy << endl;
    GlobalFree(MyProxyConfig.lpszProxy);
    }
    if(NULL != MyProxyConfig.lpszProxyBypass)
    {
    wcout << "AutoConfigURL is: " << MyProxyConfig.lpszProxyBypass << endl;
    GlobalFree(MyProxyConfig.lpszProxyBypass);
    }

    }//end else
    cout << "finished!";
    }//end main

    Note The Winhttp.h file and the Winhttp.lib file are included in the Microsoft Platform software development kit (SDK). To download the Platform SDK, visit the following Microsoft Web site:

    http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

  10. On the Project menu, click Test Properties.

  11. In the left pane, double-click Linker.

  12. Under Linker, click Input.

  13. In the right pane, type winhttp.lib in the Additional Dependencies field, and then click OK.

  14. On the Build menu, click Build Solution.

  15. Press CTRL+F5 to run the program without the debugger.

    You receive the error message that is mentioned in the "Symptoms" section.

References

For more information, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/aa384096.aspx

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×