2 * Copyright 2001 Rein Klazes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wintrust
);
38 /***********************************************************************
39 * DllMain (WINTRUST.@)
41 BOOL WINAPI
DllMain( HINSTANCE inst
, DWORD reason
, LPVOID reserved
)
45 case DLL_WINE_PREATTACH
:
46 return FALSE
; /* prefer native version */
47 case DLL_PROCESS_ATTACH
:
48 DisableThreadLibraryCalls( inst
);
54 /***********************************************************************
55 * TrustIsCertificateSelfSigned (WINTRUST.@)
57 BOOL WINAPI
TrustIsCertificateSelfSigned( PCCERT_CONTEXT cert
)
62 ret
= CertCompareCertificateName(cert
->dwCertEncodingType
,
63 &cert
->pCertInfo
->Subject
, &cert
->pCertInfo
->Issuer
);
67 /***********************************************************************
68 * WinVerifyTrust (WINTRUST.@)
70 * Verifies an object by calling the specified trust provider.
73 * hwnd [I] Handle to a caller window.
74 * ActionID [I] Pointer to a GUID that identifies the action to perform.
75 * ActionData [I] Information used by the trust provider to verify the object.
79 * Failure: A TRUST_E_* error code.
82 * Trust providers can be found at:
83 * HKLM\SOFTWARE\Microsoft\Cryptography\Providers\Trust\
85 LONG WINAPI
WinVerifyTrust( HWND hwnd
, GUID
*ActionID
, LPVOID ActionData
)
87 FIXME("%p %s %p\n", hwnd
, debugstr_guid(ActionID
), ActionData
);
91 /***********************************************************************
92 * WinVerifyTrustEx (WINTRUST.@)
94 HRESULT WINAPI
WinVerifyTrustEx( HWND hwnd
, GUID
*ActionID
,
95 WINTRUST_DATA
* ActionData
)
97 FIXME("%p %s %p\n", hwnd
, debugstr_guid(ActionID
), ActionData
);
101 /***********************************************************************
102 * WTHelperGetProvSignerFromChain (WINTRUST.@)
104 CRYPT_PROVIDER_SGNR
* WINAPI
WTHelperGetProvSignerFromChain(
105 CRYPT_PROVIDER_DATA
*pProvData
, DWORD idxSigner
, BOOL fCounterSigner
,
106 DWORD idxCounterSigner
)
108 FIXME("%p %d %d %d\n", pProvData
, idxSigner
, fCounterSigner
,
113 /***********************************************************************
114 * WTHelperProvDataFromStateData (WINTRUST.@)
116 CRYPT_PROVIDER_DATA
* WINAPI
WTHelperProvDataFromStateData(HANDLE hStateData
)
118 FIXME("%p\n", hStateData
);
122 static const WCHAR Software_Publishing
[] = {
123 'S','o','f','t','w','a','r','e','\\',
124 'M','i','c','r','o','s','o','f','t','\\',
125 'W','i','n','d','o','w','s','\\',
126 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
127 'W','i','n','t','r','u','s','t','\\',
128 'T','r','u','s','t',' ','P','r','o','v','i','d','e','r','s','\\',
129 'S','o','f','t','w','a','r','e',' ',
130 'P','u','b','l','i','s','h','i','n','g',0 };
131 static const WCHAR State
[] = { 'S','t','a','t','e',0 };
133 /***********************************************************************
134 * WintrustGetRegPolicyFlags (WINTRUST.@)
136 void WINAPI
WintrustGetRegPolicyFlags( DWORD
* pdwPolicyFlags
)
141 TRACE("%p\n", pdwPolicyFlags
);
144 r
= RegCreateKeyExW(HKEY_CURRENT_USER
, Software_Publishing
, 0, NULL
, 0,
145 KEY_READ
, NULL
, &key
, NULL
);
148 DWORD size
= sizeof(DWORD
);
150 r
= RegQueryValueExW(key
, State
, NULL
, NULL
, (LPBYTE
)pdwPolicyFlags
,
155 /* Failed to query, create and return default value */
156 *pdwPolicyFlags
= WTPF_IGNOREREVOCATIONONTS
|
157 WTPF_OFFLINEOKNBU_COM
|
158 WTPF_OFFLINEOKNBU_IND
|
161 WintrustSetRegPolicyFlags(*pdwPolicyFlags
);
166 /***********************************************************************
167 * WintrustSetRegPolicyFlags (WINTRUST.@)
169 BOOL WINAPI
WintrustSetRegPolicyFlags( DWORD dwPolicyFlags
)
174 TRACE("%x\n", dwPolicyFlags
);
176 r
= RegCreateKeyExW(HKEY_CURRENT_USER
, Software_Publishing
, 0,
177 NULL
, 0, KEY_WRITE
, NULL
, &key
, NULL
);
180 r
= RegSetValueExW(key
, State
, 0, REG_DWORD
, (LPBYTE
)&dwPolicyFlags
,
184 if (r
) SetLastError(r
);
185 return r
== ERROR_SUCCESS
;