⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 data.c

📁 Dos6.0
💻 C
📖 第 1 页 / 共 4 页
字号:

	itoa( MajorVer, szVer + 1, 10 );				/* Make version string [0.00] */
	szVer[2] = '.';
	szVer[3] = '0';
	itoa( MinorVer, szVer + (MinorVer > 9 ? 3 : 4), 10 );
	szVer[5] = ']';
	szVer[6] = EOL;

	if ( (Oem = GetOemRecord( szSearch, 0, 0 )) != NULL )
	{
		ReadOemData( Oem->uDataOffset );
		Data[ OEM_TABLE ] = GetClassData( szVer );
	}
	else
		Data[ OEM_TABLE ] = NULL;

	return( Data[ OEM_TABLE ] );
}

/***************************************************************************/
/* Frees the memory allocated to OEM_TABLE array. This can be called as 	*/
/* soon as the OEM has been identified since the search list is only used	*/
/* the initial time the OEM is determined.											*/
/* 																								*/
/* void FreeSearchData( void )															*/
/* 																								*/
/* ARGUMENTS:	NONE																			*/
/* RETURNS: 	void																			*/
/* 																								*/
/***************************************************************************/

void FreeSearchData( void )
{
	if ( Data[ OEM_TABLE ] != NULL )
	{
		FreeMemory( Data[ OEM_TABLE ] );
		Data[ OEM_TABLE ] = NULL;
	}
}

/***************************************************************************/
/* Builds a list of ptrs to all of the OEM vender names for the specifed	*/
/* DOS version. The total number of names in the list is returned and the	*/
/* a NULL ptr will be added to mark the end of the list. 						*/
/* 																								*/
/* int BuildOemList( char *apszList, int MajorVer, int MinorVer )				*/
/* 																								*/
/* ARGUMENTS:	apszList		-	Arary to hold ptrs to oem names					*/
/* 				MajorVer 	-	DOS major version number							*/
/* 				MinorVer 	-	DSO minor version number							*/
/* RETURNS: 	int			-	Total names added to the list 					*/
/* 																								*/
/***************************************************************************/

int BuildOemList( char **apszList, int MajorVer, int MinorVer )
{
	register 	i;
	register 	iCount;

	for ( i = iCount = 0; i < (int)MaxOem; i++ )
		if ( (int)OemList[ i ].MajorVer == MajorVer &&
			  (int)OemList[ i ].MinorVer == MinorVer )
			apszList[ iCount++ ] = OemList[ i ].szOemName;

	apszList[ iCount ] = NULL;

	return( iCount	);
}

/***************************************************************************/
/* Returns a ptr to the string indexed by the argument StrNum in the list	*/
/*	of search strings for the search file specified by FileNum. 				*/
/* 																								*/
/* char	*GetOemStr( int FileNum, int StrNum )										*/
/* 																								*/
/* ARGUMENTS:	FileNum	- Search file sequence number 							*/
/* 				StrNum	- Search string sequence # for specified search 	*/
/* 							  file.															*/
/* RETURNS: 	char *	- Ptr to search string or NULL if invalid file or	*/
/* 							  string sequence number									*/
/* 																								*/
/***************************************************************************/

char *GetSearchStr( int FileNum, int StrNum )
{
	register 	i;
	register 	iStrCount;
	int			iFileCount;
	char			*szString;

	for ( i = iFileCount = 0; iFileCount < FileNum; i++ )
	{
		if ( (szString = GetDataString( OEM_TABLE, i )) == NULL )
			break;
		else
			if ( szString[0] == '&' )
				iFileCount++;
	}

	for ( iStrCount = 0;
			iStrCount <= StrNum && szString != NULL;
			iStrCount++, i++ )
	{
		if ( (szString = GetDataString( OEM_TABLE, i )) != NULL )
			if ( szString[0] == '&' )
				szString = NULL;
	}

	return( szString );
}

/***************************************************************************/
/* Returns the distribution version number for the specified device driver	*/
/* which is in the data file.																*/
/*																									*/
/* NOTE:																							*/
/* 	See the file "retail\global.h" for the number assigned to each			*/
/*		of the distributed device drivers.												*/
/*																									*/
/*	unsigned GetDriverVersion( int iDriverNum )										*/
/*																									*/
/*	ARGUMENTS:	iDriverNum - Driver number to get the version for				*/
/*	RETURNS:		unsigned	  - The specified driver's internal revision #		*/
/*																									*/
/***************************************************************************/

unsigned GetDriverVersion( int iDriverNum )
{
	char		*szVersion;

	szVersion = GetDataString( DRIVER_VERSION, (iDriverNum * 2) + 1);

	if ( szVersion != NULL )
		return( (unsigned)atoi( szVersion ) );
	else
		return( 0 );
}

/***************************************************************************/
/* Checks a filename to see if it's a file the gets copied from the			*/
/* distribution disks.																		*/
/*																									*/
/*	int IsDistrFile( char *szFile )														*/
/*																									*/
/*	ARGUMENTS:	szFile	- Ptr to file name to check for							*/
/*	RETURNS:		int		- TRUE if file is to be copied else FALSE				*/
/*																									*/
/***************************************************************************/

int IsDistrFile( char *szFile )
{
	unsigned register		iDisk;
	register		iFile;
	char			*szTmp;

	for ( iDisk = FIRST_USER_DISK; iDisk < vInfo.uchNumDisks; iDisk++ )
	{
		for ( iFile = 0;
				(szTmp = GetFileName( iDisk, iFile )) != NULL;
				iFile++ )
		{
			if ( (szTmp = GetRealDestName( szTmp )) != NULL &&
				  strcmpi( szFile, szTmp ) == OK )
				return( TRUE );
		}
	}
	return( FALSE );
}

/***************************************************************************/
/* Enumerates the distribution files.													*/
/*																									*/
/* char * EnumDistrFiles( unsigned fCont )											*/
/*																									*/
/* ARGUMENTS:	fCont 	- 0 if start new enumeration, !0 if continue 		*/
/* RETURNS: 	char *	- ptr to first/next distribution file name			*/
/* 							  NULL if no more names 									*/
/*																									*/
/***************************************************************************/

char * EnumDistrFiles(unsigned fCont)
{
	static unsigned iDisk;
	static int		 iFile;
	char	 *szTmp;

	if (fCont == 0) { 									/* initialize counters if	*/
		iDisk = FIRST_USER_DISK;						/*   starting a new enum	*/
		iFile = 0;
	}

	while (iDisk < vInfo.uchNumDisks)
	{
		if ((szTmp = GetFileName(iDisk, iFile++)) != NULL)
		{
			if ((szTmp = GetRealDestName(szTmp)) != NULL)
				return(szTmp);

		} else {

			iFile = 0;										/* switch to next disk */
			iDisk++;
		}
	}

	return(NULL);
}

/***************************************************************************/

#endif

/***************************************************************************/
/* Scans the DIF_FILE class in the data list	to see if the specified file	*/
/*	name is in the	list. If the file name is found the new file name			*/
/*	associated with the specified	file name is returned. If the file name	*/
/*	is not found in the list the original default file name is returned.		*/
/* 																								*/
/* char *GetRealSrcName( char *szFile )												*/
/* 																								*/
/* ARGUMENTS:	szFile	-	Ptr to file name string 								*/
/* RETURNS: 	char *	-	Ptr to new path or if not in list arg string		*/
/* 																								*/
/*	Video Types:																				*/
/*			0 = MONO																				*/
/*			1 = CGA																				*/
/*			2 = EGA																				*/
/*			3 = VGA																				*/
/*			4 = HERCULES																		*/
/***************************************************************************/

char *GetRealSrcName( char *szFile )
{
	char		*szString;
	char		**apszFiles;
	static char	szSourceGrpName[13] = { '\0' };
#ifndef RECOVERY_PROGRAM
	char		szPath[MAX_PATH];    /* Used in checking for existing */
                                     /*   windows utilities.          */
#endif

#ifndef OEM_PROGRAM
	extern char *gszWNToolsGrp;
#endif

	szString = NULL;

	if ( strcmpi( szFile, "DOSSHELL.VID" ) == OK )		/* Video driver chk		*/
	{
		if ( vInfo.Hw.VideoType == 0 )		/* Don't need a driver if mono	*/
			return( NULL );

		if ( (apszFiles = GetClassList( VIDEO_DRIVER )) != NULL )
			szString = apszFiles[ vInfo.Hw.VideoType ];
	}

	else 	if ( strcmpi( szFile, "DOSSHELL.INI" ) == OK )	/* .INI file chk	*/
	{
		if ( (apszFiles = GetClassList( VIDEO_LIST )) != NULL )
			szString = apszFiles[ vInfo.Hw.VideoType ];
	}		

	else 	if ( strcmpi( szFile, "DOSSHELL.GRB" ) == OK )	/* .GRB file chk	*/
	{
		if ( (apszFiles = GetClassList( GRABBER_DRIVER )) != NULL )
			szString = apszFiles[ vInfo.Hw.VideoType ];
	}		
#ifndef OEM_PROGRAM
	else 	if ( strcmpi( szFile, gszWNToolsGrp ) == OK )	/* .GRP file chk	*/
	{
        /* If there is no source .GRP filename, create one */
        if (szSourceGrpName[0] == '\0')
          {
            /* Create the name of the source group file:     */
            /*   BK = Backup, UD = Undelete, AV = Anti-Virus */

            /* Is there, or will there be a Windows Backup utiltity */

#ifdef RECOVERY_PROGRAM
            if (vInfo.OptComp.BackupChoice    == WINDOWS_AND_DOS_COMPONENT ||
                vInfo.OptComp.BackupChoice    == WINDOWS_COMPONENT)
#else
            if (Install.Flags.fMaintenance)
              {
                strcpy (szPath, vInfo.szPath);
                mycatpath (szPath, "MWBACKUP.EXE");
              }

            if (vInfo.OptComp.BackupChoice    == WINDOWS_AND_DOS_COMPONENT ||
                vInfo.OptComp.BackupChoice    == WINDOWS_COMPONENT         ||
                (Install.Flags.fMaintenance && access (szPath, 0) != -1))
#endif
              strcat (szSourceGrpName, "bk");


            /* Is there, or will there be a Windows Undelete utility */

#ifdef RECOVERY_PROGRAM
            if (vInfo.OptComp.UndeleteChoice  == WINDOWS_AND_DOS_COMPONENT ||
                vInfo.OptComp.UndeleteChoice  == WINDOWS_COMPONENT)
#else
            if (Install.Flags.fMaintenance)
              {
                strcpy (szPath, vInfo.szPath);
                mycatpath (szPath, "WNUNDEL.EXE");
              }

            if (vInfo.OptComp.UndeleteChoice  == WINDOWS_AND_DOS_COMPONENT ||
                vInfo.OptComp.UndeleteChoice  == WINDOWS_COMPONENT         ||
                (Install.Flags.fMaintenance && access (szPath, 0) != -1))
#endif
              strcat (szSourceGrpName, "ud");


            /* Is there, or will there be a Windows Anti-Virus utility */

#ifdef RECOVERY_PROGRAM
            if (vInfo.OptComp.AntiVirusChoice == WINDOWS_AND_DOS_COMPONENT ||
                vInfo.OptComp.AntiVirusChoice == WINDOWS_COMPONENT)
#else
            if (Install.Flags.fMaintenance)
              {
                strcpy (szPath, vInfo.szPath);
                mycatpath (szPath, "MWAV.EXE");
              }

            if (vInfo.OptComp.AntiVirusChoice == WINDOWS_AND_DOS_COMPONENT ||
                vInfo.OptComp.AntiVirusChoice == WINDOWS_COMPONENT         ||
                (Install.Flags.fMaintenance && access (szPath, 0) != -1))
#endif
              strcat (szSourceGrpName, "av");

            strcat (szSourceGrpName, ".grp");
          }

        szString = szSourceGrpName;
	}
#endif
	else if ( (szString = TranslateString( DIF_FILE, szFile )) == NULL )
		szString = szFile;

	return( szString  );
}


/***************************************************************************/
/*   void ReplaceParam()                                                   */
/*                                                                         */
/*   Useful for replaceable parameters in setup screens.  It allows the    */
/*   parameter to be on any line in the screen.                            */
/*   In its current incarnation, you have to call it once for each         */
/*   replaceable param.                                                    */
/*                                                                         */
/*   ARGUMENTS:   apszScreen  - array of strings (from GetMessage).        */
/*                pszOld      - pattern to look for.                       */
/*                pszNew      - pattern to replace it with.                */
/*                pszBuf      - buffer to return modified line in. Buffer  */
/*                              will be inserted in apszScreen[] array     */
/*                fKeepLength - TRUE if line length must remain the same   */
/*   RETURNS:     NOTHING.                                                 */
/***************************************************************************/
void ReplaceParam (char **apszScreen, char *pszOld, char *pszNew,
                   char *pszBuf, int fKeepLength)
{
   char     *psz;
   unsigned  i, cbOld;
   int       delta;

   while (*apszScreen != NULL)
   {
      if ((psz = strstr(*apszScreen, pszOld)) != NULL)
      {
         cbOld = strlen(pszOld);
         i = psz-*apszScreen;

         strncpy (pszBuf, *apszScreen, i);
         strcpy (pszBuf+i, pszNew);
         strcat (pszBuf, psz+cbOld);

         if (fKeepLength)
         {
            delta = (int)((int)strlen(pszNew) - (int)cbOld);
            i     = strlen(pszBuf);

            if (delta > 0)
               pszBuf[ i-(unsigned)delta ] = 0;
            else if (delta < 0)
            {
               psz = i+pszBuf;
               for (i=0, delta=-(delta); i<(unsigned)delta; i++)
                  *(psz+i) = ' ';
               *(psz+i) = 0;
            }
         }

         *apszScreen = pszBuf;
      }
      apszScreen++;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -