mirror of
https://github.com/TangentFoxy/love-pe.git
synced 2025-07-28 10:12:16 +00:00
Some improvements
This commit is contained in:
@@ -4,9 +4,14 @@
|
|||||||
local iconChanger = require("icon-changer")
|
local iconChanger = require("icon-changer")
|
||||||
|
|
||||||
local icodata = iconChanger.extractIcon(exeFile)
|
local icodata = iconChanger.extractIcon(exeFile)
|
||||||
|
|
||||||
|
- Reference:
|
||||||
|
Version File Resource: https://msdn.microsoft.com/en-us/library/ms647001(v=vs.85).aspx
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local bit = require("bit")
|
local bit = require("bit")
|
||||||
|
local utf8 = require("utf8")
|
||||||
|
|
||||||
local bor,band,lshift,rshift,tohex = bit.bor,bit.band,bit.lshift,bit.rshift,bit.tohex
|
local bor,band,lshift,rshift,tohex = bit.bor,bit.band,bit.lshift,bit.rshift,bit.tohex
|
||||||
|
|
||||||
@@ -26,7 +31,9 @@ local resourcesTypes = {
|
|||||||
"13",
|
"13",
|
||||||
"Group Icons",
|
"Group Icons",
|
||||||
"15",
|
"15",
|
||||||
"Version Information"
|
"Version Information",
|
||||||
|
"17","18","19","20","21","22","23",
|
||||||
|
"Manifests"
|
||||||
}
|
}
|
||||||
|
|
||||||
--==Internal Functions==--
|
--==Internal Functions==--
|
||||||
@@ -47,9 +54,17 @@ local function decodeNumber(str,bigEndian)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function convertUTF16(str16)
|
local function convertUTF16(str16)
|
||||||
return str16--return str16:gsub("..","%1")
|
--return str16--return str16:gsub("..","%1")
|
||||||
|
local newstr = {}
|
||||||
|
for chars in string.gmatch(str16,"..") do
|
||||||
|
local unicode = decodeNumber(chars,true)
|
||||||
|
newstr[#newstr+1] = utf8.char(unicode)
|
||||||
|
end
|
||||||
|
return table.concat(newstr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
convertUTF16 = function(...) return ... end
|
||||||
|
|
||||||
local function convertRVA2Offset(RVA,Sections)
|
local function convertRVA2Offset(RVA,Sections)
|
||||||
for id, Section in ipairs(Sections) do
|
for id, Section in ipairs(Sections) do
|
||||||
if (Section.VirtualAddress <= RVA) and (RVA < (Section.VirtualAddress + Section.VirtualSize)) then
|
if (Section.VirtualAddress <= RVA) and (RVA < (Section.VirtualAddress + Section.VirtualSize)) then
|
||||||
@@ -134,7 +149,7 @@ local function readResourceDirectoryTable(exeFile,Sections,RootOffset,Level)
|
|||||||
if ok then
|
if ok then
|
||||||
print("RVA OK")
|
print("RVA OK")
|
||||||
exeFile:seek(DataOffset)
|
exeFile:seek(DataOffset)
|
||||||
Tree[Name.."_P_"..tohex(DataCodepage)] = convertUTF16(exeFile:read(DataSize))
|
Tree[Name] = convertUTF16(exeFile:read(DataSize))
|
||||||
else
|
else
|
||||||
print("RVA Failed",DataOffset)
|
print("RVA Failed",DataOffset)
|
||||||
Tree[Name] = ""
|
Tree[Name] = ""
|
||||||
|
Reference in New Issue
Block a user