Initialization failure

vbimport

#1

Hi!

I’m trying to implement a small library, so that others are able to burn data to DVD/CDRW. I’m using NeroSDK 1.03 (planning to change to 1.04 soon), MSVC++ Enterprise Edition 6.0. Nero is installed with version 5.5.10.42. I’ve already looked at the ressources that came with the NeroSDK, but found no solution to the following problem:

When calling
NeroBurn(m_sDH, NERO_ISO_AUDIO_MEDIA, psNWCD, dwBOpt.GetCurrentOptions(), 0, 0)
it returns with NEROAPI_BURN_ERROR and GetLastError tells me “Initialization failed”. So, obviously something must be wrong :wink:

<ul><li>m_sDH is a device handle (and other calls, such as e.g. NeroEraseCDRW) work fine with this handle
<li>
psNWCD is a NeroWriteCD structure of size<br>
sizeof(NERO_WRITE_CD) + sizeof(NERO_AUDIO_TRACK)<br>
I’m currently only using a single track. In this structure I’ve set
<ul><li>
nwcdNumTracks to 1 (only one track)<li>
nwcdTitle to some null-terminated text (I assume this is the title of the CD to be burned)<li>
nwcdArtist and nwcdpCDStamp are NULL<li>
nwcdCDExtra is false<li>
nwcdMediaType is MEDIA_DVD_ANY|MEDIA_CDRW<li></ul><li>
dwBOpt are burn options supported by my recorder (mainly BUP)
</ul>
I also collected the files to burn in an IsoItemTree and built an ISO track from this using NeroCreateIsoTrackEx.
This worked fine.

Calling NeroBurn with just this data set gives me the above mentioned “Initialization failure” - which seems quite fine to me, because up until now, I haven’t put the ISO track into the psNWCD structure.

However, if I set psNWCD->nmcdIsoTrack to the ISO track I’ve built from the ISO tree, I don’t get this NEROAPI_BURN_ERROR any longer - but an access violation. This is also, if I fill in any other fields in the psNWCD struct.

Any help?

Regards,
Thorsten


#2

Hi!

Originally posted by Thorsten
I’m trying to implement a small library, so that others are able to burn data to DVD/CDRW. I’m using NeroSDK 1.03 (planning to change to 1.04 soon), MSVC++ Enterprise Edition 6.0. Nero is installed with version 5.5.10.42. I’ve already looked at the ressources that came with the NeroSDK, but found no solution to the following problem:

I’ve updated to the newest version of SDK (1.04) and Nero (V6.3.0.3) now. The problem still persists, but with a small progress.

Calling NeroBurn with just this data set gives me the above mentioned “Initialization failure” - which seems quite fine to me, because up until now, I haven’t put the ISO track into the psNWCD structure.
However, if I set psNWCD->nmcdIsoTrack to the ISO track I’ve built from the ISO tree, I don’t get this NEROAPI_BURN_ERROR any longer - but an access violation. This is also, if I fill in any other fields in the psNWCD struct.

With the newest versions of SDK and API I now get a return result of NEROAPI_BURN_ERROR (with GetLastError returning “Initialization failed”) in both cases. So, obviously, something is missing in the structs, I’m passing to NeroBurn - but what is it, that’s missing?

Any help?

Regards,
Thorsten


#3

I see two possible problems:

  1. You set nwcdNumTracks to 1, but it looks like you want to burn only the iso track and no audio tracks. nwcdNumTracks refers to the number of audio tracks.

  2. You set nwcdMediaType to MEDIA_DVD_ANY|MEDIA_CDRW. This is not supported. You have to set it to a single media type like MEDIA_DVD_ANY or MEDIA_CD.


#4

Hi!

Sorry for my late reply, but I haven’t been in the office yesterday.

Originally posted by matze
[B]I see two possible problems:

  1. You set nwcdNumTracks to 1, but it looks like you want to burn only the iso track and no audio tracks. nwcdNumTracks refers to the number of audio tracks.
    [/B]

I already figured out this in the last days and had already changed it to nwcdNumTracks = 0, but this made no difference.

Originally posted by matze
2) You set nwcdMediaType to MEDIA_DVD_ANY|MEDIA_CDRW. This is not supported. You have to set it to a single media type like MEDIA_DVD_ANY or MEDIA_CD.

I tried this, but also to no avail. I’m still getting a NEROAPI_BURN_ERROR with “Initialization failure” in GetLastError.

I figured out, that the media type shows a strange behaviour in a different subject as well: I had used (MEDIA_DVD_ANY|MEDIA_CDRW) as well when looking for the available drives (NeroGetAvailableDrivesEx). As expected this returned with a list of available devices :wink:
Strangely enough, however, the write speeds array was completely filled with 0 (read speeds array was fine, though). Changing the first parameter of GetAvailableDrivesEx to MEDIA_NONE fixed this.

If I remember correctly, this was not the case when using V5.5.10.42. If you want me to verify this, just let me know and I try to reinstall the older version, if possible.

Regards,
Thorsten


#5

What does the error log say?


#6

Hi!

Originally posted by matze
What does the error log say?

NeroGetErrorLog returns this:

{"version number deleted
Windows 2000 5.0
IA32
WinAspi: -
ahead WinASPI: File ‘C:\Programme\Ahead\Nero\Wnaspi32.dll’: Ver=2.0.1.59, size=160016 bytes, created 16.12.2003 19:18:06
Nero API version: 6.3.0.3
Using interface version: 6.3.0.0
"

Regards,
Thorsten


#7

Hi!

Perhaps the actual code does help much more than just a textual description. I have included it with this post. Code that is not related to Nero has been removed as well as most of the error handling, version checking, etc.

I’m basically doing this in my burning routine:

{
int iNumTracks;
int iSize;

NEROAPI_BURN_ERROR result;
NERO_WRITE_CD* psNeroWriteCD;
NERO_ISO_ITEM* ppIsoItem = NULL;

// Calculate the size required for NERO_WRITE_CD plus the given number of tracks
// (at the moment we always write a single track containing all files as IsoItems)
iNumTracks = 0;
iSize = sizeof(NERO_WRITE_CD) + (iNumTracks-1)*sizeof(NERO_AUDIO_TRACK);

// Allocate a WriteCD structure and fill it with null bytes.
psNeroWriteCD = (NERO_WRITE_CD*) new char[iSize];
memset (psNeroWriteCD, 0, iSize);

psNeroWriteCD->nwcdNumTracks = iNumTracks;
// there is no extra audio on this disk, so:
psNeroWriteCD->nwcdCDExtra = false;

psNeroWriteCD->nwcdMediaType = static_cast<NERO_MEDIA_TYPE>(MEDIA_CD);

// Set the ISO track data
CBurnOptions dwBurnOptions(m_sNeroDeviceInfo.nsdiCapabilities);

CreateIsoTrack (“Test”, psNeroWriteCD->nwcdIsoTrack);

// Actually burn all data using the currently selected device.
// NERO_ISO_AUDIO_MEDIA tells the burn process to detect the kind of media using the nwcdMediaType member within the WRITE_CD structure (third parameter).
// (DWORD) 204 is currently used, because this is the value NeroCmd uses as well - and NeroCmd does work.
result = NeroBurn (m_sDevHandle, NERO_ISO_AUDIO_MEDIA, psNeroWriteCD, (DWORD) 204, 0, 0);
if (NEROAPI_BURN_FAILED == result)
{
CString error = NeroGetLastError();
CString log = NeroGetErrorLog();
}
}

with the following important subroutines. These are more or less identical with those in NeroCmd:

// Create an ISO track
void CVideoArchivierung::CreateIsoTrack (const CString sName, CNeroIsoTrack** ppIsoTrack)
{
NERO_ISO_ITEM* psIsoItemRoot = NULL;
NERO_CITE_ARGS citeArgs;

psIsoItemRoot = CreateIsoItemTree();

memset (&citeArgs, 0, sizeof (citeArgs));
citeArgs.firstRootItem = psIsoItemRoot;
citeArgs.name = (LPCTSTR)sName;
// (ULONG) 16385 is currently used, because this is the value NeroCmd uses as well - and NeroCmd does work.
citeArgs.dwBurnOptions = (ULONG) 16385; /* NCITEF_CREATE_ISO_FS; */
// Finally, create the ISO track.
ppIsoTrack = NeroCreateIsoTrackEx (NULL, (const char) &citeArgs, NCITEF_USE_STRUCT);
}

and

// Create an ISO item tree from all files in the working directory.
NERO_ISO_ITEM* CVideoArchivierung::CreateIsoItemTree()
{
NERO_ISO_ITEM* psIsoItemRoot = NULL;
NERO_ISO_ITEM* psIsoItem = NULL;
BOOL bMoreFiles;
CFileFind finder;
CString aFile;

// Walk through the current working directory and throw all items into the ISO tree.
bMoreFiles = finder.FindFile((LPCTSTR)m_sWorkingDirectory);
while (bMoreFiles)
{
bMoreFiles = finder.FindNextFile();

// We have to skip the elements "." and ".."
if (!finder.IsDots())
{
  CTime ftime;
  time_t t;
  if (finder.GetCreationTime(ftime))
  {
    t = ftime.GetTime();
  }

  // Remember the root of all items
  if (NULL == psIsoItemRoot)
  {
    psIsoItemRoot = NeroCreateIsoItem();
    psIsoItem = psIsoItemRoot;
  }
  else
  {
    psIsoItem-&gt;nextItem = NeroCreateIsoItem();
    psIsoItem = psIsoItem-&gt;nextItem;
  }
  memset(psIsoItem, 0, sizeof(NERO_ISO_ITEM));
  StoreString (psIsoItem-&gt;fileName, psIsoItem-&gt;longFileName, finder.GetFileName());
  StoreString (psIsoItem-&gt;sourceFilePath, (char*)psIsoItem-&gt;longSourceFilePath, finder.GetFilePath());
  psIsoItem-&gt;isDirectory = finder.IsDirectory();
  psIsoItem-&gt;isReference = false;
  psIsoItem-&gt;subDirFirstItem = NULL;
  psIsoItem-&gt;itemSize = sizeof(NERO_ISO_ITEM);
  psIsoItem-&gt;entryTime = *localtime (&t);
}

}

return psIsoItemRoot;
}

If I take a look at the ISO item tree in the debugger, the one generated by the routine above is nearly identical to that generated by NeroCmd (except for addresses, of course).

I wrote nearly identical, because this code sorts filenames in reverse order compared to NeroCmd. That’s no deal here, however, because in my test directory there is just one file.

I’m not in any way an expert in C or C++ (this is my first project in this language actually), so I might have made some really stupid mistake. Please let me know, if this is the case.

Regards,


#8

Hi!

I’ve done some more tests on this subject, because this error still bothers me. Both my program as well as NeroCmd call the same NeroAPI library routines before building the ISO tree and before calling NeroCreateIsoTrackEx. The only difference I currently see, is that my routine (see post above) sorts the directory entries in reverse order compared to NeroCmd. This, however, could not really make a difference, could it?

So, I did some memory dumps of the relevant parts before and after calling NeroCreateIsoTrackEx. These are the results:

My Program: NeroCmd:
=========== ========
Before calling CreateIsoTrack with
ppIsoTrack = NeroCreateIsoTrackEx (NULL, (const char) &citeArgs, NCITEF_USE_STRUCT);

Memorydump of &citeArgs:
0012F54C 00 00 00 00 0012F600 00 00 00 00 .size
0012F550 48 77 CA 01 0012F604 00 78 22 01 .firstRootItem
0012F554 00 00 00 00 0012F608 00 00 00 00 .firstRootItem_wrapper
0012F558 3C 19 30 00 0012F60C EA 0E 80 00 .name
0012F55C 01 40 00 00 0012F610 01 40 00 00 .dwBurnOptions
0012F560 00 00 00 00 0012F614 00 00 00 00 .systemidentifier
0012F564 00 00 00 00 0012F618 00 00 00 00 .volumeSet
0012F568 00 00 00 00 0012F61C 00 00 00 00 .publisher
0012F56C 00 00 00 00 0012F620 00 00 00 00 .dataPreparer
0012F570 00 00 00 00 0012F624 00 00 00 00 .application
0012F574 00 00 00 00 0012F628 00 00 00 00 .copyright
0012F578 00 00 00 00 0012F62C 00 00 00 00 .abstract
0012F57C 00 00 00 00 0012F630 00 00 00 00 .bibliographic

It can be seen that there is no difference, except for the value of pointers
(which is to be expected). Examining the name pointer shows that they both
point to the string “Test” (followed by a null byte).

After calling CreateIsoTrack:

Memorydump of ppIsoTrack:
003018A8 A8 AF CA 01 00801C58 60 B0 22 01
Memorydump of *ppIsoTrack:
01CAAFA8 A0 C6 A9 00 0122B060 A0 C6 19 10
01CAAFAC 01 40 00 00 0122B064 01 40 00 00 dwBurnOptions?
01CAAFB0 54 65 73 74 0122B068 54 65 73 74 “Test”
01CAAFB4 00 00 00 00 0122B06C 00 00 00 00
01CAAFB8 00 00 00 00 0122B070 00 00 00 00
01CAAFBC 00 00 00 00 0122B074 00 00 00 00
01CAAFC0 00 00 00 00 0122B078 00 00 00 00
01CAAFC4 00 00 00 00 0122B07C 00 00 00 00
01CAAFC8 00 00 00 00 0122B080 00 00 00 00
01CAAFCC 00 00 00 00 0122B084 00 00 00 00
01CAAFD0 00 00 00 00 0122B088 00 00 00 00
01CAAFD4 00 00 00 00 0122B08C 00 00 00 00
01CAAFD8 00 00 00 00 0122B090 00 00 00 00
01CAAFDC 00 00 00 00 0122B094 00 00 00 00
01CAAFE0 00 00 00 00 0122B098 00 00 00 00
01CAAFE4 00 00 00 00 0122B09C 00 00 00 00
01CAAFE8 00 00 00 00 0122B0A0 00 00 00 00
01CAAFEC 00 00 00 00 0122B0A4 00 00 00 00
01CAAFF0 00 00 00 00 0122B0A8 00 00 00 00
01CAAFF4 00 00 00 00 0122B0AC 00 00 00 00
01CAAFF8 00 00 00 00 0122B0B0 00 00 00 00
01CAAFFC 00 00 00 00 0122B0B4 00 00 00 00
01CAB000 00 00 00 00 0122B0B8 00 00 00 00
01CAB004 00 00 00 00 0122B0BC 00 00 00 00
01CAB008 00 00 00 00 0122B0C0 00 00 00 00
01CAB00C 00 00 00 00 0122B0C4 00 00 00 00
01CAB010 00 00 00 00 0122B0C8 00 00 00 00
01CAB014 00 00 00 00 0122B0CC 00 00 00 00
01CAB018 00 00 00 00 0122B0D0 00 00 00 00
01CAB01C 00 00 00 00 0122B0D4 00 00 00 00
01CAB020 00 00 00 00 0122B0D8 00 00 00 00
01CAB024 00 00 00 00 0122B0DC 00 00 00 00
01CAB028 00 00 00 00 0122B0E0 00 00 00 00
01CAB02C 00 00 00 00 0122B0E4 00 00 00 00
01CAB030 00 00 00 00 0122B0E8 00 00 00 00
01CAB034 00 00 00 00 0122B0EC 00 00 00 00
01CAB038 00 00 00 00 0122B0F0 00 00 00 00
01CAB03C 00 00 00 00 0122B0F4 00 00 00 00
01CAB040 00 00 00 00 0122B0F8 00 00 00 00
01CAB044 00 00 00 00 0122B0FC 00 00 00 00
01CAB048 00 00 00 00 0122B100 00 00 00 00
01CAB04C 00 00 00 00 0122B104 00 00 00 00
01CAB050 00 00 00 00 0122B108 00 00 00 00
01CAB054 00 00 00 00 0122B10C 00 00 00 00
01CAB05C 00 00 00 00 0122B110 00 00 00 00
01CAB060 00 00 00 00 0122B114 00 00 00 00
01CAB064 00 00 00 00 0122B118 00 00 00 00
01CAB068 00 00 00 00 0122B11C 00 00 00 00
01CAB06C 00 00 00 00 0122B120 00 00 00 00
01CAB070 00 00 00 00 0122B124 00 00 00 00
01CAB074 00 00 00 00 0122B128 00 00 00 00
01CAB078 00 00 00 00 0122B12C 00 00 00 00
01CAB07C 00 00 00 00 0122B130 00 00 00 00
01CAB080 00 00 00 00 0122B134 00 00 00 00
01CAB084 00 00 00 00 0122B138 00 00 00 00
01CAB088 00 00 00 00 0122B13C 00 00 00 00
01CAB08C 00 00 00 00 0122B140 00 00 00 00
01CAB090 00 00 00 00 0122B144 00 00 00 00
01CAB094 00 00 00 00 0122B148 00 00 00 00
01CAB098 00 00 00 00 0122B14C 00 00 00 00
01CAB09C 00 00 00 00 0122B150 00 00 00 00
01CAB0A0 00 00 00 00 0122B154 00 00 00 00
01CAB0A4 00 00 00 00 0122B158 00 00 00 00
01CAB0A8 00 00 00 00 0122B15C 00 00 00 00
01CAB0AC 00 00 00 00 0122B160 00 00 00 00
01CAB0B0 00 00 00 00 0122B164 00 00 00 00
01CAB0B4 48 77 CA 01 0122B168 00 00 00 00 .firstRootItem in MyProgram
01CAB0B8 00 00 00 00 0122B16C 00 78 22 01 .firstRootItem in NeroCmd
01CAB0BC 00 00 00 00 0122B170 00 00 00 00
01CAB0C0 14 B1 AE 00 0122B174 00 00 00 00
01CAB0C4 14 B1 AE 00 0122B178 14 B1 1E 10
01CAB0C8 14 B1 AE 00 0122B17C 14 B1 1E 10
01CAB0CC 14 B1 AE 00 0122B180 14 B1 1E 10
01CAB0D0 08 C8 CA 01 0122B184 14 B1 1E 10 .firstRootItem+$50C0 in MyProgram
01CAB0D4 14 B1 AE 00 0122B188 58 C8 22 01 .firstRootItem+$5058 in NeroCmd
01CAB0D8 14 B1 AE 00 0122B18C 14 B1 1E 10
01CAB0DC 14 B1 AE 00 0122B190 14 B1 1E 10
01CAB0E0 0D F0 AD BA 0122B194 14 B1 1E 10
01CAB0E4 0D F0 AD BA 0122B198 0D F0 AD BA
01CAB0E8 AB AB AB AB 0122B19C 0D F0 AD BA
01CAB0EC AB AB AB AB 0122B1A0 AB AB AB AB
01CAB0F0 00 00 00 00 0122B1A4 AB AB AB AB
01CAB0F4 00 00 00 00 0122B1A8 00 00 00 00
01CAB0F8 C3 00 2B 00 0122B1AC 00 00 00 00
01CAB0FC 00 04 EE FE 0122B1B0 B6 00 2B 00
01CAB100 78 01 CA 01 0122B1B4 00 04 EE FE
01CAB104 78 01 CA 01 0122B1B8 E8 CF 22 01
0122B1BC 78 01 22 01

The problem here is that I don’t know the meaning of the components
of **ppIsoTrack. I’ve thus dumped all parts that deem relevant to me
up until the value of .firstRootItem (which was given as part of
&citeArgs when calling NeroCreateIsoTrackEx) appeared. It can be seen
that there is a difference between what my program received and what
the NeroCmd program received as output of NeroCreateIsoTrackEx.

The first four bytes are not identical, but seem to be a pointer to
something. So, they might differ of course. However, we then see that
there are a lot of identical bytes (mostly 00 00 00 00) up until the
value of .firstRootItem appears for the first time. In the return
value in neroCmd, however, this value appears four bytes later then
it appears in my program. All following bytes (up until AB AB AB AB
00 00 00 00 00 00 00 00) also have an offset of 4 bytes. Obviously,
this is not correct in my program - but why?

Regards,
Thorsten


#9

You can use DebugPrintIsoTrack function defined in IsoTrack.cpp to print out your ISO tracks, then do a comparison.

You can also modify it to suit your needs better and print more information.


#10

Hi!

Originally posted by alexp
You can use DebugPrintIsoTrack function defined in IsoTrack.cpp to print out your ISO tracks, then do a comparison.
You can also modify it to suit your needs better and print more information.

DebugIsoTrack only prints an ISO tree, so it does not really help in this case, does it? I already did a comparison on the ISO trees (not tracks!), but have not included the details as they are fine in my eyes (I will give it a try anyway). They have been identical except for the ordering of files. In my post above, I found a difference in the ISO track (not ISO tree) that is returned by NeroCreateIsoTrackEx.

Is there somewhere a function to debug an ISO track? Or is there any information on the layout of an ISO track?

Regards,
Thorsten


#11

The iso track returned by NeroCreateIsoTrackEx is of type CNeroIsoTrack which is defined in NeroIsoTrack.h. Maybe this helps.

Does the error log not say more than what you pasted above? If not, could you please use NeroGetLastErrors(x, NGLE_REPORT, NULL). This should give me some more information where the error actually happened.


#12

Originally posted by matze
The iso track returned by NeroCreateIsoTrackEx is of type CNeroIsoTrack which is defined in NeroIsoTrack.h. Maybe this helps.

I’ll have a look at this, thanks.

Originally posted by matze
Does the error log not say more than what you pasted above? If not, could you please use NeroGetLastErrors(x, NGLE_REPORT, NULL). This should give me some more information where the error actually happened.

Unfortunately, this results in a linker error:
error LNK2001: Unresolved external symbol _NeroGetLastErrors

I’m linking against NeroAPIGlue.lib and NeroAPIGlueRT.lib. Is there any other library I should link against - and where can I find it?

Regards,
Thorsten


#13

I’m linking against NeroAPIGlue.lib and NeroAPIGlueRT.lib. Is there any other library I should link against - and where can I find it?

You should only link to one of the libs. NeroAPIGlueRT.lib is linked dynamically to the runtime library and NeroAPIGlue.lib statically.
Maybe this is the problem.

Otherwise it is very strange, that you get an unresolved external symbol. Are you sure, you are using the NeroAPIGlue.lib of NeroSDK 1.04?


#14

Originally posted by matze
You should only link to one of the libs. NeroAPIGlueRT.lib is linked dynamically to the runtime library and NeroAPIGlue.lib statically.
Maybe this is the problem.

OK - I changed it, to link just against the NeroAPIGlue.lib, … but to no avail :frowning:
I’m still getting the unresolved symbol linker error.

Originally posted by matze

Otherwise it is very strange, that you get an unresolved external symbol. Are you sure, you are using the NeroAPIGlue.lib of NeroSDK 1.04?

Yes, I’m quite sure. The Changelog.txt in the API I downloaded says it is version 1.04. I just recompiled everything from the very beginning (with renaming the Nero SDK directory beforehand) and it resulted in a complete failure due to libs and includes not found. I then renamed the Nero SDK directory again and everything compiled and linke with the unresolved symbol again. So, I’m quite sure, the linker uses the directory I’ve told him to use.
The libs in C:\NeroSDK-v1.04\NeroAPI\Lib are of size

  • NeroAPIGlue.lib: 142.782 Bytes
  • NeroAPIGlueRT.lib: 143.006 Bytes

Regards,
Thorsten


#15

Ok, sorry. You are right. The symbol is missing in the Gluelib of NeroSDK 1.04. This will be fixed in the next NeroSDK version.


#16

Originally posted by matze
What does the error log say?

Hi!
I just realized that the error log I posted above was not complete. Sorry about that. Here’s the complete error log, which might be of more help to you, matze, because there’s a line number given in NeroAPI.cpp (line 4875):


<serial number deleted>

Windows 2000 5.0
IA32
WinAspi: -
ahead WinASPI: File 'C:\Programme\Ahead\Nero\Wnaspi32.dll': Ver=2.0.1.59, size=160016 bytes, created 16.12.2003 19:18:06
Nero API version: 6.3.0.3
Using interface version: 6.3.0.0
Installed in: C:\Programme\Ahead\Nero\
Application: ahead\Nero - Burning Rom
Recorder:             <TOSHIBA DVD-ROM SD-R1312>Version: 1011 - HA 1 TA 0 - 6.3.0.3
 Adapter driver:      <atapi>                   HA 1
 Drive buffer  :      2048kB
 Bus Type      :      default (0) -> ATAPI, detected: ATAPI

=== Scsi-Device-Map ===
CdRomPeripheral      : TOSHIBA DVD-ROM SD-R1312         atapi Port 1 ID 0  DMA: On
DiskPeripheral       : IBM     DPSS-336950N    S96H    sym_u3 Port 2 ID 0  DMA: Off
DiskPeripheral       : SEAGATE ST373405LW      0002    sym_u3 Port 2 ID 1  DMA: Off

=== CDRom-Device-Map ===
TOSHIBA DVD-ROM SD-R1312   E:   CDRom0
=======================

AutoRun : 1
Excluded drive IDs:
CmdQueuing     : 1
CmdNotification: 2
WriteBufferSize: 83886080 (0) Byte
ShowDrvBufStat : 0
EraseSpeed     : 0
BUFE           : 0
Physical memory     : 767MB (785948kB)
Free physical memory: 334MB (342696kB)
Memory in use       : 56 %
Uncached PFiles: 0x0
Use Static Write Speed Table: 0
Use Inquiry    : 1
Global Bus Type: default (0)
Check supported media : Disabled (0)

24.3.2004
NeroAPI
17:09:12        #1 NEROAPI 2 File NeroAPI.cpp, Line 4875
        Initialization failed


Existing drivers:
File 'Drivers\PXHELP20.SYS': Ver=2.02.25a, size=15680 bytes, created 30.07.2001 02:02:00 (Prassi/Veritas driver for win 2K)

Registry Keys:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\AllocateCDROMs : 0 (Security Option)

Regards,
Thorsten


#17

Sorry, this doesn’t help. And unfortunately I don’t have any idea currently, what could be the reason for this problem.

I would suggest that you try to find the difference to the NeroCMD source. Not just the actual iso track generating code but maybe also the other source code.


#18

Originally posted by matze
Sorry, this doesn’t help. And unfortunately I don’t have any idea currently, what could be the reason for this problem.
I would suggest that you try to find the difference to the NeroCMD source. Not just the actual iso track generating code but maybe also the other source code.

Hi matze!

Thanks for your help so far. I have already found some errors in my code with the information provided both in this and in other threads here.

Since the beginning of this thread I’ve done a lot of tests to track down this “Initialization failure” problem. It seems to me, some relevant change has been done in the burn routine between Nero V5.5.10.42 and Nero V6.x.x.x. I’ve done tests with these Nero versions

  • Nero V5.5.10.42
  • Nero V6.3.0.0
  • Nero V6.3.0.3
  • Nero V6.1.3.6
    using both SDK-v1.03 and SDK-v1.04. I’ve tried this on several machines here with different CDRW or DVD drives.

The following program parts works fine with Nero V5.5.10.42 (I do not have any older versions available here), but fails to burn with “Initialization failure” as soon as I switch to any Nero V6.x.x.x version. The SDK version does not affect this behaviour. Neither does the drive (CDRW or DVD) affect it.
The member variables of this class (e.g. m_sNeroDeviceInfo) are of course declared and set correctly outside these routines. For the sake of brevity I have also removed all error handling (e.g. checking whether memory has been allocated (and the like).


CVA::Burn(const string sName)
{
	int iNumTracks;
	int iSize;
	bool success;
	CBurnOptions dwBurnOptions(m_sNeroDeviceInfo.nsdiCapabilities);

	NEROAPI_BURN_ERROR	result;
	NERO_WRITE_CD*		psNeroWriteCD;
	NERO_ISO_ITEM*		ppIsoItem = NULL;

	// Calculate the size required for NERO_WRITE_CD structure. As there are no tracks, this is
	// is fairly easy (tracks are used only in case of audio media).
	iNumTracks = 0;
	iSize = sizeof(NERO_WRITE_CD) + (iNumTracks-1)*sizeof(NERO_AUDIO_TRACK);
	
	// Allocate a WriteCD structure and fill it with null bytes.
	psNeroWriteCD = (NERO_WRITE_CD*) new char[iSize];
	memset (psNeroWriteCD, 0, iSize);

	// Set structure to refer to data to be burnt.
	psNeroWriteCD->nwcdNumTracks = iNumTracks;
	// the title will be the sName
	psNeroWriteCD->nwcdTitle = sName.c_str();
	// we do not have an audio CD, so there is no artist, no special CD and also no extra audio track
	psNeroWriteCD->nwcdArtist = NULL;
	psNeroWriteCD->nwcdCDExtra = false;
	psNeroWriteCD->nwcdpCDStamp = NULL;

	// Depending on the kind of medium available, we have to set the media type filter. Otherwise
	// we will receive an initialization error when trying to burn.
	CMedium medium;

	medium.GetMediumInfo(m_sDevHandle);
	if (medium.IsCDRW())
	{
		psNeroWriteCD->nwcdMediaType = static_cast<NERO_MEDIA_TYPE>(MEDIA_CDRW);
	}
	else if (medium.IsDVD())
	{
		psNeroWriteCD->nwcdMediaType = static_cast<NERO_MEDIA_TYPE>(MEDIA_DVD_ANY);
	}

	// Create an ISO track from all files to be burned.
	success = GetIsoTrack(sName.c_str(), &psNeroWriteCD->nwcdIsoTrack, &ppIsoItem);

	// Set the options we want to use - although these are the defaults, we just set them to be
	// sure. We must disable ejecting the disc under all circumstances. Unfortunately, this
	// prevents us from doing an automatic verify, because with verify set, the tray will open
	// and immediately close again after burning has finished. Our speed member variable is in
	// multiples of the base speed, so we will use that.
	dwBurnOptions.AddBufferUnderrunProtection();
	dwBurnOptions.AddDisableEject();
	dwBurnOptions.AddDiskAtOnce();
	dwBurnOptions.AddReallyWrite();
	if (VerificationIsDisabled())	{ dwBurnOptions.RemoveVerify(); }
	else				{ dwBurnOptions.AddVerify(); }
	dwBurnOptions.RemoveKBInSeconds();
	dwBurnOptions.AddHighCompatabilityMode();

	// And finally burn ...
	result = NeroBurn(m_sDevHandle, NERO_ISO_AUDIO_MEDIA, psNeroWriteCD, dwBurnOptions.GetCurrentOptions(), m_iBurnSpeed, 0);

	char * NeroResult = NeroGetErrorLog();
	cout << "Nero error: <" << endl << NeroResult << endl << ">" << endl;
	NeroFreeMem(NeroResult);

	// Release memory allocated
	NeroFreeIsoTrack(psNeroWriteCD->nwcdIsoTrack);

};


bool CVA::GetIsoTrack(const string sName, CNeroIsoTrack** ppIsoTrack, NERO_ISO_ITEM** ppItem)
{
	*ppIsoTrack = NULL;

	NERO_ISO_ITEM* pItem=NULL;
	bool result = false;

	// Create a tree from the the files found in our working directory.
	CreateIsoItemTree(GetWorkingDirectory(), &pItem);

	*ppItem = pItem;
	if (NULL != *ppItem)
	{
		NERO_CITE_ARGS citeArgs;

		memset (&citeArgs, 0, sizeof (citeArgs));
		// We want to create all data as it appears in our working directory, i.e. long
		// filenames (NCITEF_USE_JOLIET) and have the medium readable on most drives
		// (NCITEF_USE_MODE2).
		citeArgs.dwBurnOptions = NCITEF_USE_MODE2 | NCITEF_USE_JOLIET;
		citeArgs.name = sName.c_str();
		citeArgs.firstRootItem = *ppItem;
		
		// Finally, create the ISO track.
		DebugPrintIsoTree(*ppItem, 0);

It makes no difference whether the ISO track is created using the citeArgs struct or not - I’ve tried both, as can be see from the line commented out.


//		*ppIsoTrack = NeroCreateIsoTrackEx (pItem, sName.c_str(), (DWORD) (NCITEF_USE_MODE2 | NCITEF_USE_JOLIET));
		*ppIsoTrack = NeroCreateIsoTrackEx (NULL, (const char *) &citeArgs, NCITEF_USE_STRUCT);
		
		// If the ISO track could not be created then delete the ISO item tree and return with
		// an error.
		if (NULL != *ppIsoTrack)
		{
			result = true;
		}
	}

	return result;
}

The file finder class used below is similar to that coming with NeroCmd, but with some additional functionality not being used here. However, to simplify the problems that might arise, the directory I’m testing with, contains just a single file. So, in reality this routine does not really build a tree (however, it does this correctly, when there are more files and/or directories in the tree).


CVA::CreateIsoItemTree(string sStartDir, NERO_ISO_ITEM** pItemRoot)
{
	NERO_ISO_ITEM* pCurrentItem = *pItemRoot;
	CFileFinder finder(sStartDir);

	// Walk through the current working directory and throw all items into the ISO tree.
	while (finder.IsValidEntry())
	{
		// We have to skip the elements "." and ".." that are returned by the finder.
		if (!finder.IsDots())
		{
			time_t t = finder.GetCreationTime();

			// If this is the first item, we have to remember it as the root of all items,
			// otherwise append the new item to the existing item list.
			if (NULL == *pItemRoot)
			{
				*pItemRoot = NeroCreateIsoItem();
				pCurrentItem = *pItemRoot;
			}
			else
			{
				pCurrentItem->nextItem = NeroCreateIsoItem();
				pCurrentItem = pCurrentItem->nextItem;
			}

			// Fill in the necessary information, i.e. target filename, source filename
			// (including path), whether it's directory and file creation time.
			// StoreString is identical to the one defined in NeroCmd.
			StoreString (pCurrentItem->fileName,
						 pCurrentItem->longFileName,
						 (LPCTSTR)finder.GetFileName());
			StoreString (pCurrentItem->sourceFilePath,
						 (char*)pCurrentItem->longSourceFilePath,
						 finder.GetFilePath().append(finder.GetFileName()));
			pCurrentItem->isDirectory = finder.IsDirectory();
			pCurrentItem->isReference = false;
			pCurrentItem->subDirFirstItem = NULL;
			pCurrentItem->itemSize = sizeof(NERO_ISO_ITEM);
			pCurrentItem->entryTime = *localtime (&t);

			// Distinguish between directories and plain files
			if (finder.IsDirectory())
			{
				string sDir = finder.GetFilePath();

				sDir.append(finder.GetFileName());
				CreateIsoItemTree(sDir, &pCurrentItem->subDirFirstItem);
			}
		}

		finder.FindNextFile();
	}
}

void CA::DebugPrintIsoTree (const NERO_ISO_ITEM * pItem, int iLevel)
{
	while (pItem)
	{
		string indent(iLevel*2, ' ');

		// Indent each level a little bit.
		cout << indent << "fileName          : [" << pItem->fileName << "]" << endl;
		cout << indent << "longFileName      : [" << ((NULL == pItem->longFileName) ? "" : pItem->longFileName) << "]" << endl;
		cout << indent << "isDirectory       : " << (pItem->isDirectory ? "true" : "false" ) << endl;
		cout << indent << "isReference       : " << (pItem->isReference ? "true" : "false" ) << endl;
		cout << indent << "sourceFilePath    : [" << pItem->sourceFilePath << "]" << endl;
		cout << indent << "longSourceFilePath: [" << ((NULL == pItem->longSourceFilePath) ? "" : pItem->longSourceFilePath) << "]" << endl;
		cout << indent << "nextItem          : " << (long)pItem->nextItem << endl;
		cout << indent << "userData          : " << (long)pItem->userData << endl;
		cout << indent << "dataStartSec      : " << pItem->dataStartSec << endl;
		cout << indent << "dataLength        : " << (long)pItem->dataLength << endl;
		cout << indent << "itemSize          : " << pItem->itemSize << endl;
		cout << indent << "importInfo        : " << (long)pItem->importinfo << endl;

		// If it is a directory, show next level
		if (pItem->isDirectory)
		{
			DebugPrintIsoTree (pItem->subDirFirstItem, iLevel + 1);
		}

		pItem = pItem->nextItem;
	}
}

As far as I can see (and trace) there is no substantial difference between the program given above and NeroCmd. Strangely enough, NeroCmd does work, so there must be something wrong. I’ve singlestepped through NeroCmd using an input resembling the input to my program, but there are no routines called that are not called in my program.
I do call

  • NeroAPIGlueConnect
  • NeroInit
  • NeroGetAvailableDrivesEx
  • NeroOpenDevice
  • NeroEraseCDRW (or NeroEraseDisc when testing with V6.x.x.x)
    before calling the CVA::Burn routine. None of these routines return with an error condition.

The output (see call of DebugPrintIsoTree in GetIsoTrack and call of NeroGetErrorLog after NeroBurn) shows

  • when using Nero V6.x.x.x (serial number manually deleted)

fileName          : [File1]
longFileName      : []
isDirectory       : false
isReference       : false
sourceFilePath    : [C:	emp\File1]
longSourceFilePath: []
nextItem          : 0
userData          : 0
dataStartSec      : 0
dataLength        : 0
itemSize          : 592
importInfo        : 0
Nero error: <
####-####-####-####-####-####

Windows 2000 5.0
IA32
WinAspi: -
ahead WinASPI: File 'C:\Programme\Ahead\Nero\Wnaspi32.dll': Ver=2.0.1.59, size=160016 bytes, created 16.12.2003 19:18:06 
Nero API version: 6.3.1.6
Using interface version: 6.3.0.0
Installed in: C:\Programme\Ahead\Nero\
Application: ahead\Nero - Burning Rom
Recorder:             <TOSHIBA DVD-ROM SD-R1312>Version: 1011 - HA 1 TA 0 - 6.3.1.6
 Adapter driver:      <atapi>                   HA 1
 Drive buffer  :      2048kB
 Bus Type      :      default (0) -> ATAPI, detected: ATAPI 

=== Scsi-Device-Map ===
CdRomPeripheral      : TOSHIBA DVD-ROM SD-R1312         atapi Port 1 ID 0  DMA: On 
DiskPeripheral       : IBM     DPSS-336950N    S96H    sym_u3 Port 2 ID 0  DMA: Off
DiskPeripheral       : SEAGATE ST373405LW      0002    sym_u3 Port 2 ID 1  DMA: Off

=== CDRom-Device-Map ===
TOSHIBA DVD-ROM SD-R1312   E:   CDRom0
=======================

AutoRun : 1
Excluded drive IDs: 
CmdQueuing     : 1
CmdNotification: 2
WriteBufferSize: 83886080 (0) Byte
ShowDrvBufStat : 0
EraseSpeed     : 0
BUFE           : 0
Physical memory     : 767MB (785948kB)
Free physical memory: 281MB (288572kB)
Memory in use       : 63 %
Uncached PFiles: 0x0
Use Static Write Speed Table: 0
Use Inquiry    : 1
Global Bus Type: default (0)
Check supported media : Disabled (0) 

26.3.2004
NeroAPI
13:28:43	#1 NEROAPI 2 File NeroAPI.cpp, Line 4862
	Initialization failed

Existing drivers:
File 'Drivers\PXHELP20.SYS': Ver=2.02.25a, size=15680 bytes, created 30.07.2001 02:02:00 (Prassi/Veritas driver for win 2K)

Registry Keys:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\AllocateCDROMs : 0 (Security Option) 
>

  • when using Nero V5.5.10.42

fileName          : [File1]
longFileName      : []
isDirectory       : false
isReference       : false
sourceFilePath    : [C:	emp\File1]
longSourceFilePath: []
nextItem          : 0
userData          : 0
dataStartSec      : 0
dataLength        : 0
itemSize          : 592
importInfo        : 0
Nero error: <
####-####-####-####-####-####

Windows 2000 5.0
IA32
WinAspi: -
ahead WinASPI: File 'C:\Programme\Ahead\Nero\Wnaspi32.dll': Ver=2.0.1.59, size=160016 bytes, created 29.01.2003 22:37:36 
Nero API version: 5.5.10.42
Using interface version: 6.3.0.0
Installed in: C:\Programme\Ahead\Nero\
Application: ahead\Nero - Burning Rom
Recorder:             <TOSHIBA DVD-ROM SD-R1312>Version: 1011 - HA 1 TA 0 - 5.5.10.42
 Adapter driver:      <atapi>                   HA 1
 Drive buffer  :      2048kB
 Bus Type      :      default (0) -> ATAPI, detected: ATAPI 

=== Scsi-Device-Map ===
CdRomPeripheral      : TOSHIBA DVD-ROM SD-R1312         atapi Port 1 ID 0  DMA: On 
DiskPeripheral       : IBM     DPSS-336950N    S96H    sym_u3 Port 2 ID 0  DMA:  ? 
DiskPeripheral       : SEAGATE ST373405LW      0002    sym_u3 Port 2 ID 1  DMA:  ? 
=======================

AutoRun : 1
Excluded drive IDs: 
CmdQueuing     : 1
CmdNotification: 2
WriteBufferSize: 83886080 (0) Byte
ShowDrvBufStat : 0
EraseSpeed     : 0
BUFE           : 0
Physical memory     : 767MB (785948kB)
Free physical memory: 285MB (292120kB)
Memory in use       : 62 %
Uncached PFiles: 0x0
Use Static Write Speed Table: 0
Use Inquiry    : 1
Global Bus Type: default (0)
Check supported media : Enabled (1) 

26.3.2004
NeroAPI
15:23:49	#1 Text 0 File Reader.cpp, Line 115
	Reader running
	
15:23:49	#2 Text 0 File Writer.cpp, Line 125
	Writer TOSHIBA  DVD-ROM SD-R1312 running
	
15:23:49	#3 ISO9660GEN -11 File geniso.cpp, Line 4571
	First writeable address = 0 (0x00000000)
	
15:23:49	#4 Text 0 File Burncd.cpp, Line 3745
	Turn on Disc-At-Once, using CD-R/RW media
	
15:23:49	#5 Text 0 File ThreadedTransferInterface.cpp, Line 672
	Setup items (original item values)
	 0: TRM_DATA_MODE2_2336 (CTransferItem)
	    2 indices, index0 (150) not provided
	    original CD pos #0 + 600 (600) = #600/0:8.0
	    relocatable, CD pos for caching/writing not required/required, no patch infos 
	--------------------------------------------------------------
	
15:23:51	#6 Text 0 File DlgWaitCD.cpp, Line 225
	Last possible write address on media:   337349 (74:59.74)
	Last address to be written:                599 ( 0:09.74)
	
15:23:51	#7 Text 0 File DlgWaitCD.cpp, Line 230
	Write in overburning mode: FALSE
	
15:23:51	#8 Text 0 File DlgWaitCD.cpp, Line 1700
	Recorder: TOSHIBA DVD-ROM SD-R1312;
	   CDRW code: 00 97 26 65; OSJ entry from: CMC Magnetics Corporation
	   ATIP Data:
	     Special    Info [hex] 1: B3 00 CE, 2: 61 1A 41 (LI 97:26.65), 3: 4B 00 00 (LO 75:00.00)
	     Additional Info [hex] 1: 24 1A D8, 2: 26 B2 4A, 3: 00 00 00 (invalid)
	
15:23:51	#9 Text 0 File ThreadedTransferInterface.cpp, Line 824
	Prepare recorder TOSHIBA  DVD-ROM SD-R1312 for write in cue-sheet-DAO
	DAO infos:
	==========
	MCN: 
	TOCTYPE: 0x20   Session Closed, CD fixated
	Tracks 1 to 1:
	   TRM_DATA_MODE2_2336, 2336/0x0, ISRC "", FilePos 0 350400 1752000
	
15:23:51	#10 Text 0 File ThreadedTransferInterface.cpp, Line 672
	Setup items (after recorder preparation)
	 0: TRM_DATA_MODE2_2336 (CTransferItem)
	    2 indices, index0 (150) not provided
	    original CD pos #0 + 600 (600) = #600/0:8.0
	    relocatable, CD pos for caching/writing not required/required, no patch infos 
	    -> TRM_DATA_MODE2_2336, 2336, config 0, wanted index0 0 blocks, length 600 blocks [TOSHIBA  DVD-ROM SD-R1312]
	--------------------------------------------------------------
	
15:23:51	#11 Text 0 File ThreadedTransferInterface.cpp, Line 1978
	Verifying CD position of item 0 (relocatable, CD pos, no patch infos, orig at #0): write at #0
	
15:23:51	#12 Text 0 File Mmc.cpp, Line 13932
	StartDAO : CD-Text - Off
	
15:23:51	#13 Text 0 File Mmc.cpp, Line 18419
	Set BUFE: supported -> ON 
	
15:23:51	#14 Text 0 File Mmc.cpp, Line 14192
	CueData, Len=32
	41 00 00 24 00 00 00 00 
	41 01 00 20 00 00 00 00 
	41 01 01 20 00 00 02 00 
	41 aa 01 24 00 00 0a 00 
	
15:24:32	#15 Text 0 File WriterStatus.cpp, Line 115
	<TOSHIBA  DVD-ROM SD-R1312> start writing Lead-Out at LBA 600 (258h), lenght 0 blocks
	
15:25:14	#16 Text 0 File ThreadedTransfer.cpp, Line 222
	all writers idle, stopping conversion
	
15:25:15	#17 Text 0 File Scsicmd.cpp, Line 406
	SCSI not using temporary buffers
	20 out of 20 temporary buffers allocated
	

Existing drivers:
File 'Drivers\PXHELP20.SYS': Ver=2.02.25a, size=15680 bytes, created 30.07.2001 02:02:00 (Prassi/Veritas driver for win 2K)

Registry Keys:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\AllocateCDROMs : 0 (Security Option) 
>

Perhaps you (or someone else) has an idea as to what might be fishy here.

Regards
Thorsten


#19

I’ve the same error. A question to the makers of the toolkit: What is the meaning of the log line:

29.3.2004

NeroAPI

14:24:04 #1 NEROAPI 2 File NeroAPI.cpp, Line 4875

Initialization failed

???

I use the following code:

if (!m_NeroDeviceHandle)
	return 1;		// / no dvd drive

NERO_ISO_ITEM *pItem = NeroCreateIsoItem();
strcpy(pItem-&gt;fileName,"Test.exe");
strcpy(pItem-&gt;sourceFilePath,"E:\	emp\	est.exe"); 

CNeroIsoTrack *pIsoTrack = NeroCreateIsoTrackEx (pItem,"TEST",	NCITEF_USE_JOLIET|NCITEF_CREATE_ISO_FS);

ASSERT (pIsoTrack!=NULL);

// finally, burn the CD
NERO_WRITE_CD writeCD;
ZeroMemory(&writeCD, sizeof(writeCD));

writeCD.nwcdIsoTrack = pIsoTrack;
writeCD.nwcdNumTracks = 0;	// number of audio (!) tracks
writeCD.nwcdMediaType=MEDIA_CD; // type


NEROAPI_BURN_ERROR err=NeroBurn(m_NeroDeviceHandle,NERO_ISO_AUDIO_MEDIA,&writeCD,
		NBF_WRITE,				// write CD
		0,						// use maximum speed
		NULL);					// no progress (currently)

// ...	

//here I've got the error "Initialization failed" !!!

Do you have any idea??


#20

I’ve finally found your (and my) mistake:

THE LAST PARAMETER OF BURN() IS NOT ALLOWED TO BE EMPTY!!!

You have to pass a NERO_PROGRESS structure there. Of course, you can set most of the callback functions to NULL in that structure.

Please reply if your problem is solved now.