共用方式為


IPersistFileCheckSum.CalculateCheckSum(Guid, UInt32, Byte[], UInt32) Method

Definition

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

public:
 int CalculateCheckSum(Guid % guidCheckSumAlgorithm, System::UInt32 cbBufferSize, cli::array <System::Byte> ^ pbHash, [Runtime::InteropServices::Out] System::UInt32 % pcbActualSize);
public int CalculateCheckSum (ref Guid guidCheckSumAlgorithm, uint cbBufferSize, byte[] pbHash, out uint pcbActualSize);
abstract member CalculateCheckSum : Guid * uint32 * byte[] * uint32 -> int
Public Function CalculateCheckSum (ByRef guidCheckSumAlgorithm As Guid, cbBufferSize As UInteger, pbHash As Byte(), ByRef pcbActualSize As UInteger) As Integer

Parameters

guidCheckSumAlgorithm
Guid

[in] GUID representing the algorithm to use

cbBufferSize
UInt32

[in] Buffer size passed in

pbHash
Byte[]

[out] Buffer into which the checksum is written

pcbActualSize
UInt32

[out] Buffer size required

Returns

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

Applies to