From 37cfc8b2a858458b5ac0f80fb97937953cbaaadf Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Thu, 28 Mar 2024 19:45:47 +0100 Subject: [PATCH] library: handle IMPORT_OBJECT_NAME_EXPORTAS --- src/Library.zig | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Library.zig b/src/Library.zig index bf41643..934b8eb 100644 --- a/src/Library.zig +++ b/src/Library.zig @@ -109,17 +109,15 @@ pub fn print(self: *const Library, writer: anytype, options: anytype) !void { switch (hdr.types.name_type) { .ORDINAL => {}, .NAME => try writer.print(" {s: <13}: {s}\n", .{ "Name", import_name }), - .NAME_NOPREFIX => try writer.print(" {s: <13}: {s}\n", .{ - "Name", - std.mem.trimLeft(u8, import_name, "?@_"), - }), + .NAME_NOPREFIX => try writer.print(" {s: <13}: {s}\n", .{ "Name", std.mem.trimLeft(u8, import_name, "?@_") }), .NAME_UNDECORATE => { const trimmed = std.mem.trimLeft(u8, import_name, "?@_"); const index = std.mem.indexOf(u8, trimmed, "@") orelse trimmed.len; - try writer.print(" {s: <13}: {s}\n", .{ - "Name", - trimmed[0..index], - }); + try writer.print(" {s: <13}: {s}\n", .{ "Name", trimmed[0..index] }); + }, + .NAME_EXPORTAS => { + const actual_name = std.mem.sliceTo(@as([*:0]const u8, @ptrCast(strings.ptr + import_name.len + 1 + dll_name.len + 1)), 0); + try writer.print(" {s: <13}: {s}\n", .{ "Name", actual_name }); }, else => unreachable, }