GetCDInfo() raises an unhandled exception


I’ve got a problem with the GetCDInfo() routine. From time to time, it does not seem to recognize an inserted disk and raises an (unhandled) exception. Opening and closing the tray and trying again or just erasing the (already empty disk) seems to solve the problem, however.

This does not happen everytime I call GetCDInfo(), but only 1 out of 20 times or so (it’s hard to measure this). I have not yet found any common prerequisites that need to be fulfilled for this problem to occur. If it does occur, however, neither the operating system, Win2000 Professional SP4, (shows the error messages “Please insert a disk in drive…” or “Disk in drive … is not formatted”) nor NeroInfoTool (shows “no disk inserted”) detect the disk. This problem occurs with several different disks, so I think it is not related to a particular disk itself.

Here’s the call stack output after the exception has been raised:

  KERNEL32! 77e7e592()
  NEROAPI! 00baff67()
  NEROAPI! 00a6c382()
  VATEST! NeroGetCDInfo + 38 bytes
  CMedium::GetMediumInfo(CSourceDriveInfo * 0x01eb7b50) line 159 + 11 bytes
  CVideoArchivierung::Burn(std::basic_string<char,std::char_traits<char>,std::allocator<char> > {0x00322b29 "Dummy"}, std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > {...}, const unsigned char 1, const unsigned char 1) line 1420
  CVideoArchivierung::Burn(std::basic_string<char,std::char_traits<char>,std::allocator<char> > {0x00322b29 "Dummy"}, std::basic_string<char,std::char_traits<char>,std::allocator<char> > {0x00322ac1 "*.txt"}, const unsigned char 1, const unsigned char 1) line 1314 + 101 bytes
  main(int 10, char * * 0x003228d8) line 207 + 114 bytes
  mainCRTStartup() line 338 + 17 bytes
  KERNEL32! 77e81af6()

CMedium() is a class of mine which just holds any media related data. The method GetMediumInfo() looks like this (m_psCDInfo is a member variable of type NERO_CD_INFO* and m_bValidMedium is of type bool):

  void CMedium::GetMediumInfo(NERO_DEVICEHANDLE device)
    // Zuerst den evtl. bereits allokierten Speicher wieder zurückgeben.
    if (NULL != m_psCDInfo)
      m_psCDInfo = NULL;

    m_psCDInfo = NeroGetCDInfo(device, 0);
    m_bValidMedium = (NULL != m_psCDInfo) && (0 != m_psCDInfo);
    if (m_bValidMedium)
      TRACE_INFO("Medium type ", m_psCDInfo->ncdiMediaType)

Nero has been initialized properly and, as said above, all this works fine most of the time.

I’m using NeroAPI with SDK V1.05. The WinASPI is Version (size=160016 bytes, created 16.12.2003 20:18:06), the installed burner is a
<TOSHIBA DVD-ROM SD-R1312>Version: 1011 - HA 1 TA 0 -

I’d appreciate any help you could provide me with.