locked
Custom Logging PlugIn read statistics from buffer problem RRS feed

  • Question

  • Hi,
    I read how to create custom logging plugIn article from msdn and create my 
    new.
    Bu while reading logging statistics from buffer it throw an exception and ı 
    couldn't  succeed to read. I use windows server 2003 Enterprise + sp2 and sdk 
    9.
    
    object ContextBody;
                    CmdRequest.GetIUnknownValue("WMS_COMMAND_CONTEXT_BODY",
                                                11,
                                                out ContextBody,
                                                0);
    
                    // The logging statistics are stored in a buffer. Retrieve
                    // a pointer to the buffer and use the pointer to retrieve
                    // a string containing the statistics.
                    INSSBuffer NSBuffer = (INSSBuffer)ContextBody;
    
                    if (null == NSBuffer) return;
                    uint bufSize;
                   
                    System.IntPtr pBuf = new IntPtr();
                    NSBuffer.GetBufferAndLength(pBuf, out bufSize);
    
    It throws following exception at last code :
    
    
    System.ArgumentException: Value does not fall within the expected range.
       at Microsoft.WindowsMediaServices.Interop.INSSBuffer.GetBufferAndLength(IntPtr ppbBuffer, out int pdwLength)
      at LoggingPlugInDesign.LoggingReportPlugIn.OnEvent(WMS_EVENT& pEvent, IWMSContext pUserCtx, IWMSContext pPresentationCtx, IWMSCommandContext pCommandCtx) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\LoggingPlugInDesign\LoggingPlugInDesign\LoggingReportPlugIn.cs:line 117 Can anybody help me?
    Tuesday, November 27, 2007 3:43 PM

Answers

All replies

  • This forum is for discussion of developing software using Media Foundation.  The Windows Media SDK newsgroup is at http://www.microsoft.com/windows/windowsmedia/community/newsgroups/WindowsMedia/default.mspx?dg=microsoft.public.windowsmedia.sdk&lang=en&cr=US and would likely be better able to help you with this problem.

     

    However, it may fix your problem to use the 'out' keyword before pBuf when you call GetBufferAndLength.  Both parameters are out parameters from my understanding.

    Wednesday, December 26, 2007 7:43 PM
  • I have the same issue, the INSSBuffer supplied by the commandcontext has length=0. The sample code in the Windows SDK doesn't work because of it. The above suggestion makes no difference, I've tried it with and without the "out", I've tried it in VB.NET, I'm stumped. If anyone has an answer to this problem I'd appreciate it
    Wednesday, May 13, 2009 8:49 AM