OcTroN Posted January 16, 2005 Share Posted January 16, 2005 Like the topic title says I want to automaticly install Nero if a CDRW or DVDRW drive is present in the system. Since we build a lot of systems and almost every system has a DVDRW or CDRW in it. Only a few don't have it so I want the preinstallation to automaticly skip Nero here.The install stuff will be easy to make, only how can the preinstallation find out if theres a writer in the system? How to find that out in a cmd-box? Can someone point me to the right direction?I want to do the same with PowerDVD, but thats project two Thanks in advance ! Link to comment Share on other sites More sharing options...
atlas95 Posted January 16, 2005 Share Posted January 16, 2005 Very good idea Link to comment Share on other sites More sharing options...
buletov Posted January 16, 2005 Share Posted January 16, 2005 try checking somehow if a device has imapi as a lower filter... Link to comment Share on other sites More sharing options...
OcTroN Posted January 16, 2005 Author Share Posted January 16, 2005 try checking somehow if a device has imapi as a lower filter...Explain yourself...? Link to comment Share on other sites More sharing options...
LaptoniC Posted January 16, 2005 Share Posted January 16, 2005 I am not good programmer but here is the sloppy code.hDevice = CreateFile("\\\\.\\F:", // drive to open GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, // default security attributes OPEN_EXISTING, // disposition 0, // file attributes NULL); // do not copy file attributesif (hDevice == INVALID_HANDLE_VALUE) // cannot open the drive { return (FALSE); //error handling } bResult = DeviceIoControl(hDevice, // device to be queried IOCTL_STORAGE_GET_MEDIA_TYPES_EX, // operation to perform NULL, 0, // no input buffer obuff, sizeof(*obuff), // output buffer &rtnd, // # bytes returned (LPOVERLAPPED) NULL); // synchronous I/ONow you will have GET_MEDIA_TYPES structDeviceType dd ?MediaInfoCount dd ?MediaInfo DEVICE_MEDIA_INFO <>GET_MEDIA_TYPES endsat obuff.Its size depends on the capabilities of device.You have MediaInfoCount*DEVICE_MEDIA_INFO structure at that buffer which is union you have to parse according to its type.More info at MSDN.I have written some of the code but failed on parsing unions will try later if no one attempts:) Link to comment Share on other sites More sharing options...
Fonceur Posted January 17, 2005 Share Posted January 17, 2005 If you are using a RunOnce.CMD or such, you could look for the appropriate driver of the cdrw/dvdrw, something like:if NOT exist %systemroot%\system32\CD-driver.abc goto NoCDstart /wait Nero.exe:NoCDOf course if you install many brands or if the burner and non-burner use the same driver that might not help much... Link to comment Share on other sites More sharing options...
Dahi Posted January 18, 2005 Share Posted January 18, 2005 You could also use CDRECORD (which requires cygwin) to search for CD burners.@ECHO OFFSETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSIONSET CDROM=SET CDR=FOR /F "SKIP=2 TOKENS=1,8 DELIMS= '" %%A IN ('CDRECORD -scanbus') DO ( IF /I "%%B" EQU " REMOVABLE CD-ROM" SET CDROM=!CDROM! "%%A")ECHO CD Drives: %CDROM%FOR %%X IN (%CDROM%) DO FOR /F "SKIP=2 DELIMS=" %%A IN ('CDRECORD -dev %%X -prcap') DO ( IF /I "%%A" EQU " DOES WRITE CD-R MEDIA" SET CDR=%%X)ECHO CD Burners: %CDR%IF "%CDR%"="" GOTO NO_CDRrem Install Nero:NO_CDR Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now