[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to modify string in binary files ?



On 2009-09-01 01:03, Jerome BENOIT wrote:
Hello Chris !

Chris Jones wrote:
On Mon, Aug 31, 2009 at 08:08:50PM EDT, Jerome BENOIT wrote:
Hello List,

I would like to change the string of a file name in a (propriety) binary:
if applicable, how can we do that ?

Use vim's binary mode.
$ vim -b binary-file

And before you start editing:

:h edit-binary

I have just tried.

It is claimed that

 When editing executable files the number of characters must not change.
 Use only the "R" or "r" command to change text.  Do not delete characters
 with "x" or by backspacing.

So a string cannot be made longer.
Can we make a string shorter ?

The program is going to expect certain "stuff" to be at certain places within the file. Adding or removing bytes is *definitely* A VERY BAD THING.

The first idea that comes is to put a '\n' at the desired end of the string
and then fill the extra with '\0': is it safe.

IFF the app was written in a language that uses \0 as the string terminator...

Otherwise, as no HEX code appears, is `bvi' a good alternative ?

It's what I'd use...

--
Brawndo's got what plants crave.  It's got electrolytes!


Reply to: