CFF Explorer Script

I’m implementing the LUA as scripting language in the CFF Explorer. It’s working very well and I managed to make it support unicode. Actually, it converts unicode down to utf8, but what’s important is that it keeps the characters as they are. The only thing to remember is that the code itself when handling strings is actually working with utf8 ones. That said, it doesn’t matter how the script is saved as a file on disk: it can be ascii, utf8 or unicode.

I’m not only adding functions for handling Portable Executables, but also a few to communicate with the user. Something similar to VBS with message box, input box, open file, save file, open folder etc.

Here’s a little example of how I implemented the message box function:

if MsgBox(“Continue?”, “My Script”, MB_YESNO | MB_ICONQUESTION) == IDYES then
   MsgBox(“Final Message Box”)
end

The syntax of the message box can be:

MsgBox(Caption)
or
MsgBox(Caption, Title)
or
MsgBox(Caption, Title, Type)

Of course, it will take some other time to write all the functions, but it won’t be too long. What I’m still thinking about is how modify a file multiple times or just one time. E.g.:

AddResource(“filename”, “resname”, ..)

but also:

filehandle = OpenFile(“filename”)
AddResource(filehandle, “resname”, ..)
CloseFile(filehandle)

So that a single file must not necessary be opened for every operation. On the other hand, it would be also very nice to modify a file with just one line of script. So, I’m looking for a way to implement both systems.