Module: wine Branch: master Commit: da8853f06226f97e2486066b45785be7894afca2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=da8853f06226f97e2486066b45...
Author: Michael Müller michael@fds-team.de Date: Fri Mar 10 15:35:14 2017 +0100
bcrypt: Implement BCryptDuplicateHash.
Signed-off-by: Michael Müller michael@fds-team.de Signed-off-by: Sebastian Lackner sebastian@fds-team.de Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/bcrypt/bcrypt.spec | 2 +- dlls/bcrypt/bcrypt_main.c | 21 +++++++++++++++++++++ dlls/ncrypt/ncrypt.spec | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec index e299fe0..a1cce44 100644 --- a/dlls/bcrypt/bcrypt.spec +++ b/dlls/bcrypt/bcrypt.spec @@ -11,7 +11,7 @@ @ stdcall BCryptDestroyHash(ptr) @ stub BCryptDestroyKey @ stub BCryptDestroySecret -@ stub BCryptDuplicateHash +@ stdcall BCryptDuplicateHash(ptr ptr ptr long long) @ stub BCryptDuplicateKey @ stub BCryptEncrypt @ stdcall BCryptEnumAlgorithms(long ptr ptr long) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 561b459..b188479 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -536,6 +536,27 @@ end: return STATUS_SUCCESS; }
+NTSTATUS WINAPI BCryptDuplicateHash( BCRYPT_HASH_HANDLE handle, BCRYPT_HASH_HANDLE *handle_copy, + UCHAR *object, ULONG objectlen, ULONG flags ) +{ + struct hash *hash_orig = handle; + struct hash *hash_copy; + + TRACE( "%p, %p, %p, %u, %u\n", handle, handle_copy, object, objectlen, flags ); + + if (!hash_orig || hash_orig->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE; + if (!handle_copy) return STATUS_INVALID_PARAMETER; + if (object) FIXME( "ignoring object buffer\n" ); + + if (!(hash_copy = HeapAlloc( GetProcessHeap(), 0, sizeof(*hash_copy) ))) + return STATUS_NO_MEMORY; + + memcpy( hash_copy, hash_orig, sizeof(*hash_orig) ); + + *handle_copy = hash_copy; + return STATUS_SUCCESS; +} + NTSTATUS WINAPI BCryptDestroyHash( BCRYPT_HASH_HANDLE handle ) { struct hash *hash = handle; diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec index 0412760..6e871a5 100644 --- a/dlls/ncrypt/ncrypt.spec +++ b/dlls/ncrypt/ncrypt.spec @@ -13,7 +13,7 @@ @ stdcall BCryptDestroyHash(ptr) bcrypt.BCryptDestroyHash @ stub BCryptDestroyKey @ stub BCryptDestroySecret -@ stub BCryptDuplicateHash +@ stdcall BCryptDuplicateHash(ptr ptr ptr long long) bcrypt.BCryptDuplicateHash @ stub BCryptDuplicateKey @ stub BCryptEncrypt @ stdcall BCryptEnumAlgorithms(long ptr ptr long) bcrypt.BCryptEnumAlgorithms