home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************/
- /* */
- /* SmartIcon, release 1.0 - An Intuition object iconifier for the Amiga */
- /* Copyright (c) 1988 Gauthier H. Groult */
- /* */
- /* Written in January 1988 by Gauthier H. Groult */
- /* 33, Boulevard Saint Denis, */
- /* 92400 Courbevoie */
- /* France - Europe */
- /* Tel: (16) 1 47 89 09 54 */
- /* email: mcvax!inria!litp!germinal!groult */
- /* */
- /* This source code is not in public domain, please do not distribute. */
- /* The binary program is shareaware. Read docs files for details. */
- /* */
- /***************************************************************************/
-
- #include <exec/types.h>
-
- typedef LONG (*PFL)();
-
- extern struct ExecBase *SysBase;
- extern struct IntuitionBase *IntuitionBase;
-
- extern LONG OWentry_point(), CWentry_point(), MIentry_point(),
- PMentry_point();
- extern VOID MyOpenWindow(), MyCloseWindow(), MyPutMsg();
-
- /* The SetHooks() and CleanHooks() functions set the parameters for */
- /* the SetFunction() calls and execute those. By doing so, the */
- /* libraries (namely Exec and Intuition) vector tables are patched so */
- /* that calls to the specified functions go trough our code before or */
- /* after doing their normal stuff. */
- /* We must save the old pointers to restore them when exiting. */
- /* */
- /* This is derived from DropShadow's hooks. */
-
- VOID SetHooks(), CleanHooks();
-
- struct hook
- {
- LONG hk_SysFunc;
- PFL hk_MyFunc;
- PFL hk_Entry;
- LONG hk_LVO;
- };
-
- struct hook owhook =
- {
- 0,
- (PFL)MyOpenWindow,
- (PFL)OWentry_point,
- -204
- };
-
- struct hook cwhook =
- {
- 0,
- (PFL)MyCloseWindow,
- (PFL)CWentry_point,
- -72
- };
-
- struct hook mihook =
- {
- 0,
- NULL,
- (PFL)MIentry_point,
- -150
- };
-
- struct hook pmhook =
- {
- 0,
- (PFL)MyPutMsg,
- (PFL)PMentry_point,
- -366
- };
-
- VOID
- SetHooks()
- {
- Forbid();
- owhook.hk_SysFunc = SetFunction(IntuitionBase,owhook.hk_LVO,owhook.hk_Entry);
- cwhook.hk_SysFunc = SetFunction(IntuitionBase,cwhook.hk_LVO,cwhook.hk_Entry);
- mihook.hk_SysFunc = SetFunction(IntuitionBase,mihook.hk_LVO,mihook.hk_Entry);
- pmhook.hk_SysFunc = SetFunction(SysBase,pmhook.hk_LVO,pmhook.hk_Entry);
- Permit();
- }
-
- VOID
- CleanHooks()
- {
- SetFunction(IntuitionBase,owhook.hk_LVO,owhook.hk_SysFunc);
- SetFunction(IntuitionBase,cwhook.hk_LVO,cwhook.hk_SysFunc);
- SetFunction(IntuitionBase,mihook.hk_LVO,mihook.hk_SysFunc);
- SetFunction(SysBase,pmhook.hk_LVO,pmhook.hk_SysFunc);
- }
-
-