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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
BOOL ret;
|
||||
|
||||
pI_CryptAllocTls = (I_CryptAllocTlsFunc)GetProcAddress(hCrypt,
|
||||
"I_CryptAllocTls");
|
||||
pI_CryptDetachTls = (I_CryptDetachTlsFunc)GetProcAddress(hCrypt,
|
||||
"I_CryptDetachTls");
|
||||
pI_CryptGetTls = (I_CryptGetTlsFunc)GetProcAddress(hCrypt,
|
||||
"I_CryptGetTls");
|
||||
pI_CryptSetTls = (I_CryptSetTlsFunc)GetProcAddress(hCrypt,
|
||||
"I_CryptSetTls");
|
||||
pI_CryptFreeTls = (I_CryptFreeTlsFunc)GetProcAddress(hCrypt,
|
||||
"I_CryptFreeTls");
|
||||
pI_CryptAllocTls = (void *)GetProcAddress(hCrypt, "I_CryptAllocTls");
|
||||
pI_CryptDetachTls = (void *)GetProcAddress(hCrypt, "I_CryptDetachTls");
|
||||
pI_CryptGetTls = (void *)GetProcAddress(hCrypt, "I_CryptGetTls");
|
||||
pI_CryptSetTls = (void *)GetProcAddress(hCrypt, "I_CryptSetTls");
|
||||
pI_CryptFreeTls = (void *)GetProcAddress(hCrypt, "I_CryptFreeTls");
|
||||
|
||||
/* One normal pass */
|
||||
index = pI_CryptAllocTls();
|
||||
|
@ -277,16 +266,12 @@ static void test_cryptTls(void)
|
|||
}
|
||||
}
|
||||
|
||||
typedef BOOL (WINAPI *I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)
|
||||
(LPCWSTR, DWORD *);
|
||||
|
||||
static void test_readTrustedPublisherDWORD(void)
|
||||
{
|
||||
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc pReadDWORD;
|
||||
|
||||
pReadDWORD =
|
||||
(I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)GetProcAddress(
|
||||
hCrypt, "I_CryptReadTrustedPublisherDWORDValueFromRegistry");
|
||||
BOOL (WINAPI *pReadDWORD)(LPCWSTR, DWORD *);
|
||||
|
||||
pReadDWORD = (void *)GetProcAddress(hCrypt, "I_CryptReadTrustedPublisherDWORDValueFromRegistry");
|
||||
if (pReadDWORD)
|
||||
{
|
||||
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)
|
||||
{
|
||||
I_CryptGetDefaultCryptProvFunc pI_CryptGetDefaultCryptProv;
|
||||
HCRYPTPROV (WINAPI *pI_CryptGetDefaultCryptProv)(DWORD w);
|
||||
HCRYPTPROV prov;
|
||||
|
||||
pI_CryptGetDefaultCryptProv = (I_CryptGetDefaultCryptProvFunc)
|
||||
GetProcAddress(hCrypt, "I_CryptGetDefaultCryptProv");
|
||||
pI_CryptGetDefaultCryptProv = (void *)GetProcAddress(hCrypt, "I_CryptGetDefaultCryptProv");
|
||||
if (!pI_CryptGetDefaultCryptProv) return;
|
||||
|
||||
prov = pI_CryptGetDefaultCryptProv(0xdeadbeef);
|
||||
|
@ -345,14 +327,12 @@ static void test_getDefaultCryptProv(void)
|
|||
CryptReleaseContext(prov, 0);
|
||||
}
|
||||
|
||||
typedef int (WINAPI *I_CryptInstallOssGlobal)(DWORD,DWORD,DWORD);
|
||||
|
||||
static void test_CryptInstallOssGlobal(void)
|
||||
{
|
||||
int (WINAPI *pI_CryptInstallOssGlobal)(DWORD,DWORD,DWORD);
|
||||
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.*/
|
||||
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 WCHAR encodedIntStr[] = { '0','2',' ','0','1',' ','0','1',0 };
|
||||
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)
|
||||
{
|
||||
BOOL (WINAPI *pCryptFormatObject)(DWORD dwEncoding, DWORD dwFormatType,
|
||||
DWORD dwFormatStrType, void *pFormatStruct, LPCSTR lpszStructType,
|
||||
const BYTE *pbEncoded, DWORD dwEncoded, void *pbFormat,
|
||||
DWORD *pcbFormat);
|
||||
BOOL ret;
|
||||
DWORD size;
|
||||
LPWSTR str;
|
||||
|
|
|
@ -738,8 +738,6 @@ static const struct CertPropIDHeader *findPropID(const BYTE *buf, DWORD size,
|
|||
return ret;
|
||||
}
|
||||
|
||||
typedef DWORD (WINAPI *SHDeleteKeyAFunc)(HKEY, LPCSTR);
|
||||
|
||||
static void testRegStore(void)
|
||||
{
|
||||
static const char tempKey[] = "Software\\Wine\\CryptTemp";
|
||||
|
@ -1017,9 +1015,9 @@ static void testRegStore(void)
|
|||
*/
|
||||
if (shlwapi)
|
||||
{
|
||||
SHDeleteKeyAFunc pSHDeleteKeyA =
|
||||
(SHDeleteKeyAFunc)GetProcAddress(shlwapi, "SHDeleteKeyA");
|
||||
DWORD (WINAPI *pSHDeleteKeyA)(HKEY, LPCSTR);
|
||||
|
||||
pSHDeleteKeyA = (void*)GetProcAddress(shlwapi, "SHDeleteKeyA");
|
||||
if (pSHDeleteKeyA)
|
||||
pSHDeleteKeyA(HKEY_CURRENT_USER, tempKey);
|
||||
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',
|
||||
';',' ','C','=','U','S',0 };
|
||||
|
||||
typedef BOOL (WINAPI *CryptDecodeObjectFunc)(DWORD, LPCSTR, const BYTE *,
|
||||
DWORD, DWORD, void *, DWORD *);
|
||||
typedef DWORD (WINAPI *CertNameToStrAFunc)(DWORD,LPVOID,DWORD,LPSTR,DWORD);
|
||||
typedef DWORD (WINAPI *CertNameToStrWFunc)(DWORD,LPVOID,DWORD,LPWSTR,DWORD);
|
||||
typedef DWORD (WINAPI *CertRDNValueToStrAFunc)(DWORD, PCERT_RDN_VALUE_BLOB,
|
||||
static HMODULE dll;
|
||||
static DWORD (WINAPI *pCertNameToStrA)(DWORD,LPVOID,DWORD,LPSTR,DWORD);
|
||||
static DWORD (WINAPI *pCertNameToStrW)(DWORD,LPVOID,DWORD,LPWSTR,DWORD);
|
||||
static DWORD (WINAPI *pCertRDNValueToStrA)(DWORD, PCERT_RDN_VALUE_BLOB,
|
||||
LPSTR, DWORD);
|
||||
typedef DWORD (WINAPI *CertRDNValueToStrWFunc)(DWORD, PCERT_RDN_VALUE_BLOB,
|
||||
static DWORD (WINAPI *pCertRDNValueToStrW)(DWORD, PCERT_RDN_VALUE_BLOB,
|
||||
LPWSTR, DWORD);
|
||||
typedef BOOL (WINAPI *CertStrToNameAFunc)(DWORD dwCertEncodingType,
|
||||
static BOOL (WINAPI *pCertStrToNameA)(DWORD dwCertEncodingType,
|
||||
LPCSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded,
|
||||
DWORD *pcbEncoded, LPCSTR *ppszError);
|
||||
typedef BOOL (WINAPI *CertStrToNameWFunc)(DWORD dwCertEncodingType,
|
||||
static BOOL (WINAPI *pCertStrToNameW)(DWORD dwCertEncodingType,
|
||||
LPCWSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded,
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1096,18 +1086,13 @@ START_TEST(str)
|
|||
{
|
||||
dll = GetModuleHandleA("Crypt32.dll");
|
||||
|
||||
pCertNameToStrA = (CertNameToStrAFunc)GetProcAddress(dll,"CertNameToStrA");
|
||||
pCertNameToStrW = (CertNameToStrWFunc)GetProcAddress(dll,"CertNameToStrW");
|
||||
pCertRDNValueToStrA = (CertRDNValueToStrAFunc)GetProcAddress(dll,
|
||||
"CertRDNValueToStrA");
|
||||
pCertRDNValueToStrW = (CertRDNValueToStrWFunc)GetProcAddress(dll,
|
||||
"CertRDNValueToStrW");
|
||||
pCryptDecodeObject = (CryptDecodeObjectFunc)GetProcAddress(dll,
|
||||
"CryptDecodeObject");
|
||||
pCertStrToNameA = (CertStrToNameAFunc)GetProcAddress(dll,"CertStrToNameA");
|
||||
pCertStrToNameW = (CertStrToNameWFunc)GetProcAddress(dll,"CertStrToNameW");
|
||||
pCertGetNameStringA = (CertGetNameStringAFunc)GetProcAddress(dll,
|
||||
"CertGetNameStringA");
|
||||
pCertNameToStrA = (void*)GetProcAddress(dll,"CertNameToStrA");
|
||||
pCertNameToStrW = (void*)GetProcAddress(dll,"CertNameToStrW");
|
||||
pCertRDNValueToStrA = (void*)GetProcAddress(dll, "CertRDNValueToStrA");
|
||||
pCertRDNValueToStrW = (void*)GetProcAddress(dll, "CertRDNValueToStrW");
|
||||
pCertStrToNameA = (void*)GetProcAddress(dll,"CertStrToNameA");
|
||||
pCertStrToNameW = (void*)GetProcAddress(dll,"CertStrToNameW");
|
||||
pCertGetNameStringA = (void*)GetProcAddress(dll, "CertGetNameStringA");
|
||||
|
||||
test_CertRDNValueToStrA();
|
||||
test_CertRDNValueToStrW();
|
||||
|
|
Loading…
Reference in New Issue