示例#1
0
extern  void    PGBlip(char *name)
/********************************/
{
    int         count;

    CheckEvents();
    if( BlipsOn ) {
        count = 0;
        for( ;; ) {
            if( *name == NULLCHAR ) break;
            if( count >= MAX_FNAME_LEN ) break;
            Blip( count + PGPos, *name );
            ++count;
            ++name;
        }
        while( count < MAX_FNAME_LEN ) {
            Blip( count + PGPos, ' ' );
            ++count;
        }
        count = PGPos;
        while( --count >= BLPos ) {
            Blip( count, ' ' );
        }
        count = 0;
        while( Version[ count ] != NULLCHAR ) {
            Blip( count, Version[ count ] );
            ++count;
        }
    }
}
示例#2
0
static  void    DoBlip( int *count, uint pos, char ch )
/*****************************************************/
{
    if( ( ++(*count) & 1 ) != 0 ) {
        Blip( pos + 1, ' ' );
        Blip( pos    , ch );
    } else {
        Blip( pos    , ' ' );
        Blip( pos + 1, ch );
    }
}
示例#3
0
unsigned RemotePut( char *rec, unsigned len )
{
#ifdef __WINDOWS__
int rc;
    while( 1 ) {
        rc = ConvPut( _id, rec, len, NO_BLOCK );
        if( rc == BLOCK ) SetExecutionFocus( _id );
        else break;
    }
#else
#ifdef DEBUG_ME
    Blip( &_aa, &_bb, 'T' );
#endif
    ConvPut( _id, rec, len, BLOCK );
#ifdef DEBUG_ME
    Blip( &_aa, &_bb, 't' );
#endif
#endif
    return( len );
}
示例#4
0
void    LNBlip( source_line_number num )
/**************************************/
{
    int         i;
    char        ch;

    CheckEvents();
    if( BlipsOn ) {
        Blip( LNPos+LNSize, ' ' );
        for( i = LNSize; i-- > 0; ) {
            if( num == 0 ) {
                ch = ' ';
            } else {
                ch = num % 10 + '0';
                num /= 10;
            }
            Blip( LNPos + i, ch );
        }
    }
}
示例#5
0
unsigned RemoteGet( char *rec, unsigned len )
{
unsigned long rc;

#ifdef __WINDOWS__
    while( 1 ) {
        rc = ConvGet( _id, rec, len, NO_BLOCK );
        if( (rc & 0xffff) == BLOCK ) SetExecutionFocus( _id );
        else break;
    }
#else
#ifdef DEBUG_ME
    Blip( &_a, &_b, 'G' );
#endif
    rc = ConvGet( _id, rec, len, BLOCK );
#ifdef DEBUG_ME
    Blip( &_a, &_b, 'g' );
#endif
#endif
    return( rc >> 16 );
}
示例#6
0
void    PGBlip( const char *name )
/********************************/
{
    int         count;

    CheckEvents();
    if( BlipsOn ) {
        for( count = 0; *name != NULLCHAR && count < MAX_FNAME_LEN; ++count, ++name) {
            Blip( count + PGPos, *name );
        }
        for( ; count < MAX_FNAME_LEN; ++count ) {
            Blip( count + PGPos, ' ' );
        }
        for( count = PGPos; count-- > BLPos; ) {
            Blip( count, ' ' );
        }
        for( count = 0; Version[count] != NULLCHAR; ++count ) {
            Blip( count, Version[count] );
        }
    }
}
示例#7
0
trap_retval RemotePut( byte *rec, trap_elen len )
{
#ifdef __WINDOWS__
    int rc;

    for( ;; ) {
        rc = ConvPut( _id, rec, len, NO_BLOCK );
        if( rc == BLOCK ) SetExecutionFocus( _id );
        else break;
    }
#else
#ifdef DEBUG_ME
    Blip( &_aa, &_bb, 'T' );
#endif
    ConvPut( _id, rec, len, BLOCK );
#ifdef DEBUG_ME
    Blip( &_aa, &_bb, 't' );
#endif
#endif
    return( len );
}
示例#8
0
trap_retval RemoteGet( byte *rec, trap_elen len )
{
    unsigned long rc;

#ifdef __WINDOWS__
    for( ;; ) {
        rc = ConvGet( _id, rec, len, NO_BLOCK );
        if( (rc & 0xffff) == BLOCK ) SetExecutionFocus( _id );
        else break;
    }
#else
#ifdef DEBUG_ME
    Blip( &_a, &_b, 'G' );
#endif
    rc = ConvGet( _id, rec, len, BLOCK );
#ifdef DEBUG_ME
    Blip( &_a, &_b, 'g' );
#endif
#endif
    return( rc >> 16 );
}
UINT _stdcall Relocate_File(
	MSIHANDLE hModule,
	const TCHAR *sDirectoryFrom, // Directory to relocate from
	const TCHAR *sDirectoryTo,   // Directory to relocate to
	const TCHAR *sFile,          // File to relocate
	const TCHAR *sType)          // Type of relocation to do.
{
	UINT uiAnswer = ERROR_SUCCESS;
	TCHAR sFileIn[_MAX_PATH];
	TCHAR sFileOut[_MAX_PATH];
	_tcscpy_s(sFileIn, _MAX_PATH, sDirectoryTo);
	_tcscat_s(sFileIn, _MAX_PATH, sFile);
	_tcscpy_s(sFileOut, _MAX_PATH, sFileIn);
	_tcscat_s(sFileOut, _MAX_PATH, _T(".new"));

	TCHAR sStringIn[_MAX_PATH];
	TCHAR sStringOut[_MAX_PATH];

	// Log the fact that we're relocating a file.
	StartLogStringR(_T("Relocating "));
	AppendLogStringR(sFile);
	AppendLogStringR(_T(" using relocation type "));
	AppendLogStringR(sType);
	uiAnswer = LogStringR(hModule);
	MSI_OK(uiAnswer)

	// Get the strings to look for.
	Relocate_GetSearchString(sStringIn,  sDirectoryFrom, sType);
	Relocate_GetSearchString(sStringOut, sDirectoryTo,   sType);

	if (0 == _tcscmp(sStringIn, _T(""))) {
		return ERROR_INSTALL_FAILURE;
	}

	if (0 == _tcscmp(sStringOut, _T(""))) {
		return ERROR_INSTALL_FAILURE;
	}

	// Open our files.
	FILE *fFileIn;
	FILE *fFileOut;
	errno_t eAnswer = 0;
	eAnswer = _tfopen_s(&fFileIn, sFileIn, _T("rtS"));
	if (eAnswer != 0) {
		return ERROR_INSTALL_FAILURE;
	}
	eAnswer = _tfopen_s(&fFileOut, sFileOut, _T("wt"));
	if (eAnswer != 0) {
		fclose(fFileIn);
		return ERROR_INSTALL_FAILURE;
	}

	// Set up our variables for the relocation.
	TCHAR  sLine[32767];
	TCHAR  sWork1[32767];
	TCHAR  sWork2[32767];
	TCHAR *sLoc   = NULL;
	size_t iStringInLength = _tcslen(sStringIn);
	size_t iStringOutLength = _tcslen(sStringOut);
	int iErrorFlag = 0;
	long lLine = 0;
	// Do the relocation.
	while (!feof(fFileIn)) {

		// Deal with errors. 
		if( _fgetts( sLine, 32766, fFileIn ) == NULL) {
			if (iErrorFlag) {
				fclose(fFileIn);
				fclose(fFileOut);
				::DeleteFile(sFileOut);
				uiAnswer = ERROR_INSTALL_FAILURE;
				break;
			}
			iErrorFlag++;
			continue;
		}

		_tcscpy_s(sWork1, 32766, sLine);
		sLoc = _tcsstr(sWork1, sStringIn);
		while (sLoc) {
			// "Cap" the initial string and copy it to sWork2, then append sStringOut to it.
			*sLoc = _T('\0');
			_tcscpy_s(sWork2, 32766, sWork1);
			_tcscat_s(sWork2, 32766, sStringOut);

			// Append the rest of the line.
			sLoc += iStringInLength;
			_tcscat_s(sWork2, 32766, sLoc);

			// Copy back out of our work area, so that they match.
			_tcscpy_s(sWork1, 32766, sWork2);

			// Advance along the string.
			sLoc -= iStringInLength;
			sLoc += iStringInLength;

			// Try another search.
			sLoc = _tcsstr(sLoc, sStringIn);

			// If we're done, copy to sLine so it can be written out.
			if (!sLoc) {
				_tcscpy_s(sLine, 32766, sWork1);
			}
		}
		
		// Write the line out.
		_fputts(sLine, fFileOut);

		// Check every so often for cancel button.
		lLine++;
		if (0 == (lLine % 100)) {
			uiAnswer = Blip(hModule);
			if (ERROR_SUCCESS != uiAnswer) {
				fclose(fFileIn);
				fclose(fFileOut);
				::DeleteFile(sFileOut);
				return uiAnswer;
			}
		}

	}

	fflush(fFileOut);
	fclose(fFileIn);
	fclose(fFileOut);

	MSI_OK(uiAnswer);

	BOOL bAnswer = TRUE;
	// Check for readonly status on the file.
	DWORD dwAttributes = ::GetFileAttributes(sFileIn);
	if (dwAttributes && FILE_ATTRIBUTE_READONLY) {
		bAnswer = ::SetFileAttributes(sFileIn, dwAttributes && !FILE_ATTRIBUTE_READONLY);
		if (bAnswer == FALSE) { 
			::DeleteFile(sFileOut);
			uiAnswer = ERROR_INSTALL_FAILURE; 
		}
		MSI_OK(uiAnswer)
	}