Signed-off-by: Santino Mazza mazzasantino1206@gmail.com --- dlls/ncrypt/tests/ncrypt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/dlls/ncrypt/tests/ncrypt.c b/dlls/ncrypt/tests/ncrypt.c index bd30189e2c2..c5ba5080241 100644 --- a/dlls/ncrypt/tests/ncrypt.c +++ b/dlls/ncrypt/tests/ncrypt.c @@ -136,7 +136,31 @@ static void test_key_import_rsa(void) NCryptFreeObject(prov); }
+static void test_ncrypt_free_object(void) +{ + NCRYPT_PROV_HANDLE prov; + SECURITY_STATUS ret = NCryptOpenStorageProvider(&prov, NULL, 0); + ok(ret == ERROR_SUCCESS, "got 0x%x\n", ret); + + todo_wine { + NCRYPT_KEY_HANDLE key; + ret = NCryptImportKey(prov, (NCRYPT_KEY_HANDLE)NULL, BCRYPT_RSAPUBLIC_BLOB, NULL, &key, rsa_key_blob, sizeof(rsa_key_blob), 0); + ret = NCryptFreeObject(key); + ok(ret == ERROR_SUCCESS, "got 0x%x\n", ret); + + key = 0; + ret = NCryptFreeObject(key); + ok(ret == NTE_INVALID_HANDLE, "got 0x%x\n", ret); + + key = malloc(50); + ret = NCryptFreeObject(key); + ok(ret == NTE_INVALID_HANDLE, "got 0x%x\n", ret); + free(key); + } +} + START_TEST(ncrypt) { test_key_import_rsa(); + test_ncrypt_free_object(); }