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,
|
TRACE("(%s, %p, %p, %p)\n", debugstr_a(szPolicyOID), pChainContext,
|
||||||
pPolicyPara, pPolicyStatus);
|
pPolicyPara, pPolicyStatus);
|
||||||
|
|
||||||
if (!HIWORD(szPolicyOID))
|
if (IS_INTOID(szPolicyOID))
|
||||||
{
|
{
|
||||||
switch (LOWORD(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 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)))
|
#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
|
#endif
|
||||||
|
|
|
@ -5578,7 +5578,7 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType,
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!HIWORD(lpszStructType))
|
if (IS_INTOID(lpszStructType))
|
||||||
{
|
{
|
||||||
switch (LOWORD(lpszStructType))
|
switch (LOWORD(lpszStructType))
|
||||||
{
|
{
|
||||||
|
|
|
@ -4305,7 +4305,7 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HIWORD(lpszStructType))
|
if (IS_INTOID(lpszStructType))
|
||||||
{
|
{
|
||||||
switch (LOWORD(lpszStructType))
|
switch (LOWORD(lpszStructType))
|
||||||
{
|
{
|
||||||
|
|
|
@ -2525,7 +2525,7 @@ static CryptFormatObjectFunc CRYPT_GetBuiltinFormatFunction(DWORD encodingType,
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!HIWORD(lpszStructType))
|
if (IS_INTOID(lpszStructType))
|
||||||
{
|
{
|
||||||
switch (LOWORD(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
|
* "EncodingType 2" would be expected if it were a mask. Instead native
|
||||||
* stores values in "EncodingType 3".
|
* stores values in "EncodingType 3".
|
||||||
*/
|
*/
|
||||||
if (!HIWORD(pszOID))
|
if (IS_INTOID(pszOID))
|
||||||
{
|
{
|
||||||
snprintf(numericOID, sizeof(numericOID), "#%d", LOWORD(pszOID));
|
snprintf(numericOID, sizeof(numericOID), "#%d", LOWORD(pszOID));
|
||||||
oid = numericOID;
|
oid = numericOID;
|
||||||
|
@ -255,7 +255,7 @@ BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule,
|
||||||
{
|
{
|
||||||
struct OIDFunction *func;
|
struct OIDFunction *func;
|
||||||
|
|
||||||
if (HIWORD(rgFuncEntry[i].pszOID))
|
if (!IS_INTOID(rgFuncEntry[i].pszOID))
|
||||||
func = CryptMemAlloc(sizeof(struct OIDFunction)
|
func = CryptMemAlloc(sizeof(struct OIDFunction)
|
||||||
+ strlen(rgFuncEntry[i].pszOID) + 1);
|
+ strlen(rgFuncEntry[i].pszOID) + 1);
|
||||||
else
|
else
|
||||||
|
@ -263,7 +263,7 @@ BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule,
|
||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
func->encoding = GET_CERT_ENCODING_TYPE(dwEncodingType);
|
func->encoding = GET_CERT_ENCODING_TYPE(dwEncodingType);
|
||||||
if (HIWORD(rgFuncEntry[i].pszOID))
|
if (!IS_INTOID(rgFuncEntry[i].pszOID))
|
||||||
{
|
{
|
||||||
LPSTR oid;
|
LPSTR oid;
|
||||||
|
|
||||||
|
@ -402,9 +402,9 @@ BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet,
|
||||||
{
|
{
|
||||||
if (function->encoding == GET_CERT_ENCODING_TYPE(dwEncodingType))
|
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))
|
!strcasecmp(function->entry.pszOID, pszOID))
|
||||||
{
|
{
|
||||||
*ppvFuncAddr = function->entry.pvFuncAddr;
|
*ppvFuncAddr = function->entry.pvFuncAddr;
|
||||||
|
@ -1398,7 +1398,7 @@ static void init_oid_info(void)
|
||||||
for (i = 0; i < sizeof(oidInfoConstructors) /
|
for (i = 0; i < sizeof(oidInfoConstructors) /
|
||||||
sizeof(oidInfoConstructors[0]); i++)
|
sizeof(oidInfoConstructors[0]); i++)
|
||||||
{
|
{
|
||||||
if (HIWORD(oidInfoConstructors[i].pwszName))
|
if (!IS_INTRESOURCE(oidInfoConstructors[i].pwszName))
|
||||||
{
|
{
|
||||||
struct OIDInfo *info;
|
struct OIDInfo *info;
|
||||||
|
|
||||||
|
|
|
@ -745,7 +745,7 @@ HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider,
|
||||||
TRACE("(%s, %08x, %08lx, %08x, %p)\n", debugstr_a(lpszStoreProvider),
|
TRACE("(%s, %08x, %08lx, %08x, %p)\n", debugstr_a(lpszStoreProvider),
|
||||||
dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara);
|
dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara);
|
||||||
|
|
||||||
if (!HIWORD(lpszStoreProvider))
|
if (IS_INTOID(lpszStoreProvider))
|
||||||
{
|
{
|
||||||
switch (LOWORD(lpszStoreProvider))
|
switch (LOWORD(lpszStoreProvider))
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,8 @@ static VOID (WINAPI *pCertFreeCertificateChain)(PCCERT_CHAIN_CONTEXT);
|
||||||
static VOID (WINAPI *pCertFreeCertificateChainEngine)(HCERTCHAINENGINE);
|
static VOID (WINAPI *pCertFreeCertificateChainEngine)(HCERTCHAINENGINE);
|
||||||
static BOOL (WINAPI *pCertVerifyCertificateChainPolicy)(LPCSTR,PCCERT_CHAIN_CONTEXT,PCERT_CHAIN_POLICY_PARA,PCERT_CHAIN_POLICY_STATUS);
|
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)
|
static void testCreateCertChainEngine(void)
|
||||||
{
|
{
|
||||||
|
@ -3883,19 +3885,19 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
||||||
if (check->todo & TODO_POLICY)
|
if (check->todo & TODO_POLICY)
|
||||||
todo_wine ok(ret,
|
todo_wine ok(ret,
|
||||||
"%s[%d]: CertVerifyCertificateChainPolicy failed: %08x\n",
|
"%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());
|
testIndex, GetLastError());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
|
if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
|
||||||
{
|
{
|
||||||
skip("%d: missing policy %s, skipping test\n", testIndex,
|
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);
|
pCertFreeCertificateChain(chain);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ok(ret, "%s[%d]: CertVerifyCertificateChainPolicy failed: %08x\n",
|
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());
|
GetLastError());
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -3906,7 +3908,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
||||||
(check->brokenStatus && broken(policyStatus.dwError ==
|
(check->brokenStatus && broken(policyStatus.dwError ==
|
||||||
check->brokenStatus->dwError)),
|
check->brokenStatus->dwError)),
|
||||||
"%s[%d]: expected %08x, got %08x\n",
|
"%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);
|
testIndex, check->status.dwError, policyStatus.dwError);
|
||||||
else
|
else
|
||||||
ok(policyStatus.dwError == check->status.dwError ||
|
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 && broken(policyStatus.dwError ==
|
||||||
check->brokenStatus->dwError)),
|
check->brokenStatus->dwError)),
|
||||||
"%s[%d]: expected %08x, got %08x\n",
|
"%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);
|
testIndex, check->status.dwError, policyStatus.dwError);
|
||||||
if (policyStatus.dwError != check->status.dwError)
|
if (policyStatus.dwError != check->status.dwError)
|
||||||
{
|
{
|
||||||
skip("%s[%d]: error %08x doesn't match expected %08x, not checking indexes\n",
|
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);
|
testIndex, policyStatus.dwError, check->status.dwError);
|
||||||
pCertFreeCertificateChain(chain);
|
pCertFreeCertificateChain(chain);
|
||||||
return;
|
return;
|
||||||
|
@ -3930,7 +3932,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
||||||
(check->brokenStatus && broken(policyStatus.lChainIndex ==
|
(check->brokenStatus && broken(policyStatus.lChainIndex ==
|
||||||
check->brokenStatus->lChainIndex)),
|
check->brokenStatus->lChainIndex)),
|
||||||
"%s[%d]: expected %d, got %d\n",
|
"%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,
|
testIndex, check->status.lChainIndex,
|
||||||
policyStatus.lChainIndex);
|
policyStatus.lChainIndex);
|
||||||
else
|
else
|
||||||
|
@ -3938,7 +3940,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
||||||
(check->brokenStatus && broken(policyStatus.lChainIndex ==
|
(check->brokenStatus && broken(policyStatus.lChainIndex ==
|
||||||
check->brokenStatus->lChainIndex)),
|
check->brokenStatus->lChainIndex)),
|
||||||
"%s[%d]: expected %d, got %d\n",
|
"%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,
|
testIndex,
|
||||||
check->status.lChainIndex, policyStatus.lChainIndex);
|
check->status.lChainIndex, policyStatus.lChainIndex);
|
||||||
if (check->todo & TODO_ELEMENTS)
|
if (check->todo & TODO_ELEMENTS)
|
||||||
|
@ -3947,7 +3949,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
||||||
(check->brokenStatus && broken(policyStatus.lElementIndex ==
|
(check->brokenStatus && broken(policyStatus.lElementIndex ==
|
||||||
check->brokenStatus->lElementIndex)),
|
check->brokenStatus->lElementIndex)),
|
||||||
"%s[%d]: expected %d, got %d\n",
|
"%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,
|
testIndex,
|
||||||
check->status.lElementIndex, policyStatus.lElementIndex);
|
check->status.lElementIndex, policyStatus.lElementIndex);
|
||||||
else
|
else
|
||||||
|
@ -3955,7 +3957,7 @@ static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
|
||||||
(check->brokenStatus && broken(policyStatus.lElementIndex ==
|
(check->brokenStatus && broken(policyStatus.lElementIndex ==
|
||||||
check->brokenStatus->lElementIndex)),
|
check->brokenStatus->lElementIndex)),
|
||||||
"%s[%d]: expected %d, got %d\n",
|
"%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,
|
testIndex,
|
||||||
check->status.lElementIndex, policyStatus.lElementIndex);
|
check->status.lElementIndex, policyStatus.lElementIndex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue