В принципе, всё понятно
RILMESSAGE msg = (RILMESSAGE)Marshal.PtrToStructure(lpData, typeof(RILMESSAGE));