SmileeTiger
Programmer
Hi,<br><br>I am attempting to gain information about the CD-ROM drive using some assembly code in VC++ the followinf code is what I have found on the MSDN site with some minor modifications.<br><br>#include <windows.h><br>#include <string.h><br>#include <iostream.h><br><br>BOOL IsCDRomDrive (short nDrive);<br><br>BOOL IsCDRomDrive (short nDrive)<br> {<br> BOOL bResult = FALSE; // Assume not a CD-ROM drive<br> __asm {<br> mov ax, 150Bh // MSCDEX CD-ROM Drive Check<br> xor bx, bx<br> mov cx, nDrive<br> int 2Fh<br> cmp bx, 0ADADh // Check MSCDEX signature<br> jne not_cd_drive<br> or ax, ax // Check the drive type<br> jz not_cd_drive // 0 (zero) means not CD-ROM<br> mov bResult, TRUE<br> not_cd_drive:<br> }<br> return (bResult);<br> }<br><br>void main()<br>{<br>//I am just using '1' here as a sample drive<br><br>if (IsCDRomDrive(1))<br>{ <br> cout << "Yup";<br>}<br>cout << "end";<br>}<br><br><br>When I sun the code I get an access violation and I don't recieve the information I need. Does anyone have any ideas how to get this code working or can you suggest a differet approach to take?<br><br><br>Cory M Hicks<br><br>