Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55759
-- v4: cryptowinrt/tests: Add some ICryptographicBufferStatics::EncodeToBase64String() tests. cryptowinrt: Stub ICryptographicBufferStatics::EncodeToBase64String().
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55759 --- dlls/cryptowinrt/main.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/cryptowinrt/main.c b/dlls/cryptowinrt/main.c index e6f811b5d12..7a2268a8467 100644 --- a/dlls/cryptowinrt/main.c +++ b/dlls/cryptowinrt/main.c @@ -203,8 +203,13 @@ static HRESULT STDMETHODCALLTYPE cryptobuffer_statics_DecodeFromBase64String( static HRESULT STDMETHODCALLTYPE cryptobuffer_statics_EncodeToBase64String( ICryptographicBufferStatics *iface, IBuffer *buffer, HSTRING *value) { + UINT32 len = 0; + FIXME("iface %p, buffer %p, value %p stub!\n", iface, buffer, value);
+ if (buffer) len = IBuffer_get_Length( buffer, &len ); + + if (!buffer || !len) return WindowsCreateString( NULL, 0, value ); return E_NOTIMPL; }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/cryptowinrt/tests/crypto.c | 34 ++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/cryptowinrt/tests/crypto.c b/dlls/cryptowinrt/tests/crypto.c index 260287dbd23..926901d3f07 100644 --- a/dlls/cryptowinrt/tests/crypto.c +++ b/dlls/cryptowinrt/tests/crypto.c @@ -208,9 +208,14 @@ static struct bool_async_handler default_bool_async_handler = {{&bool_async_hand static void test_CryptobufferStatics(void) { static const WCHAR *cryptobuffer_statics_name = L"Windows.Security.Cryptography.CryptographicBuffer"; + static const WCHAR *buffer_name = L"Windows.Storage.Streams.Buffer"; ICryptographicBufferStatics *cryptobuffer_statics; - IActivationFactory *factory; + IActivationFactory *factory, *factory2; + IBufferFactory *buffer_factory; + const WCHAR *base64_str; + IBuffer *buffer; HSTRING str; + UINT32 len; HRESULT hr; LONG ref;
@@ -233,6 +238,33 @@ static void test_CryptobufferStatics(void) hr = IActivationFactory_QueryInterface( factory, &IID_ICryptographicBufferStatics, (void **)&cryptobuffer_statics ); ok( hr == S_OK, "got hr %#lx.\n", hr );
+ hr = ICryptographicBufferStatics_EncodeToBase64String( cryptobuffer_statics, NULL, &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + base64_str = WindowsGetStringRawBuffer( str, &len ); + ok( !wcscmp( L"", base64_str ) && !len, "got str %s, len %d.\n", wine_dbgstr_w( base64_str ), len ); + WindowsDeleteString( str ); + + hr = WindowsCreateString( buffer_name, wcslen( buffer_name ), &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void **)&factory2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = IActivationFactory_QueryInterface( factory2, &IID_IBufferFactory, (void **)&buffer_factory ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + WindowsDeleteString( str ); + + hr = IBufferFactory_Create( buffer_factory, 0, &buffer ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = ICryptographicBufferStatics_EncodeToBase64String( cryptobuffer_statics, buffer, &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + base64_str = WindowsGetStringRawBuffer( str, &len ); + ok( !wcscmp( L"", base64_str ) && !len, "got str %s, len %d.\n", wine_dbgstr_w( base64_str ), len ); + WindowsDeleteString( str ); + + IBuffer_Release( buffer ); + IBufferFactory_Release( buffer_factory ); + IActivationFactory_Release( factory2 ); + ref = ICryptographicBufferStatics_Release( cryptobuffer_statics ); ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory );