![]() |
|
[C#] Controlling cd-rom motor - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Controlling cd-rom motor (/showthread.php?tid=5370224) |
Controlling cd-rom motor - Mudzay - Aug 10, 2016 Hey, can someone tell me if its possible to control (change speed, start/stop) the cd-rom motor? Thanks in advance :P * - i-manuel - Aug 10, 2016 (Aug 10, 2016 10:13 AM)Mudzay Wrote: Hey, can someone tell me if its possible to control (change speed, start/stop) the cd-rom motor? lol i asked my teacher about that, he told me that it is not possible with .NET * - Lord - Aug 10, 2016 (Aug 10, 2016 10:29 AM)i-manuel Wrote: lol i asked my teacher about that, he told me that it is not possible with .NET Everything is possible. I'm sure there's a dll out there somewhere or something. * - Mudzay - Aug 10, 2016 (Aug 10, 2016 10:29 AM)i-manuel Wrote: lol i asked my teacher about that, he told me that it is not possible with .NETU can always make c++ etc. dll and call it from c# xD (I think its possible, windows dlls like wimm.dll are c or c++) * - Oliver Sykes - Aug 10, 2016 You can open/close the tray from within c# easily. Not so sure about the speed, though. * - еlixir - Aug 10, 2016 Code public bool IsDiscAvailable(int driveNumber)or Code using System;The snippets above checks for a disk, causing the motor to run. source: http://stackoverflow.com/questions/11420365/detecting-if-disc-is-in-dvd-drive * - 0xDEAD10CC - Aug 10, 2016 You would need to use IOCTL's for this. IOCTL_CDROM_SET_SPEED more specifically as the control code that you'd have to send to the CD-ROM class driver as a request of type CdromSetSpeed (from the CDROM_SPEED_REQUEST enum) in the RequestType memer of the CDROM_SET_SPEED struct. The buffer at Irp->AssociatedIrp.SystemBuffer would contain the CDROM_SET_SPEED structure. You wouldn't need to keep track of the previous speed either because when media is changed it will revert to it's default speed. From a user-mode application you would have to call DeviceIoControl() to send these requests. (Aug 10, 2016 07:33 PM)еlixir Wrote: ... Yeah wonderful -- Not at ALL what OP asked for... |