mirror of
https://github.com/reactos/reactos.git
synced 2024-06-23 14:31:47 +00:00
[WINTRUST] Sync with Wine Staging 4.18. CORE-16441
This commit is contained in:
parent
a2da235c67
commit
d296bbebbe
|
@ -18,9 +18,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
@ -673,8 +670,8 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
|
|||
items[1].pvStructInfo = &algo->Parameters;
|
||||
else
|
||||
items[1].pvStructInfo = &nullBlob;
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
|
||||
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, pcbEncoded);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -688,8 +685,8 @@ static BOOL WINAPI CRYPT_AsnEncodeAttributeTypeValue(DWORD dwCertEncodingType,
|
|||
{ &typeValue->Value, CRYPT_CopyEncodedBlob, 0 },
|
||||
};
|
||||
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
|
||||
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
|
||||
pbEncoded, pcbEncoded);
|
||||
}
|
||||
|
||||
struct SPCDigest
|
||||
|
@ -708,8 +705,8 @@ static BOOL WINAPI CRYPT_AsnEncodeSPCDigest(DWORD dwCertEncodingType,
|
|||
{ &digest->Digest, CRYPT_CopyEncodedBlob, 0 },
|
||||
};
|
||||
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
|
||||
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
|
||||
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
|
||||
pbEncoded, pcbEncoded);
|
||||
}
|
||||
|
||||
BOOL WINAPI WVTAsn1SpcIndirectDataContentEncode(DWORD dwCertEncodingType,
|
||||
|
@ -729,8 +726,8 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentEncode(DWORD dwCertEncodingType,
|
|||
{ &data->DigestAlgorithm, CRYPT_AsnEncodeSPCDigest, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
|
||||
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
|
||||
pbEncoded, pcbEncoded);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -996,8 +993,8 @@ BOOL WINAPI WVTAsn1CatMemberInfoEncode(DWORD dwCertEncodingType,
|
|||
{ &info->dwCertVersion, CRYPT_AsnEncodeInt, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
|
||||
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
|
||||
pbEncoded, pcbEncoded);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -1025,8 +1022,8 @@ BOOL WINAPI WVTAsn1CatNameValueEncode(DWORD dwCertEncodingType,
|
|||
{ &value->Value, CRYPT_AsnEncodeOctets, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
|
||||
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
|
||||
pbEncoded, pcbEncoded);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -1084,8 +1081,8 @@ BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoEncode(DWORD dwCertEncodingType,
|
|||
{ &criteria->fMeetsCriteria, CRYPT_AsnEncodeBool, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
|
||||
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
|
||||
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
|
||||
pbEncoded, pcbEncoded);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -1808,9 +1805,8 @@ BOOL WINAPI WVTAsn1SpcPeImageDataDecode(DWORD dwCertEncodingType,
|
|||
offsetof(SPC_PE_IMAGE_DATA, pFile), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo, NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -1995,9 +1991,8 @@ static BOOL WINAPI CRYPT_AsnDecodeAttributeTypeValue(DWORD dwCertEncodingType,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo,
|
||||
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo,
|
||||
typeValue ? typeValue->pszObjId : NULL);
|
||||
}
|
||||
|
||||
|
@ -2019,9 +2014,8 @@ static BOOL WINAPI CRYPT_AsnDecodeAlgorithmId(DWORD dwCertEncodingType,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo, algo ? algo->pszObjId : NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, algo ? algo->pszObjId : NULL);
|
||||
if (ret && pvStructInfo)
|
||||
{
|
||||
TRACE("pszObjId is %p (%s)\n", algo->pszObjId,
|
||||
|
@ -2048,9 +2042,8 @@ static BOOL WINAPI CRYPT_AsnDecodeSPCDigest(DWORD dwCertEncodingType,
|
|||
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, *pcbStructInfo);
|
||||
|
||||
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo,
|
||||
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo,
|
||||
digest ? digest->DigestAlgorithm.pszObjId : NULL);
|
||||
}
|
||||
|
||||
|
@ -2076,9 +2069,8 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentDecode(DWORD dwCertEncodingType,
|
|||
offsetof(SPC_INDIRECT_DATA_CONTENT, DigestAlgorithm.pszObjId), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo, NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -2174,9 +2166,8 @@ BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
|
|||
offsetof(SPC_SP_OPUS_INFO, pPublisherInfo), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo, NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -2256,9 +2247,8 @@ BOOL WINAPI WVTAsn1CatMemberInfoDecode(DWORD dwCertEncodingType,
|
|||
FALSE, FALSE, 0, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo, NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -2292,9 +2282,8 @@ BOOL WINAPI WVTAsn1CatNameValueDecode(DWORD dwCertEncodingType,
|
|||
offsetof(CAT_NAMEVALUE, Value.pbData), 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo, NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
@ -2367,9 +2356,8 @@ BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoDecode(DWORD dwCertEncodingType,
|
|||
fMeetsCriteria), FALSE, FALSE, 0, 0 },
|
||||
};
|
||||
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
|
||||
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
|
||||
pvStructInfo, pcbStructInfo, NULL);
|
||||
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
|
||||
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
|
||||
}
|
||||
__EXCEPT_PAGE_FAULT
|
||||
{
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "winternl.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
|
||||
|
||||
|
@ -75,7 +74,7 @@ static HCATINFO create_catinfo(const WCHAR *filename)
|
|||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
strcpyW(ci->file, filename);
|
||||
lstrcpyW(ci->file, filename);
|
||||
ci->magic = CATINFO_MAGIC;
|
||||
return ci;
|
||||
}
|
||||
|
@ -125,13 +124,13 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
|
|||
}
|
||||
|
||||
GetSystemDirectoryW(catroot_dir, MAX_PATH);
|
||||
strcatW(catroot_dir, catroot);
|
||||
lstrcatW(catroot_dir, catroot);
|
||||
|
||||
/* create the directory if it doesn't exist */
|
||||
CreateDirectoryW(catroot_dir, NULL);
|
||||
|
||||
if (!sys) sys = &defsys;
|
||||
sprintfW(ca->path, fmt, catroot_dir, sys->Data1, sys->Data2,
|
||||
swprintf(ca->path, fmt, catroot_dir, sys->Data1, sys->Data2,
|
||||
sys->Data3, sys->Data4[0], sys->Data4[1], sys->Data4[2],
|
||||
sys->Data4[3], sys->Data4[4], sys->Data4[5], sys->Data4[6],
|
||||
sys->Data4[7]);
|
||||
|
@ -146,6 +145,17 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminAcquireContext2 (WINTRUST.@)
|
||||
*/
|
||||
BOOL WINAPI CryptCATAdminAcquireContext2(HCATADMIN *catAdmin, const GUID *sys, const WCHAR *algorithm,
|
||||
const CERT_STRONG_SIGN_PARA *policy, DWORD flags)
|
||||
{
|
||||
FIXME("%p %s %s %p %x stub\n", catAdmin, debugstr_guid(sys), debugstr_w(algorithm), policy, flags);
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CryptCATAdminAddCatalog (WINTRUST.@)
|
||||
*/
|
||||
|
@ -173,15 +183,15 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
len = strlenW(ca->path) + strlenW(selectBaseName) + 2;
|
||||
len = lstrlenW(ca->path) + lstrlenW(selectBaseName) + 2;
|
||||
if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
strcpyW(target, ca->path);
|
||||
strcatW(target, slashW);
|
||||
strcatW(target, selectBaseName);
|
||||
lstrcpyW(target, ca->path);
|
||||
lstrcatW(target, slashW);
|
||||
lstrcatW(target, selectBaseName);
|
||||
|
||||
if (!CopyFileW(catalogFile, target, FALSE))
|
||||
{
|
||||
|
@ -197,7 +207,7 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
|
|||
return NULL;
|
||||
}
|
||||
ci->magic = CATINFO_MAGIC;
|
||||
strcpyW(ci->file, target);
|
||||
lstrcpyW(ci->file, target);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, target);
|
||||
return ci;
|
||||
|
@ -297,15 +307,15 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
|||
{
|
||||
WCHAR *path;
|
||||
|
||||
size = strlenW(ca->path) * sizeof(WCHAR) + sizeof(globW);
|
||||
size = lstrlenW(ca->path) * sizeof(WCHAR) + sizeof(globW);
|
||||
if (!(path = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
{
|
||||
CryptReleaseContext(prov, 0);
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
strcpyW(path, ca->path);
|
||||
strcatW(path, globW);
|
||||
lstrcpyW(path, ca->path);
|
||||
lstrcatW(path, globW);
|
||||
|
||||
FindClose(ca->find);
|
||||
ca->find = FindFirstFileW(path, &data);
|
||||
|
@ -331,15 +341,15 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
|
|||
struct catinfo *ci;
|
||||
HANDLE hcat;
|
||||
|
||||
size = (strlenW(ca->path) + strlenW(data.cFileName) + 2) * sizeof(WCHAR);
|
||||
size = (lstrlenW(ca->path) + lstrlenW(data.cFileName) + 2) * sizeof(WCHAR);
|
||||
if (!(filename = HeapAlloc(GetProcessHeap(), 0, size)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
strcpyW(filename, ca->path);
|
||||
strcatW(filename, slashW);
|
||||
strcatW(filename, data.cFileName);
|
||||
lstrcpyW(filename, ca->path);
|
||||
lstrcatW(filename, slashW);
|
||||
lstrcatW(filename, data.cFileName);
|
||||
|
||||
hcat = CryptCATOpen(filename, CRYPTCAT_OPEN_EXISTING, prov, 0, 0);
|
||||
if (hcat == INVALID_HANDLE_VALUE)
|
||||
|
@ -476,22 +486,22 @@ BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogF
|
|||
|
||||
/* Only delete when there is a filename and no path */
|
||||
if (pwszCatalogFile && pwszCatalogFile[0] != 0 &&
|
||||
!strchrW(pwszCatalogFile, '\\') && !strchrW(pwszCatalogFile, '/') &&
|
||||
!strchrW(pwszCatalogFile, ':'))
|
||||
!wcschr(pwszCatalogFile, '\\') && !wcschr(pwszCatalogFile, '/') &&
|
||||
!wcschr(pwszCatalogFile, ':'))
|
||||
{
|
||||
static const WCHAR slashW[] = {'\\',0};
|
||||
WCHAR *target;
|
||||
DWORD len;
|
||||
|
||||
len = strlenW(ca->path) + strlenW(pwszCatalogFile) + 2;
|
||||
len = lstrlenW(ca->path) + lstrlenW(pwszCatalogFile) + 2;
|
||||
if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
strcpyW(target, ca->path);
|
||||
strcatW(target, slashW);
|
||||
strcatW(target, pwszCatalogFile);
|
||||
lstrcpyW(target, ca->path);
|
||||
lstrcatW(target, slashW);
|
||||
lstrcatW(target, pwszCatalogFile);
|
||||
|
||||
DeleteFileW(target);
|
||||
|
||||
|
@ -517,9 +527,9 @@ BOOL WINAPI CryptCATAdminResolveCatalogPath(HCATADMIN hcatadmin, WCHAR *catalog_
|
|||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
strcpyW(info->wszCatalogFile, ca->path);
|
||||
strcatW(info->wszCatalogFile, slashW);
|
||||
strcatW(info->wszCatalogFile, catalog_file);
|
||||
lstrcpyW(info->wszCatalogFile, ca->path);
|
||||
lstrcatW(info->wszCatalogFile, slashW);
|
||||
lstrcatW(info->wszCatalogFile, catalog_file);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -834,7 +844,7 @@ BOOL WINAPI CryptCATCatalogInfoFromContext(HCATINFO hcatinfo, CATALOG_INFO *info
|
|||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
strcpyW(info->wszCatalogFile, ci->file);
|
||||
lstrcpyW(info->wszCatalogFile, ci->file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#ifndef _WINTRUST_PRECOMP_H
|
||||
#define _WINTRUST_PRECOMP_H
|
||||
|
||||
#include <wine/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define _INC_WINDOWS
|
||||
|
@ -15,12 +13,12 @@
|
|||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
#include <winreg.h>
|
||||
#include <winnls.h>
|
||||
#include <winternl.h>
|
||||
#include <softpub.h>
|
||||
#include <mscat.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
#include <wine/unicode.h>
|
||||
|
||||
#include "wintrust_priv.h"
|
||||
|
||||
|
|
|
@ -210,12 +210,31 @@ static DWORD SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
|
|||
return err;
|
||||
}
|
||||
|
||||
static BOOL hash_file_data( HANDLE file, DWORD start, DWORD end, HCRYPTHASH hash )
|
||||
{
|
||||
DWORD bytes_read, size = end - start;
|
||||
DWORD buffer_size = min( size, 1024*1024 );
|
||||
BYTE *buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size );
|
||||
|
||||
if (!buffer) return FALSE;
|
||||
SetFilePointer( file, start, NULL, FILE_BEGIN );
|
||||
while (size)
|
||||
{
|
||||
if (!ReadFile( file, buffer, min( buffer_size, size ), &bytes_read, NULL )) break;
|
||||
if (!bytes_read) break;
|
||||
if (!CryptHashData( hash, buffer, bytes_read, 0 )) break;
|
||||
size -= bytes_read;
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, buffer );
|
||||
return !size;
|
||||
}
|
||||
|
||||
/* See https://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt
|
||||
* for details about the hashing.
|
||||
*/
|
||||
static BOOL SOFTPUB_HashPEFile(HANDLE file, HCRYPTHASH hash)
|
||||
{
|
||||
DWORD pos, checksum, security_dir;
|
||||
DWORD checksum, security_dir;
|
||||
IMAGE_DOS_HEADER dos_header;
|
||||
union
|
||||
{
|
||||
|
@ -225,7 +244,6 @@ static BOOL SOFTPUB_HashPEFile(HANDLE file, HCRYPTHASH hash)
|
|||
IMAGE_DATA_DIRECTORY secdir;
|
||||
LARGE_INTEGER file_size;
|
||||
DWORD bytes_read;
|
||||
BYTE buffer[1024];
|
||||
BOOL ret;
|
||||
|
||||
if (!GetFileSizeEx(file, &file_size))
|
||||
|
@ -237,10 +255,7 @@ static BOOL SOFTPUB_HashPEFile(HANDLE file, HCRYPTHASH hash)
|
|||
return FALSE;
|
||||
|
||||
if (dos_header.e_magic != IMAGE_DOS_SIGNATURE)
|
||||
{
|
||||
ERR("Unrecognized IMAGE_DOS_HEADER magic %04x\n", dos_header.e_magic);
|
||||
return FALSE;
|
||||
}
|
||||
if (dos_header.e_lfanew >= 256 * 1024 * 1024) /* see RtlImageNtHeaderEx */
|
||||
return FALSE;
|
||||
if (dos_header.e_lfanew + FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader.MajorLinkerVersion) > file_size.QuadPart)
|
||||
|
@ -253,10 +268,7 @@ static BOOL SOFTPUB_HashPEFile(HANDLE file, HCRYPTHASH hash)
|
|||
return FALSE;
|
||||
|
||||
if (nt_header.nt32.Signature != IMAGE_NT_SIGNATURE)
|
||||
{
|
||||
ERR("Unrecognized IMAGE_NT_HEADERS signature %08x\n", nt_header.nt32.Signature);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nt_header.nt32.OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
|
||||
{
|
||||
|
@ -277,10 +289,7 @@ static BOOL SOFTPUB_HashPEFile(HANDLE file, HCRYPTHASH hash)
|
|||
secdir = nt_header.nt64.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY];
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Unrecognized OptionalHeader magic %04x\n", nt_header.nt32.OptionalHeader.Magic);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (secdir.VirtualAddress < security_dir + sizeof(IMAGE_DATA_DIRECTORY))
|
||||
return FALSE;
|
||||
|
@ -289,40 +298,10 @@ static BOOL SOFTPUB_HashPEFile(HANDLE file, HCRYPTHASH hash)
|
|||
if (secdir.VirtualAddress + secdir.Size != file_size.QuadPart)
|
||||
return FALSE;
|
||||
|
||||
/* Hash until checksum. */
|
||||
SetFilePointer(file, 0, NULL, FILE_BEGIN);
|
||||
for (pos = 0; pos < checksum; pos += bytes_read)
|
||||
{
|
||||
ret = ReadFile(file, buffer, min(sizeof(buffer), checksum - pos), &bytes_read, NULL);
|
||||
if (!ret || !bytes_read)
|
||||
return FALSE;
|
||||
if (!CryptHashData(hash, buffer, bytes_read, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Hash until the DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY] entry. */
|
||||
checksum += sizeof(DWORD);
|
||||
SetFilePointer(file, checksum, NULL, FILE_BEGIN);
|
||||
for (pos = checksum; pos < security_dir; pos += bytes_read)
|
||||
{
|
||||
ret = ReadFile(file, buffer, min(sizeof(buffer), security_dir - pos), &bytes_read, NULL);
|
||||
if (!ret || !bytes_read)
|
||||
return FALSE;
|
||||
if (!CryptHashData(hash, buffer, bytes_read, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Hash until the end of the file. */
|
||||
security_dir += sizeof(IMAGE_DATA_DIRECTORY);
|
||||
SetFilePointer(file, security_dir, NULL, FILE_BEGIN);
|
||||
for (pos = security_dir; pos < secdir.VirtualAddress; pos += bytes_read)
|
||||
{
|
||||
ret = ReadFile(file, buffer, min(sizeof(buffer), secdir.VirtualAddress - pos), &bytes_read, NULL);
|
||||
if (!ret || !bytes_read)
|
||||
return FALSE;
|
||||
if (!CryptHashData(hash, buffer, bytes_read, 0))
|
||||
return FALSE;
|
||||
}
|
||||
if (!hash_file_data( file, 0, checksum, hash )) return FALSE;
|
||||
if (!hash_file_data( file, checksum + sizeof(DWORD), security_dir, hash )) return FALSE;
|
||||
if (!hash_file_data( file, security_dir + sizeof(IMAGE_DATA_DIRECTORY), secdir.VirtualAddress, hash ))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -716,11 +695,9 @@ static LPCSTR filetime_to_str(const FILETIME *time)
|
|||
|
||||
if (!time) return NULL;
|
||||
|
||||
GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt,
|
||||
sizeof(dateFmt) / sizeof(dateFmt[0]));
|
||||
GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt, ARRAY_SIZE(dateFmt));
|
||||
FileTimeToSystemTime(time, &sysTime);
|
||||
GetDateFormatA(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date,
|
||||
sizeof(date) / sizeof(date[0]));
|
||||
GetDateFormatA(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date, ARRAY_SIZE(date));
|
||||
return date;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
@ stub AddPersonalTrustDBPages
|
||||
@ stub CatalogCompactHashDatabase
|
||||
#@ stub ComputeFirstPageHash
|
||||
#@ stub ConfigCiFinalPolicy
|
||||
#@ stub ConfigCiPackageFamilyNameCheck
|
||||
@ stdcall CryptCATAdminAcquireContext(ptr ptr long)
|
||||
@ stdcall CryptCATAdminAcquireContext2(ptr ptr wstr ptr long)
|
||||
@ stdcall CryptCATAdminAddCatalog(long wstr wstr long)
|
||||
@ stdcall CryptCATAdminCalcHashFromFileHandle(long ptr ptr long)
|
||||
#@ stub CryptCATAdminCalcHashFromFileHandle2
|
||||
@ stdcall CryptCATAdminEnumCatalogFromHash(long ptr long long ptr)
|
||||
@ stub CryptCATAdminPauseServiceForBackup
|
||||
@ stdcall CryptCATAdminReleaseCatalogContext(long long long)
|
||||
@ stdcall CryptCATAdminReleaseContext(long long)
|
||||
@ stdcall CryptCATAdminRemoveCatalog(ptr wstr long)
|
||||
@ stdcall CryptCATAdminResolveCatalogPath(ptr wstr ptr long)
|
||||
#@ stub CryptCATAllocSortedMemberInfo
|
||||
@ stdcall CryptCATCDFClose(ptr)
|
||||
@ stub CryptCATCDFEnumAttributes
|
||||
@ stub CryptCATCDFEnumAttributesWithCDFTag
|
||||
|
@ -22,6 +28,7 @@
|
|||
@ stdcall CryptCATEnumerateAttr(ptr ptr ptr)
|
||||
@ stdcall CryptCATEnumerateCatAttr(ptr ptr)
|
||||
@ stdcall CryptCATEnumerateMember(long ptr)
|
||||
#@ stub CryptCATFreeSortedMemberInfo
|
||||
@ stdcall CryptCATGetAttrInfo(ptr ptr wstr)
|
||||
@ stdcall CryptCATGetCatAttrInfo(ptr wstr )
|
||||
@ stdcall CryptCATGetMemberInfo(ptr wstr)
|
||||
|
@ -34,8 +41,10 @@
|
|||
@ stub CryptCATStoreFromHandle
|
||||
@ stub CryptCATVerifyMember
|
||||
@ stdcall CryptSIPCreateIndirectData(ptr ptr ptr)
|
||||
#@ stub CryptSIPGetCaps
|
||||
@ stub CryptSIPGetInfo
|
||||
@ stub CryptSIPGetRegWorkingFlags
|
||||
#@ stub CryptSIPGetSealedDigest
|
||||
@ stdcall CryptSIPGetSignedDataMsg(ptr ptr long ptr ptr)
|
||||
@ stdcall CryptSIPPutSignedDataMsg(ptr long ptr long ptr)
|
||||
@ stdcall CryptSIPRemoveSignedDataMsg(ptr long)
|
||||
|
@ -48,6 +57,7 @@
|
|||
@ stdcall FindCertsByIssuer(ptr ptr ptr ptr long wstr long)
|
||||
@ stdcall GenericChainCertificateTrust(ptr)
|
||||
@ stdcall GenericChainFinalProv(ptr)
|
||||
#@ stub GetAuthenticodeSha256Hash
|
||||
@ stdcall HTTPSCertificateTrust(ptr)
|
||||
@ stdcall HTTPSFinalProv(ptr)
|
||||
@ stdcall IsCatalogFile(ptr wstr)
|
||||
|
@ -56,6 +66,7 @@
|
|||
@ stub OfficeCleanupPolicy
|
||||
@ stub OfficeInitializePolicy
|
||||
@ stdcall OpenPersonalTrustDBDialog(ptr)
|
||||
#@ stub OpenPersonalTrustDBDialogEx
|
||||
@ stdcall SoftpubAuthenticode(ptr)
|
||||
@ stdcall SoftpubCheckCert(ptr long long long)
|
||||
@ stdcall SoftpubCleanup(ptr)
|
||||
|
@ -68,29 +79,48 @@
|
|||
@ stub SoftpubLoadDefUsageCallData
|
||||
@ stdcall SoftpubLoadMessage(ptr)
|
||||
@ stdcall SoftpubLoadSignature(ptr)
|
||||
#@ stub SrpCheckSmartlockerEAandProcessToken
|
||||
@ stub TrustDecode
|
||||
@ stub TrustFindIssuerCertificate
|
||||
@ stub TrustFreeDecode
|
||||
@ stdcall TrustIsCertificateSelfSigned(ptr)
|
||||
@ stub TrustOpenStores
|
||||
#@ stub WTGetBioSignatureInfo
|
||||
#@ stub WTGetPluginSignatureInfo
|
||||
#@ stub WTGetSignatureInfo
|
||||
@ stdcall WTHelperCertCheckValidSignature(ptr)
|
||||
@ stub WTHelperCertFindIssuerCertificate
|
||||
@ stub WTHelperCertIsSelfSigned
|
||||
@ stub WTHelperCheckCertUsage
|
||||
@ stub WTHelperGetAgencyInfo
|
||||
@ stdcall WTHelperGetFileHandle(ptr)
|
||||
#@ stub WTHelperGetFileHash
|
||||
@ stdcall WTHelperGetFileName(ptr)
|
||||
@ stdcall WTHelperGetKnownUsages(long ptr)
|
||||
@ stdcall WTHelperGetProvCertFromChain(ptr long)
|
||||
@ stdcall WTHelperGetProvPrivateDataFromChain(ptr ptr)
|
||||
@ stdcall WTHelperGetProvSignerFromChain(ptr long long long)
|
||||
#@ stub WTHelperIsChainedToMicrosoft
|
||||
#@ stub WTHelperIsChainedToMicrosoftFromStateData
|
||||
@ stub WTHelperIsInRootStore
|
||||
@ stub WTHelperOpenKnownStores
|
||||
@ stdcall WTHelperProvDataFromStateData(ptr)
|
||||
#@ stub WTIsFirstConfigCiResultPreferred
|
||||
#@ stub WTLogConfigCiScriptEvent
|
||||
#@ stub WTLogConfigCiSignerEvent
|
||||
#@ stub WTValidateBioSignaturePolicy
|
||||
#@ stub WVTAsn1CatMemberInfo2Decode
|
||||
#@ stub WVTAsn1CatMemberInfo2Encode
|
||||
@ stdcall WVTAsn1CatMemberInfoDecode(long str ptr long long ptr ptr)
|
||||
@ stdcall WVTAsn1CatMemberInfoEncode(long str ptr ptr ptr)
|
||||
@ stdcall WVTAsn1CatNameValueDecode(long str ptr long long ptr ptr)
|
||||
@ stdcall WVTAsn1CatNameValueEncode(long str ptr ptr ptr)
|
||||
#@ stub WVTAsn1IntentToSealAttributeDecode
|
||||
#@ stub WVTAsn1IntentToSealAttributeEncode
|
||||
#@ stub WVTAsn1SealingSignatureAttributeDecode
|
||||
#@ stub WVTAsn1SealingSignatureAttributeEncode
|
||||
#@ stub WVTAsn1SealingTimestampAttributeDecode
|
||||
#@ stub WVTAsn1SealingTimestampAttributeEncode
|
||||
@ stdcall WVTAsn1SpcFinancialCriteriaInfoDecode(long str ptr long long ptr ptr)
|
||||
@ stdcall WVTAsn1SpcFinancialCriteriaInfoEncode(long str ptr ptr ptr)
|
||||
@ stdcall WVTAsn1SpcIndirectDataContentDecode(long str ptr long long ptr ptr)
|
||||
|
@ -118,6 +148,7 @@
|
|||
@ stdcall WintrustGetRegPolicyFlags(ptr)
|
||||
@ stdcall WintrustLoadFunctionPointers(ptr ptr)
|
||||
@ stdcall WintrustRemoveActionID(ptr)
|
||||
#@ stub WintrustSetDefaultIncludePEPageHashes
|
||||
@ stdcall WintrustSetRegPolicyFlags(long)
|
||||
@ stdcall mscat32DllRegisterServer()
|
||||
@ stdcall mscat32DllUnregisterServer()
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
@ -309,13 +307,11 @@ static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
|
|||
goto done;
|
||||
|
||||
error:
|
||||
if (provData)
|
||||
{
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
}
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
|
||||
done:
|
||||
TRACE("returning %08x\n", err);
|
||||
return err;
|
||||
|
@ -502,13 +498,11 @@ static LONG WINTRUST_CertVerify(HWND hwnd, GUID *actionID,
|
|||
goto done;
|
||||
|
||||
error:
|
||||
if (provData)
|
||||
{
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
}
|
||||
WINTRUST_Free(provData->padwTrustStepErrors);
|
||||
WINTRUST_Free(provData->u.pPDSip);
|
||||
WINTRUST_Free(provData->psPfns);
|
||||
WINTRUST_Free(provData);
|
||||
|
||||
done:
|
||||
TRACE("returning %08x\n", err);
|
||||
return err;
|
||||
|
|
|
@ -207,7 +207,7 @@ dll/win32/winmm # Forked at Wine-20050628
|
|||
dll/win32/winmm/midimap # Forked at Wine-20050628
|
||||
dll/win32/winmm/wavemap # Forked at Wine-20050628
|
||||
dll/win32/winscard # Synced to WineStaging-4.18
|
||||
dll/win32/wintrust # Synced to WineStaging-3.9
|
||||
dll/win32/wintrust # Synced to WineStaging-4.18
|
||||
dll/win32/wldap32 # Synced to WineStaging-3.3
|
||||
dll/win32/wmi # Synced to WineStaging-2.9
|
||||
dll/win32/wmiutils # Synced to WineStaging-3.3
|
||||
|
|
Loading…
Reference in a new issue