private void screenCaptureSourcesRClbck(IntPtr opaque, ref ADLError error, IntPtr sources, UIntPtr size) { try { Responder <List <ScreenCaptureSource> > responder = (Responder <List <ScreenCaptureSource> >) getResponder((uint)opaque); if (error.err_code != 0) { responder.errHandler(error.err_code, error.err_message.body); } List <ScreenCaptureSource> sourcesList = new List <ScreenCaptureSource>(); var arrayValue = sources; var tableEntrySize = Marshal.SizeOf(typeof(ADLScreenCaptureSource)); uint tableSize = (uint)size; for (var i = 0; i < tableSize; i++) { ADLScreenCaptureSource cur = (ADLScreenCaptureSource)Marshal.PtrToStructure( arrayValue, typeof(ADLScreenCaptureSource)); byte[] snapshotArrayData = new byte[(uint)cur.imageDataLen]; Marshal.Copy(cur.imageData, snapshotArrayData, 0, (int)(uint)cur.imageDataLen); sourcesList.Add( new ScreenCaptureSource(cur.id.body, cur.title.body, snapshotArrayData)); arrayValue = new IntPtr(arrayValue.ToInt32() + tableEntrySize); } responder.resultHandler(sourcesList); } catch (Exception) { } }