crypt32/tests: Get rid of unneeded function typedefs.
This commit is contained in:
parent
a7d08fcb6e
commit
6af6f02585
|
@ -206,33 +206,22 @@ static void test_cryptAllocate(void)
|
||||||
CryptMemFree(buf);
|
CryptMemFree(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef DWORD (WINAPI *I_CryptAllocTlsFunc)(void);
|
|
||||||
typedef LPVOID (WINAPI *I_CryptDetachTlsFunc)(DWORD dwTlsIndex);
|
|
||||||
typedef LPVOID (WINAPI *I_CryptGetTlsFunc)(DWORD dwTlsIndex);
|
|
||||||
typedef BOOL (WINAPI *I_CryptSetTlsFunc)(DWORD dwTlsIndex, LPVOID lpTlsValue);
|
|
||||||
typedef BOOL (WINAPI *I_CryptFreeTlsFunc)(DWORD dwTlsIndex, DWORD unknown);
|
|
||||||
|
|
||||||
static I_CryptAllocTlsFunc pI_CryptAllocTls;
|
|
||||||
static I_CryptDetachTlsFunc pI_CryptDetachTls;
|
|
||||||
static I_CryptGetTlsFunc pI_CryptGetTls;
|
|
||||||
static I_CryptSetTlsFunc pI_CryptSetTls;
|
|
||||||
static I_CryptFreeTlsFunc pI_CryptFreeTls;
|
|
||||||
|
|
||||||
static void test_cryptTls(void)
|
static void test_cryptTls(void)
|
||||||
{
|
{
|
||||||
|
DWORD (WINAPI *pI_CryptAllocTls)(void);
|
||||||
|
LPVOID (WINAPI *pI_CryptDetachTls)(DWORD dwTlsIndex);
|
||||||
|
LPVOID (WINAPI *pI_CryptGetTls)(DWORD dwTlsIndex);
|
||||||
|
BOOL (WINAPI *pI_CryptSetTls)(DWORD dwTlsIndex, LPVOID lpTlsValue);
|
||||||
|
BOOL (WINAPI *pI_CryptFreeTls)(DWORD dwTlsIndex, DWORD unknown);
|
||||||
DWORD index;
|
DWORD index;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
pI_CryptAllocTls = (I_CryptAllocTlsFunc)GetProcAddress(hCrypt,
|
pI_CryptAllocTls = (void *)GetProcAddress(hCrypt, "I_CryptAllocTls");
|
||||||
"I_CryptAllocTls");
|
pI_CryptDetachTls = (void *)GetProcAddress(hCrypt, "I_CryptDetachTls");
|
||||||
pI_CryptDetachTls = (I_CryptDetachTlsFunc)GetProcAddress(hCrypt,
|
pI_CryptGetTls = (void *)GetProcAddress(hCrypt, "I_CryptGetTls");
|
||||||
"I_CryptDetachTls");
|
pI_CryptSetTls = (void *)GetProcAddress(hCrypt, "I_CryptSetTls");
|
||||||
pI_CryptGetTls = (I_CryptGetTlsFunc)GetProcAddress(hCrypt,
|
pI_CryptFreeTls = (void *)GetProcAddress(hCrypt, "I_CryptFreeTls");
|
||||||
"I_CryptGetTls");
|
|
||||||
pI_CryptSetTls = (I_CryptSetTlsFunc)GetProcAddress(hCrypt,
|
|
||||||
"I_CryptSetTls");
|
|
||||||
pI_CryptFreeTls = (I_CryptFreeTlsFunc)GetProcAddress(hCrypt,
|
|
||||||
"I_CryptFreeTls");
|
|
||||||
|
|
||||||
/* One normal pass */
|
/* One normal pass */
|
||||||
index = pI_CryptAllocTls();
|
index = pI_CryptAllocTls();
|
||||||
|
@ -277,16 +266,12 @@ static void test_cryptTls(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef BOOL (WINAPI *I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)
|
|
||||||
(LPCWSTR, DWORD *);
|
|
||||||
|
|
||||||
static void test_readTrustedPublisherDWORD(void)
|
static void test_readTrustedPublisherDWORD(void)
|
||||||
{
|
{
|
||||||
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc pReadDWORD;
|
|
||||||
|
|
||||||
pReadDWORD =
|
BOOL (WINAPI *pReadDWORD)(LPCWSTR, DWORD *);
|
||||||
(I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)GetProcAddress(
|
|
||||||
hCrypt, "I_CryptReadTrustedPublisherDWORDValueFromRegistry");
|
pReadDWORD = (void *)GetProcAddress(hCrypt, "I_CryptReadTrustedPublisherDWORDValueFromRegistry");
|
||||||
if (pReadDWORD)
|
if (pReadDWORD)
|
||||||
{
|
{
|
||||||
static const WCHAR safer[] = {
|
static const WCHAR safer[] = {
|
||||||
|
@ -320,15 +305,12 @@ static void test_readTrustedPublisherDWORD(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef HCRYPTPROV (WINAPI *I_CryptGetDefaultCryptProvFunc)(DWORD w);
|
|
||||||
|
|
||||||
static void test_getDefaultCryptProv(void)
|
static void test_getDefaultCryptProv(void)
|
||||||
{
|
{
|
||||||
I_CryptGetDefaultCryptProvFunc pI_CryptGetDefaultCryptProv;
|
HCRYPTPROV (WINAPI *pI_CryptGetDefaultCryptProv)(DWORD w);
|
||||||
HCRYPTPROV prov;
|
HCRYPTPROV prov;
|
||||||
|
|
||||||
pI_CryptGetDefaultCryptProv = (I_CryptGetDefaultCryptProvFunc)
|
pI_CryptGetDefaultCryptProv = (void *)GetProcAddress(hCrypt, "I_CryptGetDefaultCryptProv");
|
||||||
GetProcAddress(hCrypt, "I_CryptGetDefaultCryptProv");
|
|
||||||
if (!pI_CryptGetDefaultCryptProv) return;
|
if (!pI_CryptGetDefaultCryptProv) return;
|
||||||
|
|
||||||
prov = pI_CryptGetDefaultCryptProv(0xdeadbeef);
|
prov = pI_CryptGetDefaultCryptProv(0xdeadbeef);
|
||||||
|
@ -345,14 +327,12 @@ static void test_getDefaultCryptProv(void)
|
||||||
CryptReleaseContext(prov, 0);
|
CryptReleaseContext(prov, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int (WINAPI *I_CryptInstallOssGlobal)(DWORD,DWORD,DWORD);
|
|
||||||
|
|
||||||
static void test_CryptInstallOssGlobal(void)
|
static void test_CryptInstallOssGlobal(void)
|
||||||
{
|
{
|
||||||
|
int (WINAPI *pI_CryptInstallOssGlobal)(DWORD,DWORD,DWORD);
|
||||||
int ret,i;
|
int ret,i;
|
||||||
I_CryptInstallOssGlobal pI_CryptInstallOssGlobal;
|
|
||||||
|
|
||||||
pI_CryptInstallOssGlobal= (I_CryptInstallOssGlobal)GetProcAddress(hCrypt,"I_CryptInstallOssGlobal");
|
pI_CryptInstallOssGlobal = (void *)GetProcAddress(hCrypt,"I_CryptInstallOssGlobal");
|
||||||
/* passing in some random values to I_CryptInstallOssGlobal, it always returns 9 the first time, then 10, 11 etc.*/
|
/* passing in some random values to I_CryptInstallOssGlobal, it always returns 9 the first time, then 10, 11 etc.*/
|
||||||
for(i=0;i<30;i++)
|
for(i=0;i<30;i++)
|
||||||
{
|
{
|
||||||
|
@ -363,10 +343,6 @@ static void test_CryptInstallOssGlobal(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL (WINAPI *pCryptFormatObject)(DWORD dwEncoding, DWORD dwFormatType,
|
|
||||||
DWORD dwFormatStrType, void *pFormatStruct, LPCSTR lpszStructType,
|
|
||||||
const BYTE *pbEncoded, DWORD dwEncoded, void *pbFormat, DWORD *pcbFormat);
|
|
||||||
|
|
||||||
static const BYTE encodedInt[] = { 0x02,0x01,0x01 };
|
static const BYTE encodedInt[] = { 0x02,0x01,0x01 };
|
||||||
static const WCHAR encodedIntStr[] = { '0','2',' ','0','1',' ','0','1',0 };
|
static const WCHAR encodedIntStr[] = { '0','2',' ','0','1',' ','0','1',0 };
|
||||||
static const BYTE encodedBigInt[] = { 0x02,0x1f,0x01,0x02,0x03,0x04,0x05,0x06,
|
static const BYTE encodedBigInt[] = { 0x02,0x1f,0x01,0x02,0x03,0x04,0x05,0x06,
|
||||||
|
@ -381,6 +357,10 @@ static const WCHAR encodedBigIntStr[] = { '0','2',' ','1','f',' ','0','1',' ',
|
||||||
|
|
||||||
static void test_format_object(void)
|
static void test_format_object(void)
|
||||||
{
|
{
|
||||||
|
BOOL (WINAPI *pCryptFormatObject)(DWORD dwEncoding, DWORD dwFormatType,
|
||||||
|
DWORD dwFormatStrType, void *pFormatStruct, LPCSTR lpszStructType,
|
||||||
|
const BYTE *pbEncoded, DWORD dwEncoded, void *pbFormat,
|
||||||
|
DWORD *pcbFormat);
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
LPWSTR str;
|
LPWSTR str;
|
||||||
|
|
|
@ -738,8 +738,6 @@ static const struct CertPropIDHeader *findPropID(const BYTE *buf, DWORD size,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef DWORD (WINAPI *SHDeleteKeyAFunc)(HKEY, LPCSTR);
|
|
||||||
|
|
||||||
static void testRegStore(void)
|
static void testRegStore(void)
|
||||||
{
|
{
|
||||||
static const char tempKey[] = "Software\\Wine\\CryptTemp";
|
static const char tempKey[] = "Software\\Wine\\CryptTemp";
|
||||||
|
@ -1017,9 +1015,9 @@ static void testRegStore(void)
|
||||||
*/
|
*/
|
||||||
if (shlwapi)
|
if (shlwapi)
|
||||||
{
|
{
|
||||||
SHDeleteKeyAFunc pSHDeleteKeyA =
|
DWORD (WINAPI *pSHDeleteKeyA)(HKEY, LPCSTR);
|
||||||
(SHDeleteKeyAFunc)GetProcAddress(shlwapi, "SHDeleteKeyA");
|
|
||||||
|
|
||||||
|
pSHDeleteKeyA = (void*)GetProcAddress(shlwapi, "SHDeleteKeyA");
|
||||||
if (pSHDeleteKeyA)
|
if (pSHDeleteKeyA)
|
||||||
pSHDeleteKeyA(HKEY_CURRENT_USER, tempKey);
|
pSHDeleteKeyA(HKEY_CURRENT_USER, tempKey);
|
||||||
FreeLibrary(shlwapi);
|
FreeLibrary(shlwapi);
|
||||||
|
|
|
@ -185,32 +185,22 @@ static WCHAR x500SubjectStrSemicolonReverseW[] = {
|
||||||
'e','a','p','o','l','i','s',';',' ','S','=','M','i','n','n','e','s','o','t','a',
|
'e','a','p','o','l','i','s',';',' ','S','=','M','i','n','n','e','s','o','t','a',
|
||||||
';',' ','C','=','U','S',0 };
|
';',' ','C','=','U','S',0 };
|
||||||
|
|
||||||
typedef BOOL (WINAPI *CryptDecodeObjectFunc)(DWORD, LPCSTR, const BYTE *,
|
static HMODULE dll;
|
||||||
DWORD, DWORD, void *, DWORD *);
|
static DWORD (WINAPI *pCertNameToStrA)(DWORD,LPVOID,DWORD,LPSTR,DWORD);
|
||||||
typedef DWORD (WINAPI *CertNameToStrAFunc)(DWORD,LPVOID,DWORD,LPSTR,DWORD);
|
static DWORD (WINAPI *pCertNameToStrW)(DWORD,LPVOID,DWORD,LPWSTR,DWORD);
|
||||||
typedef DWORD (WINAPI *CertNameToStrWFunc)(DWORD,LPVOID,DWORD,LPWSTR,DWORD);
|
static DWORD (WINAPI *pCertRDNValueToStrA)(DWORD, PCERT_RDN_VALUE_BLOB,
|
||||||
typedef DWORD (WINAPI *CertRDNValueToStrAFunc)(DWORD, PCERT_RDN_VALUE_BLOB,
|
|
||||||
LPSTR, DWORD);
|
LPSTR, DWORD);
|
||||||
typedef DWORD (WINAPI *CertRDNValueToStrWFunc)(DWORD, PCERT_RDN_VALUE_BLOB,
|
static DWORD (WINAPI *pCertRDNValueToStrW)(DWORD, PCERT_RDN_VALUE_BLOB,
|
||||||
LPWSTR, DWORD);
|
LPWSTR, DWORD);
|
||||||
typedef BOOL (WINAPI *CertStrToNameAFunc)(DWORD dwCertEncodingType,
|
static BOOL (WINAPI *pCertStrToNameA)(DWORD dwCertEncodingType,
|
||||||
LPCSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded,
|
LPCSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded,
|
||||||
DWORD *pcbEncoded, LPCSTR *ppszError);
|
DWORD *pcbEncoded, LPCSTR *ppszError);
|
||||||
typedef BOOL (WINAPI *CertStrToNameWFunc)(DWORD dwCertEncodingType,
|
static BOOL (WINAPI *pCertStrToNameW)(DWORD dwCertEncodingType,
|
||||||
LPCWSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded,
|
LPCWSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded,
|
||||||
DWORD *pcbEncoded, LPCWSTR *ppszError);
|
DWORD *pcbEncoded, LPCWSTR *ppszError);
|
||||||
typedef DWORD (WINAPI *CertGetNameStringAFunc)(PCCERT_CONTEXT cert, DWORD type,
|
static DWORD (WINAPI *pCertGetNameStringA)(PCCERT_CONTEXT cert, DWORD type,
|
||||||
DWORD flags, void *typePara, LPSTR str, DWORD cch);
|
DWORD flags, void *typePara, LPSTR str, DWORD cch);
|
||||||
|
|
||||||
static HMODULE dll;
|
|
||||||
static CertNameToStrAFunc pCertNameToStrA;
|
|
||||||
static CertNameToStrWFunc pCertNameToStrW;
|
|
||||||
static CryptDecodeObjectFunc pCryptDecodeObject;
|
|
||||||
static CertRDNValueToStrAFunc pCertRDNValueToStrA;
|
|
||||||
static CertRDNValueToStrWFunc pCertRDNValueToStrW;
|
|
||||||
static CertStrToNameAFunc pCertStrToNameA;
|
|
||||||
static CertStrToNameWFunc pCertStrToNameW;
|
|
||||||
static CertGetNameStringAFunc pCertGetNameStringA;
|
|
||||||
|
|
||||||
static void test_CertRDNValueToStrA(void)
|
static void test_CertRDNValueToStrA(void)
|
||||||
{
|
{
|
||||||
|
@ -1096,18 +1086,13 @@ START_TEST(str)
|
||||||
{
|
{
|
||||||
dll = GetModuleHandleA("Crypt32.dll");
|
dll = GetModuleHandleA("Crypt32.dll");
|
||||||
|
|
||||||
pCertNameToStrA = (CertNameToStrAFunc)GetProcAddress(dll,"CertNameToStrA");
|
pCertNameToStrA = (void*)GetProcAddress(dll,"CertNameToStrA");
|
||||||
pCertNameToStrW = (CertNameToStrWFunc)GetProcAddress(dll,"CertNameToStrW");
|
pCertNameToStrW = (void*)GetProcAddress(dll,"CertNameToStrW");
|
||||||
pCertRDNValueToStrA = (CertRDNValueToStrAFunc)GetProcAddress(dll,
|
pCertRDNValueToStrA = (void*)GetProcAddress(dll, "CertRDNValueToStrA");
|
||||||
"CertRDNValueToStrA");
|
pCertRDNValueToStrW = (void*)GetProcAddress(dll, "CertRDNValueToStrW");
|
||||||
pCertRDNValueToStrW = (CertRDNValueToStrWFunc)GetProcAddress(dll,
|
pCertStrToNameA = (void*)GetProcAddress(dll,"CertStrToNameA");
|
||||||
"CertRDNValueToStrW");
|
pCertStrToNameW = (void*)GetProcAddress(dll,"CertStrToNameW");
|
||||||
pCryptDecodeObject = (CryptDecodeObjectFunc)GetProcAddress(dll,
|
pCertGetNameStringA = (void*)GetProcAddress(dll, "CertGetNameStringA");
|
||||||
"CryptDecodeObject");
|
|
||||||
pCertStrToNameA = (CertStrToNameAFunc)GetProcAddress(dll,"CertStrToNameA");
|
|
||||||
pCertStrToNameW = (CertStrToNameWFunc)GetProcAddress(dll,"CertStrToNameW");
|
|
||||||
pCertGetNameStringA = (CertGetNameStringAFunc)GetProcAddress(dll,
|
|
||||||
"CertGetNameStringA");
|
|
||||||
|
|
||||||
test_CertRDNValueToStrA();
|
test_CertRDNValueToStrA();
|
||||||
test_CertRDNValueToStrW();
|
test_CertRDNValueToStrW();
|
||||||
|
|
Loading…
Reference in New Issue