WinHttpGetDefaultProxyConfiguration 함수(winhttp.h)

WinHttpGetDefaultProxyConfiguration 함수는 레지스트리에서 기본 WinHTTP 프록시 구성을 검색합니다.

구문

WINHTTPAPI BOOL WinHttpGetDefaultProxyConfiguration(
  [in, out] WINHTTP_PROXY_INFO *pProxyInfo
);

매개 변수

[in, out] pProxyInfo

기본 프록시 구성을 수신하는 WINHTTP_PROXY_INFO 형식의 변수에 대한 포인터입니다.

반환 값

성공하면 TRUE를 반환하고 그렇지 않으면 FALSE를 반환합니다. 특정 오류 메시지를 검색하려면 GetLastError를 호출합니다. 반환된 오류 코드에는 다음이 포함됩니다.

오류 코드 Description
ERROR_WINHTTP_INTERNAL_ERROR
내부 오류가 발생했습니다.
ERROR_NOT_ENOUGH_MEMORY
메모리가 부족하여 요청된 작업을 완료할 수 없습니다. (Windows 오류 코드)

설명

WinHttpGetDefaultProxyConfigurationWinHttpSetDefaultProxyConfiguration 또는 ProxyCfg.exe의해 설정된 프록시 구성을 검색합니다.

WinHttpSetOption을 호출하고 WINHTTP_OPTION_PROXY 플래그를 지정하여 WinHTTP 세션에 대한 기본 프록시 구성을 재정의할 수 있습니다.
WinHttpGetDefaultProxyConfiguration 은 현재 세션에 대한 구성을 검색하지 않습니다. 레지스트리에 지정된 구성을 검색합니다.

레지스트리에 프록시 서버 목록이 포함되어 있으면 pProxyInfodwAccessType 멤버가 WINHTTP_ACCESS_TYPE_NAMED_PROXY 설정됩니다. 그렇지 않으면 WINHTTP_ACCESS_TYPE_NO_PROXY 설정됩니다.

WinHttpGetDefaultProxyConfigurationpProxyInfo의 문자열 멤버에 대한 메모리를 할당합니다. 이 메모리를 해제하려면 GlobalFree를 호출합니다.

WinHTTP가 비동기 모드(즉, WinHttpOpen에서 WINHTTP_FLAG_ASYNC 설정된 경우)에서 사용되는 경우에도 이 함수는 동기적으로 작동합니다. 반환 값은 성공 또는 실패를 나타냅니다. 확장 오류 정보를 가져오려면 GetLastError를 호출합니다.

참고 Windows XP 및 Windows 2000의 경우 WinHTTP 시작 페이지의 런타임 요구 사항 섹션을 참조하세요.
 

예제

다음 코드 예제에서는 레지스트리에서 기본 프록시 구성을 검색 하는 방법을 보여 주세요.

    WINHTTP_PROXY_INFO proxyInfo;

    // Retrieve the default proxy configuration.
    WinHttpGetDefaultProxyConfiguration( &proxyInfo );

    // Display the proxy servers and free memory 
    // allocated to this string.
    if (proxyInfo.lpszProxy != NULL)
    {
        printf("Proxy server list: %S\n", proxyInfo.lpszProxy);
        GlobalFree( proxyInfo.lpszProxy );
    }

    // Display the bypass list and free memory 
    // allocated to this string.
    if (proxyInfo.lpszProxyBypass != NULL)
    {
        printf("Proxy bypass list: %S\n", proxyInfo.lpszProxyBypass);
        GlobalFree( proxyInfo.lpszProxyBypass );
    }

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional SP3 [데스크톱 앱만 해당]
지원되는 최소 서버 Windows Server 2003, Windows 2000 Server SP3 [데스크톱 앱만 해당]
대상 플랫폼 Windows
헤더 winhttp.h
라이브러리 Winhttp.lib
DLL Winhttp.dll
재배포 가능 파일 Windows XP 및 Windows 2000에서 WinHTTP 5.0 및 인터넷 Explorer 5.01 이상.

추가 정보

프록시 구성 도구인ProxyCfg.exe

WinHTTP 버전

WinHttpSetDefaultProxyConfiguration