IPersistFileCheckSum::CalculateCheckSum Method (Guid, UInt32, array<Byte>^, UInt32)

 

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)

int CalculateCheckSum(
	[InAttribute] Guid% guidCheckSumAlgorithm,
	unsigned int cbBufferSize,
	array<unsigned char>^ pbHash,
	[OutAttribute] unsigned int% pcbActualSize
)

Parameters

guidCheckSumAlgorithm
Type: System::Guid

[in] GUID representing the algorithm to use

cbBufferSize
Type: System::UInt32

[in] Buffer size passed in

pbHash
Type: array<System::Byte>^

[out] Buffer into which the checksum is written

pcbActualSize
Type: System::UInt32

[out] Buffer size required

Return Value

Type: System::Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

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

Return to top
Show: