Help me:NeroBurn return NEROAPI_USER_ABORT

I’ve a problem to burn a data file or directory in Delphi.
NeroBurn function return NEROAPI_USER_ABORT and I don’t know why.
Please I need help :sad:

my code is:

procedure TForm1.AddFileToRootIsoItem(var RootItem: PNeroIsoItem; FileName: String);
var
FileTime: TDateTime;
tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_msec: WORD;
TempItem, SubDirItem: PNeroIsoItem;
sr: TSearchRec;
begin
TempItem := RootItem;

if not (RootItem.fileName = ‘’) then
begin
while Assigned(TempItem.nextItem) do
TempItem := TempItem.nextItem;

TempItem.nextItem := NeroCreateIsoItem();
TempItem := TempItem.nextItem;

end;

StrPCopy(TempItem.fileName, ExtractFileName(FileName));
TempItem.fileName[SizeOf(TempItem.fileName) - 1] := #00;

If DirectoryExists(FileName) then
begin
StrPCopy(TempItem.sourceFilePath, ‘’);
FileTime := now;
end
else
begin
StrPCopy(TempItem.sourceFilePath, FileName);
TempItem.sourceFilePath[SizeOf(TempItem.sourceFilePath) - 1] := #00;
FileTime := FileDateToDateTime(FileAge(FileName));
end;
DecodeDateTime(FileTime, tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_msec);

TempItem.entryTime.tm_year := tm_year;
TempItem.entryTime.tm_mon := tm_mon;
TempItem.entryTime.tm_wday := DayOfTheWeek(FileTime);
TempItem.entryTime.tm_mday := DayOfTheMonth(FileTime);
TempItem.entryTime.tm_yday := DayOfTheYear(FileTime);
TempItem.entryTime.tm_isdst := WORD(False);
TempItem.entryTime.tm_hour := tm_hour;
TempItem.entryTime.tm_min := tm_min;
TempItem.entryTime.tm_sec := tm_min;

TempItem.isReference := False;
TempItem.isDirectory := DirectoryExists(FileName);
TempItem.importinfo := nil;
TempItem.userData := nil;
TempItem.subDirFirstItem := nil;
SubDirItem := nil;

if TempItem.isDirectory then
if FindFirst(IncludeTrailingPathDelimiter(FileName) + ‘.’, faAnyFile + faHidden + faArchive + faReadOnly + faSysFile + faDirectory, sr) = 0 then
begin

  repeat
    if (not((sr.Name = '.') or (sr.Name = '..'))) then
    begin
      if Assigned(SubDirItem) then
      begin
        SubDirItem.nextItem := NeroCreateIsoItem();
        SubDirItem.fileName := '';
        SubDirItem := SubDirItem.nextItem;
      end
      else
      begin
        SubDirItem := NeroCreateIsoItem();
        SubDirItem.fileName := '';
        TempItem.subDirFirstItem := SubDirItem;
      end;
      AddFileToRootIsoItem(SubDirItem, IncludeTrailingPathDelimiter(FileName) +'\'+sr.Name);
    end;
  until FindNext(sr) <> 0;

  FindClose(sr);
end;

end;

procedure TForm1.BurnClick(Sender: TObject);
var
Flags: Cardinal ;
resBurn : NEROAPI_BURN_ERROR;
begin
if Assigned(NeroWriteCD) then
ReallocMem(NeroWriteCD, SizeOf(NERO_WRITE_CD))
else
NeroWriteCD :=AllocMem(SizeOf(NERO_WRITE_CD));

ZeroMemory(NeroWriteCD, SizeOf(NERO_WRITE_CD));
if not Assigned(RootIsoItem) then
begin
RootIsoItem := NeroCreateIsoItem();
end;
{ TODO : Add Visual return of added files and directories }
flags := NCITEF_USE_JOLIET+NCITEF_USE_MODE2+NCITEF_CREATE_ISO_FS+NCITEF_CREATE_UDF_FS;

AddFileToRootIsoItem(RootIsoItem, Edit1.Text);

NeroIsoTrack := NeroCreateIsoTrackEx(RootIsoItem,‘VOL1’,Flags);
NeroWriteCD.nwcdArtist:=nil;
NeroWriteCD.nwcdpCDStamp:=nil;
NerowriteCD.nwcdTitle:=nil;
NeroWriteCD.nwcdCDExtra :=false;
NeroWriteCD.nwcdNumTracks :=0;
NerowriteCD.nwcdMediaType := MEDIA_CDRW;
NeroWriteCD.nwcdIsoTrack:=NeroIsoTrack;
Flags :=0;

Flags := NBF_WRITE + NBF_DISABLE_ABORT + NBF_DETECT_NON_EMPTY_CDRW +
NBF_SPEED_IN_KBS + NBF_CD_TEXT;

if Assigned(NeroCDInfo) then
NeroWriteCD.nwcdMediaType := NeroCDInfo.ncdiMediaType;

NeroDeviceInfos.nsdisDevInfos[DeviceName.ItemIndex].nsdiWriteSpeeds.nsiSupportedSpeedsKBs[DeviceSpeed.ItemIndex];
resBurn := NeroBurn(NeroDeviceHd, NERO_ISO_AUDIO_MEDIA, NeroWriteCD, Flags,
{NeroDeviceInfos.nsdisDevInfos[DeviceName.ItemIndex].nsdiWriteSpeeds.nsiSupportedSpeedsKBs[DeviceSpeed.ItemIndex],}
0,
@NeroProgress);

case resBurn of
NEROAPI_BURN_OK: begin end;
NEROAPI_BURN_UNKNOWN_CD_FORMAT:
MessageDlg(‘NeroBurn() : NEROAPI_BURN_UNKNOWN_CD_FORMAT’,mtError, [mbOk], 0);
NEROAPI_BURN_INVALID_DRIVE:
MessageDlg(‘NeroBurn() : NEROAPI_BURN_INVALID_DRIVE’,mtError, [mbOk], 0);
NEROAPI_BURN_FAILED:
MessageDlg(‘NeroBurn() : NEROAPI_BURN_FAILED’,mtError, [mbOk], 0);
NEROAPI_BURN_FUNCTION_NOT_ALLOWED:
MessageDlg(‘NeroBurn() : NEROAPI_BURN_FUNCTION_NOT_ALLOWED’,mtError, [mbOk], 0);
NEROAPI_BURN_DRIVE_NOT_ALLOWED:
MessageDlg(‘NeroBurn() : NEROAPI_BURN_DRIVE_NOT_ALLOWED’,mtError, [mbOk], 0);
NEROAPI_BURN_USER_ABORT:
MessageDlg(‘NeroBurn() : NEROAPI_BURN_USER_ABORT’,mtError, [mbOk], 0);
NEROAPI_BURN_BAD_MESSAGE_FILE:
MessageDlg(‘NeroBurn() : NEROAPI_BURN_BAD_MESSAGE_FILE’,mtError, [mbOk], 0);
else
MessageDlg(‘NeroBurn() : unspecified error’,mtError, [mbOk], 0);
end;
if Assigned(NeroWriteCD) then
ReallocMem(NeroWriteCD, 0);

if Assigned(NeroIsoTrack) then
FreeIsoTrack(NeroIsoTrack);

if Assigned(RootIsoItem) then
FreeIsoItem(RootIsoItem);

end;