Add some commented out code to disable https in winhttp.

This commit is contained in:
Mr_Goldberg 2019-08-17 18:03:21 -04:00
parent 0e17aeef76
commit 06b4332187
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278

View File

@ -673,6 +673,35 @@ HINTERNET WINAPI Mine_WinHttpConnect(
} }
} }
HINTERNET (WINAPI *Real_WinHttpOpenRequest)(
IN HINTERNET hConnect,
IN LPCWSTR pwszVerb,
IN LPCWSTR pwszObjectName,
IN LPCWSTR pwszVersion,
IN LPCWSTR pwszReferrer,
IN LPCWSTR *ppwszAcceptTypes,
IN DWORD dwFlags
);
HINTERNET WINAPI Mine_WinHttpOpenRequest(
IN HINTERNET hConnect,
IN LPCWSTR pwszVerb,
IN LPCWSTR pwszObjectName,
IN LPCWSTR pwszVersion,
IN LPCWSTR pwszReferrer,
IN LPCWSTR *ppwszAcceptTypes,
IN DWORD dwFlags
) {
PRINT_DEBUG("Mine_WinHttpOpenRequest %ls %ls %ls %ls %i\n", pwszVerb, pwszObjectName, pwszVersion, pwszReferrer, dwFlags);
if (dwFlags & WINHTTP_FLAG_SECURE) {
dwFlags ^= WINHTTP_FLAG_SECURE;
}
return Real_WinHttpOpenRequest(hConnect, pwszVerb, pwszObjectName, pwszVersion, pwszReferrer, ppwszAcceptTypes, dwFlags);
}
static bool network_functions_attached = false; static bool network_functions_attached = false;
BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) { BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) {
switch ( dwReason ) { switch ( dwReason ) {
@ -689,7 +718,10 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) {
if (winhttp) { if (winhttp) {
Real_WinHttpConnect = (decltype(Real_WinHttpConnect))GetProcAddress(winhttp, "WinHttpConnect"); Real_WinHttpConnect = (decltype(Real_WinHttpConnect))GetProcAddress(winhttp, "WinHttpConnect");
DetourAttach( &(PVOID &)Real_WinHttpConnect, Mine_WinHttpConnect ); DetourAttach( &(PVOID &)Real_WinHttpConnect, Mine_WinHttpConnect );
// Real_WinHttpOpenRequest = (decltype(Real_WinHttpOpenRequest))GetProcAddress(winhttp, "WinHttpOpenRequest");
// DetourAttach( &(PVOID &)Real_WinHttpOpenRequest, Mine_WinHttpOpenRequest );
} }
DetourTransactionCommit(); DetourTransactionCommit();
network_functions_attached = true; network_functions_attached = true;
} }
@ -706,6 +738,7 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) {
DetourDetach( &(PVOID &)Real_WSAConnect, Mine_WSAConnect ); DetourDetach( &(PVOID &)Real_WSAConnect, Mine_WSAConnect );
if (Real_WinHttpConnect) { if (Real_WinHttpConnect) {
DetourDetach( &(PVOID &)Real_WinHttpConnect, Mine_WinHttpConnect ); DetourDetach( &(PVOID &)Real_WinHttpConnect, Mine_WinHttpConnect );
// DetourDetach( &(PVOID &)Real_WinHttpOpenRequest, Mine_WinHttpOpenRequest );
} }
DetourTransactionCommit(); DetourTransactionCommit();
} }