I saw it as a challenge, and so I said yes. Honestly, I had better said no way... was that a working.
First was the study of relevant documents from T10.org. This was followed by the study of the source code of cdrdao.
Finally I was able to make the finished component and my friend is (so far) happy.
At the moment, the DLL has not so many features, more will follow. On W2K, XP and Vista admin rights are required.
On Win7/Win8 user rights satisfies. Used Interface is SPTI, so no runtimes required.
Demo_cdwGetDriveInfo.pb > demo source shows information on attached CD ROM drives
Demo_cdwGetMediaInfo.pb > demo source shows information from drive present disc
Demo_cdwDrive2ISO.pb > demo source shows how create a iso image from drive with progress status
Demo_cdwISO2Drive.pb > demo source shows hor write a iso image to cd-r/w dvd-r/w disc.
Here the source of Demo_cdwGetDriveInfo.pb
Code: Select all
; CDWorks Lib v0.2 Demo for PureBasic.
; (c)2013 by MRware, all rights reserved.
; Free to use for freeware, use it at your own risk!
EnableExplicit
IncludeFile "cdwlib.pbi"
Procedure Main()
Protected.l lNumDrives, lActDrive
lNumDrives = cdwGetDriveCount()
If lNumDrives > 0
Debug "Found " + Str(lNumDrives) + " usable drives."
For lActDrive = 1 To lNumDrives
If cdwUseDrive(lActDrive) = #CDW_SUCCESS And cdwGetDriveInfo() = #CDW_SUCCESS
Debug "Infos for drive #" + Str(lActDrive)
Debug "Driveletter: " + PeekS(cdwGetDriveLetter())
Debug "Drive Vendor: " + PeekS(cdwGetDriveVendor())
Debug "Drive Product: " + PeekS(cdwGetDriveProduct())
Debug "Drive Firmware: " + PeekS(cdwGetDriveFirmware())
Else
Debug "Can't get drive infos."
EndIf
Next
Else
Debug "No useable drives found."
EndIf
EndProcedure
Main() : End
Code: Select all
Enumeration
#CDW_SUCCESS
#CDW_ERROR_INVALID_DRIVE
#CDW_ERROR_NO_DRIVE
#CDW_ERROR_INVALID_ISO
#CDW_ERROR_DRIVE_ACCESS
#CDW_ERROR_GETPAGE
#CDW_ERROR_PUTPAGE
#CDW_ERROR_SET_WRITE_SPEED
#CDW_ERROR_READ_TOC
#CDW_ERROR_CREATE_FILE
#CDW_ERROR_READ_ERROR
#CDW_ERROR_WRITE_FILE
#CDW_ERROR_WRITE_DISC
#CDW_ERROR_USER_ABORT
#CDW_ERROR_INQUIRY_ERROR
#CDW_ERROR_NO_DISC
#CDW_ERROR_INVALID_DISC
#CDW_ERROR_ERASE_ERROR
EndEnumeration
Enumeration
#CDW_DS_EMPTY
#CDW_DS_INCOMPLETE
#CDW_DS_COMPLETE
#CDW_DS_UNKNOW
EndEnumeration
Enumeration
#CDW_MT_INVALID
#CDW_MT_CDRW
#CDW_MT_CDR
#CDW_MT_DVDRW
#CDW_MT_DVDR
EndEnumeration
Import "cdwlib.lib"
cdwGetDriveCount() As "_cdwGetDriveCount@0"
cdwUseDrive(lDrive.l) As "_cdwUseDrive@4"
cdwGetDriveInfo() As "_cdwGetDriveInfo@0"
cdwGetDriveLetter() As "_cdwGetDriveLetter@0"
cdwGetDriveVendor() As "_cdwGetDriveVendor@0"
cdwGetDriveProduct() As "_cdwGetDriveProduct@0"
cdwGetDriveFirmware() As "_cdwGetDriveFirmware@0"
cdwISO2Drive(sISOImage.s, lCallback.l) As "_cdwISO2Drive@8"
cdwDrive2ISO(sISOImage.s, lCallback.l) As "_cdwDrive2ISO@8"
cdwLoadMedia() As "_cdwLoadMedia@0"
cdwEjectMedia() As "_cdwEjectMedia@0"
cdwLockMedia() As "_cdwLockMedia@0"
cdwUnlockMedia() As "_cdwUnlockMedia@0"
cdwIsMediaPresent() As "_cdwIsMediaPresent@0"
cdwGetMediaInfo() As "_cdwGetMediaInfo@0"
cdwGetMediaState() As "_cdwGetMediaState@0"
cdwGetMediaType() As "_cdwGetMediaType@0"
cdwGetDiscCapacity.q() As "_cdwGetDiscCapacity@0"
cdwIsMediaEraseable() As "_cdwIsMediaEraseable@0"
cdwEraseMedia(lFullErase.l) As "_cdwEraseMedia@4"
EndImport
The component is currently more suited for CD-R/W disc. Only restricted DVD support.
The erase a CD-RW disc blocked the further program sequence until the end of erase.
On the moment only cd-rw discs are supported by the cdwEraseMedia() command.
cdwGetDiscCapacity returns used data size on cd-r/dvd-r discs, disc capacity on cd-rw/dvd-rw discs.
As the writemode is TAO, it's normal only used for cd-r/cd-rw discs. I testet it with some iso dvd images too,
has worked fine for me but normal dvd write mode are DAO. I will implement even.
OK, enough said, hope can be useful... more features will follow / add in future.