home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / DESQVIEW / MISC / NODV.ZIP / NODV.C next >
Encoding:
C/C++ Source or Header  |  1991-12-19  |  1.3 KB  |  58 lines

  1. /* JohnPC 1991
  2.  
  3.     From the quick programming series:
  4.     "How It Can Always Be Done Even Dirtier",
  5.     The public domain program, #42: The DESQview hider.
  6.  
  7.     Compiles under Borland C++ 2.0
  8. */
  9.  
  10. #ifndef __BORLANDC__
  11. #error Hah! And you thought you could port this?
  12. #endif
  13.  
  14. #ifndef __SMALL__
  15. #error Supposed to be compiled using the small memory model.
  16. #endif
  17.  
  18. #pragma inline
  19. #pragma hdrfile "nodv.sym"
  20. #include <stdio.h>
  21. #include <process.h>
  22. #include <dos.h>
  23. #pragma hdrstop
  24.  
  25. unsigned _stklen = 0x1000;
  26. unsigned _heaplen = 0x400;
  27.  
  28. void nodv21(void);
  29. void old21vec(void) { /* Now if this isn't ugly, tell me what is. */ }
  30. void interrupt (*far* old21p)(void);
  31.  
  32. void main(int argc, char** argv) {
  33.     int exitv;
  34.  
  35.     if ( argc == 1 ) {
  36.         puts("NODV is a commandline prefix that hides DESQview.\n\
  37. Just prepend it to the command you would normally enter.");
  38.         exit(-1);
  39.     }
  40.     old21p = (void interrupt (*far*)(void)) old21vec;
  41.     *old21p = getvect(0x21);
  42.     setvect(0x21, (void interrupt (*)(void)) nodv21);
  43.     if ( (exitv = spawnvp(P_WAIT, argv[1], argv + 1)) == -1 )
  44.         puts("Unknown command");
  45.     setvect(0x21, *old21p);
  46.     exit(exitv);
  47. }
  48.  
  49. void nodv21(void) {
  50.     asm pop bp;
  51.     if ( _AH == 0x2B && _CX == 0x4445 && _DX == 0x5351 ) {
  52.         _AL = 0xFF;
  53.         asm iret;
  54.     }
  55.     else
  56.         asm jmp dword ptr [cs:old21vec];
  57. }
  58.