Skip to content

Commit e0375d1

Browse files
committed
Add more comments to fake_code_signer.rb
1 parent 4005673 commit e0375d1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/fake_code_signer.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,17 @@ def sign
3232
raise "input and output files must be different!"
3333
end
3434

35+
# Below we access an instance of the IMAGE_DATA_DIRECTORY struct.
36+
# This instance is called IMAGE_DIRECTORY_ENTRY_SECURITY and it contains information about the digital signature
37+
# see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680305(v=vs.85).aspx
38+
39+
# write the offset (address) of the digital signature to the security header (VirtualAddress field)
3540
@image[pe_header.security_offset, 4] = raw_bytes(@image.size + @padding)
3641

42+
# write the size of the digital signature to the security header (Size field)
3743
@image[pe_header.security_offset + 4, 4] = raw_bytes(FAKE_SIG.size)
44+
45+
# append the "digital signature" to the end of the executable, complete with padding
3846
@image << padding_string << FAKE_SIG
3947

4048
File.binwrite(@output, @image)

0 commit comments

Comments
 (0)