共用方式為


ICLRHostBindingPolicyManager::EvaluatePolicy Method

Evaluates binding policy on behalf of the host.

HRESULT EvaluatePolicy (
    [in] LPCWSTR     pwzReferenceIdentity,
    [in] BYTE       *pbApplicationPolicy,
    [in] DWORD       cbAppPolicySize,
    [out, size_is(*pcchPostPolicyReferenceIdentity)] LPWSTR pwzPostPolicyReferenceIdentity,
    [in, out] DWORD *pcchPostPolicyReferenceIdentity,
    [out] DWORD     *pdwPoliciesApplied
);

Parameters

  • pwzReferenceIdentity
    [in] A reference to the assembly before the policy evaluation.

  • pbApplicationPolicy
    [in] A pointer to a buffer that contains the policy data.

  • cbAppPolicySize
    [in] The size of the pbApplicationPolicy buffer.

  • pwzPostPolicyReferenceIdentity
    [out] A reference to the assembly after the evaluation of the new policy data.

  • pcchPostPolicyReferenceIdentity
    [in, out] A pointer to the size of the assembly identity reference buffer after the evaluation of the new policy data.

  • pdwPoliciesApplied
    [out] A pointer to a logical OR combination of EBindPolicyLevels values, indicating which policies have been applied.

Return Value

HRESULT

Description

S_OK

The evaluation completed successfully.

E_INVALIDARG

Either pwzReferenceIdentity or pbApplicationPolicy is a null reference.

ERROR_INSUFFICIENT_BUFFER

cbAppPolicySize is too small.

HOST_E_CLRNOTAVAILABLE

The common language runtime (CLR) has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call successfully.

HOST_E_TIMEOUT

The call timed out.

HOST_E_NOT_OWNER

The caller does not own the lock.

HOST_E_ABANDONED

An event was canceled while a blocked thread or fiber was waiting on it.

E_FAIL

An unknown catastrophic failure occurred. After a method returns E_FAIL, the CLR is no longer usable within the process. Subsequent calls to hosting methods return HOST_E_CLRNOTAVAILABLE.

Remarks

The EvaluatePolicy method allows the host to influence binding policy to maintain host-specific assembly versioning requirements. The policy engine itself remains inside the CLR.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: MSCorEE.idl

Library: Included as a resource in MSCorEE.dll

.NET Framework Version: 2.0

See Also

Concepts

ICLRHostBindingPolicyManager Interface