[crypt32/tests] Use CryptAcquireContextA instead of CryptAcquireContextW

Detlef Riekenberg wine.dev at web.de
Tue Aug 26 04:57:19 CDT 2008


On Mo, 2008-08-25 at 22:16 +0200, Paul Vriens wrote:

>  static BOOL (WINAPI * pCryptAcquireContextA)
>                          (HCRYPTPROV *, LPCSTR, LPCSTR, DWORD, DWORD);
> -static BOOL (WINAPI * pCryptAcquireContextW)
> -                        (HCRYPTPROV *, LPCWSTR, LPCWSTR, DWORD,
> DWORD);

> @@ -47,7 +45,6 @@ static void init_function_pointers(void)
>        trace("GetProcAddress(%s) failed\n", #func);
>  
>      GET_PROC(hAdvapi32, CryptAcquireContextA)
> -    GET_PROC(hAdvapi32, CryptAcquireContextW)

> @@ -2799,10 +2794,10 @@ static BOOL detect_nt(void)
>      signer.pCertInfo = &certInfo;
>      signer.HashAlgorithm.pszObjId = oid_rsa_md5;
>  
> -    ret = pCryptAcquireContextW(&signer.hCryptProv, cspNameW, NULL,
> +    ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
>                                  PROV_RSA_FULL, CRYPT_NEWKEYSET);

> -        ret = pCryptAcquireContextW(&signer.hCryptProv, cspNameW,
> NULL,
> +        ret = pCryptAcquireContextA(&signer.hCryptProv, cspNameA,
> NULL,
>                                      PROV_RSA_FULL, 0);
>      }
>  
> @@ -2810,7 +2805,7 @@ static BOOL detect_nt(void)
>  
>      /* cleanup */
>      CryptReleaseContext(signer.hCryptProv, 0);
> -    pCryptAcquireContextW(&signer.hCryptProv, cspNameW, NULL,
> PROV_RSA_FULL,
> +    pCryptAcquireContextA(&signer.hCryptProv, cspNameA, NULL,
> PROV_RSA_FULL,
>                            CRYPT_DELETEKEYSET);


This changes are wrong.
Please compare your change with the name of the last Function.
The code is expected to Fail on Win9x.

This should work as first code in detect_nt():
+  if (!pCryptAcquireContextW) return FALSE;

Thanks

-- 
 
By by ... Detlef





More information about the wine-devel mailing list