bzirk
Guest
|
Posted:
Thu Sep 16, 2004 11:19 pm Post subject:
IWMHeaderInfo::GetAttributeByIndex return 'buffer too small" |
|
|
I have translated the WMFSDKWrapper from the managed code example in
WMFSDK95. I can succuessfully open ASF files, but when I attempt to iterate
through the attributes using IWMHeaderInfo::GetAttributeByIndex it throws a
ComException with an HRESULT of 0xC00D07D1 which I believe is
ASF_E_BUFFERTOOSMALL.
The GetAttributeByIndex functions is defined as follows:
Function GetAttributeByIndex( _
ByVal wIndex As UInt16, _
ByRef wStreamNum As UInt16, _
<MarshalAs(UnmanagedType.LPWStr)> ByRef wszName As String, _
ByRef cchNameLen As UInt16, _
ByRef [Type] As WMT_ATTR_DATATYPE, _
<MarshalAs(UnmanagedType.LPArray)> ByRef Value As Byte(), _
ByRef cbLength As UInt16) As UInt32
As suggested in the WMFSDK documentation, the first call is to retrieve the
sizes of the wszName string and Value byte arrary. That call is as follows:
Dim mmr As UInt32
Dim wIndex As UInt16 = Convert.ToUInt16(i)
Dim wStreamNum As UInt16 = Convert.ToUInt16(0)
Dim wAttribType As WMSDK.WMFSDKWrapper.WMT_ATTR_DATATYPE
Dim ccNameLen As UInt16 = Convert.ToUInt16(0)
Dim cbLength As UInt16 = Convert.ToUInt16(0)
mmr = hdr.GetAttributeByIndex(wIndex, wStreamNum, Nothing,
ccNameLen, wAttribType, Nothing, cbLength)
where i in the first pass is zero. The first call fails with the
aforementioned ComException. Any ideas?
Thanks,
BZ
|
|