home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* EasyRequest trapper - deals with requests for nonexistant volumes */
- /* V1.0, by Steve Tibbett */
- /************************************************************************/
- #include <Stdio.h>
- #include <libraries/gadtools.h>
- #include <intuition/intuition.h>
- #include <proto/gadtools.h>
- #include <proto/asl.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <dos/dos.h>
- #include <exec/memory.h>
- #include <string.h>
- #include <ctype.h>
-
- struct Library *IntuitionBase;
- struct Library *AslBase;
- struct Library *GfxBase;
- struct Remember *Remember;
-
- void MemCleanup(void) { }
-
- void *OrigFunc;
- void *OurVec;
-
- /************************************************************************/
- /* The new "EasyRequest" */
- /************************************************************************/
- int __saveds __interrupt __asm
- NewFunc(register __a0 struct Window *Win, register __a1 struct EasyStruct *EZ,
- register __a2 ULONG *idcmp, register __a3 ULONG *args)
- {
- int Res;
-
- if (args && args[0])
- {
- if (strcmp((char *)args[0], "Please insert volume")==0)
- return(0);
-
- if (strcmp((char *)EZ->es_GadgetFormat, "Suspend|Reboot")==0)
- return(0);
- };
-
- Res=MyFunc(Win, EZ, idcmp, args);
- return(Res);
- }
-
-
- main()
- {
- IntuitionBase=OpenLibrary("intuition.library", 36);
- AslBase=OpenLibrary("asl.library", 36);
- if (IntuitionBase==0 || AslBase==0)
- return(10);
-
- OrigFunc=SetFunction(IntuitionBase, -0x24c, NewFunc);
- if (OrigFunc==0)
- return(15);
-
- Wait(SIGBREAKF_CTRL_C);
-
- OurVec=SetFunction(IntuitionBase, -0x24c, OrigFunc);
-
- if (OurVec!=NewFunc)
- EasyRequester(NULL, "AssignX Request", "Error removing wedge!\nReboot soon!", "Okay");
-
- FreeRemember(&Remember, TRUE);
- CloseLibrary(IntuitionBase);
- CloseLibrary(AslBase);
- return(0);
- }
-