home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4604 < prev    next >
Encoding:
Text File  |  1993-01-05  |  3.3 KB  |  127 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dog.ee.lbl.gov!news!vela!bcmatusz
  3. From: bcmatusz@vela.acs.oakland.edu (Brian Matusz)
  4. Subject: Starting Windows, Debug Kernels ...
  5. Message-ID: <1993Jan5.173713.29747@vela.acs.oakland.edu>
  6. Organization: Oakland University, Rochester MI.
  7. Date: Tue, 5 Jan 1993 17:37:13 GMT
  8. Lines: 117
  9.  
  10. Being posted for a friend ... followup to center03@cps201.cps.cmich.edu
  11. -----------------------------------------------------------------------
  12.  
  13. I have come up with a use(less|ful) utility to start Windows when using
  14. the Debug Kernels.  Since the kernels make BCW unbearably slow with the
  15. syntax highlighting, I got tired of running them when I didn't need
  16. them.  This simple C program prompts you for your intended Win mode
  17. at startup.  Here's what I do:
  18.  
  19. 1.  Compile winmode.c and put it in the path (somewhere)
  20. 2.  Create win.bat (see notes)
  21. 3.  Create current.mod files (see notes)
  22. 4.  Type "win" for windows as usual
  23.  
  24. Notes:
  25.  
  26. 2.  Rename win.com to _win.com.  Create win.bat that contains:
  27.  
  28. @echo off
  29. winmode \windows \c7
  30. if errorlevel 1 goto Quit
  31. _win %1 %2 %3 %4 %5
  32. :Quit
  33.  
  34. Insert your Windows and C7 directories correctly on the command line
  35. to winmode (don't add trailing backslashes!)
  36.  
  37. 3.  Create the current.mod files:
  38.  
  39. This is easy ... in the DEBUG and NODEBUG directories of C7, create a
  40. file called current.mod.  In DEBUG, it contains D[CR][CTRL-Z], and in
  41. NODEBUG it contains N[CR][CTRL-Z] ... these files get copied into your
  42. Windows system directory so winmode can find them and determine what
  43. mode you're in!
  44.  
  45. NOTES:
  46.  
  47. It may seem petty, and some work to do it at that, but it's been worth
  48. it for me.  When I type WIN now, I know what mode I was in, and know
  49. what mode I'm going to be in.  If you don't want it, ignore it.
  50.  
  51. Brad Wilson
  52. center03@cps201.cps.cmich.edu
  53.  
  54. ---------- 8<  Clip here for winmode.c  >8 -----------
  55.  
  56. #include <stdio.h>
  57. #include <stdlib.h>
  58. #include <ctype.h>
  59.  
  60. int main( int argc, char *argv[] )
  61. {
  62.   char  answer, szTemp[ 128 ], current;
  63.   FILE *file;
  64.  
  65.   if( argc != 3 )
  66.   {
  67.     printf( "usage: winmode windir sdk31dir\n" );
  68.     return 1;
  69.   }
  70.  
  71.   sprintf( szTemp, "%s\\system\\current.mod", argv[ 1 ]);
  72.   file = fopen( szTemp, "r" );
  73.  
  74.   if( file )
  75.   {
  76.     fgets( szTemp, sizeof szTemp, file );
  77.     fclose( file );
  78.     current = toupper( szTemp[ 0 ]);
  79.   }
  80.   else
  81.     current = '?';
  82.  
  83.   printf( "\nWindows 3.1 Execution Options:\n" );
  84.   printf( "  [D] Debugging kernels        %s\n", 
  85.     current == 'D' ? "(default)" : "" );
  86.   printf( "  [N] Non-debugging kernels    %s\n", 
  87.     current == 'N' ? "(default)" : "" );
  88.   printf( "  [A] Abort, don't run Windows\n\n" );
  89.   printf( "Selection: " );
  90.  
  91.   scanf( "%c", &answer );
  92.  
  93.   switch( toupper( answer ))
  94.   {
  95.   case 'D':
  96.     if( current != 'D' )
  97.     {
  98.       printf( "\nInstalling debugging kernels ... " );
  99.       sprintf( szTemp, "xcopy %s\\debug %s\\system > nul", 
  100.         argv[ 2 ], argv[ 1 ]);
  101.       system( szTemp );
  102.     }
  103.     return 0;
  104.  
  105.   case 'N':
  106.     if( current != 'N' )
  107.     {
  108.       printf( "\nInstalling retail kernels ... " );
  109.       sprintf( szTemp, "xcopy %s\\nodebug %s\\system > nul", 
  110.         argv[ 2 ], argv[ 1 ]);
  111.       system( szTemp );
  112.     }
  113.     return 0;
  114.  
  115.   case 'A':
  116.     return 1;
  117.  
  118.   default:
  119.     return 0;
  120.   }
  121. }
  122. -- 
  123.  
  124. ---
  125. bcmatusz@vela.acs.oakland.edu
  126. "Use DEVICE=EXXON to screw up your environment."
  127.