home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / newc_dev / assignx.lha / NoReq.c < prev    next >
C/C++ Source or Header  |  1991-04-17  |  2KB  |  71 lines

  1. /************************************************************************/
  2. /*  EasyRequest trapper - deals with requests for nonexistant volumes   */
  3. /*                        V1.0, by Steve Tibbett                        */
  4. /************************************************************************/
  5. #include <Stdio.h>
  6. #include <libraries/gadtools.h>
  7. #include <intuition/intuition.h>
  8. #include <proto/gadtools.h>
  9. #include <proto/asl.h>
  10. #include <proto/exec.h>
  11. #include <proto/dos.h>
  12. #include <dos/dos.h>
  13. #include <exec/memory.h>
  14. #include <string.h>
  15. #include <ctype.h>
  16.  
  17. struct Library *IntuitionBase;
  18. struct Library *AslBase;
  19. struct Library *GfxBase;
  20. struct Remember *Remember;
  21.  
  22. void MemCleanup(void) { }
  23.  
  24. void *OrigFunc;
  25. void *OurVec;
  26.  
  27. /************************************************************************/
  28. /*                        The new "EasyRequest"                         */
  29. /************************************************************************/
  30. int __saveds __interrupt __asm
  31. NewFunc(register __a0 struct Window *Win, register __a1 struct EasyStruct *EZ, 
  32. register __a2 ULONG *idcmp, register __a3 ULONG *args)
  33. {
  34. int Res;
  35. int Mine=0;
  36.  
  37. if (strcmp((char *)args[0], "Please insert volume")==0)
  38.     return(0);
  39.  
  40. if (strcmp((char *)EZ->es_GadgetFormat, "Suspend|Reboot")==0)
  41.     return(0);
  42.  
  43. Res=MyFunc(Win, EZ, idcmp, args);
  44. return(Res);
  45. }
  46.  
  47.  
  48. main()
  49. {
  50. IntuitionBase=OpenLibrary("intuition.library", 36);
  51. AslBase=OpenLibrary("asl.library", 36);
  52. if (IntuitionBase==0 || AslBase==0)
  53.     return(10);
  54.  
  55. OrigFunc=SetFunction(IntuitionBase, -0x24c, NewFunc);
  56. if (OrigFunc==0) 
  57.     return(15);
  58.  
  59. Wait(SIGBREAKF_CTRL_C);
  60.  
  61. OurVec=SetFunction(IntuitionBase, -0x24c, OrigFunc);
  62.  
  63. if (OurVec!=NewFunc)
  64.     EasyRequester(NULL, "AssignX Request", "Error removing wedge!\nReboot soon!", "Okay");
  65.  
  66. FreeRemember(&Remember, TRUE);
  67. CloseLibrary(IntuitionBase);
  68. CloseLibrary(AslBase);
  69. return(0);
  70. }
  71.