2222#include <winpr/winpr.h>
2323
2424#ifdef _WIN32
25+ #include <windows.h>
2526#include <wincred.h>
2627#else
2728
29+ #include <winpr/wtypes.h>
30+
2831#define CERT_HASH_LENGTH 20
2932
3033typedef enum
3134{
32- CertCredential ,
35+ CertCredential = 1 ,
3336 UsernameTargetCredential ,
3437 BinaryBlobCredential ,
3538 UsernameForPackedCredentials ,
@@ -43,7 +46,91 @@ typedef struct
4346 UCHAR rgbHashOfCert [CERT_HASH_LENGTH ];
4447} CERT_CREDENTIAL_INFO , * PCERT_CREDENTIAL_INFO ;
4548
46- #if 0 /* shall we implement these ? */
49+ typedef struct
50+ {
51+ LPSTR Keyword ;
52+ DWORD Flags ;
53+ DWORD ValueSize ;
54+ LPBYTE Value ;
55+ } CREDENTIAL_ATTRIBUTEA , * PCREDENTIAL_ATTRIBUTEA ;
56+
57+ typedef struct
58+ {
59+ LPWSTR Keyword ;
60+ DWORD Flags ;
61+ DWORD ValueSize ;
62+ LPBYTE Value ;
63+ } CREDENTIAL_ATTRIBUTEW , * PCREDENTIAL_ATTRIBUTEW ;
64+
65+ typedef struct
66+ {
67+ DWORD Flags ;
68+ DWORD Type ;
69+ LPSTR TargetName ;
70+ LPSTR Comment ;
71+ FILETIME LastWritten ;
72+ DWORD CredentialBlobSize ;
73+ LPBYTE CredentialBlob ;
74+ DWORD Persist ;
75+ DWORD AttributeCount ;
76+ PCREDENTIAL_ATTRIBUTEA Attributes ;
77+ LPSTR TargetAlias ;
78+ LPSTR UserName ;
79+ } CREDENTIALA , * PCREDENTIALA ;
80+
81+ typedef struct
82+ {
83+ DWORD Flags ;
84+ DWORD Type ;
85+ LPWSTR TargetName ;
86+ LPWSTR Comment ;
87+ FILETIME LastWritten ;
88+ DWORD CredentialBlobSize ;
89+ LPBYTE CredentialBlob ;
90+ DWORD Persist ;
91+ DWORD AttributeCount ;
92+ PCREDENTIAL_ATTRIBUTEA Attributes ;
93+ LPWSTR TargetAlias ;
94+ LPWSTR UserName ;
95+ } CREDENTIALW , * PCREDENTIALW ;
96+
97+ typedef struct
98+ {
99+ LPSTR TargetName ;
100+ LPSTR NetbiosServerName ;
101+ LPSTR DnsServerName ;
102+ LPSTR NetbiosDomainName ;
103+ LPSTR DnsDomainName ;
104+ LPSTR DnsTreeName ;
105+ LPSTR PackageName ;
106+ ULONG Flags ;
107+ DWORD CredTypeCount ;
108+ LPDWORD CredTypes ;
109+ } CREDENTIAL_TARGET_INFORMATIONA , * PCREDENTIAL_TARGET_INFORMATIONA ;
110+
111+ typedef struct
112+ {
113+ LPWSTR TargetName ;
114+ LPWSTR NetbiosServerName ;
115+ LPWSTR DnsServerName ;
116+ LPWSTR NetbiosDomainName ;
117+ LPWSTR DnsDomainName ;
118+ LPWSTR DnsTreeName ;
119+ LPWSTR PackageName ;
120+ ULONG Flags ;
121+ DWORD CredTypeCount ;
122+ LPDWORD CredTypes ;
123+ } CREDENTIAL_TARGET_INFORMATIONW , * PCREDENTIAL_TARGET_INFORMATIONW ;
124+
125+ typedef enum
126+ {
127+ CredUnprotected ,
128+ CredUserProtection ,
129+ CredTrustedProtection ,
130+ CredForSystemProtection
131+ } CRED_PROTECTION_TYPE ,
132+ * PCRED_PROTECTION_TYPE ;
133+
47134WINPR_API BOOL CredMarshalCredentialA (CRED_MARSHAL_TYPE CredType , PVOID Credential ,
48135 LPSTR * MarshaledCredential );
49136WINPR_API BOOL CredMarshalCredentialW (CRED_MARSHAL_TYPE CredType , PVOID Credential ,
@@ -55,7 +142,21 @@ WINPR_API BOOL CredMarshalCredentialW(CRED_MARSHAL_TYPE CredType, PVOID Credenti
55142#define CredMarshalCredential CredMarshalCredentialA
56143#endif
57144
58- #endif /* 0 */
145+ WINPR_API BOOL CredUnmarshalCredentialW (LPCWSTR cred , PCRED_MARSHAL_TYPE CredType ,
146+ PVOID * Credential );
147+
148+ WINPR_API BOOL CredUnmarshalCredentialA (LPCSTR cred , PCRED_MARSHAL_TYPE CredType ,
149+ PVOID * Credential );
150+
151+ #ifdef UNICODE
152+ #define CredUnmarshalCredential CredUnmarshalCredentialW
153+ #else
154+ #define CredUnmarshalCredential CredUnmarshalCredentialA
155+ #endif
156+
157+ WINPR_API BOOL CredIsMarshaledCredentialA (LPCSTR MarshaledCredential );
158+ WINPR_API BOOL CredIsMarshaledCredentialW (LPCWSTR MarshaledCredential );
159+ WINPR_API VOID CredFree (PVOID Buffer );
59160
60161#endif /* _WIN32 */
61162
0 commit comments