//trial private void button1_Click(object sender, RoutedEventArgs e) { IDiscRecorder2 recorder = new MsftDiscRecorder2(); recorder.InitializeDiscRecorder(selectedDrive); IDiscRecorder2Ex dr2 = recorder as IDiscRecorder2Ex; //recorder.QueryInterface(); byte[] resp = new byte[32]; byte[] recv = new byte[18]; uint sb = 1024; IntPtr respPtr; resp[0] = 0; resp[1] = 0; resp[2] = 0; resp[3] = 0; resp[4] = 0; resp[5] = 0; resp[6] = 0; resp[7] = 0; resp[8] = 0; resp[9] = 0; resp[10] = 0; resp[11] = 0; resp[12] = 0; try { dr2.SendCommandNoData(resp, 6, recv, 60); dr2.GetDiscInformation(out respPtr, ref sb); if (sb > 1024) { sb = 1024; } Marshal.Copy(respPtr, resp, 0, (int)sb); } catch (System.Runtime.InteropServices.COMException) { } }
/// <summary> /// Retrieves the disc information from the media (via READ_DISC_INFORMATION).</summary> /// <returns> /// Data buffer that contains disc information from the media. /// For details of the contents of the data buffer, see the READ DISC INFORMATION command in the latest /// revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5/. /// </returns> Byte[] IDiscRecorder2X.GetDiscInformation() { uint byteSize = 0; IntPtr discDescriptorPtr; IDiscRecorder2Ex recorderEx = (IDiscRecorder2Ex)this; recorderEx.GetDiscInformation(out discDescriptorPtr, ref byteSize); Byte[] discDescriptor = new Byte[byteSize]; Marshal.Copy(discDescriptorPtr, discDescriptor, 0, (int)byteSize); Marshal.FreeCoTaskMem(discDescriptorPtr); return(discDescriptor); }