BOOL INSTAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection,
                                         LPCWSTR lpszEntry,
                                         LPCWSTR lpszString,
                                         LPCWSTR lpszFilename)
{
	char *sect;
	char *entry;
	char *string;
	char *file;
	BOOL ret;

	sect = lpszSection ? _single_string_alloc_and_copy( lpszSection ) : (char*)NULL;
	entry = lpszEntry ? _single_string_alloc_and_copy( lpszEntry ) : (char*)NULL;
	string = lpszString ? _single_string_alloc_and_copy( lpszString ) : (char*)NULL;
	file = lpszFilename ? _single_string_alloc_and_copy( lpszFilename ) : (char*)NULL;

	ret = SQLWritePrivateProfileString( sect, entry, string, file );

	if ( sect )
		free( sect );
	if ( entry )
		free( entry );
	if ( string )
		free( string );
	if ( file )
		free( file );

	return ret;
}
Exemplo n.º 2
0
BOOL INSTAPI SQLWriteFileDSNW(LPCWSTR  lpszFileName,
                              LPCWSTR  lpszAppName,
                              LPCWSTR  lpszKeyName,
                              LPCWSTR  lpszString)
{
	BOOL ret;
	char *file;
	char *app;
	char *key;
	char *str;

	file = lpszFileName ? _single_string_alloc_and_copy( lpszFileName ) : (char*)NULL;
	app = lpszAppName ? _single_string_alloc_and_copy( lpszAppName ) : (char*)NULL;
	key = lpszKeyName ? _single_string_alloc_and_copy( lpszKeyName ) : (char*)NULL;
	str = lpszString ? _single_string_alloc_and_copy( lpszString ) : (char*)NULL;

	ret = SQLWriteFileDSN( file, app, key, str );

	if ( file )
		free( file );
	if ( app )
		free( app );
	if ( key )
		free( key );
	if ( str )
		free( str );

	return ret;
}
Exemplo n.º 3
0
BOOL INSTAPI  SQLReadFileDSNW(LPCWSTR  lpszFileName,
                              LPCWSTR  lpszAppName,
                              LPCWSTR  lpszKeyName,
                              LPWSTR   lpszString,
                              WORD     cbString,
                              WORD    *pcbString)
{
    char *file;
    char *app;
    char *key;
    char *str;
    WORD len;
    BOOL ret;

    inst_logClear();

    file = lpszFileName ? _single_string_alloc_and_copy( lpszFileName ) : (char*)NULL;
    app = lpszAppName ? _single_string_alloc_and_copy( lpszAppName ) : (char*)NULL;
    key = lpszKeyName ? _single_string_alloc_and_copy( lpszKeyName ) : (char*)NULL;

    if ( lpszString )
    {
        if ( cbString > 0 )
        {
            str = calloc( cbString + 1, 1 );
        }
        else
        {
            str = NULL;
        }
    }
    else
    {
        str = NULL;
    }

    ret = SQLReadFileDSN( file, app, key, str, cbString, &len );

    if ( ret )
    {
        if ( str && lpszString )
        {
            _single_copy_to_wide( lpszString, str, len + 1 );
        }
    }

    if ( file )
        free( file );
    if ( app )
        free( app );
    if ( key )
        free( key );
    if ( str )
        free( str );

    if ( pcbString )
        *pcbString = len;

    return ret;
}
Exemplo n.º 4
0
BOOL INSTAPI SQLWriteDSNToIniW        (LPCWSTR     lpszDSN,
                                      LPCWSTR     lpszDriver)
{
	char *drv, *dsn;
	BOOL ret;

	dsn = _single_string_alloc_and_copy( lpszDSN );
	drv = _single_string_alloc_and_copy( lpszDriver );

	ret = SQLWriteDSNToIni( dsn, drv );

	free( dsn );
	free( drv );

	return ret;
}
Exemplo n.º 5
0
BOOL INSTAPI SQLValidDSNW(LPCWSTR lpszDSN)
{
	char *dsn;
	BOOL ret;

	dsn = _single_string_alloc_and_copy( lpszDSN );

	ret = SQLValidDSN( dsn );

	free( dsn );

	return ret;
}
Exemplo n.º 6
0
BOOL INSTAPI SQLRemoveDriverW(LPCWSTR lpszDriver,
                             BOOL fRemoveDSN,
                             LPDWORD lpdwUsageCount)
{
	BOOL ret;
	char *drv = _single_string_alloc_and_copy( lpszDriver );

    inst_logClear();

	ret = SQLRemoveDriver( drv, fRemoveDSN, lpdwUsageCount );

	free( drv );

	return ret;
}
Exemplo n.º 7
0
int  INSTAPI SQLGetPrivateProfileStringW( LPCWSTR lpszSection,
                                        LPCWSTR lpszEntry,
                                        LPCWSTR lpszDefault,
                                        LPWSTR  lpszRetBuffer,
                                        int    cbRetBuffer,
                                        LPCWSTR lpszFilename)
{
	int ret;
	char *sect;
	char *entry;
	char *def;
	char *buf;
	char *name;

    inst_logClear();

	sect = lpszSection ? _single_string_alloc_and_copy( lpszSection ) : (char*)NULL;
	entry = lpszEntry ? _single_string_alloc_and_copy( lpszEntry ) : (char*)NULL;
	def = lpszDefault ? _single_string_alloc_and_copy( lpszDefault ) : (char*)NULL;
	name = lpszFilename ? _single_string_alloc_and_copy( lpszFilename ) : (char*)NULL;

	if ( lpszRetBuffer ) 
	{
		if ( cbRetBuffer > 0 )
		{
			buf = calloc( cbRetBuffer + 1, 1 );
		}
		else
		{
			buf = NULL;
		}
	}
	else
	{
		buf = NULL;
	}

	ret = SQLGetPrivateProfileString( sect, entry, def, buf, cbRetBuffer, name );

	if ( sect )
		free( sect );
	if ( entry )
		free( entry );
	if ( def )
		free( def );
	if ( name )
		free( name );

	if ( ret > 0 )
	{
		if ( buf && lpszRetBuffer )
		{
			_single_copy_to_wide( lpszRetBuffer, buf, ret + 1 );
		}
	}

	if ( buf )
	{
		free( buf );
	}

	return ret;
}