Tag Archives: win32 code

Http Error 12057 (Bug Fix Note)

A Bug has been reported in the product that only occurs for a specific platform, Windows Server 2003 Standard Edition.
Check the Trace Log and find that the wrapper class of Wininet call returns Error 12057, with the specific Error contents as follows:

ERROR_WINHTTP_SECURE_CERT_REV_FAILED

12057

Indicates that revocation cannot be checked because the revocation server was offline (equivalent to CRYPT_E_REVOCATION_OFFLINE).
Open the
IE-> Tools-> Internet Options-> Advanced Tab-> Security Options – & gt;” Check for server certificate revocation(Requires Restart) “

This option is currently selected. Remove this option and the Bug symptoms disappear. Only IE with Windows Server 2003 Standard Edition is checked by default, and Error 12057 (Microsoft’s Bug?) does not occur when this option is checked on other platforms. or with other options?) . Decided to code the problem.
The code to solve this problem is quite simple. Add the following code after HttpOpenRequest to set the current Http connection options to cancel this check
DWORD dwFlags = 0;

DWORD dwError = 0;

DWORD dwBuffLen = sizeof(dwFlags);
InternetQueryOption(m_hRequest, INTERNET_OPTION_SECURITY_FLAGS,

(LPVOID)& dwFlags, & dwBuffLen);

dwFlags |= SECURITY_FLAG_IGNORE_REVOCATION;

InternetSetOption(m_hRequest, INTERNET_OPTION_SECURITY_FLAGS, (LPVOID)& dwFlags, sizeof(dwFlags)) ;