Exemple #1
0
int main( int argc, TEXTCHAR **argv )
{
   int saveas = 0;
	if( argc < 2 )
	{
		printf( WIDE("Usage: %s <config filename> [optional - set as config filename]\n" ), argv[0] );
      return 1;

	}
	if( argc > 2 )
		saveas = 1;

	{
      TEXTSTR tmp = (TEXTSTR)StrDup( argv[1] );
		TEXTSTR filename = (TEXTSTR)pathrchr( tmp );
		if( !filename )
         filename = tmp;


		{
			uint32_t size = 0;
			POINTER mem = OpenSpace( NULL, argv[1], &size );
			if( mem && size )
			{
#ifndef __NO_SQL__
				SACK_WriteProfileBlob( WIDE("intershell/configuration" ), saveas?argv[2]:filename, (TEXTCHAR*)mem, size );
#endif
				CloseSpace( mem );
			}
		}

	}
   return 1;
}
Exemple #2
0
int main( int argc, char **argv )
{
	POINTER mem_lock;
	uintptr_t size = 0;
	TEXTCHAR *myname = StrDup( pathrchr( DupCharToText( argv[0] ) ) );
	TEXTCHAR *endname;
	TEXTCHAR lockname[256];
	if( myname )
		myname++;
	else
		myname = DupCharToText( argv[0] );
   // go to the .exe extension
	endname = (TEXTCHAR*)StrRChr( myname, '.' );
	if( endname )
	{
      // remove .exe extension
		endname[0] = 0;
      // go to the .stop extension
		endname = (TEXTCHAR*)StrRChr( myname, '.' );
	}
	if( endname )
	{
      // remove .stop extension
		endname[0] = 0;
	}
	else
	{
      // this would be an invalid name.
		return 0;
	}
	snprintf( lockname, sizeof( lockname ), WIDE( "%s.instance.lock" ), myname );
	lprintf( WIDE( "Checking lock %s" ), lockname );
	mem_lock = OpenSpace( lockname
		, NULL
		//, WIDE("memory.delete")
		, &size );
	if( mem_lock )
	{
#ifdef WIN32
		PRENDER_INTERFACE pri = GetDisplayInterface();
		PVIDEO video = (PVIDEO)mem_lock;
		if( video->hWndOutput )
		{
			ForceDisplayFocus( video );
			RestoreDisplay( video );

		}
		else
		{
			// region found, but no content...
		}
#endif
	}
	else
		lprintf( WIDE("lock region not found.") );
	return 0;
}
Exemple #3
0
void MakeDirectory( char *name )
{
	char *path;
	printf( WIDE("Checking %s\n"), name );
	path = pathrchr( name );
	if( path )
	{
		path[0] = 0;
		MakeDirectory( name );
		path[0] = '/';
	}
	if( !CreateDirectory( name, NULL ) )
	{
		if( GetLastError() != ERROR_ALREADY_EXISTS ) // 183
		{
			fprintf( stderr, WIDE("Create Directory failed on :%s %d\n"), name, GetLastError() );
			failed = 1;
		}
	}
}
Exemple #4
0
 int  ScanFilesEx ( CTEXTSTR base
           , CTEXTSTR mask
           , void **pInfo
           , void CPROC Process( uintptr_t psvUser, CTEXTSTR name, int flags )
           , int flags 
           , uintptr_t psvUser 
		   , LOGICAL begin_sub_path 
		   , struct file_system_mounted_interface *mount
		   )
{
	PMFD pDataCurrent = (PMFD)(pInfo);
	PMFD pData = (PMFD)(*pInfo);
	TEXTSTR tmp_base = NULL;
	int sendflags;
	int processed = 0;
#ifndef WIN32
	struct dirent *de;
#endif
	if( begin_sub_path )
	{
		pInfo = (void**)&(pDataCurrent->current);
	}
	else
		pDataCurrent = NULL;

	//lprintf( "Search in %s for %s   %d %d", base?base:"(NULL)", mask?mask:"(*)", (*pInfo)?((PMFD)*pInfo)->scanning_mount:0, (*pInfo)?((PMFD)*pInfo)->single_mount:0 );
	if( !*pInfo || begin_sub_path || ((PMFD)*pInfo)->new_mount )
	{
		TEXTCHAR findmask[256];
		pData = (PMFD)(*pInfo);
		if( !pData )
		{
			*pInfo = Allocate( sizeof( MFD ) );
			pData = (PMFD)(*pInfo);
			if( !( pData->scanning_mount = mount ) )
			{
				if( !winfile_local )
					SimpleRegisterAndCreateGlobal( winfile_local );

				//lprintf( "... %p", winfile_local );
				pData->single_mount = FALSE;
				pData->scanning_mount = (*winfile_local).mounted_file_systems;
			}
			else
				pData->single_mount = TRUE;

			if( !pData->scanning_mount )
			{
				Deallocate( PMFD, pData );
				if( tmp_base )
					Release( tmp_base );
				return 0;
			}
			if( pData->scanning_mount->fsi )
			{
				//lprintf( "create cursor" );
				tmp_base = ExpandPathEx( base, pData->scanning_mount->fsi );
				pData->cursor = pData->scanning_mount->fsi->find_create_cursor( pData->scanning_mount->psvInstance, CStrDup( tmp_base ), CStrDup( mask ) );
			}
			else
			{
				//lprintf( "no cursor" );
				pData->cursor = NULL;
			}
		}
		else
		{
			if( pData->new_mount )
			{
				if( pData->scanning_mount->fsi )
				{
					//lprintf( "create cursor (new mount)" );
					tmp_base = ExpandPathEx( base, pData->scanning_mount->fsi );
					pData->cursor = pData->scanning_mount->fsi->find_create_cursor( pData->scanning_mount->psvInstance, CStrDup( tmp_base ), CStrDup( mask ) );
				}
				else
					pData->cursor = NULL;
			}
		}
		pData->new_mount = FALSE;
		pData->current = NULL;
		pData->prior = pDataCurrent;

		if( pDataCurrent )
		{
			pData->root_info = pDataCurrent->root_info;
			pInfo = (void**)pData->root_info;
		}
		else
		{
			pData->root_info = (struct myfinddata**)pInfo;
		}

		(*pData->root_info) = pData;
		if( base )
		{
			TEXTSTR tmp;
			StrCpyEx( findbasename(pInfo), tmp = ExpandPathEx( base, pData->scanning_mount?pData->scanning_mount->fsi:NULL ), MAX_PATH_NAME );
			Release( tmp );
			StrCpyEx( findmask(pInfo), mask, MAX_PATH_NAME );
		}
		else
		{
			CTEXTSTR p = pathrchr( mask );
			if( p )
			{
				StrCpyEx( findbasename(pInfo), mask, p - mask + 1 );
				StrCpyEx( findmask(pInfo), p + 1, MAX_PATH_NAME );
				//mask = p + 1;
			}
			else
			{
				StrCpyEx( findbasename(pInfo), WIDE(""), 2 );
				StrCpyEx( findmask(pInfo), mask, MAX_PATH_NAME );
			}
		}
		if( findbasename(pInfo)[0] )
			tnprintf( findmask, sizeof(findmask), WIDE("%s/*"), findbasename(pInfo) );
		else
			tnprintf( findmask, sizeof( findmask ), WIDE( "*" ) );
		if( pData->scanning_mount?pData->scanning_mount->fsi:NULL )
			if( pData->scanning_mount->fsi->find_first( findcursor(pInfo) ) )
				findhandle(pInfo) = 0;
			else
				findhandle(pInfo) = (HANDLECAST)-1;
		else
		{
#if WIN32
			findhandle(pInfo) = findfirst( findmask, finddata(pInfo) );
#else
			//lprintf( "opendir %s", findbasename(pInfo) );
			findhandle( pInfo ) = opendir( findbasename(pInfo) );
			if( !findhandle(pInfo ) )
				findhandle(pInfo) = (HANDLECAST)-1;
			else
				de = readdir( (DIR*)findhandle( pInfo ) );
#endif
		}
		if( findhandle(pInfo) == (HANDLECAST)-1 )
		{
			PMFD prior = pData->prior;
			//lprintf( "first use of cursor or first open of directoy failed..." );
			if( pData->scanning_mount && pData->scanning_mount->fsi )
				pData->scanning_mount->fsi->find_close( (struct find_cursor*)findcursor(pInfo) );
			else
			{
#ifdef WIN32
				findclose( findhandle(pInfo) );
#else
				// but it failed... so ... don't close
				//closedir( findhandle( pInfo ) );
#endif
			}
			pData->scanning_mount = NextThing( pData->scanning_mount );
			if( !pData->scanning_mount || pData->single_mount )
			{
				(*pData->root_info) = pData->prior;
				if( !begin_sub_path ) {
					Release( pData ); pInfo[0] = NULL;
				}
				//lprintf( WIDE( "%p %d" ), prior, processed );
				if( tmp_base )
					Release( tmp_base );
				return prior?processed:0;
			}
			pData->new_mount = TRUE;
				if( tmp_base )
					Release( tmp_base );
			return 1;
		}
	}
	else
	{
		int r;
getnext:
		//lprintf( "returning customer..." );
		if( pData->scanning_mount?pData->scanning_mount->fsi:NULL )
			r = !pData->scanning_mount->fsi->find_next( findcursor( pInfo ) );
		else
		{
#ifdef _WIN32
			r = findnext( findhandle(pInfo), finddata( pInfo ) );
#else
			de = readdir( (DIR*)findhandle( pInfo ) );
			//lprintf( "using %p got %p", findhandle( pInfo ), de );
			r = (de == NULL);
#endif
		}
		if( r )
		{
			PMFD prior = pData->prior;
			//lprintf( "nothing left to find..." );
			if( pData->scanning_mount->fsi )
				pData->scanning_mount->fsi->find_close( findcursor(pInfo) );
			else
			{
#ifdef WIN32
				findclose( findhandle(pInfo) );
#else
				closedir( (DIR*)findhandle(pInfo));
#endif
			}
			pData->scanning_mount = NextThing( pData->scanning_mount );
			//lprintf( "Step mount... %p %d", pData->scanning_mount, pData->single_mount );
			if( !pData->scanning_mount || pData->single_mount )
			{
				//lprintf( "done with mounts?" );
				(*pData->root_info) = pData->prior;
				Release( pData );
				if( prior )
					prior->current = NULL;
				if( !processed && !begin_sub_path )
				{
					//pInfo = (void**)&(prior->prior->current);
					pData = prior;
					if( pData )
						goto getnext;
				}
				if( tmp_base )
					Release( tmp_base );
				return (*pInfo)?processed:0;
			}
			pData->new_mount = TRUE;
			if( tmp_base )
				Release( tmp_base );
			return 1;
		}
	}
	if( pData->scanning_mount?pData->scanning_mount->fsi:NULL )
	{
		char * path = pData->scanning_mount->fsi->find_get_name( findcursor(pInfo) );
		//lprintf( "... %s", path );
		if( !strcmp( ".", path ) ||
		    !strcmp( "..", path ) )
		goto getnext;
	}
	else
	{
#if WIN32 
		//lprintf( "... %s", finddata(pInfo)->name );
#  ifdef UNDER_CE
		if( !StrCmp( WIDE("."), finddata(pInfo)->cFileName ) ||
		    !StrCmp( WIDE(".."), finddata(pInfo)->cFileName ) )
#  else
		if( !StrCmp( WIDE("."), finddata(pInfo)->name ) ||
		    !StrCmp( WIDE(".."), finddata(pInfo)->name ) )
#  endif
#else
		if( !StrCmp( WIDE("."), de->d_name ) ||
		    !StrCmp( WIDE(".."), de->d_name ) )
#endif
			goto getnext;
	}
	if( !(flags & SFF_NAMEONLY) ) // if nameonly - have to rebuild the correct name.
	{
		if( pData->scanning_mount?pData->scanning_mount->fsi:NULL )
		{
			tnprintf( pData->file_buffer, MAX_PATH_NAME, WIDE("%s"), pData->scanning_mount->fsi->find_get_name( findcursor(pInfo) ) );
			if( findbasename( pInfo )[0] )
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s/%s"), findbasename(pInfo), pData->file_buffer );
			else
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE( "%s" ), pData->file_buffer );
		}
		else
		{
#ifdef WIN32
#  ifdef UNDER_CE
			tnprintf( pData->file_buffer, MAX_PATH_NAME, WIDE( "%s" ), finddata( pInfo )->cFileName );
			tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s/%s"), findbasename(pInfo), finddata(pInfo)->cFileName );
#  else
			tnprintf( pData->file_buffer, MAX_PATH_NAME, WIDE("%s"), finddata(pInfo)->name );
			tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s%s%s"), findbasename(pInfo), findbasename( pInfo )[0]?"/":"", pData->file_buffer );
#  endif
#else
			tnprintf( pData->file_buffer, MAX_PATH_NAME, WIDE("%s"), de->d_name );
			tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s/%s"), findbasename(pInfo), de->d_name );
#endif
		}
	}
	else
	{
		if( flags & SFF_SUBCURSE )
		{
			if( pData->scanning_mount?pData->scanning_mount->fsi:NULL )
			{
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s%s%s")
					  , pData->prior?pData->prior->buffer:WIDE( "" )
					  , pData->prior?WIDE( "/" ):WIDE( "" )
					, pData->scanning_mount->fsi->find_get_name( findcursor(pInfo) ) 
					);
			}
			else
			{
#if WIN32
#  ifdef UNDER_CE
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s%s%s")
						  , pData->prior?pData->prior->buffer:WIDE( "" )
						  , pData->prior?WIDE( "/" ):WIDE( "" )
						  , finddata(pInfo)->cFileName );
#  else
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s%s%s")
						  , pData->prior?pData->prior->buffer:WIDE( "" )
						  , pData->prior?WIDE( "/" ):WIDE( "" )
						  , finddata(pInfo)->name );
#  endif
#else
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s%s%s")
					  , pData->prior?pData->prior->buffer:WIDE( "" )
					  , pData->prior?WIDE( "/" ):WIDE( "" )
					  , de->d_name );
					  lprintf( "resulting is %s", pData->buffer );
#endif
			}
		}
		else
		{
			if( pData->scanning_mount?pData->scanning_mount->fsi:NULL )
			{
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s"), pData->scanning_mount->fsi->find_get_name( findcursor(pInfo) ) );
			}
			else
			{
#if WIN32
#  ifdef UNDER_CE
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s"), finddata(pInfo)->cFileName );
#  else
#    ifdef UNICODE
				snwprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s"), finddata(pInfo)->name );
#    else
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s"), finddata(pInfo)->name );
#    endif
#  endif
#else
				tnprintf( pData->buffer, MAX_PATH_NAME, WIDE("%s"), de->d_name );
#endif
			}
		}
	}
	pData->buffer[MAX_PATH_NAME-1] = 0; // force nul termination...
#ifdef UNICODE
	{
		char *pDataBuffer = CStrDup( pData->buffer );
#else
#  define pDataBuffer pData->buffer
#endif
	//lprintf( "Check if %s is a directory...", pData->buffer );
	if( (flags & (SFF_DIRECTORIES | SFF_SUBCURSE))
		&& (pData->scanning_mount && pData->scanning_mount->fsi
			&& (pData->scanning_mount->fsi->is_directory
				&& pData->scanning_mount->fsi->is_directory( pDataBuffer )))
		|| (!(pData->scanning_mount ? pData->scanning_mount->fsi : NULL)
#ifdef WIN32
#  ifdef UNDER_CE
			&& (finddata( pInfo )->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#  else
			&& (finddata( pInfo )->attrib & _A_SUBDIR)
#  endif
#else
			&& IsPath( pData->buffer )
#endif
			) )
	{
#ifdef UNICODE
		Deallocate( char *, pDataBuffer );
#else 
#  undef pDataBuffer
#endif
		//lprintf( "... it is?" );
		if( flags & SFF_DIRECTORIES )
		{
			if( Process != NULL )
			{
				//lprintf( "Send %s", pData->buffer );
				Process( psvUser, pData->buffer, SFF_DIRECTORY );
				processed = 1;
			}
			//return 1;
		}
		if( flags & SFF_SUBCURSE )
		{
			void *data = NULL;
			int ofs = 0;
			TEXTCHAR tmpbuf[MAX_PATH_NAME];
			if( flags & SFF_NAMEONLY )
			{
				// even in name only - need to have this full buffer for subcurse.
				if( pData->scanning_mount && pData->scanning_mount->fsi )
				{
					ofs = tnprintf( tmpbuf, sizeof( tmpbuf ), WIDE( "%s/%s" ), findbasename( pInfo ), pData->scanning_mount->fsi->find_get_name( findcursor( pInfo ) ) );
				}
				else
				{
#ifdef WIN32
#  ifdef UNDER_CE
					ofs = tnprintf( tmpbuf, sizeof( tmpbuf ), WIDE( "%s/%s" ), findbasename( pInfo ), finddata( pInfo )->cFileName );
#  else
#    ifdef UNICODE
					ofs = snwprintf( tmpbuf, sizeof( tmpbuf ), WIDE( "%s/%s" ), findbasename( pInfo ), finddata( pInfo )->name );
#    else
					ofs = tnprintf( tmpbuf, sizeof( tmpbuf ), WIDE( "%s/%s" ), findbasename( pInfo ), finddata( pInfo )->name );
#    endif
#  endif
#else	
					ofs = tnprintf( tmpbuf, sizeof( tmpbuf ), WIDE( "%s/%s" ), findbasename( pInfo ), de->d_name );
#endif
				}
				//lprintf( "process sub... %s %s", tmpbuf, findmask(pInfo)  );
				processed |= ScanFilesEx( tmpbuf, findmask( pInfo ), (POINTER*)pData, Process, flags, psvUser, TRUE, pData->scanning_mount );
			}
			else
			{
				//lprintf( "process sub..." );
				processed |= ScanFilesEx( pData->buffer, findmask( pInfo ), (POINTER*)pData, Process, flags, psvUser, TRUE, pData->scanning_mount );
			}
		}
		if( !processed )
			goto getnext;
		if( tmp_base )
			Release( tmp_base );
		return (*pInfo) ? 1 : 0;
	}
#ifdef UNICODE
	Deallocate( char *, pDataBuffer );
	}
#else 
#  undef pDataBuffer
#endif
	if( ( sendflags = SFF_DIRECTORY, ( ( flags & SFF_DIRECTORIES )
#ifdef WIN32
#  ifdef UNDER_CE
												 && ( finddata(pInfo)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
#  else
												 && ( finddata(pInfo)->attrib & _A_SUBDIR )
#  endif
#else
												 && ( IsPath( pData->buffer ) )

#endif
												) ) || ( sendflags = 0, CompareMask( findmask( pInfo )
#ifdef WIN32
#  ifdef UNDER_CE
																							  , finddata(pInfo)->cFileName
#  else
																							  , pData->file_buffer
#  endif
#else
																							  , de->d_name
#endif
																								// yes this is silly - but it's correct...
																							  , (flags & SFF_IGNORECASE)?0:0 ) ) )
	{
		//lprintf( "Send %s", pData->buffer );
		if( Process != NULL )
			Process( psvUser, pData->buffer, sendflags );
		if( tmp_base )
			Release( tmp_base );
		return (*pInfo)?1:0;
	}
	if( tmp_base )
		Release( tmp_base );
	return (*pInfo)?1:0;
}
Exemple #5
0
int main( int argc, char **argv )
{
    POINTER mem_lock;
    uintptr_t size = 0;
    TEXTCHAR *myname = StrDup( pathrchr( DupCharToText( argv[0] ) ) );
    TEXTCHAR *endname;
    TEXTCHAR lockname[256];
    if( myname )
        myname++;
    else
        myname = DupCharToText( argv[0] );
    // go to the .exe extension
    endname = (TEXTCHAR*)StrRChr( myname, '.' );
    if( endname )
    {
        // remove .exe extension
        endname[0] = 0;
        // go to the .stop extension
        endname = (TEXTCHAR*)StrRChr( myname, '.' );
    }
    if( endname )
    {
        // remove .stop extension
        endname[0] = 0;
    }
    else
    {
        // this would be an invalid name.
        return 0;
    }
    snprintf( lockname, sizeof( lockname ), WIDE( "%s.instance.lock" ), myname );
    lprintf( WIDE( "Checking lock %s" ), lockname );
    mem_lock = OpenSpace( lockname
                          , NULL
                          //, WIDE("memory.delete")
                          , &size );
    if( mem_lock )
    {
#ifdef WIN32
        PRENDER_INTERFACE pri = GetDisplayInterface();
        PVIDEO video = (PVIDEO)mem_lock;
        if( video->hWndOutput )
        {
            ForceDisplayFocus( video );

            keybd_event( VK_MENU, 56, 0, 0 );
            keybd_event( VK_F4, 62, 0, 0 );
            keybd_event( VK_F4, 62, KEYEVENTF_KEYUP, 0 );
            keybd_event( VK_MENU, 56, KEYEVENTF_KEYUP, 0 );
#if 0
            {
                int tick = timeGetTime();
                while( ( tick + 15000  > timeGetTime() ) && IsWindow( video->hWndOutput ) )
                    WakeableSleep( 100 );
                if( IsWindow( video->hWndOutput ) )
#define WM_EXIT_PLEASE 0xd1e
                    if( !SendMessage( video->hWndOutput, WM_QUERYENDSESSION, 0, 0 ) )
                        printf( "Failed to post queyendsession." );
            }
#endif
        }
        else
        {
            // region found, but no content...
        }
#endif
    }
    else
        lprintf( WIDE("lock region not found.") );
    return 0;
}
Exemple #6
0
static LOGICAL CPROC ExtractFile( CTEXTSTR name )
{
    if( StrCmp( name, ".app.config" ) == 0 ) {
        FILE *file = sack_fopenEx( 0, name, "rb", l.rom );
        if( file )
        {
            size_t sz = sack_fsize( file );
            if( sz )
            {
                POINTER data = NewArray( uint8_t, sz );
                sack_fread( data, 1, sz, file );
                ProcessConfigurationInput( l.pch, data, sz, 0 );
                if( !l.target_path )
                    l.target_path = ".";
                Release( data );
            }
            sack_fclose( file );
        }
    } else {
        FILE *file;
        file = sack_fopenEx( 0, name, "rb", l.rom );
        if( file )
        {
            size_t sz = sack_fsize( file );
            if( sz )
            {
                POINTER data = NewArray( uint8_t, sz );
                sack_fread( data, 1, sz, file );

                /* this is where the file should be output */
                {
                    char target[256];
                    char *tmp;
                    snprintf( target, 256, "%s/%s", l.target_path, name );
                    tmp = (char*)pathrchr( target );
                    if( tmp ) {
                        tmp[0] = 0;
                        if( !l.prior_output_path
                                || StrCmp( l.prior_output_path, target ) ) {
                            l.prior_output_path = strdup( target );
                            MakePath( target );
                        }
                        tmp[0] = '/';
                    }
                    {
                        FILE *out;
                        out = sack_fopenEx( 0, target, "wb", sack_get_default_mount() );
                        if( out ) {
                            if( !l.first_file )
                                l.first_file = strdup( target );
                            sack_fwrite( data, 1, sz, out );
                            sack_fclose( out );
                        }
                    }
                }
                Release( data );
            }
            sack_fclose( file );
            return TRUE;
        }
    }

    return FALSE;
}
Exemple #7
0
void CPROC ParseINI( uintptr_t psv, char *name, int flags )
{
	FILE *in = fopen( name, WIDE("rt") );
	if( in )
	{
		char line[1024];
      char section[128];
		char *filename = (char*)pathrchr( name );
		if( filename )
			filename++;
		else
         filename = name;
		while( fgets( line, sizeof( line ), in ) )
		{
			int len = strlen( line );
			if( line[len-1] == '\n' )
			{
				line[len-1] = 0;
				len--;
			}
			if( line[0] == '[' )
			{
				char *end = strchr( line, ']' );
				if( end )
				{
					end[0] = 0;
               strcpy( section, line + 1 );
				}
			}
			else if( line[0] == ';' )
			{
            // commented line...
			}
			else
			{
				char *val = strchr( line, '=' );
				if( val )
				{
               char *trim = val;
               char classname[1024];
					val[0] = 0;
					val++;
               while( val[0] == ' ' || val[0] == '\t' ) val++;
					trim--;
					while( trim[0] == ' ' || trim[0] == '\t' ) trim--;
					trim++;
					trim[0] = 0;
					// double slashes for section name...
               // filename will be without a slash, and so is INI...
					{
						char *p = section;
						while( p[0] )
						{
							if( p[0] == '/' || p[0] == '\\' )
							{
								char *c = p;
								while( c[0] ) c++;
                        c++;
								while( c != p )
								{
									c[0] = c[-1];
                           c--;
								}
								p++;
							}
                     p++;
						}
					}
               sprintf( classname, WIDE("INI/%s/%s"), filename, section );
               RegisterValue( classname, line, val );
				}
			}
		}
      fclose( in );
	}
}