共用方式為


IPersistFileCheckSum.CalculateCheckSum Method

Calculates the check sum for the file representation of the associated text buffer using the specified algorithm.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

Syntax

'宣告
Function CalculateCheckSum ( _
    ByRef guidCheckSumAlgorithm As Guid, _
    cbBufferSize As UInteger, _
    <OutAttribute> pbHash As Byte(), _
    <OutAttribute> ByRef pcbActualSize As UInteger _
) As Integer
int CalculateCheckSum(
    ref Guid guidCheckSumAlgorithm,
    uint cbBufferSize,
    byte[] pbHash,
    out uint pcbActualSize
)
int CalculateCheckSum(
    [InAttribute] Guid% guidCheckSumAlgorithm, 
    [InAttribute] unsigned int cbBufferSize, 
    [OutAttribute] array<unsigned char>^ pbHash, 
    [OutAttribute] unsigned int% pcbActualSize
)
abstract CalculateCheckSum : 
        guidCheckSumAlgorithm:Guid byref * 
        cbBufferSize:uint32 * 
        pbHash:byte[] byref * 
        pcbActualSize:uint32 byref -> int 
function CalculateCheckSum(
    guidCheckSumAlgorithm : Guid, 
    cbBufferSize : uint, 
    pbHash : byte[], 
    pcbActualSize : uint
) : int

Parameters

  • guidCheckSumAlgorithm
    Type: System.Guid%
    [in] GUID representing the algorithm to use
  • pbHash
    Type: array<System.Byte[]
    [out] Buffer into which the checksum is written

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr2.idl:

HRESULT IPersistFileCheckSum::CalculateCheckSum(
   [in] REFGUID guidCheckSumAlgorithm,
   [in] DWORD cbBufferSize,
   [out, size_is(cbBufferSize)] BYTE *pbHash,
   [out] DWORD *pcbActualSize
);

If the passed-in buffer size i.e. cbBufferSize is non-zero, then this function returns E_INVALIDARG. But if the passed in buffer size is zero, it returns success. In both cases, the required buffer size is return via pcbActualSize. For the MD5 algorithm, the maximum required buffer size required is 16 bytes. For the SHA1 algorithm, the maximum required buffer size is 20 bytes

.NET Framework Security

See Also

Reference

IPersistFileCheckSum Interface

Microsoft.VisualStudio.TextManager.Interop Namespace