On Tue, 26 Oct 1999, Geoff Canyon wrote:

(snip)

> I then opened the application with BBEdit, and searched for the text, 
> "This is the really the text to modify." When I found it, I changed it 
> to, "This is some dangerous text to modify." (note the identical 
> character length)
> 
> I saved Mod.app out of BBEdit, and quit BBEdit.
> 
> I ran Mod.app, and clicked the button. Voila! the field contained "This 
> is some dangerous text to modify."
> 
> My questions are:
> 
> 1. Is this dangerous? (obviously, yes)

Yes.

> 2. Is there a way to write another MetaCard application to do this? (also 
> obviously, yes--a MetaCard application could do the same thing I did with 
> BBEdit--the file can be read/written as binary if necessary)

Yes.

> 3. Is there a better way to do this with a MetaCard application? In other 
> words, is it possible with a MetaCard application to do this with 
> something like,
> 
> Set the testProperty of application "Mod.app" to "This is some dangerous 
> text to modify."
> 
> I'm assuming the answer to 3 is no.

Right again.

> 4. If I write an application to go in and hack the string, as in 2, does 
> the string have to stay the same length? (my guess would be yes, but 
> obviously this is dependant on MetaCard's internal data structures, and 
> so is more of a question for Kevin or Scott)

There is no CRC or other bitwise check on stack integrity, so as long
as the string stays the same size, there's no technical reason why you
can't do this.  For some strings, it'd even be possible to change the
length.  For example, most of the things that have a uint2 (64K)
length limit have a 2-byte length stored at the front of them.
Unfortunately changing the length of scripts and custom properties and
other things that don't have this limit isn't practical because the
lengths are stored in different ways for these.

Changing a stack this way is still a dangerous thing to do, though,
and you should be *very* sure that the strings you're replacing are
unique in the stack because it's possible that normal object storage
could generate the source strings.  It's also not possible to do this
in password protected stacks, nor is it possible for a standalone to
modify itself (at least on Windows and UNIX systems), so a separate
application would be required.  And of course, someday we might change
the file format (actually we're about guaranteed to do this), so your
best long-term solution is to store stuff that needs to change in a
separate "preferences" stack.

Another think you might consider is distributing an updater that
actually builds a new standalone using a new stack and the engine from
the old standalone.  It's the same kind of process, but much safer
because it doesn't involve changing the stacks themselves.  You're on
your own if you want to try this, but you should be able to figure it
out using the scripts in the standalone builder.
  Regards,
    Scott

> Geoff Canyon
> [EMAIL PROTECTED]
> Your child can learn to read using the classics of children's literature.
> Check out C.D. Caterpillar: <http://www.inspiredlogic.com/cd/>


********************************************************
Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...

Reply via email to