Fix the uninitialized g_hWinHttpModule global variable to avoid empty error messages (#225)
This commit is contained in:
parent
483e0e9491
commit
c315b27ad9
|
|
@ -191,6 +191,7 @@ HRESULT
|
||||||
g_pModuleId = pModuleInfo->GetId();
|
g_pModuleId = pModuleInfo->GetId();
|
||||||
g_pszModuleName = pModuleInfo->GetName();
|
g_pszModuleName = pModuleInfo->GetName();
|
||||||
g_pHttpServer = pHttpServer;
|
g_pHttpServer = pHttpServer;
|
||||||
|
g_hWinHttpModule = GetModuleHandle(TEXT("winhttp.dll"));
|
||||||
|
|
||||||
//
|
//
|
||||||
// WinHTTP does not create enough threads, ask it to create more.
|
// WinHTTP does not create enough threads, ask it to create more.
|
||||||
|
|
|
||||||
|
|
@ -1451,9 +1451,8 @@ Failure:
|
||||||
//
|
//
|
||||||
pResponse->SetStatus(502, "Bad Gateway", 3, hr);
|
pResponse->SetStatus(502, "Bad Gateway", 3, hr);
|
||||||
|
|
||||||
if (hr > HRESULT_FROM_WIN32(WINHTTP_ERROR_BASE) &&
|
if (!(hr > HRESULT_FROM_WIN32(WINHTTP_ERROR_BASE) &&
|
||||||
hr <= HRESULT_FROM_WIN32(WINHTTP_ERROR_LAST))
|
hr <= HRESULT_FROM_WIN32(WINHTTP_ERROR_LAST)) ||
|
||||||
{
|
|
||||||
#pragma prefast (suppress : __WARNING_FUNCTION_NEEDS_REVIEW, "Function and parameters reviewed.")
|
#pragma prefast (suppress : __WARNING_FUNCTION_NEEDS_REVIEW, "Function and parameters reviewed.")
|
||||||
FormatMessage(
|
FormatMessage(
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,
|
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,
|
||||||
|
|
@ -1462,9 +1461,7 @@ Failure:
|
||||||
0,
|
0,
|
||||||
strDescription.QueryStr(),
|
strDescription.QueryStr(),
|
||||||
strDescription.QuerySizeCCH(),
|
strDescription.QuerySizeCCH(),
|
||||||
NULL);
|
NULL) == 0)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
LoadString(g_hModule,
|
LoadString(g_hModule,
|
||||||
IDS_SERVER_ERROR,
|
IDS_SERVER_ERROR,
|
||||||
|
|
@ -1774,9 +1771,8 @@ REQUEST_NOTIFICATION_STATUS
|
||||||
|
|
||||||
pResponse->SetStatus(502, "Bad Gateway", 3, hr);
|
pResponse->SetStatus(502, "Bad Gateway", 3, hr);
|
||||||
|
|
||||||
if (hr > HRESULT_FROM_WIN32(WINHTTP_ERROR_BASE) &&
|
if (!(hr > HRESULT_FROM_WIN32(WINHTTP_ERROR_BASE) &&
|
||||||
hr <= HRESULT_FROM_WIN32(WINHTTP_ERROR_LAST))
|
hr <= HRESULT_FROM_WIN32(WINHTTP_ERROR_LAST)) ||
|
||||||
{
|
|
||||||
#pragma prefast (suppress : __WARNING_FUNCTION_NEEDS_REVIEW, "Function and parameters reviewed.")
|
#pragma prefast (suppress : __WARNING_FUNCTION_NEEDS_REVIEW, "Function and parameters reviewed.")
|
||||||
FormatMessage(
|
FormatMessage(
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,
|
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,
|
||||||
|
|
@ -1785,15 +1781,14 @@ REQUEST_NOTIFICATION_STATUS
|
||||||
0,
|
0,
|
||||||
strDescription.QueryStr(),
|
strDescription.QueryStr(),
|
||||||
strDescription.QuerySizeCCH(),
|
strDescription.QuerySizeCCH(),
|
||||||
NULL);
|
NULL) == 0)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
LoadString(g_hModule,
|
LoadString(g_hModule,
|
||||||
IDS_SERVER_ERROR,
|
IDS_SERVER_ERROR,
|
||||||
strDescription.QueryStr(),
|
strDescription.QueryStr(),
|
||||||
strDescription.QuerySizeCCH());
|
strDescription.QuerySizeCCH());
|
||||||
}
|
}
|
||||||
|
|
||||||
(VOID)strDescription.SyncWithBuffer();
|
(VOID)strDescription.SyncWithBuffer();
|
||||||
if (strDescription.QueryCCH() != 0)
|
if (strDescription.QueryCCH() != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -2379,9 +2374,8 @@ Failure:
|
||||||
|
|
||||||
pResponse->SetStatus(502, "Bad Gateway", 3, hr);
|
pResponse->SetStatus(502, "Bad Gateway", 3, hr);
|
||||||
|
|
||||||
if (hr > HRESULT_FROM_WIN32(WINHTTP_ERROR_BASE) &&
|
if (!(hr > HRESULT_FROM_WIN32(WINHTTP_ERROR_BASE) &&
|
||||||
hr <= HRESULT_FROM_WIN32(WINHTTP_ERROR_LAST))
|
hr <= HRESULT_FROM_WIN32(WINHTTP_ERROR_LAST)) ||
|
||||||
{
|
|
||||||
#pragma prefast (suppress : __WARNING_FUNCTION_NEEDS_REVIEW, "Function and parameters reviewed.")
|
#pragma prefast (suppress : __WARNING_FUNCTION_NEEDS_REVIEW, "Function and parameters reviewed.")
|
||||||
FormatMessage(
|
FormatMessage(
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,
|
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,
|
||||||
|
|
@ -2390,15 +2384,14 @@ Failure:
|
||||||
0,
|
0,
|
||||||
strDescription.QueryStr(),
|
strDescription.QueryStr(),
|
||||||
strDescription.QuerySizeCCH(),
|
strDescription.QuerySizeCCH(),
|
||||||
NULL);
|
NULL) == 0)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
LoadString(g_hModule,
|
LoadString(g_hModule,
|
||||||
IDS_SERVER_ERROR,
|
IDS_SERVER_ERROR,
|
||||||
strDescription.QueryStr(),
|
strDescription.QueryStr(),
|
||||||
strDescription.QuerySizeCCH());
|
strDescription.QuerySizeCCH());
|
||||||
}
|
}
|
||||||
|
|
||||||
strDescription.SyncWithBuffer();
|
strDescription.SyncWithBuffer();
|
||||||
if (strDescription.QueryCCH() != 0)
|
if (strDescription.QueryCCH() != 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue