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

Re: how to modify string in binary files ?



In <4A9CD48B.6040208@cox.net>, Ron Johnson wrote:
>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
>> 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.
>> 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...

Which you should be able to tell upon inspection.  If there's no '\0' after 
your string, using them as terminators is probably useless.
-- 
Boyd Stephen Smith Jr.                   ,= ,-_-. =.
bss@iguanasuicide.net                   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy         `-'(. .)`-'
http://iguanasuicide.net/                    \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: