« Previous Next »

Thread: WMS Custom Logging Plugins dont work

Last post 05-27-2009 8:14 AM by Paul@Prostream. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 05-14-2009, 7:33 AM

    WMS Custom Logging Plugins dont work

    I need help. Badly.
    I need to write a custom login plugin for Windows Media Services but I cant get it to work. My own plugin didnt work, so I compiled the sample from the SDK and that doesnt work either. It will enable, it will create a table in my database and I know that the log event is being handled, but the code that's supposed to get the data to put into the log fails every time.

    The code looks like this (lifted directly from the sample project;

    ...
    CommandCtx.GetCommandRequest(CommandRequest)
    CommandRequest.GetIUnknownValue("@WMS_COMMAND_CONTEXT_BODY", 11, ContextBody, 0)

    NsBuffer = ContextBody
    strContext = GetStringFromNSSBuffer(NsBuffer)
    ...

    Private Function GetStringFromNSSBuffer(ByRef NsBuffer As INSSBuffer) As String
    Dim s As String = ""
    GetStringFromNSSBuffer = ""
    Try
    Dim uBufSize As UInt32
    Dim pbuf As IntPtr = New IntPtr()
    NsBuffer.GetBufferAndLength(pbuf, uBufSize)
    Dim iBufSize As Int32 = Convert.ToInt32(uBufSize) / 2
    s = Marshal.PtrToStringUni(pbuf, iBufSize)
    GetStringFromNSSBuffer = s
    Catch
    End Try
    End Function

    I get the same exception every time, NsBuffer.GetBufferAndLength() throws an exception: "Value does not fall within expected range" because the length of the buffer in question is always 0. I've tried it on two different servers now (one 2008 std and one 2008 datacenter).

    If anyone has any idea why it doesnt work I'd love to hear it cos I'm stumped. I cant find any answers on the net, and no-one in the media SDK newsgroups has answered.

    This should have been so easy, but if even the SDK is wrong, what am I supposed to do?

     

  • 05-27-2009, 8:14 AM In reply to

    Re: WMS Custom Logging Plugins dont work

    240 views and no-one has any idea?

    More info on the problem. It seems that it's not that the buffer is empty, I was wrong about that. If you call NSBuffer.GetLength you can get a size back, but GetBufferAndLength() and GetBuffer() both always return the error. It seems to be a badly worded error message, the real problem is that the IntPtr supplied for it to set to the buffer address is always rejected. It doesnt matter if you supply it uninstantiated, set up a value for it, or use IntPtr.Zero.

    it's the same in c# as it is in vb.net

Page 1 of 1 (2 items)
Microsoft Communities