Some applications crash when the storage provider its null.
Signed-off-by: Santino Mazza mazzasantino1206@gmail.com --- dlls/ncrypt/ncrypt_internal.c | 13 +++++++++++++ dlls/ncrypt/ncrypt_internal.h | 1 + dlls/ncrypt/ncrypt_main.c | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/ncrypt/ncrypt_internal.c b/dlls/ncrypt/ncrypt_internal.c index 8895bf9ac8d..f52a6619dc9 100644 --- a/dlls/ncrypt/ncrypt_internal.c +++ b/dlls/ncrypt/ncrypt_internal.c @@ -42,6 +42,19 @@ int allocate_key_object(struct ncrypt_object **keyobject) return ERROR_SUCCESS; }
+int allocate_storage_provider_object(struct ncrypt_object **providerobject) +{ + *providerobject = malloc(sizeof(struct ncrypt_object)); + if (providerobject == NULL) + { + ERR("Error allocating memory.\n"); + return NTE_NO_MEMORY; + } + memset(*providerobject, 0, sizeof(struct ncrypt_object)); + (*providerobject)->type = STORAGE_PROVIDER; + return ERROR_SUCCESS; +} + int free_key_object(struct ncrypt_object *keyobject) { struct ncrypt_key_object *key = &keyobject->object.key; diff --git a/dlls/ncrypt/ncrypt_internal.h b/dlls/ncrypt/ncrypt_internal.h index 6538e7c43cb..a9345da3c80 100644 --- a/dlls/ncrypt/ncrypt_internal.h +++ b/dlls/ncrypt/ncrypt_internal.h @@ -92,6 +92,7 @@ struct ncrypt_object };
int allocate_key_object(struct ncrypt_object **keyobject); +int allocate_storage_provider_object(struct ncrypt_object **providerobject); int free_key_object(struct ncrypt_object *keyobject); int set_object_property(struct ncrypt_object *obj, WCHAR *property_name, BYTE *value, DWORD value_size); int get_object_property(struct ncrypt_object *obj, WCHAR *property_name, struct ncrypt_object_property *propertyout); diff --git a/dlls/ncrypt/ncrypt_main.c b/dlls/ncrypt/ncrypt_main.c index f9a2e10f932..7c6fe76338f 100644 --- a/dlls/ncrypt/ncrypt_main.c +++ b/dlls/ncrypt/ncrypt_main.c @@ -107,6 +107,12 @@ SECURITY_STATUS WINAPI NCryptFreeObject(NCRYPT_HANDLE object) } break;
+ case STORAGE_PROVIDER: + { + FIXME("Storage provider not implemented."); + } + break; + default: { ERR("invalid handle 0x%x\n", ncryptobj); @@ -260,7 +266,7 @@ SECURITY_STATUS WINAPI NCryptOpenKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_HAN SECURITY_STATUS WINAPI NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE *provider, const WCHAR *name, DWORD flags) { FIXME("(%p, %s, %u): stub\n", provider, wine_dbgstr_w(name), flags); - return ERROR_SUCCESS; + return allocate_storage_provider_object(provider); }
SECURITY_STATUS WINAPI NCryptSetProperty(NCRYPT_HANDLE object, const WCHAR *property,