diff options
-rw-r--r-- | src/luarocks/fs/win32/pe-parser.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/luarocks/fs/win32/pe-parser.lua b/src/luarocks/fs/win32/pe-parser.lua index 9cd36ffc..34556812 100644 --- a/src/luarocks/fs/win32/pe-parser.lua +++ b/src/luarocks/fs/win32/pe-parser.lua | |||
@@ -550,4 +550,19 @@ function M.msvcrt(infile) | |||
550 | return nil, "No msvcrt found" | 550 | return nil, "No msvcrt found" |
551 | end | 551 | end |
552 | 552 | ||
553 | function M.get_architecture(program) | ||
554 | -- detect processor arch interpreter was compiled for | ||
555 | local proc = (M.parse(program) or {}).Machine | ||
556 | if not proc then | ||
557 | return nil, "Could not detect processor architecture used in "..program | ||
558 | end | ||
559 | proc = M.const.Machine[proc] -- collect name from constant value | ||
560 | if proc == "IMAGE_FILE_MACHINE_I386" then | ||
561 | proc = "x86" | ||
562 | else | ||
563 | proc = "x86_64" | ||
564 | end | ||
565 | return proc | ||
566 | end | ||
567 | |||
553 | return M | 568 | return M |