SetFunction Manager SetMan / SetManager V1.0 Copyright © 1991,1992 by Nicola Salmoria Via Piemonte 11 53100 Siena ITALY Internet: mc6489@mclink.it This program is FREEWARE. It is NOT, and will never be, public domain. Copy it as much as you can (provided no charge is made and the archive is left intact). It cannot be included in any commercial program without the written permission of the author. NOVICE USERS ------------ The program 'SetMan' should be put in C: and executed as the first command in the startup-sequence. When I say first, I mean FIRST!! Run it even before SetPatch. If you're not expert with the Amiga operating system, all you need to know about SetMan is that it will, under certain circumstances, avoid GURUs. Read on for more infos. EXPERT USERS ------------ Let's go into details. There's a function in exec.library, whose name is SetFunction(). You know that Amiga libraries contain a 'jump table', where are stored the addresses of every function in the library. Library functions are always executed via the jump table, and NEVER through absolute addressing. SetFunction() allows the user to modify the jump table, in order to insert a custom routine in place of the standard one. For example, one could modify the DisplayBeep() vector to play a sound instead of flashing the screen. SetFunction() is a very useful feature of the Amiga operating system, but it has the major drawback that there's no system supervising of concurrent use of the same vector by different tasks. Under certain circumstances, that can be deadly. Before removing its custom vector, a program should check that it was not modified again. However, very few do that, and so if you do not terminate such program in REVERSE order of when you executed them, you'll probably get a system crash. Another fault of KickStart 1.x is that the dos.library vectors cannot be modified by SetFunction(), 'cos they do not follow the conventions estabilished by Commodore itself. SetMan modifies the SetFunction() vector, and inserts a custom routine which solves both of the previous problems. It keeps a linked list of all changes to the jump tables, and allows any program to remove its vector at any time. Moreover, it allows to modify dos.library vectors in a transparent, upward compatible, way. In this archive there's another free gift, whose name is SetManager. SetManager displays the list of all modified vectors, with the name of the program which inserted a custom routine, the address of that routine, and the current status. Status will usually be 'active'; if you click on the function name, you can disable it, thus removing the custom function. The third possible state is 'removed', which only occurs when you don't quit programs in the correct order I explained later. It's there for your information, but is absolutely no problem. When you exit the other program which uses the same vector, both will disappear from the list. NOTE: modified vectors are shown as 'offset' 'library name'. However, SetManager is able to read the standard 'xxx_lib.fd' files, provided by Commodore on the 'Extras' disk. just assign the name 'FD:' to a directory containing the .fd files, and they will be read and interpreted when you load SetManager. That way, you will get the true function names, instead of offsets. PROGRAMMERS ----------- You are strongly suggested to use SetMan facilities to modify the dos.library vectors. To know if SetMan is running, all you have to do is search for a public MsgPort named "SetMan". You need that only under KickStart 1.x, 'cos since version 2.0 of the operating system dos.library has joined the rest of us. However, SetMan is smart enough to use the custom routine for dos.library only if it's really the non-standard one. Here is an example of how to proceed: ----------------------- if (DOSBase->dl_lib.lib_Version < 36 && !FindPort("SetMan")) { printf("You need SetMan to execute this program!\n"); exit(RETURN_WARN); } else { TrueFunction = SetFunction((struct Library *)DOSBase,FUNCOFFSET,NewFunction); etc etc..... } ----------------------- BUGS AND INCOMPATIBILITIES -------------------------- There are no known bugs in this version of SetMan. A few more words should be spent on compatibility problems. Due to the very different procedures followed by the original SetFunction() and by SetMan, it's not possible to guarantee a 100% compatibility with every program around. Every effort has been made to avoid every possible problem; SetMan handles correctly every strange behaviour I could think about; the only way to confuse SetMan should be using two differnt programs communicating through a message port and doing very strange things. I'm almost sure such things things should never happen. I've encountered a problem with a program called 'TurboTopaz', which refuses to quit saying that 'Vector has been changed'. That's true, 'cos SetMan puts a function of its own ahead of the custom one; if TurboTopaz used SetFunction(), it would receive in return the value it expects, but it reads directly the jump table, something I believe is not supported by Commodore. I use a lot of programs which call SetFunction(), and none of them has problems with SetMan. ACKNOWLODGEMENT --------------- I'd like to thank Marco Ciuchini who pointed out an important incompatibility problem which I have been able to completely remove.