From NSIS Wiki
|Author: Wizou (talk, contrib)|
nsisFile is a small NSIS plugin that manipulate file content, especially binary data.
You can typically use it to:
- search for binary patterns in file
- read or write (patch) binary data from/to binary files
The following is taken from the readme file in the downloadable zip file:
- nsisFile::BinToHex <string>
- Convert a string into an hexadecimal string representing the equivalent ANSI character bytes
- No terminating NUL (00) character and no formatting characters are added.
- nsisFile::HexToBin <hex string>
- Convert an hexadecimal string representing ANSI characters bytes into the equivalent string
- The string might be truncated to the first NUL (00) character encoutered.
- Eventual formatting characters are ignored.
- nsisFile::FileReadBytes <file handle> <length>
- Read <length> bytes from the given file and return them as an hexadecimal string
- nsisFile::FileWriteBytes <file handle> <hex string>
- Write to the given file the bytes sequence, given as hexadecimal string
- nsisFile::FileFindBytes <file handle> <hex string> <length>
- Search the given file for the bytes sequence, given as hexadecimal string.
- The search is done over <length> bytes from the file (this value should include the length of the bytes sequence)
- Use -1 as <length> to search the whole file.
- The result is -1 if not found, or the file offset found. (File pointer is automatically positioned to this offset)
- nsisFile::FileTruncate <file handle>
- Truncate the given opened file at the current file pointer (as positioned by NSIS FileSeek)
- File handle is the value returned by NSIS FileOpen function
- Function result is returned on NSIS stack (use Pop to retrieve it)
- You can use NSIS FileSeek function to move to a specific offset before calling these functions to specify where to start the operation
ZIP archive contains the plug-in DLLs (ANSI & Unicode NSIS) as well as documentation, source code and sample script