mirror of
https://github.com/TangentFoxy/love-pe.git
synced 2025-07-28 10:12:16 +00:00
Finally extracts the icon correctly !!!!!!
This commit is contained in:
@@ -7,7 +7,8 @@ local icodata = iconChanger.extractIcon(exeFile)
|
|||||||
|
|
||||||
- Reference:
|
- Reference:
|
||||||
Version File Resource: https://msdn.microsoft.com/en-us/library/ms647001(v=vs.85).aspx
|
Version File Resource: https://msdn.microsoft.com/en-us/library/ms647001(v=vs.85).aspx
|
||||||
|
Icons:
|
||||||
|
https://msdn.microsoft.com/en-us/library/ms997538.aspx
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local bit = require("bit")
|
local bit = require("bit")
|
||||||
@@ -202,6 +203,12 @@ local function readResourceDirectoryTable(exeFile,Sections,RootOffset,Level)
|
|||||||
|
|
||||||
local DataOffset = convertRVA2Offset(DataRVA,Sections)
|
local DataOffset = convertRVA2Offset(DataRVA,Sections)
|
||||||
|
|
||||||
|
print("Data RVA Offset",DataRVA,DataOffset)
|
||||||
|
|
||||||
|
print("Data Codepage",DataCodepage)
|
||||||
|
|
||||||
|
exeFile:seek(DataOffset)
|
||||||
|
|
||||||
Tree[Name] = exeFile:read(DataSize)
|
Tree[Name] = exeFile:read(DataSize)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -321,15 +328,15 @@ function icapi.extractIcon(exeFile)
|
|||||||
--Icon extraction process
|
--Icon extraction process
|
||||||
local IconGroup = ResourcesTree["Group Icons"]["1"]["1033"]
|
local IconGroup = ResourcesTree["Group Icons"]["1"]["1033"]
|
||||||
|
|
||||||
|
--if true then return "MEH" end
|
||||||
|
|
||||||
do
|
do
|
||||||
local Icons = {""}
|
local Icons = {""}
|
||||||
|
|
||||||
local o = 5 --String Offset
|
local o = 5 --String Offset
|
||||||
|
|
||||||
--Read the icon header
|
--Read the icon header
|
||||||
local Count = decodeNumber(IconGroup:sub(o,o+1))
|
local Count = decodeNumber(IconGroup:sub(o,o+1),true)
|
||||||
|
|
||||||
error(Count)
|
|
||||||
|
|
||||||
o = o+2
|
o = o+2
|
||||||
|
|
||||||
@@ -338,7 +345,8 @@ function icapi.extractIcon(exeFile)
|
|||||||
for i=1,Count do
|
for i=1,Count do
|
||||||
o = o+12
|
o = o+12
|
||||||
|
|
||||||
local IcoID = decodeNumber(IconGroup:sub(o,o+1))
|
local IcoID = decodeNumber(IconGroup:sub(o,o+1),true)
|
||||||
|
print("IcoID",IcoID)
|
||||||
|
|
||||||
if not ResourcesTree["Icons"][tostring(IcoID)] then error(IcoID) end
|
if not ResourcesTree["Icons"][tostring(IcoID)] then error(IcoID) end
|
||||||
|
|
||||||
@@ -346,7 +354,7 @@ function icapi.extractIcon(exeFile)
|
|||||||
|
|
||||||
local Length = #Icons[#Icons]
|
local Length = #Icons[#Icons]
|
||||||
|
|
||||||
IconGroup = IconGroup:sub(1,o-1) .. encodeNumber(DataOffset,4,true) .. IconGroup:sub(o+2,-1)
|
IconGroup = IconGroup:sub(1,o-1) .. encodeNumber(DataOffset,4) .. IconGroup:sub(o+2,-1)
|
||||||
|
|
||||||
o = o + 4
|
o = o + 4
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user