wininet: Move InternetQueryOption(INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT) to vtbl.
This commit is contained in:
parent
ce6a2289c6
commit
7e63f95326
|
@ -55,6 +55,7 @@
|
|||
#define NO_SHLWAPI_GDI
|
||||
#include "shlwapi.h"
|
||||
#include "sspi.h"
|
||||
#include "wincrypt.h"
|
||||
|
||||
#include "internet.h"
|
||||
#include "wine/debug.h"
|
||||
|
@ -1478,6 +1479,68 @@ static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *b
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
case INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT: {
|
||||
PCCERT_CONTEXT context;
|
||||
|
||||
if(*size < sizeof(INTERNET_CERTIFICATE_INFOW)) {
|
||||
*size = sizeof(INTERNET_CERTIFICATE_INFOW);
|
||||
return ERROR_INSUFFICIENT_BUFFER;
|
||||
}
|
||||
|
||||
context = (PCCERT_CONTEXT)NETCON_GetCert(&(req->netConnection));
|
||||
if(context) {
|
||||
INTERNET_CERTIFICATE_INFOW *info = (INTERNET_CERTIFICATE_INFOW*)buffer;
|
||||
DWORD len;
|
||||
|
||||
memset(info, 0, sizeof(INTERNET_CERTIFICATE_INFOW));
|
||||
info->ftExpiry = context->pCertInfo->NotAfter;
|
||||
info->ftStart = context->pCertInfo->NotBefore;
|
||||
if(unicode) {
|
||||
len = CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR, NULL, 0);
|
||||
info->lpszSubjectInfo = LocalAlloc(0, len*sizeof(WCHAR));
|
||||
if(info->lpszSubjectInfo)
|
||||
CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
info->lpszSubjectInfo, len);
|
||||
len = CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR, NULL, 0);
|
||||
info->lpszIssuerInfo = LocalAlloc(0, len*sizeof(WCHAR));
|
||||
if (info->lpszIssuerInfo)
|
||||
CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
info->lpszIssuerInfo, len);
|
||||
}else {
|
||||
INTERNET_CERTIFICATE_INFOA *infoA = (INTERNET_CERTIFICATE_INFOA*)info;
|
||||
|
||||
len = CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR, NULL, 0);
|
||||
infoA->lpszSubjectInfo = LocalAlloc(0, len);
|
||||
if(infoA->lpszSubjectInfo)
|
||||
CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
infoA->lpszSubjectInfo, len);
|
||||
len = CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR, NULL, 0);
|
||||
infoA->lpszIssuerInfo = LocalAlloc(0, len);
|
||||
if(infoA->lpszIssuerInfo)
|
||||
CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
infoA->lpszIssuerInfo, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Contrary to MSDN, these do not appear to be set.
|
||||
* lpszProtocolName
|
||||
* lpszSignatureAlgName
|
||||
* lpszEncryptionAlgName
|
||||
* dwKeySize
|
||||
*/
|
||||
CertFreeCertificateContext(context);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FIXME("Not implemented option %d\n", option);
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include "winerror.h"
|
||||
#define NO_SHLWAPI_STREAM
|
||||
#include "shlwapi.h"
|
||||
#include "wincrypt.h"
|
||||
|
||||
#include "wine/exception.h"
|
||||
|
||||
|
@ -2036,87 +2035,6 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
|
|||
bSuccess = TRUE;
|
||||
break;
|
||||
|
||||
case INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT:
|
||||
if (!lpwhh)
|
||||
{
|
||||
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (*lpdwBufferLength < sizeof(INTERNET_CERTIFICATE_INFOW))
|
||||
{
|
||||
*lpdwBufferLength = sizeof(INTERNET_CERTIFICATE_INFOW);
|
||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
}
|
||||
else if (lpwhh->htype == WH_HHTTPREQ)
|
||||
{
|
||||
LPWININETHTTPREQW lpwhr;
|
||||
PCCERT_CONTEXT context;
|
||||
|
||||
lpwhr = (LPWININETHTTPREQW)lpwhh;
|
||||
context = (PCCERT_CONTEXT)NETCON_GetCert(&(lpwhr->netConnection));
|
||||
if (context)
|
||||
{
|
||||
LPINTERNET_CERTIFICATE_INFOW info = (LPINTERNET_CERTIFICATE_INFOW)lpBuffer;
|
||||
DWORD strLen;
|
||||
|
||||
memset(info,0,sizeof(INTERNET_CERTIFICATE_INFOW));
|
||||
info->ftExpiry = context->pCertInfo->NotAfter;
|
||||
info->ftStart = context->pCertInfo->NotBefore;
|
||||
if (bIsUnicode)
|
||||
{
|
||||
strLen = CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
info->lpszSubjectInfo = LocalAlloc(0,
|
||||
strLen * sizeof(WCHAR));
|
||||
if (info->lpszSubjectInfo)
|
||||
CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
info->lpszSubjectInfo, strLen);
|
||||
strLen = CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
info->lpszIssuerInfo = LocalAlloc(0,
|
||||
strLen * sizeof(WCHAR));
|
||||
if (info->lpszIssuerInfo)
|
||||
CertNameToStrW(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
info->lpszIssuerInfo, strLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
LPINTERNET_CERTIFICATE_INFOA infoA =
|
||||
(LPINTERNET_CERTIFICATE_INFOA)info;
|
||||
|
||||
strLen = CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
infoA->lpszSubjectInfo = LocalAlloc(0, strLen);
|
||||
if (infoA->lpszSubjectInfo)
|
||||
CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
|
||||
infoA->lpszSubjectInfo, strLen);
|
||||
strLen = CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
NULL, 0);
|
||||
infoA->lpszIssuerInfo = LocalAlloc(0, strLen);
|
||||
if (infoA->lpszIssuerInfo)
|
||||
CertNameToStrA(context->dwCertEncodingType,
|
||||
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
|
||||
infoA->lpszIssuerInfo, strLen);
|
||||
}
|
||||
/*
|
||||
* Contrary to MSDN, these do not appear to be set.
|
||||
* lpszProtocolName
|
||||
* lpszSignatureAlgName
|
||||
* lpszEncryptionAlgName
|
||||
* dwKeySize
|
||||
*/
|
||||
CertFreeCertificateContext(context);
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INTERNET_OPTION_VERSION:
|
||||
{
|
||||
TRACE("INTERNET_OPTION_VERSION\n");
|
||||
|
|
Loading…
Reference in New Issue