Problem with CD access after I use NeroAPI

vbimport

#1

Hello,

I have some strange problems with CD access after I use the NeroAPI. After I use and close NeroAPI in the correct way, i can not access the CD drive with any application while my BurnApplication (which use NeroAPI) runs.

I simplify my application to a simple cd recorder counter:


#include "NeroApiGlue.h"

int NeroTest()
{
	if (!NeroAPIGlueConnect (NULL)) 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 = NULL;
	NeroSettings.nstUserDialog.ncUserData = NULL;
	NeroSettings.nstLanguageFile =pcLanguageFile;
	NeroSettings.nstIdle.ncCallbackFunction = NULL;
	NeroSettings.nstIdle.ncUserData = NULL;
	
	NEROAPI_INIT_ERROR initErr = NeroInit (&NeroSettings, NULL);
	if (initErr!=NEROAPI_INIT_OK) 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(NeroGetErrorLog());
   NERO_DRIVE_ERROR DriveError;
   NeroGetLastDriveError(&DriveError,NULL);
   printf("drive errror: %i
",DriveError);
   
   NeroClearErrors();
   if(NeroDone()) printf("memory leaks detected by NeroDone()
");
   NeroAPIGlueDone();

   return DriveCount;
}

int main(int argc, char* argv[])
{
   printf("Hello World!
");
   int RetVal=NeroTest();
   printf("NeroTest() returncode = %i
",RetVal);
   printf("Press ENTER to exit...
");
   getchar();
   return 0;
}

The problem exist when I start the application without a CD in the drives. At “Press ENTER to exit” (NeroAPI ist closed but my application still running) I insert a CD with some data. With Windows Explorer (or any other application) i can’t access the drive.

I have a Samsung SM-348B and a Plextor PX-W4824A. The problem exist only on my Samsung but not on my Plextor. Intressting point is that before I build in the Plextor drive my Samsung has no such problems (as far as I can remember).

The question is WHY can I not access the CD? Where is my code wrong? What can I do to solve my problem?
I notice similar problems witch CD access after NeroBurn() but that is may be the same problem.
(BTW: NeroDone() says that the application has memory leaks, but i can’t find the reason in my short application. Maybe someone can help my?)

Thanks for any help,

Michael

GetErrorLog() reports: (for your information)


Windows 2000 5.0
IA32
WinAspi: -
ahead WinASPI: File 'D:\Programme\ahead\Nero\Wnaspi32.dll': Ver=2.0.1.59, size=1
60016 bytes, created 16.12.2003 19:18:06
Nero API version: 6.3.1.17
Using interface version: 6.3.1.4
Installed in: D:\Programme\ahead\Nero\
Application: ahead\Nero - Burning Rom

=== Scsi-Device-Map ===
DiskPeripheral       : WDC WD400BB-75DEA0               atapi Port 0 ID 0  DMA:On
CdRomPeripheral      : SAMSUNG CDRW/DVD SM-348B         atapi Port 1 ID 0  DMA:On
CdRomPeripheral      : PLEXTOR CD-R   PX-W4824A         atapi Port 1 ID 1  DMA:Off

=== CDRom-Device-Map ===
SAMSUNG CDRW/DVD SM-348B   E:   CDRom0
PLEXTOR CD-R   PX-W4824A   F:   CDRom1
=======================

AutoRun : 0
Excluded drive IDs:
WriteBufferSize: 83886080 (0) Byte
ShowDrvBufStat : 0
BUFE           : 0
Physical memory     : 1021MB (1046520kB)
Free physical memory: 573MB (587596kB)
Memory in use       : 43
Uncached PFiles: 0x0
Use Static Write Speed Table: 0
Use Inquiry    : 1
Global Bus Type: default (0)
Check supported media : Enabled (1)

21.2.2005
NeroAPI

Existing drivers:
File 'Drivers\NeroCD2k.sys': Ver=2.0.0.3, size=15584 bytes, created 14.01.2002 20:07:50
File 'Drivers\ADPU160M.SYS': Ver=v3.10a, size=64432 bytes, created 19.06.2003 11:05:04
File 'Drivers\CDR4_2K.SYS': Ver=5.3.2.31, size=58000 bytes, created 26.04.2004 12:52:12
File 'Drivers\CDRALW2K.SYS': Ver=5.3.2.31, size=23420 bytes, created 26.04.2004 12:52:12
File 'WNASPINT.DLL': Ver=V1.20, size=57344 bytes, created 04.02.2003 07:24:08

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


#2

I am not sure why you have the problem you described. Since you say you did not notice the problem before adding the second drive, you could try rearranging your drives in terms of master/slave IDE positions (if IDE) and see if that helps.

As far as the code is concerned, you do have memory leaks. Please note the line

printf(NeroGetErrorLog());

NeroAPI gives you a pointer to a string which you should free using NeroFreeMem(). Also, using this kind of syntax is dangerous. You should always use

printf ("%s
", NeroGetErrorLog());

#3

Thanks you for your answer.

I maked some test with the IDE configuration. As far as I see exist the problem mainly at the device which is configured as “master” at IDE bus and a other device is present. I can switch my cd burner and always the “master” device had the problems. But if I use one of them alone (which is then of course also “master”) then there are no problems.

With a other computer, which has only one cd writer, I have the same problems, but there is a 9-in-1 memory card reader installed. This device is also reported as several devices in the “Scsi-Device-Map” by NeroGetErrorLog().


...
=== Scsi-Device-Map ===
DiskPeripheral       : IC35L060AVV207-0                 atapi Port 0 ID 0  DMA: On 
CdRomPeripheral      : PLEXTOR CD-R   PX-W4824A         atapi Port 1 ID 0  DMA: On 
DiskPeripheral       : eUSB    Compact Flash         EUSBMASS Port 2 ID 0  DMA: Off
DiskPeripheral       : eUSB    SmartMedia            EUSBMASS Port 2 ID 0  DMA: Off
DiskPeripheral       : eUSB    Secure Digital        EUSBMASS Port 3 ID 0  DMA: Off
DiskPeripheral       : eUSB    Memory Stick          EUSBMASS Port 3 ID 0  DMA: Off
DiskPeripheral       : eUSB    PCCARD Flash          EUSBMASS Port 4 ID 0  DMA: Off

=== CDRom-Device-Map ===
PLEXTOR CD-R   PX-W4824A   E:   CDRom0
=======================
...

May be I make a mistake in my code, but I can’t find a error. May be also Nero has a problem with this IDE configurations (which i can only hardly believe). Has somebody similar experiences?

The other problem with the memory leak is really the forgotten release of NeroErrorLog. After fix this error, there were no memory leaks left. :slight_smile:
But this was only my secondary problem. My primery problem still exist :sad:

May be somebody has some suggestions to solve my problem.

Thanks,

Michael


#4

Did you tried to switch DMA mode for Secondary IDE Channel ID 1 ON?


#5

Hi,

I switch DMA for the plextor drive on, but I notice no change. The errorlog only differ in the “DMA:On” instead “DMA:Off” (see below). But the “slave” drive works fine. Only the “master” drive has the problem, if a slave drive is present.

NeroInfoTool recognise the inserted disk (which is not readable by other applications like windows explorer), but I think it use other functions as the explorer. I can provide the full InfoTool.txt (or part of it) , if someone need it to help me (I don’t post the full Infotool.txt without request because is it not short). I can also provide other information about my system, but it is not only a problem on a single pc, it occur on different systems. There are two type of systems were the problem exist every time.

System 1: PC with 2 cd writer on one ide bus (which provide the errorlogs in this thread)
Problem: “Master” drive has the problem, “slave” not (but if no slave is present, master has no problems)

System 2: PC with 1 cd writer but with a multi photocard reader (in our system SCM PCD-62U is used) (which is also listed in the “scsi-device-map” section of errorlog)
Problem: Problem exist with the cardreader is attached (but without the card reader there is no problem)

Thanks for any help,

Michael

new errorlog:


Windows 2000 5.0
IA32
WinAspi: -
ahead WinASPI: File 'D:\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.17
Using interface version: 6.3.1.4
Installed in: D:\Programme\ahead\Nero\
Application: ahead\Nero - Burning Rom

=== Scsi-Device-Map ===
DiskPeripheral       : WDC WD400BB-75DEA0               atapi Port 0 ID 0  DMA:On
CdRomPeripheral      : SAMSUNG CDRW/DVD SM-348B         atapi Port 1 ID 0  DMA:On
CdRomPeripheral      : PLEXTOR CD-R   PX-W4824A         atapi Port 1 ID 1  DMA:On

=== CDRom-Device-Map ===
SAMSUNG CDRW/DVD SM-348B   E:   CDRom0
PLEXTOR CD-R   PX-W4824A   F:   CDRom1
=======================

AutoRun : 0
Excluded drive IDs:
WriteBufferSize: 83886080 (0) Byte
ShowDrvBufStat : 0
BUFE           : 0
Physical memory     : 1021MB (1046520kB)
Free physical memory: 515MB (527712kB)
Memory in use       : 49 %
Uncached PFiles: 0x0
Use Static Write Speed Table: 0
Use Inquiry    : 1
Global Bus Type: default (0)
Check supported media : Enabled (1)

25.2.2005
NeroAPI

Existing drivers:
File 'Drivers\NeroCD2k.sys': Ver=2.0.0.3, size=15584 bytes, created 14.01.2002 20:07:50
File 'Drivers\ADPU160M.SYS': Ver=v3.10a, size=64432 bytes, created 19.06.2003 11:05:04
File 'Drivers\CDR4_2K.SYS': Ver=5.3.2.31, size=58000 bytes, created 26.04.2004 12:52:12
File 'Drivers\CDRALW2K.SYS': Ver=5.3.2.31, size=23420 bytes, created 26.04.2004 12:52:12
File 'WNASPINT.DLL': Ver=V1.20, size=57344 bytes, created 04.02.2003 07:24:08

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


#6

Hi,

my further investigation of this problem resulted in the following realizations:

The problem (no cd access with my or other application like explorer) seems to arise only after I close NeroAPI with NeroDone() and NeroAPIGlueDone(). Before I close NeroAPI I can read a new inserted CD. I use the NeroAPI only as long as I realy need it and close it afterwards and maybe reopen it if needed. Is this forbidden?

A simple workaround (but not a satisfying solution) would be to close NeroAPI at the end of my application (like in your example NeroFiddles). But I can’t use this workaround, because I use the NeroAPI in a other thread then the main application thread. So I would open and use NeroAPI from one thread and close it from another thread. As far as I see Nero don’t support this, because I get Access Violations on NeroDone().

What can I do to omit this violations? Which consequences would it have if I omit NeroDone() and NeroApiGlueDone()? How can I determine if NeroInit is ever called or can I call NeroDone without any NeroInit before without problems? Any other suggestions?

Of course, my main target is to get a real solution (see my other posts in the thread)

Thanks,

Michael

PS: I also test the newest Nero version 6.6.0.8 but no change