[net.micro.mac] Convering Data fork stuff to a CODE resource

espen@well.UUCP (Peter Espen) (09/29/86)

	Can anyone help me with this one? I am trying to take all the stuff
that's in the Data fork of a file and change it into a CODE type and put
it into the resource fork of the file. 
	The program that I'm trying to disassemble with MacNosy uses a
short program to read the Data file (it's actually code though) into RAM
and then sets up all the pointers and jumps to it. I've tried using TMON 
to just trace through the code when it's in RAM, but the program re-assigns
alot of the system pointers etc. and I can only trace so far with TMON before
the whole thing just blows up.
	MacNosy will only lets you disassemble all the stuff (like CODE types)
in the resource fork of APPL files. So what i really need to do is convert
the data fork to a resource fork of type CODE. 
	Any help would be appreciated.
	Peter Espen (espen@well)

tomas@apple.UUCP (Tom Taylor) (09/29/86)

In article <1851@well.UUCP> espen@well.UUCP (Peter Espen) writes:
>
>	Can anyone help me with this one? I am trying to take all the stuff
>that's in the Data fork of a file and change it into a CODE type and put
>it into the resource fork of the file. 
	...stuff deleted...
>	Any help would be appreciated.
>	Peter Espen (espen@well)

In the Macintosh Programmer's Workshop (MPW), the tool Rez (resource compiler)
supports a directive called "Read" that lets you read the data fork
of a file and save it as a resource.
	For example:

	Read 'CODE' (1) "TheFileName";

This statement would save the contents of TheFileName's data fork as a
CODE resource with an ID of 1.

Tom Taylor
Development Systems Group

bezanson@gumby.WISC.EDU (Brian Bezanson) (09/30/86)

In article <1851@well.UUCP>, espen@well.UUCP (Peter Espen) writes:
> 
> 	Can anyone help me with this one? I am trying to take all the stuff
> that's in the Data fork of a file and change it into a CODE type and put
> it into the resource fork of the file. 
> 	The program that I'm trying to disassemble with MacNosy uses a
> short program to read the Data file (it's actually code though) into RAM
> and then sets up all the pointers and jumps to it. I've tried using TMON 
> to just trace through the code when it's in RAM, but the program re-assigns
> alot of the system pointers etc. and I can only trace so far with TMON before
> the whole thing just blows up.
> 	MacNosy will only lets you disassemble all the stuff (like CODE types)
> in the resource fork of APPL files. So what i really need to do is convert
> the data fork to a resource fork of type CODE. 
> 	Any help would be appreciated.
> 	Peter Espen (espen@well)

Peter, 
     I have not used Nosy too much, except in playing around with it
(I'm still waiting for a real users manual), but in the later versions (2.1+)
you can load Nosy in one switcher partition and your program in another.
Then you tell Nosy to disassemble the file, it will see that you have loaded
it into switcher and you can play with it from there.  The latest version
of Nosy is 2.25 (or even higher now), which has this capability, plus the
ability to use the new debugger.  Get onto the Nosy SIG on Delphi and they
explain more on how to do this.  I hope this info helps.  If not, you can
always leave mail for MacNosy of Delphi and Jasik will answer your questions
fairly promptly.

Note: Standard disclaimer, I have no connection with Steve Jasik, aka MacNosy,
aka The Head Nose, etc...  I am just an impressed customer who can't wait
to have enough time to sit down and play with the sucker (MacNosy).

-- 
Brian Bezanson {seismo,ihnp4,allegra,topaz,harvard}!uwvax!gumby!bezanson
Manta Software Corp.				  bezanson@gumby.wisc.edu 

joel@gould9.UUCP (Joel West) (09/30/86)

You would take the output of the data fork in hex and then shove
it into a resource compiler.

Using RMaker, you would use the type GNRL followed by a .H, as described
in the appropriate documentation.  Using the MPW compiler Rez, you would
define a CODE as a type with just an integer array.
-- 
	Joel West			     MCI Mail: 282-8879
	Western Software Technology, POB 2733, Vista, CA  92083
	{cbosgd, ihnp4, pyramid, sdcsvax, ucla-cs} !gould9!joel
	joel%gould9.uucp@NOSC.ARPA