Module: wine Branch: master Commit: ad514dbc204321c9aef81193b3f86d21fbe8b8bb URL: http://source.winehq.org/git/wine.git/?a=commit;h=ad514dbc204321c9aef81193b3...
Author: Juan Lang juan.lang@gmail.com Date: Wed Oct 17 09:31:18 2007 -0700
crypt32: Add basic tests for CryptGetDefaultOIDFunctionAddress.
---
dlls/crypt32/tests/oid.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/tests/oid.c b/dlls/crypt32/tests/oid.c index c42b891..f4f11f0 100644 --- a/dlls/crypt32/tests/oid.c +++ b/dlls/crypt32/tests/oid.c @@ -414,6 +414,47 @@ static void test_registerDefaultOIDFunction(void) "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError()); }
+static void test_getDefaultOIDFunctionAddress(void) +{ + BOOL ret; + HCRYPTOIDFUNCSET set; + void *funcAddr; + HCRYPTOIDFUNCADDR hFuncAddr; + + /* Crash + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, NULL, NULL); + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, &funcAddr, NULL); + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, NULL, &hFuncAddr); + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, &funcAddr, + &hFuncAddr); + */ + set = CryptInitOIDFunctionSet("CertDllOpenStoreProv", 0); + ok(set != 0, "CryptInitOIDFunctionSet failed: %d\n", GetLastError()); + /* This crashes if hFuncAddr is not 0 to begin with */ + hFuncAddr = 0; + ret = CryptGetDefaultOIDFunctionAddress(set, 0, NULL, 0, &funcAddr, + &hFuncAddr); + ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); + /* This fails with the normal encoding too, so built-in functions aren't + * returned. + */ + ret = CryptGetDefaultOIDFunctionAddress(set, X509_ASN_ENCODING, NULL, 0, + &funcAddr, &hFuncAddr); + ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); + + /* Even with a registered dll, this fails (since the dll doesn't exist) */ + ret = CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 0, + bogusDll); + ok(ret, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError()); + ret = CryptGetDefaultOIDFunctionAddress(set, 0, NULL, 0, &funcAddr, + &hFuncAddr); + ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); + CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv", bogusDll); +} + static BOOL WINAPI countOidInfo(PCCRYPT_OID_INFO pInfo, void *pvArg) { (*(DWORD *)pvArg)++; @@ -499,4 +540,5 @@ START_TEST(oid) test_installOIDFunctionAddress(); test_registerOIDFunction(); test_registerDefaultOIDFunction(); + test_getDefaultOIDFunctionAddress(); }