🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2484

Starting Windows, Debug Kernels ...

#2484
From: Brian Matusz
Date: Tue, 05 Jan 1993 17:37
117 lines
3524 bytes
Being posted for a friend ... followup to center03@cps201.cps.cmich.edu
-----------------------------------------------------------------------

I have come up with a use(less|ful) utility to start Windows when using
the Debug Kernels.  Since the kernels make BCW unbearably slow with the
syntax highlighting, I got tired of running them when I didn't need
them.  This simple C program prompts you for your intended Win mode
at startup.  Here's what I do:

1.  Compile winmode.c and put it in the path (somewhere)
2.  Create win.bat (see notes)
3.  Create current.mod files (see notes)
4.  Type "win" for windows as usual

Notes:

2.  Rename win.com to _win.com.  Create win.bat that contains:

@echo off
winmode \windows \c7
if errorlevel 1 goto Quit
_win %1 %2 %3 %4 %5
:Quit

Insert your Windows and C7 directories correctly on the command line
to winmode (don't add trailing backslashes!)

3.  Create the current.mod files:

This is easy ... in the DEBUG and NODEBUG directories of C7, create a
file called current.mod.  In DEBUG, it contains D[CR][CTRL-Z], and in
NODEBUG it contains N[CR][CTRL-Z] ... these files get copied into your
Windows system directory so winmode can find them and determine what
mode you're in!

NOTES:

It may seem petty, and some work to do it at that, but it's been worth
it for me.  When I type WIN now, I know what mode I was in, and know
what mode I'm going to be in.  If you don't want it, ignore it.

Brad Wilson
center03@cps201.cps.cmich.edu

---------- 8<  Clip here for winmode.c  >8 -----------

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main( int argc, char *argv[] )
{
  char  answer, szTemp[ 128 ], current;
  FILE *file;

  if( argc != 3 )
  {
    printf( "usage: winmode windir sdk31dir\n" );
    return 1;
  }

  sprintf( szTemp, "%s\\system\\current.mod", argv[ 1 ]);
  file = fopen( szTemp, "r" );

  if( file )
  {
    fgets( szTemp, sizeof szTemp, file );
    fclose( file );
    current = toupper( szTemp[ 0 ]);
  }
  else
    current = '?';

  printf( "\nWindows 3.1 Execution Options:\n" );
  printf( "  [D] Debugging kernels        %s\n", 
    current == 'D' ? "(default)" : "" );
  printf( "  [N] Non-debugging kernels    %s\n", 
    current == 'N' ? "(default)" : "" );
  printf( "  [A] Abort, don't run Windows\n\n" );
  printf( "Selection: " );

  scanf( "%c", &answer );

  switch( toupper( answer ))
  {
  case 'D':
    if( current != 'D' )
    {
      printf( "\nInstalling debugging kernels ... " );
      sprintf( szTemp, "xcopy %s\\debug %s\\system > nul", 
        argv[ 2 ], argv[ 1 ]);
      system( szTemp );
    }
    return 0;

  case 'N':
    if( current != 'N' )
    {
      printf( "\nInstalling retail kernels ... " );
      sprintf( szTemp, "xcopy %s\\nodebug %s\\system > nul", 
        argv[ 2 ], argv[ 1 ]);
      system( szTemp );
    }
    return 0;

  case 'A':
    return 1;

  default:
    return 0;
  }
}
-- 

---
bcmatusz@vela.acs.oakland.edu
"Use DEVICE=EXXON to screw up your environment."
Technical Details
Message-ID: <1993Jan5.173713.29747@vela.acs.oakland.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dog.ee.lbl.gov!news!vela!bcmatusz

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dog.ee.lbl.gov!news!vela!bcmatusz
From: bcmatusz@vela.acs.oakland.edu (Brian Matusz)
Subject: Starting Windows, Debug Kernels ...
Message-ID: <1993Jan5.173713.29747@vela.acs.oakland.edu>
Organization: Oakland University, Rochester MI.
Date: Tue, 5 Jan 1993 17:37:13 GMT
Lines: 117