Problem with CD access if NeroSDK closed without inserted CD

vbimport

#1

Hi,

I have a problem with CD access after I close NeroSDK for several time now (see http://club.cdfreaks.com/showthread.php?t=127867). My further problem investigation brings some new facts and a new testprogram and so I create this new thread.

Test program:


#include "stdafx.h"
#include "NeroApiGlue.h"

NeroUserDlgInOut NERO_CALLBACK_ATTR UserDialog(void *pUserData, NeroUserDlgInOut type, void *data)
{
   printf ("UserDialog(type = %i) called
",type);
   switch (type) {
   case DLG_AUTO_INSERT:         return DLG_RETURN_CONTINUE;  break;
   case DLG_DISCONNECT_RESTART:  return DLG_RETURN_ON_RESTART;break;
   case DLG_DISCONNECT:          return DLG_RETURN_CONTINUE;  break;
   case DLG_AUTO_INSERT_RESTART: return DLG_RETURN_EXIT;      break;
   case DLG_RESTART:             return DLG_RETURN_EXIT;      break;
   case DLG_SETTINGS_RESTART:    return DLG_RETURN_CONTINUE;  break;
   case DLG_OVERBURN:            return DLG_RETURN_TRUE;      break;
   case DLG_AUDIO_PROBLEMS:      return DLG_RETURN_EXIT;      break;
   case DLG_FILESEL_IMAGE:
      {
         strcpy((char*)data,"test.txt");
         return DLG_RETURN_TRUE; 
         break;
      }
   case DLG_WAITCD:
      {
         NERO_WAITCD_TYPE waitcdType = (NERO_WAITCD_TYPE) (int)data;
         char *waitcdString = NeroGetLocalizedWaitCDTexts (waitcdType);
         printf("waitcd: %s
",waitcdString);
         NeroFreeMem(waitcdString);
         return DLG_RETURN_EXIT;
         break;
      }
   default: break;
   }
   return DLG_RETURN_EXIT;
}

BOOL NERO_CALLBACK_ATTR ProgressCallback(void *pUserData, DWORD dwProgressInPercent)
{
   printf("progress callback %i %", dwProgressInPercent);
   return true;
}

BOOL NERO_CALLBACK_ATTR AbortedCallback(void *pUserData)
{
   return FALSE;
}

int main(int argc, char* argv[])
{
   printf("Hello World!
");
   if (!NeroAPIGlueConnect (NULL)) {
      printf("NeroAPIGlueConnect failed!
");
      return -1;
   }
   
   char pcNeroFilesPath[128];
   char pcVendor[128];
   char pcSoftware[128];
   char pcLanguageFile[128];
   
   strcpy(pcNeroFilesPath, "NeroFiles");
   strcpy(pcVendor, "ahead");
   strcpy(pcSoftware, "Nero - Burning Rom");
   strcpy(pcLanguageFile, "Nero.txt");
   
   NERO_SETTINGS NeroSettings;
   memset(&NeroSettings, 0, sizeof(NeroSettings));
   NeroSettings.nstNeroFilesPath = pcNeroFilesPath;
   NeroSettings.nstVendor = pcVendor;
   NeroSettings.nstSoftware = pcSoftware;
   NeroSettings.nstUserDialog.ncCallbackFunction = UserDialog;
   NeroSettings.nstUserDialog.ncUserData = NULL;
   NeroSettings.nstLanguageFile =pcLanguageFile;
   NeroSettings.nstIdle.ncCallbackFunction = AbortedCallback;
   NeroSettings.nstIdle.ncUserData = NULL;
   
   NEROAPI_INIT_ERROR initErr = NeroInit (&NeroSettings, NULL);
   if (initErr!=NEROAPI_INIT_OK) {
      printf("NeroInit failed! errorcode = %i
",initErr);
      NeroAPIGlueDone();
      return -2;
   }
   
   long DriveCount = 0;
   NERO_SCSI_DEVICE_INFOS* pDeviceInfos = NeroGetAvailableDrivesEx (MEDIA_CD, NULL);
   if (pDeviceInfos != NULL) {
      if (pDeviceInfos->nsdisNumDevInfos > 0) {
         for (DWORD dDeviceCounter = 0; (dDeviceCounter < pDeviceInfos->nsdisNumDevInfos); dDeviceCounter++) {
            NERO_SCSI_DEVICE_INFO devInfo=pDeviceInfos->nsdisDevInfos[dDeviceCounter];
            if ((devInfo.nsdiDevType == NEA_SCSI_DEVTYPE_WORM)&&
               ((devInfo.nsdiCapabilities & NSDI_IMAGE_RECORDER)==0)) 
            {
               DriveCount++;
            }
         }
      }
      else DriveCount = 0;
      NeroFreeMem(pDeviceInfos);
   }
   else DriveCount = -99;
   
   printf("Nero found %i drives.
",DriveCount);
   
   char* ErrorLog = NeroGetErrorLog();
   printf("%s
",ErrorLog);
   NeroFreeMem(ErrorLog);
   NERO_DRIVE_ERROR DriveError;
   NeroGetLastDriveError(&DriveError,NULL);
   printf("drive errror: %i
",DriveError);
   
   printf("
NeroSDK still open.
Press ENTER to close...
");
   getchar();
   
   NeroClearErrors();
   if(NeroDone()) printf("memory leaks detected by NeroDone()
");
   NeroAPIGlueDone();
   
   printf("
NeroSDK closed.
Press ENTER to exit...
");
   getchar();
   return 0;
}

My test program open NeroSDK, count CD writer, show Nero errorlog and close NeroSDK. This tasks are quite simple and so I think my code is correct. I insert a user input break before and after NeroDone().

I detect now, that if during NeroDone() (between my two user input breaks) no cd is inserted, then I can’t access any cd with the windows explorer when my program stands at the second user input break (“NeroSDK closed. Press ENTER to exit…”). The status of the cd drive (cd or no cd present) during getting drive information seems to be irrelevant. You can start with a inserted CD and eject this CD at the first break (“NeroSDK still open. Press ENTER to close…”) or you start without a CD, the result is the same.
After I close my application anythings is correct with the cd access, but between the close of NeroSDK and my application end can be much time.

To make it more difficult I detected that this behavoir occurs on some cddrives (mainly plextor drives but not only) every time and on other models of other manufactors not. I also detect a cd drive model (also a plextor) which produce this problem only if the cd drive tray is open during closing NeroSDK.

As you can read in my old thread http://club.cdfreaks.com/showthread.php?t=127867 the problem can also related to the hardware configuration

Can someone try my test program to see if my problem also occurs? Can someone help me to solve my problem in any way? If somebody need more information, please ask and I provide the wanted information.

:bow: PLEASE HELP ME :bow:
It is really annoying, not to be able to access CD drive after I close NeroSDK.

Bye,

Michael

PS: I try it with Nero 6.6.0.1, 6.6.0.6 and the new 6.6.0.12. Every version produce the problem.


#2

This problem resides in the winaspi layer, which sometimes blocks windows mounting procedure, during it tries to obtain access to the drive.
Because of complexity of this problem the solution bypassing this winaspi limitation will unfortunatelly be available only in the next Nero upgrade.


#3

Having same issue, when can we expect the next Nero Upgrade?


#4

Same problem here, any information about a workaround would be great! I would also like to know when we can exspect the upgrade.
Thanks and best regards,
Ullrich


#5

Solved the problem… Treat your application as you were writing a ‘Nero’ program. Create only 1 instant of nero and do not destroy it. Pass the pointers when you need to use it and everything should be fine.