Skip to content

Commit 0cf7502

Browse files
committed
Refined PE95TIME.LUA description string for clarity and added argument usage.
1 parent d83df06 commit 0cf7502

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

demo/xtra/PE95TIME.LUA

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env lua
22

3-
I,X,V,H="<I4",0x80000000,809222400,[[This script will edit timestamps in a PE EXE with the Windows 95 release date.
4-
Doing so allows repeatable builds to be verified by checksum. Make a backup of your EXE before using this tool on it.]]
3+
I,X,V,H="<I4",0x80000000,809222400,[[This script edits timestamps in a PE formatted EXE to the Windows 95 release date.
4+
This allows repeatable builds to be verified by checksum tools. Backup the EXE before using this tool on it.]]
55
function C(x)return F:seek("cur",x)end
66
function S(x)return F:seek("set",x)end
77
function R(l)local b=F:read(l)if b and#b>=l then return string.unpack(l==2 and"<I2"or I,b)end error("!EOF")end
@@ -13,14 +13,13 @@ function O()
1313
for _=1,n do local u,o=C(),F:read(8):gsub("\0.*","")C(4)J=R(4)C(4)K=R(4)S(u+40)if o==".rsrc"then return end end error("!rsrc")end
1414
function B(p,s)
1515
S((p-J)+K)local d,t,k=F:read(s),("VS_VERSION_INFO"):gsub(".","\0%1").."\0\0"k=d:find(t,1,true)
16-
if k then k=k+#t+((4-((k+#t)%4))%4)+44 d,t=C()+(k-s)W(d,0)W(d+4,V)end
17-
end
16+
if k then k=k+#t+((4-((k+#t)%4))%4)+44 d,t=C()+(k-s)W(d,0)W(d+4,V)end end
1817
function A(o,l,v)
1918
local d,n,i,t,e=K+o+4 W(d,V)C(4)n,i=R(2),R(2)t,e=n+i,d+12
2019
for j=0,t-1 do S(e+(j*8))i,d=R(4),R(4)
2120
if(d&X)~=0 then A(d&(X-1),l+1,v or(l==1 and i==16))
2221
elseif v and l==3 then local r=C()S(K+d)B(R(4),R(4))S(r)end end end
23-
if #arg<1 then print(H)os.exit(1)end
22+
if #arg<1 then print(arg[0],"'PEFORMAT.EXE'\n\n"..H)os.exit(1)end
2423
F=assert(io.open(arg[1],"r+b"))J=P()W(J+8,V)O()
2524
A(0,1)F:close()
2625
print("OK")

0 commit comments

Comments
 (0)