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?