コード例 #1
0
ファイル: UPKReader.cpp プロジェクト: wghost/XCModUtil
void UPKReader::SaveExportData(uint32_t idx, std::string outDir)
{
    if (idx < 1 || idx >= ExportTable.size())
    {
        LogWarn("Index is out of bounds in SaveExportData!");
        return;
    }
    std::string filename = outDir + "/" + ExportTable[idx].FullName + "." + ExportTable[idx].Type;
    std::vector<char> dataChunk = GetExportData(idx);
    std::ofstream out(filename.c_str(), std::ios::binary);
    out.write(dataChunk.data(), dataChunk.size());
}
コード例 #2
0
void dynLibImplLinux::GetImportAndExportData( 
	const char* dllName )
{
	if( std::string(dllName).empty())
	{
		return;
	}

	Elf* mainElf;
	struct link_map* mainLm;
	std::string csPath_o;
	OpenDynamicLibrary( dllName, mainElf, mainLm, csPath_o );
	if ( mainLm == NULL )
	{
		return;
	}

	Elf_Scn* section = 0;
	ElfW(Shdr) *shdr;
	FindSection( mainElf, SHT_DYNAMIC, section, shdr );

	std::list<std::string> dependencies;
	ExtractDynSymbols( mainElf, section, shdr, STT_NOTYPE, dependencies );

	std::list<std::string>::iterator it;
	for(it = dependencies.begin( ); it != dependencies.end( ) ; it++) {

		AddString( it->c_str() );

		if ( GetDllEntry( it->c_str()  ) == NULL )
		{
			DLL_ENTRY stImpExport;

			std::string csPath_o;
			if ( GetExportData( it->c_str(), stImpExport.ArrayExport, csPath_o ) )
			{
				stImpExport.m_bIsStable = true;
				stImpExport.m_csFullPath = csPath_o;

				// Add data to static internal map
				MakeUpper( *it );
				m_DataEntry[ *it ] = stImpExport;

			}

		}

		DeleteString( it->c_str() );
	}

	dlclose( mainLm );
}