crypt32: Avoid using HIWORD() on a string pointer.
The stray IS_INTRESOURCE() is applied to a true resource. The other strings are OIDs and not resources.
This commit is contained in:
parent
1dcbbfe1ee
commit
0a866d0e45
|
@ -3380,7 +3380,7 @@ BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR szPolicyOID,
|
|||
TRACE("(%s, %p, %p, %p)\n", debugstr_a(szPolicyOID), pChainContext,
|
||||
pPolicyPara, pPolicyStatus);
|
||||
|
||||
if (!HIWORD(szPolicyOID))
|
||||
if (IS_INTOID(szPolicyOID))
|
||||
{
|
||||
switch (LOWORD(szPolicyOID))
|
||||
{
|
||||
|
|
|
@ -405,4 +405,8 @@ void ContextList_Free(struct ContextList *list);
|
|||
#define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1))
|
||||
#define POINTER_ALIGN_DWORD_PTR(p) ((LPVOID)ALIGN_DWORD_PTR((DWORD_PTR)(p)))
|
||||
|
||||
/* Check if the OID is a small int
|
||||
*/
|
||||
#define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5578,7 +5578,7 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType,
|
|||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
return NULL;
|
||||
}
|
||||
if (!HIWORD(lpszStructType))
|
||||
if (IS_INTOID(lpszStructType))
|
||||
{
|
||||
switch (LOWORD(lpszStructType))
|
||||
{
|
||||
|
|
|
@ -4305,7 +4305,7 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!HIWORD(lpszStructType))
|
||||
if (IS_INTOID(lpszStructType))
|
||||
{
|
||||
switch (LOWORD(lpszStructType))
|
||||
{
|
||||
|
|
|
@ -2525,7 +2525,7 @@ static CryptFormatObjectFunc CRYPT_GetBuiltinFormatFunction(DWORD encodingType,
|
|||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
return NULL;
|
||||
}
|
||||
if (!HIWORD(lpszStructType))
|
||||
if (IS_INTOID(lpszStructType))
|
||||
{
|
||||
switch (LOWORD(lpszStructType))
|
||||
{
|
||||
|
|
|
@ -170,7 +170,7 @@ static char *CRYPT_GetKeyName(DWORD dwEncodingType, LPCSTR pszFuncName,
|
|||
* "EncodingType 2" would be expected if it were a mask. Instead native
|
||||
* stores values in "EncodingType 3".
|
||||
*/
|
||||
if (!HIWORD(pszOID))
|
||||
if (IS_INTOID(pszOID))
|
||||
{
|
||||
snprintf(numericOID, sizeof(numericOID), "#%d", LOWORD(pszOID));
|
||||
oid = numericOID;
|
||||
|
@ -255,7 +255,7 @@ BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule,
|
|||
{
|
||||
struct OIDFunction *func;
|
||||
|
||||
if (HIWORD(rgFuncEntry[i].pszOID))
|
||||
if (!IS_INTOID(rgFuncEntry[i].pszOID))
|
||||
func = CryptMemAlloc(sizeof(struct OIDFunction)
|
||||
+ strlen(rgFuncEntry[i].pszOID) + 1);
|
||||
else
|
||||
|
@ -263,7 +263,7 @@ BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule,
|
|||
if (func)
|
||||
{
|
||||
func->encoding = GET_CERT_ENCODING_TYPE(dwEncodingType);
|
||||
if (HIWORD(rgFuncEntry[i].pszOID))
|
||||
if (!IS_INTOID(rgFuncEntry[i].pszOID))
|
||||
{
|
||||
LPSTR oid;
|
||||
|
||||
|
@ -402,9 +402,9 @@ BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet,
|
|||
{
|
||||
if (function->encoding == GET_CERT_ENCODING_TYPE(dwEncodingType))
|
||||
{
|
||||
if (HIWORD(pszOID))
|
||||
if (!IS_INTOID(pszOID))
|
||||
{
|
||||
if (HIWORD(function->entry.pszOID) &&
|
||||
if (!IS_INTOID(function->entry.pszOID) &&
|
||||
!strcasecmp(function->entry.pszOID, pszOID))
|
||||
{
|
||||
*ppvFuncAddr = function->entry.pvFuncAddr;
|
||||
|
@ -1398,7 +1398,7 @@ static void init_oid_info(void)
|
|||
for (i = 0; i < sizeof(oidInfoConstructors) /
|
||||
sizeof(oidInfoConstructors[0]); i++)
|
||||
{
|
||||
if (HIWORD(oidInfoConstructors[i].pwszName))
|
||||
if (!IS_INTRESOURCE(oidInfoConstructors[i].pwszName))
|
||||
{
|
||||
struct OIDInfo *info;
|
||||
|
||||
|
|
|
@ -745,7 +745,7 @@ HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider,
|
|||
TRACE("(%s, %08x, %08lx, %08x, %p)\n", debugstr_a(lpszStoreProvider),
|
||||
dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara);
|
||||
|
||||
if (!HIWORD(lpszStoreProvider))
|
||||
if (IS_INTOID(lpszStoreProvider))
|
||||
{
|
||||
switch (LOWORD(lpszStoreProvider))
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@ static VOID (WINAPI *pCertFreeCertificateChain)(PCCERT_CHAIN_CONTEXT);
|
|||
static VOID (WINAPI *pCertFreeCertificateChainEngine)(HCERTCHAINENGINE);
|
||||
static BOOL (WINAPI *pCertVerifyCertificateChainPolicy)(LPCSTR,PCCERT_CHAIN_CONTEXT,PCERT_CHAIN_POLICY_PARA,PCERT_CHAIN_POLICY_STATUS);
|
||||
|
||||
#define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0)
|
||||
|
||||
|
||||
static void testCreateCertChainEngine(void)
|
||||
{
|
||||
|
@ -3883,19 +3885,19 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
|||
if (check->todo & TODO_POLICY)
|
||||
todo_wine ok(ret,
|
||||
"%s[%d]: CertVerifyCertificateChainPolicy failed: %08x\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex, GetLastError());
|
||||
else
|
||||
{
|
||||
if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
skip("%d: missing policy %s, skipping test\n", testIndex,
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)));
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy);
|
||||
pCertFreeCertificateChain(chain);
|
||||
return;
|
||||
}
|
||||
ok(ret, "%s[%d]: CertVerifyCertificateChainPolicy failed: %08x\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)), testIndex,
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy, testIndex,
|
||||
GetLastError());
|
||||
}
|
||||
if (ret)
|
||||
|
@ -3906,7 +3908,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
|||
(check->brokenStatus && broken(policyStatus.dwError ==
|
||||
check->brokenStatus->dwError)),
|
||||
"%s[%d]: expected %08x, got %08x\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex, check->status.dwError, policyStatus.dwError);
|
||||
else
|
||||
ok(policyStatus.dwError == check->status.dwError ||
|
||||
|
@ -3914,12 +3916,12 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
|||
(check->brokenStatus && broken(policyStatus.dwError ==
|
||||
check->brokenStatus->dwError)),
|
||||
"%s[%d]: expected %08x, got %08x\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex, check->status.dwError, policyStatus.dwError);
|
||||
if (policyStatus.dwError != check->status.dwError)
|
||||
{
|
||||
skip("%s[%d]: error %08x doesn't match expected %08x, not checking indexes\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex, policyStatus.dwError, check->status.dwError);
|
||||
pCertFreeCertificateChain(chain);
|
||||
return;
|
||||
|
@ -3930,7 +3932,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
|||
(check->brokenStatus && broken(policyStatus.lChainIndex ==
|
||||
check->brokenStatus->lChainIndex)),
|
||||
"%s[%d]: expected %d, got %d\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex, check->status.lChainIndex,
|
||||
policyStatus.lChainIndex);
|
||||
else
|
||||
|
@ -3938,7 +3940,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
|||
(check->brokenStatus && broken(policyStatus.lChainIndex ==
|
||||
check->brokenStatus->lChainIndex)),
|
||||
"%s[%d]: expected %d, got %d\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex,
|
||||
check->status.lChainIndex, policyStatus.lChainIndex);
|
||||
if (check->todo & TODO_ELEMENTS)
|
||||
|
@ -3947,7 +3949,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
|||
(check->brokenStatus && broken(policyStatus.lElementIndex ==
|
||||
check->brokenStatus->lElementIndex)),
|
||||
"%s[%d]: expected %d, got %d\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex,
|
||||
check->status.lElementIndex, policyStatus.lElementIndex);
|
||||
else
|
||||
|
@ -3955,7 +3957,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
|||
(check->brokenStatus && broken(policyStatus.lElementIndex ==
|
||||
check->brokenStatus->lElementIndex)),
|
||||
"%s[%d]: expected %d, got %d\n",
|
||||
HIWORD(policy) ? policy : num_to_str(LOWORD(policy)),
|
||||
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
|
||||
testIndex,
|
||||
check->status.lElementIndex, policyStatus.lElementIndex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue