Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!ames!ucbcad!ucbvax!hoser.berkeley.edu!bryce From: bryce@hoser.berkeley.edu (Bryce Nesbitt) Newsgroups: comp.sys.amiga Subject: Re: Help with SetFunction() Message-ID: <22035@ucbvax.BERKELEY.EDU> Date: Thu, 3-Dec-87 05:34:23 EST Article-I.D.: ucbvax.22035 Posted: Thu Dec 3 05:34:23 1987 Date-Received: Sun, 6-Dec-87 23:49:41 EST References: <4562@pyr.gatech.EDU> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: bryce@hoser.berkeley.edu (Bryce Nesbitt) Organization: University of California at Berkeley Lines: 40 In article <4562@pyr.gatech.EDU> davidc%yak@gatech.edu (Dave Corbin) writes: >Correct me where I go wrong. SetFunction allows you to patch in your own >replacement function for a function in a library. True. Also note that if you want to replace a vector you *must* use SetFunction()... it is not good enough to just patch it yourself. >Thus, if I want to monitor >certain calls (like all SizeWindow()s, or some such), I should be able to use >SetFunction to do it. True, sort of. Intuition itself does not loop back through the library vectors. Thus any program calling SizeWindow() would trigger, but mousing arround would produce no results. >Here's my problem. I get back a zero value from the >SetFunction, and apparently my new routine is NOT being called. Can someone >offer me some info on what the most likely stumbling blocks are? Zero result is wrong, it should return the old function's address. (This will be something in the $00FC0000-$00FFFFFF range, but don't count on it). You are using 68000, right? 1/2 :-). A1 must contain a pointer to the library base, A0 must contain an offset just as you might use to call the routine (_LVOSizeWindow), and D0 must contain the address of your new function. Here's a fragment from my requester Cancel!ing Cancel! program: ;SetFunction lock structure lea.l NewAutoRequest-HS(a2),a0 ;our new function move.l a0,d0 move.w #_LVOAutoRequest,a0 ;offset move.l IBase,a1 ;library jsrlib SetFunction |\ /| . Ack! (NAK, SOH, EOT) {o O} . bryce@hoser.berkeley.EDU -or- ucbvax!hoser!bryce (") U WARNING: hoser's spool directory eats a *lot* of mail. :-(