Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
254b6d69
Commit
254b6d69
authored
Nov 15, 2022
by
Mohamad Al-Jaf
Committed by
Alexandre Julliard
Feb 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cryptowinrt: Stub IKeyCredentialManagerStatics interface.
parent
a68435f0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
225 additions
and
4 deletions
+225
-4
Makefile.in
dlls/cryptowinrt/Makefile.in
+1
-0
classes.idl
dlls/cryptowinrt/classes.idl
+1
-0
credentials.c
dlls/cryptowinrt/credentials.c
+177
-0
main.c
dlls/cryptowinrt/main.c
+5
-4
private.h
dlls/cryptowinrt/private.h
+4
-0
crypto.c
dlls/cryptowinrt/tests/crypto.c
+37
-0
No files found.
dlls/cryptowinrt/Makefile.in
View file @
254b6d69
...
@@ -2,6 +2,7 @@ MODULE = cryptowinrt.dll
...
@@ -2,6 +2,7 @@ MODULE = cryptowinrt.dll
IMPORTS
=
combase bcrypt uuid
IMPORTS
=
combase bcrypt uuid
C_SRCS
=
\
C_SRCS
=
\
credentials.c
\
main.c
main.c
IDL_SRCS
=
classes.idl
IDL_SRCS
=
classes.idl
dlls/cryptowinrt/classes.idl
View file @
254b6d69
...
@@ -19,3 +19,4 @@
...
@@ -19,3 +19,4 @@
#
pragma
makedep
register
#
pragma
makedep
register
#
include
"windows.security.cryptography.idl"
#
include
"windows.security.cryptography.idl"
#
include
"windows.security.credentials.idl"
dlls/cryptowinrt/credentials.c
0 → 100644
View file @
254b6d69
/* CryptoWinRT Credentials Implementation
*
* Copyright (C) 2022 Mohamad Al-Jaf
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
crypto
);
struct
credentials_statics
{
IActivationFactory
IActivationFactory_iface
;
IKeyCredentialManagerStatics
IKeyCredentialManagerStatics_iface
;
LONG
ref
;
};
static
inline
struct
credentials_statics
*
impl_from_IActivationFactory
(
IActivationFactory
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
credentials_statics
,
IActivationFactory_iface
);
}
static
HRESULT
WINAPI
credentials_QueryInterface
(
IActivationFactory
*
iface
,
REFIID
iid
,
void
**
out
)
{
struct
credentials_statics
*
factory
=
impl_from_IActivationFactory
(
iface
);
TRACE
(
"iface %p, iid %s, out %p.
\n
"
,
iface
,
debugstr_guid
(
iid
),
out
);
if
(
IsEqualGUID
(
iid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
iid
,
&
IID_IInspectable
)
||
IsEqualGUID
(
iid
,
&
IID_IAgileObject
)
||
IsEqualGUID
(
iid
,
&
IID_IActivationFactory
))
{
IUnknown_AddRef
(
iface
);
*
out
=
&
factory
->
IActivationFactory_iface
;
return
S_OK
;
}
if
(
IsEqualGUID
(
iid
,
&
IID_IKeyCredentialManagerStatics
))
{
IUnknown_AddRef
(
iface
);
*
out
=
&
factory
->
IKeyCredentialManagerStatics_iface
;
return
S_OK
;
}
FIXME
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
iid
)
);
*
out
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
credentials_AddRef
(
IActivationFactory
*
iface
)
{
struct
credentials_statics
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
impl
->
ref
);
TRACE
(
"iface %p increasing refcount to %lu.
\n
"
,
iface
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
credentials_Release
(
IActivationFactory
*
iface
)
{
struct
credentials_statics
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
impl
->
ref
);
TRACE
(
"iface %p decreasing refcount to %lu.
\n
"
,
iface
,
ref
);
return
ref
;
}
static
HRESULT
WINAPI
credentials_GetIids
(
IActivationFactory
*
iface
,
ULONG
*
iid_count
,
IID
**
iids
)
{
FIXME
(
"iface %p, iid_count %p, iids %p stub!
\n
"
,
iface
,
iid_count
,
iids
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
credentials_GetRuntimeClassName
(
IActivationFactory
*
iface
,
HSTRING
*
class_name
)
{
FIXME
(
"iface %p, class_name %p stub!
\n
"
,
iface
,
class_name
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
credentials_GetTrustLevel
(
IActivationFactory
*
iface
,
TrustLevel
*
trust_level
)
{
FIXME
(
"iface %p, trust_level %p stub!
\n
"
,
iface
,
trust_level
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
credentials_ActivateInstance
(
IActivationFactory
*
iface
,
IInspectable
**
instance
)
{
FIXME
(
"iface %p, instance %p stub!
\n
"
,
iface
,
instance
);
return
E_NOTIMPL
;
}
static
const
struct
IActivationFactoryVtbl
factory_vtbl
=
{
credentials_QueryInterface
,
credentials_AddRef
,
credentials_Release
,
/* IInspectable methods */
credentials_GetIids
,
credentials_GetRuntimeClassName
,
credentials_GetTrustLevel
,
/* IActivationFactory methods */
credentials_ActivateInstance
,
};
DEFINE_IINSPECTABLE
(
credentials_statics
,
IKeyCredentialManagerStatics
,
struct
credentials_statics
,
IActivationFactory_iface
);
static
HRESULT
WINAPI
credentials_statics_IsSupportedAsync
(
IKeyCredentialManagerStatics
*
iface
,
IAsyncOperation_boolean
**
value
)
{
FIXME
(
"iface %p, value %p stub!
\n
"
,
iface
,
value
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
credentials_statics_RenewAttestationAsync
(
IKeyCredentialManagerStatics
*
iface
,
IAsyncAction
**
operation
)
{
FIXME
(
"iface %p, operation %p stub!
\n
"
,
iface
,
operation
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
credentials_statics_RequestCreateAsync
(
IKeyCredentialManagerStatics
*
iface
,
HSTRING
name
,
KeyCredentialCreationOption
option
,
IAsyncOperation_KeyCredentialRetrievalResult
**
value
)
{
FIXME
(
"iface %p, name %s, %d option, %p value stub!
\n
"
,
iface
,
debugstr_hstring
(
name
),
option
,
value
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
credentials_statics_OpenAsync
(
IKeyCredentialManagerStatics
*
iface
,
HSTRING
name
,
IAsyncOperation_KeyCredentialRetrievalResult
**
value
)
{
FIXME
(
"iface %p, name %s, %p value stub!
\n
"
,
iface
,
debugstr_hstring
(
name
),
value
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
credentials_statics_DeleteAsync
(
IKeyCredentialManagerStatics
*
iface
,
HSTRING
name
,
IAsyncAction
**
operation
)
{
FIXME
(
"iface %p, name %s, %p operation stub!
\n
"
,
iface
,
debugstr_hstring
(
name
),
operation
);
return
E_NOTIMPL
;
}
static
const
struct
IKeyCredentialManagerStaticsVtbl
credentials_statics_vtbl
=
{
credentials_statics_QueryInterface
,
credentials_statics_AddRef
,
credentials_statics_Release
,
/* IInspectable methods */
credentials_statics_GetIids
,
credentials_statics_GetRuntimeClassName
,
credentials_statics_GetTrustLevel
,
/* IKeyCredentialManagerStatics methods */
credentials_statics_IsSupportedAsync
,
credentials_statics_RenewAttestationAsync
,
credentials_statics_RequestCreateAsync
,
credentials_statics_OpenAsync
,
credentials_statics_DeleteAsync
,
};
static
struct
credentials_statics
credentials_statics
=
{
{
&
factory_vtbl
},
{
&
credentials_statics_vtbl
},
1
,
};
IActivationFactory
*
credentials_activation_factory
=
&
credentials_statics
.
IActivationFactory_iface
;
dlls/cryptowinrt/main.c
View file @
254b6d69
...
@@ -264,6 +264,8 @@ static struct cryptobuffer_factory cryptobuffer_factory =
...
@@ -264,6 +264,8 @@ static struct cryptobuffer_factory cryptobuffer_factory =
.
refcount
=
1
,
.
refcount
=
1
,
};
};
IActivationFactory
*
cryptobuffer_activation_factory
=
&
cryptobuffer_factory
.
IActivationFactory_iface
;
HRESULT
WINAPI
DllGetClassObject
(
REFCLSID
clsid
,
REFIID
riid
,
void
**
out
)
HRESULT
WINAPI
DllGetClassObject
(
REFCLSID
clsid
,
REFIID
riid
,
void
**
out
)
{
{
FIXME
(
"clsid %s, riid %s, out %p stub!
\n
"
,
debugstr_guid
(
clsid
),
debugstr_guid
(
riid
),
out
);
FIXME
(
"clsid %s, riid %s, out %p stub!
\n
"
,
debugstr_guid
(
clsid
),
debugstr_guid
(
riid
),
out
);
...
@@ -279,10 +281,9 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac
...
@@ -279,10 +281,9 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac
*
factory
=
NULL
;
*
factory
=
NULL
;
if
(
!
wcscmp
(
name
,
RuntimeClass_Windows_Security_Cryptography_CryptographicBuffer
))
if
(
!
wcscmp
(
name
,
RuntimeClass_Windows_Security_Cryptography_CryptographicBuffer
))
{
IActivationFactory_QueryInterface
(
cryptobuffer_activation_factory
,
&
IID_IActivationFactory
,
(
void
**
)
factory
);
*
factory
=
&
cryptobuffer_factory
.
IActivationFactory_iface
;
if
(
!
wcscmp
(
name
,
RuntimeClass_Windows_Security_Credentials_KeyCredentialManager
))
IUnknown_AddRef
(
*
factory
);
IActivationFactory_QueryInterface
(
credentials_activation_factory
,
&
IID_IActivationFactory
,
(
void
**
)
factory
);
}
if
(
*
factory
)
return
S_OK
;
if
(
*
factory
)
return
S_OK
;
return
CLASS_E_CLASSNOTAVAILABLE
;
return
CLASS_E_CLASSNOTAVAILABLE
;
...
...
dlls/cryptowinrt/private.h
View file @
254b6d69
...
@@ -34,9 +34,13 @@
...
@@ -34,9 +34,13 @@
#include "windows.foundation.h"
#include "windows.foundation.h"
#define WIDL_using_Windows_Storage_Streams
#define WIDL_using_Windows_Storage_Streams
#include "windows.storage.streams.h"
#include "windows.storage.streams.h"
#define WIDL_using_Windows_Security_Credentials
#include "windows.security.credentials.h"
extern
const
char
*
debugstr_hstring
(
HSTRING
hstr
);
extern
const
char
*
debugstr_hstring
(
HSTRING
hstr
);
extern
IActivationFactory
*
credentials_activation_factory
;
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
static inline impl_type *impl_from( iface_type *iface ) \
static inline impl_type *impl_from( iface_type *iface ) \
{ \
{ \
...
...
dlls/cryptowinrt/tests/crypto.c
View file @
254b6d69
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
#include "windows.storage.streams.h"
#include "windows.storage.streams.h"
#define WIDL_using_Windows_Security_Cryptography
#define WIDL_using_Windows_Security_Cryptography
#include "windows.security.cryptography.h"
#include "windows.security.cryptography.h"
#define WIDL_using_Windows_Security_Credentials
#include "windows.security.credentials.h"
#include "wine/test.h"
#include "wine/test.h"
...
@@ -81,6 +83,40 @@ static void test_CryptobufferStatics(void)
...
@@ -81,6 +83,40 @@ static void test_CryptobufferStatics(void)
ok
(
ref
==
1
,
"got ref %ld.
\n
"
,
ref
);
ok
(
ref
==
1
,
"got ref %ld.
\n
"
,
ref
);
}
}
static
void
test_Credentials_Statics
(
void
)
{
static
const
WCHAR
*
credentials_statics_name
=
L"Windows.Security.Credentials.KeyCredentialManager"
;
IKeyCredentialManagerStatics
*
credentials_statics
;
IActivationFactory
*
factory
;
HSTRING
str
;
HRESULT
hr
;
LONG
ref
;
hr
=
WindowsCreateString
(
credentials_statics_name
,
wcslen
(
credentials_statics_name
),
&
str
);
ok
(
hr
==
S_OK
,
"got hr %#lx.
\n
"
,
hr
);
hr
=
RoGetActivationFactory
(
str
,
&
IID_IActivationFactory
,
(
void
**
)
&
factory
);
WindowsDeleteString
(
str
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
REGDB_E_CLASSNOTREG
),
"got hr %#lx.
\n
"
,
hr
);
if
(
hr
==
REGDB_E_CLASSNOTREG
)
{
win_skip
(
"%s runtimeclass not registered, skipping tests.
\n
"
,
wine_dbgstr_w
(
credentials_statics_name
)
);
return
;
}
check_interface
(
factory
,
&
IID_IUnknown
);
check_interface
(
factory
,
&
IID_IInspectable
);
check_interface
(
factory
,
&
IID_IAgileObject
);
hr
=
IActivationFactory_QueryInterface
(
factory
,
&
IID_IKeyCredentialManagerStatics
,
(
void
**
)
&
credentials_statics
);
ok
(
hr
==
S_OK
,
"got hr %#lx.
\n
"
,
hr
);
ref
=
IKeyCredentialManagerStatics_Release
(
credentials_statics
);
ok
(
ref
==
2
,
"got ref %ld.
\n
"
,
ref
);
ref
=
IActivationFactory_Release
(
factory
);
ok
(
ref
==
1
,
"got ref %ld.
\n
"
,
ref
);
}
START_TEST
(
crypto
)
START_TEST
(
crypto
)
{
{
HRESULT
hr
;
HRESULT
hr
;
...
@@ -89,6 +125,7 @@ START_TEST(crypto)
...
@@ -89,6 +125,7 @@ START_TEST(crypto)
ok
(
hr
==
S_OK
,
"RoInitialize failed, hr %#lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"RoInitialize failed, hr %#lx
\n
"
,
hr
);
test_CryptobufferStatics
();
test_CryptobufferStatics
();
test_Credentials_Statics
();
RoUninitialize
();
RoUninitialize
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment