📄 register.c
字号:
/***********************************************************************
* DllRegisterServer (WINTRUST.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
static const CHAR SpcPeImageDataEncode[] = "WVTAsn1SpcPeImageDataEncode";
static const CHAR SpcPeImageDataDecode[] = "WVTAsn1SpcPeImageDataDecode";
static const CHAR SpcLinkEncode[] = "WVTAsn1SpcLinkEncode";
static const CHAR SpcLinkDecode[] = "WVTAsn1SpcLinkDecode";
static const CHAR SpcSigInfoEncode[] = "WVTAsn1SpcSigInfoEncode";
static const CHAR SpcSigInfoDecode[] = "WVTAsn1SpcSigInfoDecode";
static const CHAR SpcIndirectDataContentEncode[] = "WVTAsn1SpcIndirectDataContentEncode";
static const CHAR SpcIndirectDataContentDecode[] = "WVTAsn1SpcIndirectDataContentDecode";
static const CHAR SpcSpAgencyInfoEncode[] = "WVTAsn1SpcSpAgencyInfoEncode";
static const CHAR SpcSpAgencyInfoDecode[] = "WVTAsn1SpcSpAgencyInfoDecode";
static const CHAR SpcMinimalCriteriaInfoEncode[] = "WVTAsn1SpcMinimalCriteriaInfoEncode";
static const CHAR SpcMinimalCriteriaInfoDecode[] = "WVTAsn1SpcMinimalCriteriaInfoDecode";
static const CHAR SpcFinancialCriteriaInfoEncode[] = "WVTAsn1SpcFinancialCriteriaInfoEncode";
static const CHAR SpcFinancialCriteriaInfoDecode[] = "WVTAsn1SpcFinancialCriteriaInfoDecode";
static const CHAR SpcStatementTypeEncode[] = "WVTAsn1SpcStatementTypeEncode";
static const CHAR SpcStatementTypeDecode[] = "WVTAsn1SpcStatementTypeDecode";
static const CHAR CatNameValueEncode[] = "WVTAsn1CatNameValueEncode";
static const CHAR CatNameValueDecode[] = "WVTAsn1CatNameValueDecode";
static const CHAR CatMemberInfoEncode[] = "WVTAsn1CatMemberInfoEncode";
static const CHAR CatMemberInfoDecode[] = "WVTAsn1CatMemberInfoDecode";
static const CHAR SpcSpOpusInfoEncode[] = "WVTAsn1SpcSpOpusInfoEncode";
static const CHAR SpcSpOpusInfoDecode[] = "WVTAsn1SpcSpOpusInfoDecode";
static GUID Unknown1 = { 0xDE351A42, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
static GUID Unknown2 = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
static GUID Unknown3 = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
static GUID Unknown4 = { 0xC689AAB9, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
static GUID Unknown5 = { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
static GUID Unknown6 = { 0x9BA61D3F, 0xE73A, 0x11D0, { 0x8C,0xD2,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
static WCHAR MagicNumber2[] = {'M','S','C','F', 0};
static WCHAR MagicNumber3[] = {'0','x','0','0','0','0','4','5','5','0', 0};
static WCHAR CafeBabe[] = {'0','x','c','a','f','e','b','a','b','e', 0};
HRESULT CryptRegisterRes = S_OK;
HRESULT TrustProviderRes = S_OK;
HRESULT SIPAddProviderRes = S_OK;
TRACE("\n");
/* Testing on native shows that when an error is encountered in one of the CryptRegisterOIDFunction calls
* the rest of these calls is skipped. Registering is however continued for the trust providers.
*
* We are not totally in line with native as there all decoding functions are registered after all encoding
* functions.
*/
#define WINTRUST_REGISTEROID( oid, encode_funcname, decode_funcname ) \
do { \
if (!CryptRegisterOIDFunction(X509_ASN_ENCODING, CRYPT_OID_ENCODE_OBJECT_FUNC, oid, SP_POLICY_PROVIDER_DLL_NAME, encode_funcname)) \
{ \
CryptRegisterRes = HRESULT_FROM_WIN32(GetLastError()); \
goto add_trust_providers; \
} \
if (!CryptRegisterOIDFunction(X509_ASN_ENCODING, CRYPT_OID_DECODE_OBJECT_FUNC, oid, SP_POLICY_PROVIDER_DLL_NAME, decode_funcname)) \
{ \
CryptRegisterRes = HRESULT_FROM_WIN32(GetLastError()); \
goto add_trust_providers; \
} \
} while (0)
WINTRUST_REGISTEROID(SPC_PE_IMAGE_DATA_OBJID, SpcPeImageDataEncode, SpcPeImageDataDecode);
WINTRUST_REGISTEROID(SPC_PE_IMAGE_DATA_STRUCT, SpcPeImageDataEncode, SpcPeImageDataDecode);
WINTRUST_REGISTEROID(SPC_CAB_DATA_OBJID, SpcLinkEncode, SpcLinkDecode);
WINTRUST_REGISTEROID(SPC_CAB_DATA_STRUCT, SpcLinkEncode, SpcLinkDecode);
WINTRUST_REGISTEROID(SPC_JAVA_CLASS_DATA_OBJID, SpcLinkEncode, SpcLinkDecode);
WINTRUST_REGISTEROID(SPC_JAVA_CLASS_DATA_STRUCT, SpcLinkEncode, SpcLinkDecode);
WINTRUST_REGISTEROID(SPC_LINK_OBJID, SpcLinkEncode, SpcLinkDecode);
WINTRUST_REGISTEROID(SPC_LINK_STRUCT, SpcLinkEncode, SpcLinkDecode);
WINTRUST_REGISTEROID(SPC_SIGINFO_OBJID, SpcSigInfoEncode, SpcSigInfoDecode);
WINTRUST_REGISTEROID(SPC_SIGINFO_STRUCT, SpcSigInfoEncode, SpcSigInfoDecode);
WINTRUST_REGISTEROID(SPC_INDIRECT_DATA_OBJID, SpcIndirectDataContentEncode, SpcIndirectDataContentDecode);
WINTRUST_REGISTEROID(SPC_INDIRECT_DATA_CONTENT_STRUCT, SpcIndirectDataContentEncode, SpcIndirectDataContentDecode);
WINTRUST_REGISTEROID(SPC_SP_AGENCY_INFO_OBJID, SpcSpAgencyInfoEncode, SpcSpAgencyInfoDecode);
WINTRUST_REGISTEROID(SPC_SP_AGENCY_INFO_STRUCT, SpcSpAgencyInfoEncode, SpcSpAgencyInfoDecode);
WINTRUST_REGISTEROID(SPC_MINIMAL_CRITERIA_OBJID, SpcMinimalCriteriaInfoEncode, SpcMinimalCriteriaInfoDecode);
WINTRUST_REGISTEROID(SPC_MINIMAL_CRITERIA_STRUCT, SpcMinimalCriteriaInfoEncode, SpcMinimalCriteriaInfoDecode);
WINTRUST_REGISTEROID(SPC_FINANCIAL_CRITERIA_OBJID, SpcFinancialCriteriaInfoEncode, SpcFinancialCriteriaInfoDecode);
WINTRUST_REGISTEROID(SPC_FINANCIAL_CRITERIA_STRUCT, SpcFinancialCriteriaInfoEncode, SpcFinancialCriteriaInfoDecode);
WINTRUST_REGISTEROID(SPC_STATEMENT_TYPE_OBJID, SpcStatementTypeEncode, SpcStatementTypeDecode);
WINTRUST_REGISTEROID(SPC_STATEMENT_TYPE_STRUCT, SpcStatementTypeEncode, SpcStatementTypeDecode);
WINTRUST_REGISTEROID(CAT_NAMEVALUE_OBJID, CatNameValueEncode, CatNameValueDecode);
WINTRUST_REGISTEROID(CAT_NAMEVALUE_STRUCT, CatNameValueEncode, CatNameValueDecode);
WINTRUST_REGISTEROID(CAT_MEMBERINFO_OBJID, CatMemberInfoEncode, CatMemberInfoDecode);
WINTRUST_REGISTEROID(CAT_MEMBERINFO_STRUCT, CatMemberInfoEncode, CatMemberInfoDecode);
WINTRUST_REGISTEROID(SPC_SP_OPUS_INFO_OBJID, SpcSpOpusInfoEncode, SpcSpOpusInfoDecode);
WINTRUST_REGISTEROID(SPC_SP_OPUS_INFO_STRUCT, SpcSpOpusInfoEncode, SpcSpOpusInfoDecode);
#undef WINTRUST_REGISTEROID
add_trust_providers:
/* Testing on W2K3 shows:
* All registry writes are tried. If one fails this part will return S_FALSE.
*
* Last error is set to the last error encountered, regardless if the first
* part failed or not.
*/
/* Create the necessary action registry structures */
WINTRUST_InitRegStructs();
/* Register several Trust Provider actions */
if (!WINTRUST_RegisterGenVerifyV2())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterPublishedSoftware())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterPublishedSoftwareNoBadUi())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterGenCertVerify())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterTrustProviderTest())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterHttpsProv())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterOfficeSignVerify())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterDriverVerify())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterGenChainVerify())
TrustProviderRes = S_FALSE;
/* Free the registry structures */
WINTRUST_FreeRegStructs();
/* Testing on W2K3 shows:
* All registry writes are tried. If one fails this part will return S_FALSE.
*
* Last error is set to the last error encountered, regardless if the previous
* parts failed or not.
*/
if (!WINTRUST_SIPPAddProvider(&Unknown1, NULL))
SIPAddProviderRes = S_FALSE;
if (!WINTRUST_SIPPAddProvider(&Unknown2, MagicNumber2))
SIPAddProviderRes = S_FALSE;
if (!WINTRUST_SIPPAddProvider(&Unknown3, MagicNumber3))
SIPAddProviderRes = S_FALSE;
if (!WINTRUST_SIPPAddProvider(&Unknown4, CafeBabe))
SIPAddProviderRes = S_FALSE;
if (!WINTRUST_SIPPAddProvider(&Unknown5, CafeBabe))
SIPAddProviderRes = S_FALSE;
if (!WINTRUST_SIPPAddProvider(&Unknown6, CafeBabe))
SIPAddProviderRes = S_FALSE;
/* Native does a CryptSIPRemoveProvider here for {941C2937-1292-11D1-85BE-00C04FC295EE}.
* This SIP Provider is however not found on up-to-date window install and native will
* set the last error to ERROR_FILE_NOT_FOUND.
* Wine has the last error set to ERROR_INVALID_PARAMETER. There shouldn't be an app
* depending on this last error though so there is no need to imitate native to the full extent.
*
* (The ERROR_INVALID_PARAMETER for Wine it totally valid as we (and native) do register
* a trust provider without a diagnostic policy).
*/
/* If CryptRegisterRes is not S_OK it will always overrule the return value. */
if (CryptRegisterRes != S_OK)
return CryptRegisterRes;
else if (SIPAddProviderRes == S_OK)
return TrustProviderRes;
else
return SIPAddProviderRes;
}
/***********************************************************************
* DllUnregisterServer (WINTRUST.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
FIXME("stub\n");
return S_OK;
}
/***********************************************************************
* SoftpubDllRegisterServer (WINTRUST.@)
*
* Registers softpub.dll
*
* PARAMS
*
* RETURNS
* Success: S_OK.
* Failure: S_FALSE. (See also GetLastError()).
*
* NOTES
* DllRegisterServer in softpub.dll will call this function.
* See comments in DllRegisterServer.
*/
HRESULT WINAPI SoftpubDllRegisterServer(void)
{
HRESULT TrustProviderRes = S_OK;
TRACE("\n");
/* Create the necessary action registry structures */
WINTRUST_InitRegStructs();
/* Register several Trust Provider actions */
if (!WINTRUST_RegisterGenVerifyV2())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterPublishedSoftware())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterPublishedSoftwareNoBadUi())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterGenCertVerify())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterTrustProviderTest())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterHttpsProv())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterOfficeSignVerify())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterDriverVerify())
TrustProviderRes = S_FALSE;
if (!WINTRUST_RegisterGenChainVerify())
TrustProviderRes = S_FALSE;
/* Free the registry structures */
WINTRUST_FreeRegStructs();
return TrustProviderRes;
}
/***********************************************************************
* SoftpubDllUnregisterServer (WINTRUST.@)
*/
HRESULT WINAPI SoftpubDllUnregisterServer(void)
{
FIXME("stub\n");
return S_OK;
}
/***********************************************************************
* mscat32DllRegisterServer (WINTRUST.@)
*/
HRESULT WINAPI mscat32DllRegisterServer(void)
{
FIXME("stub\n");
return S_OK;
}
/***********************************************************************
* mscat32DllUnregisterServer (WINTRUST.@)
*/
HRESULT WINAPI mscat32DllUnregisterServer(void)
{
FIXME("stub\n");
return S_OK;
}
/***********************************************************************
* mssip32DllRegisterServer (WINTRUST.@)
*/
HRESULT WINAPI mssip32DllRegisterServer(void)
{
FIXME("stub\n");
return S_OK;
}
/***********************************************************************
* mssip32DllUnregisterServer (WINTRUST.@)
*/
HRESULT WINAPI mssip32DllUnregisterServer(void)
{
FIXME("stub\n");
return S_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -