Archive: Finding a string in a stream of bytes


Finding a string in a stream of bytes
I know about ${StrStr} in StrFunc.nsh.
I also know about ${WordFind} in appendix E.3.2

The "problem" with those is that they can find a string only within another string. That is, the "container" for the string to be found must be a well behaving, non-special-characters string.

My question now: Is there similar function (or plug-in) in NSIS that find a string within any stream of bytes?

Case in question: I am trying to find a certain string inside a binary file. I know how to do this in C/C++. Is this doable from within the NSIS scripting language?


Ah! Once again, after exhausting all search possibilities, I discovered that I missed one: Google NSIS Search.

I typed "string binary" in the search box and look what I have found:

BinStrSearch

"This function will find a text string in a binary file and returns the offset in the file"
I think that this is what I was looking for. :)

Actually I was too quick to celebrate. The BinStrSearch function finds a string in a binary file.

I need to do that search not in a file but rather in a variable (buffer).

I will keep searching... (no pun intended :))