lief-project / LIEF

LIEF - Library to Instrument Executable Formats

Home Page:https://lief-project.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why was the modification of the export function name unsuccessful

icyfox168168 opened this issue · comments

Please describe what you would like to have in LIEF.

Note: If the feature is not precise or if you want to have feedback first, you can open a discussion.

    // 加载 DLL 文件
    auto binary = LIEF::PE::Parser::parse(dll_path);

    // 获取导出表
    auto export_table = binary->get_export();

    // 获取导出函数的名称
    std::vector<std::string> export_functions;
    for (const auto& entry : export_table.entries()) {
        std::string func_name = entry.name();
        export_functions.push_back(func_name);
    }

    export_table.entries()[1].name("NewFunction");

    binary->write("modified_example.dll");