public static void GetCdTextInfo(UnixFileDescriptor fd, out MMC.CDTextDescriptor cdtext) { var cmd = MMC.CDB.ReadTocPmaAtip.CDText(); try { NativeApi.SendSCSIRequest(fd, ref cmd, out cdtext); } catch (Exception e) { throw new IOException("Failed to retrieve CD-TEXT information.", e); } cdtext.FixUp(); }
public static void GetCdTextInfo(SafeFileHandle hDevice, out MMC.CDTextDescriptor cdtext) { var req = new NativeApi.TOCRequest(MMC.TOCRequestFormat.CDText); var reqlen = Util.SizeOfStructure <TOCRequest>(); var cdtextlen = Util.SizeOfStructure <MMC.CDTextDescriptor>(); var ok = NativeApi.DeviceIoControl(hDevice, IOCTL.CDROM_READ_TOC_EX, ref req, reqlen, out cdtext, cdtextlen, out int _, IntPtr.Zero); if (!ok) { throw new IOException("Failed to retrieve CD-TEXT information.", new Win32Exception(Marshal.GetLastWin32Error())); } cdtext.FixUp(); }
private static extern bool DeviceIoControl(SafeFileHandle hDevice, IOCTL command, ref TOCRequest request, int nInBufferSize, out MMC.CDTextDescriptor data, int dataSize, out int pBytesReturned, IntPtr overlapped);