From 5e0acc095d67eceb58131e5daa753a4237261a9e Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 19 Sep 2022 22:40:19 +0300 Subject: [PATCH] cryptowinrt: Implement GenerateRandomNumber(). Signed-off-by: Nikolay Sivov --- dlls/cryptowinrt/Makefile.in | 2 +- dlls/cryptowinrt/main.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/cryptowinrt/Makefile.in b/dlls/cryptowinrt/Makefile.in index 0129e83fb63..192ef49f178 100644 --- a/dlls/cryptowinrt/Makefile.in +++ b/dlls/cryptowinrt/Makefile.in @@ -1,5 +1,5 @@ MODULE = cryptowinrt.dll -IMPORTS = combase uuid +IMPORTS = combase bcrypt uuid C_SRCS = \ main.c diff --git a/dlls/cryptowinrt/main.c b/dlls/cryptowinrt/main.c index 811975d8d79..720b137e4a9 100644 --- a/dlls/cryptowinrt/main.c +++ b/dlls/cryptowinrt/main.c @@ -29,6 +29,8 @@ #include "initguid.h" #include "activation.h" +#include "bcrypt.h" + #define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" @@ -214,9 +216,10 @@ static HRESULT STDMETHODCALLTYPE cryptobuffer_statics_GenerateRandom( static HRESULT STDMETHODCALLTYPE cryptobuffer_statics_GenerateRandomNumber( ICryptographicBufferStatics *iface, UINT32 *value) { - FIXME("iface %p, value %p stub!\n", iface, value); + TRACE("iface %p, value %p.\n", iface, value); - return E_NOTIMPL; + BCryptGenRandom(NULL, (UCHAR *)value, sizeof(*value), BCRYPT_USE_SYSTEM_PREFERRED_RNG); + return S_OK; } static HRESULT STDMETHODCALLTYPE cryptobuffer_statics_CreateFromByteArray(