[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Cdrecord-support] cdrtools-2.01a24 ready



>From ubuedel@gmx.de  Wed Jan  7 23:39:56 2004


>I'm using NT4preSP7. Adaptec Aspi 4.60 is running. Normally I use 
	^^^^^^^^^^^^^
	Is this the string that is retuned in osver.szCSDVersion?

If yes, then there is a big chance that you either got
a wrong result from the new function w2kstyle_create() as a result
from an illegal memory access or the function w2kstyle_create()
just does not correctly know from which NT-4 version the additional
flags from NT-5.x need to be used.


Now, I need testers!

And for the NT4preSP7 case, I need a special test:

1) please insert a test printing line:

LOCAL BOOL 
w2kstyle_create(void) 
{ 
        OSVERSIONINFO osver; 
 
/*      return FALSE; */ 
        memset(&osver, 0, sizeof (osver)); 
        osver.dwOSVersionInfoSize = sizeof (osver); 
        GetVersionEx(&osver); 
        if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { 
                /* 
                 * Win2000 is NT-5.0, Win-XP  is NT-5.1 
                 */      
                if (osver.dwMajorVersion > 4) 
                        return (TRUE); 
 
                if (osver.dwMajorVersion == 4) {                /* NT-4.x */ 
                        char    *vers = osver.szCSDVersion; 
 
error("osver.szCSDVersion: '%s'\n", vers); sleep(10);
                        if (strlen(vers) == 0) 
                                return (FALSE); 

Because of the sleep(10) you should be able to see the text even if there later
is a blue screen.

2) if you still get a blue screen, add a  return (FALSE); after the 'error(...'
line.

3) If this does not help, try a  return (TRUE);



Other changes: cdrecord dev=ASPI -scanbus will work.


save the mail and run patch < saved-mail

/*--------------------------------------------------------------------------*/
Here is a patch that needs to be applied to cdrtools-2.01a24:

*** ../cdrecord/cdrtools-2.01/libscg/scsi-wnt.c	Mi Jan  7 00:20:32 2004
--- /tmp/scsi-wnt.c	So Jan 11 14:39:46 2004
***************
*** 65,72 ****
   *	Choose your name instead of "schily" and make clear that the version
   *	string is related to a modified source.
   */
! LOCAL	char	_scg_trans_version[] = "scsi-wnt.c-1.35";	/* The version for this transport*/
! LOCAL	char	_scg_itrans_version[] = "SPTI-scsi-wnt.c-1.35";	/* The version for SPTI */
  
  /*
   * Local defines and constants
--- 65,72 ----
   *	Choose your name instead of "schily" and make clear that the version
   *	string is related to a modified source.
   */
! LOCAL	char	_scg_trans_version[] = "scsi-wnt.c-1.38";	/* The version for this transport*/
! LOCAL	char	_scg_itrans_version[] = "SPTI-scsi-wnt.c-1.38";	/* The version for SPTI */
  
  /*
   * Local defines and constants
***************
*** 110,115 ****
--- 110,116 ----
  LOCAL	void	copy_sensedata	__PR((SRB_ExecSCSICmd *cp, struct scg_cmd *sp));
  LOCAL	void	set_error	__PR((SRB_ExecSCSICmd *cp, struct scg_cmd *sp));
  LOCAL	BOOL	open_driver	__PR((SCSI *scgp));
+ LOCAL	BOOL	load_aspi	__PR((SCSI *scgp));
  LOCAL	BOOL	close_driver	__PR((void));
  LOCAL	int	ha_inquiry	__PR((SCSI *scgp, int id, SRB_HAInquiry	*ip));
  #ifdef	__USED__
***************
*** 286,305 ****
  	osver.dwOSVersionInfoSize = sizeof (osver);
  	GetVersionEx(&osver);
  	if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
! 		if (osver.dwMajorVersion > 4)	/* W2k, XP + */
  			return (TRUE);
  
! 		if (osver.dwMajorVersion == 4) {
! 			if (strlen(osver.szCSDVersion)) {	/*if Servicepack installed */
! 				int i = 0;
  
! 				while (osver.szCSDVersion[i] != '\0' &&
! 					!isdigit(osver.szCSDVersion[i]))
! 					i++;
! 				if (isdigit(osver.szCSDVersion[i]) &&
! 				    (atoi(&osver.szCSDVersion[i]) >= 4 || isdigit(osver.szCSDVersion[i+1]))) /* Fom Service Pack 4 */
! 					return (TRUE);							/* same as for W2K */
! 			}
  		}
  	}
  	return (FALSE);
--- 287,315 ----
  	osver.dwOSVersionInfoSize = sizeof (osver);
  	GetVersionEx(&osver);
  	if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
! 		/*
! 		 * Win2000 is NT-5.0, Win-XP  is NT-5.1
! 		 */	
! 		if (osver.dwMajorVersion > 4)
  			return (TRUE);
  
! 		if (osver.dwMajorVersion == 4) {		/* NT-4.x */
! 			char	*vers = osver.szCSDVersion;
  
! 			if (strlen(vers) == 0)
! 				return (FALSE);
! 
! 			/*
! 			 * Servicepack is installed, skip over non-digit part
! 			 */
! 			while (*vers != '\0' && !isdigit(*vers))
! 				vers++;
! 			if (*vers == '\0')
! 				return (FALSE);
! 
! 			if (isdigit(vers) &&
! 			    (atoi(vers) >= 4 || isdigit(vers[1])))	/* Fom Service Pack 4 */
! 				return (TRUE);				/* same as for W2K */
  		}
  	}
  	return (FALSE);
***************
*** 702,714 ****
  		return (-1);
  	}
  
! 	if ((device != NULL && *device != '\0' && strcmp(device, "SPTI") != 0 && strcmp(device, "ASPI") != 0) || (busno == -2 && tgt == -2)) {
  		errno = EINVAL;
  		if (scgp->errstr)
  			js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE,
! 				"Devname '%s' unknown.", device);
  		return (-1);
  	}
  	if (AspiLoaded <= 0) {	/* do not change access method on open driver */
  		bForceAccess = FALSE;
  #ifdef PREFER_SPTI
--- 712,730 ----
  		return (-1);
  	}
  
! 	if (device != NULL &&
! 	    (strcmp(device, "SPTI") == 0 || strcmp(device, "ASPI") == 0) &&
! 	    (busno < 0 && tgt < 0 && tlun < 0))
! 		goto devok;
! 
! 	if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) {
  		errno = EINVAL;
  		if (scgp->errstr)
  			js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE,
! 				"Open by 'devname' not supported on this OS");
  		return (-1);
  	}
+ devok:
  	if (AspiLoaded <= 0) {	/* do not change access method on open driver */
  		bForceAccess = FALSE;
  #ifdef PREFER_SPTI
***************
*** 734,739 ****
--- 750,761 ----
  		 * This is the non -scanbus case.
  		 */
  		;
+ 	} else if (tgt == -2 && tgt == -2 &&
+ 		   (tgt == -2 || tlun >= 0)) {
+ 		/*
+ 		 * This is the dev=ASPI case.
+ 		 */
+ 		;
  	} else if (tgt != -1 || tgt != -1 || tlun != -1) {
  		errno = EINVAL;
  		return (-1);
***************
*** 1309,1359 ****
  		if (InitSCSIPT() > 0) AspiLoaded++;
  #endif
  #ifdef	PREFER_SPTI
! 	if ((!bUsingSCSIPT || !bForceAccess) && AspiLoaded <= 0)
  #else
! 	if (!bUsingSCSIPT || !bForceAccess)
  #endif
! #ifdef	__CYGWIN32__
! 		hAspiLib = dlopen("WNASPI32", RTLD_NOW);
! #else
! 		hAspiLib = LoadLibrary("WNASPI32");
! #endif
! 
! 	/*
! 	 * Check if ASPI library is loaded correctly
! 	 */
! 	if (hAspiLib != NULL) {
! 	/*
! 	 * Get a pointer to GetASPI32SupportInfo function
! 	 * and a pointer to SendASPI32Command function
! 	 */
! #ifdef	__CYGWIN32__
! 	pfnGetASPI32SupportInfo = (DWORD(*)(void))dlsym(hAspiLib, "GetASPI32SupportInfo");
! 	pfnSendASPI32Command = (DWORD(*)(LPSRB))dlsym(hAspiLib, "SendASPI32Command");
! #else
! 	pfnGetASPI32SupportInfo = (DWORD(*)(void))GetProcAddress(hAspiLib, "GetASPI32SupportInfo");
! 	pfnSendASPI32Command = (DWORD(*)(LPSRB))GetProcAddress(hAspiLib, "SendASPI32Command");
! #endif
! 
! 	if ((pfnGetASPI32SupportInfo == NULL) || (pfnSendASPI32Command == NULL)) {
! 		js_fprintf((FILE *)scgp->errfile,
! 				"ASPI function not found in library!");
! 		return (FALSE);
  	}
  
- #ifdef	__CYGWIN32__
- 	pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))dlsym(hAspiLib, "GetASPI32Buffer");
- 	pfnFreeASPI32Buffer = (BOOL(*)(PASPI32BUFF))dlsym(hAspiLib, "FreeASPI32Buffer");
- 	pfnTranslateASPI32Address = (BOOL(*)(PDWORD, PDWORD))dlsym(hAspiLib, "TranslateASPI32Address");
- #else
- 	pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "GetASPI32Buffer");
- 	pfnFreeASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "FreeASPI32Buffer");
- 	pfnTranslateASPI32Address = (BOOL(*)(PDWORD, PDWORD))GetProcAddress(hAspiLib, "TranslateASPI32Address");
- #endif
- 	AspiLoaded++;
- 	bUsingSCSIPT = FALSE;
- 	}
- 
  #ifndef	PREFER_SPTI
  	if ((bUsingSCSIPT || !bForceAccess) && AspiLoaded <= 0)
  		if (InitSCSIPT() > 0)
--- 1331,1346 ----
  		if (InitSCSIPT() > 0) AspiLoaded++;
  #endif
  #ifdef	PREFER_SPTI
! 	if ((!bUsingSCSIPT || !bForceAccess) && AspiLoaded <= 0) {
  #else
! 	if (!bUsingSCSIPT || !bForceAccess) {
  #endif
! 		if (load_aspi(scgp)) {
! 			AspiLoaded++;
! 			bUsingSCSIPT = FALSE;
! 		}
  	}
  
  #ifndef	PREFER_SPTI
  	if ((bUsingSCSIPT || !bForceAccess) && AspiLoaded <= 0)
  		if (InitSCSIPT() > 0)
***************
*** 1414,1420 ****
--- 1401,1460 ----
  	return (TRUE);
  }
  
+ LOCAL BOOL
+ load_aspi(scgp)
+ 	SCSI	*scgp;
+ {
+ #ifdef	__CYGWIN32__
+ 	hAspiLib = dlopen("WNASPI32", RTLD_NOW);
+ #else
+ 	hAspiLib = LoadLibrary("WNASPI32");
+ #endif
+ 	/*
+ 	 * Check if ASPI library is loaded correctly
+ 	 */
+ 	if (hAspiLib == NULL) {
+ #ifdef	not_done_later
+ 		js_fprintf((FILE *)scgp->errfile, "Can not load ASPI driver! ");
+ #endif
+ 		return (FALSE);
+ 	}
  
+ 	/*
+ 	 * Get a pointer to GetASPI32SupportInfo function
+ 	 * and a pointer to SendASPI32Command function
+ 	 */
+ #ifdef	__CYGWIN32__
+ 	pfnGetASPI32SupportInfo = (DWORD(*)(void))dlsym(hAspiLib, "GetASPI32SupportInfo");
+ 	pfnSendASPI32Command = (DWORD(*)(LPSRB))dlsym(hAspiLib, "SendASPI32Command");
+ #else
+ 	pfnGetASPI32SupportInfo = (DWORD(*)(void))GetProcAddress(hAspiLib, "GetASPI32SupportInfo");
+ 	pfnSendASPI32Command = (DWORD(*)(LPSRB))GetProcAddress(hAspiLib, "SendASPI32Command");
+ #endif
+ 
+ 	if ((pfnGetASPI32SupportInfo == NULL) || (pfnSendASPI32Command == NULL)) {
+ 		js_fprintf((FILE *)scgp->errfile,
+ 				"ASPI function not found in library! ");
+ 		return (FALSE);
+ 	}
+ 
+ 	/*
+ 	 * The following functions are currently not used by libscg.
+ 	 * If we start to use them, we need to check whether the founctions
+ 	 * could be found in the ASPI library that just has been loaded.
+ 	 */
+ #ifdef	__CYGWIN32__
+ 	pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))dlsym(hAspiLib, "GetASPI32Buffer");
+ 	pfnFreeASPI32Buffer = (BOOL(*)(PASPI32BUFF))dlsym(hAspiLib, "FreeASPI32Buffer");
+ 	pfnTranslateASPI32Address = (BOOL(*)(PDWORD, PDWORD))dlsym(hAspiLib, "TranslateASPI32Address");
+ #else
+ 	pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "GetASPI32Buffer");
+ 	pfnFreeASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "FreeASPI32Buffer");
+ 	pfnTranslateASPI32Address = (BOOL(*)(PDWORD, PDWORD))GetProcAddress(hAspiLib, "TranslateASPI32Address");
+ #endif
+ 	return (TRUE);
+ }
+ 
  /***************************************************************************
   *									   *
   *  BOOL close_driver()							   *


Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily



Reply to: