Jump to content

Need Help w/ IMAPI2 UDF and tryin to use it ... or similar..


Recommended Posts

My situation is, we have one CDR that we use to test customers burners on systems before letting them out the door, so normally I just keep appending files (multisession) to the CDR.

I have gotten IMAPI2 to successfully write to a blank CDR ...but any subsequent writes, seem to not fuly work work .. (the filesystem or label of disc changes properly) but no files get added.

Im wondering if there is a way to add multisession detect and import to the IMAPI2 UDF easily or how I could add it to my script.

The CD is also created as UDF filesystem on first burn and subsequent ones I notice are changed to CDFS...by using IMAPI2.

So, here is basically the code Im using to burn files to disc:

Func _CDWriteTest()

; Burns the contents of specified folder into a cd-r/cd-rw in the first drive on the system
$random = Random(256, 4096, 1) & Random(512, 8098, 1)
DirCreate( @TempDir & "\testfolder" & $random)
$folder =  @Tempdir & "\testfolder" & $random
$foldershortburn = FileGetShortName($folder)
$filename = "testburn" & Random(1, 4096,1) & Random(256,10245,1)
$fileburn = $folder & "\" & $filename & ".txt"
$file = FileOpen( $folder & "\" & $filename & ".txt", 2)
;$file = FileGetShortName($file)
;MsgBox(0, "test", $file)
$count = 1
While $count < 256
FileWriteLine( $file , "testburn123" & Random(242534252, 89802934810329438, 1))
$count = $count + 1
$fileshortburn = FileGetShortName($fileburn)
MsgBox(0, "test burn" , $foldershortburn & @CR & $fileshortburn)
  ;If $fileshortburn OR $folder = "" Then
  ; _WriteNotepadNewLine(".. Input file missing .. FAILED")
  ; Return
  ; EndIf

; Get the unique ids of all the drives on the system
$ids = _IMAPI2_DrivesGetID()
; Get the object of the first drive
$drive = _IMAPI2_DriveGetObj($ids[1])
  MsgBox(64, "Info", "Insert cd-r or cd-rw into drive " & _IMAPI2_DriveGetLetter($drive))
   $code = _IMAPI2_DriveGetMedia($drive)
  Until $code <> -1 ; Wait until the drive is ready
Until $code = $IMAPI_MEDIA_TYPE_CDR Or $code = $IMAPI_MEDIA_TYPE_CDRW ; Force the user to insert cd-r or cd-rw
$fs=_IMAPI2_CreateFSForDrive($drive,"TestBurn") ; Create a filesystem
_IMAPI2_AddFolderToFS($fs, $foldershortburn)
;_IMAPI2_AddFileToFS($fs,$fileshortburn, $foldershortburn)
_IMAPI2_BurnFSToDrive($fs,$drive, "_Progress")


I used the supplied example code( w/ IMAPI2) as a basis for my function...

Any help would be great! thanks =)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...