Re: IWMHeaderInfo::GetAttributeByIndex fails with 'buffer too small'

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: ccallen (ccallen_at_windowpane.com)
Date: 09/17/04


Date: Thu, 16 Sep 2004 19:04:36 -0700

Hmmm,

Here is something else to try. This takes the aproach of converting the app
to vb and using the orginal C# wrapper.

Create a new vb.net application.
Reference the orginal csharp wrapper.

Cut & past the C# ShowAttributes function into the VB app and translate it
to VB. For a quick test, just hard code the name and stream number into your
code.

Did that work?

Because it gets compiled and refenced from your app, the wrapper can be in
any language. The typical method to create a PIA is to muck around with IL.
And this is a pretty big typelib to create it by hand, like the MetadataEdit
sample does.

Conan

Using the orginal c# wrapper.
"bzirk" <bzirk@discussions.microsoft.com> wrote in message
news:10885CFD-50BA-48E5-95F4-0298C17FCCEC@microsoft.com...
> 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
>
>
>
>



Relevant Pages

  • Re: IWMHeaderInfo::GetAttributeByIndex fails with buffer too smal
    ... I modified the GetAttributeByIndex definition to pass ByVal pointers to ... wszName and Value rather then ByRef inclusions of the variables themselves. ... This takes the aproach of converting the app ... > Reference the orginal csharp wrapper. ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: MSFlexGrid in simple ATL container window doesnt accept keystrokes
    ... a wrapper, not an app and it uses an old version of ATL and won't build ... As a wrapper, we don't have access to the event loop. ... Surely getting the keyboard to work ... turns out the control is irrelevant. ...
    (microsoft.public.win32.programmer.ole)
  • Re: Question about mmap wrt compressed files
    ... How is a wrapper to mmap() going to help? ... A lot really depends on your app. ... exactly what you mention where it decompresses gzip/bzip2 data into an ...
    (comp.compression)
  • Re: Remoting between 2.0 and 1.1
    ... >> reference in my 2.0 app because it will be run in 2.0. ... >> and then it will communicate with my 2.0 app using remoting. ... > Even if it did not for you, then how about providing a COM wrapper on your ...
    (microsoft.public.dotnet.framework)