home *** CD-ROM | disk | FTP | other *** search
/ IBM Presents OS/2 Software Hits 1995 / OS-2_SW_HITS_2ND_EDITION_1995.ISO / i17 / pmx20c1.exe / PMXC1.ZIP / BIN / HOOKINST.CMD < prev    next >
OS/2 REXX Batch file  |  1994-01-21  |  3KB  |  79 lines

  1. /*Rexx*/
  2. /***********************************************************************
  3.  *  December 1993 RLM -- HOOKINST.CMD -- installs new PMX GREHOOK.DLLL
  4.  *  Copyright (C) 1993, 1994 IBM Corporation
  5.  ***********************************************************************
  6.  */
  7.    parse arg newHookPath .
  8.  
  9.    if (newHookPath='?') then do
  10.       say "HOOKINST.CMD --"
  11.       say "   A PMX 2.0 utility for installing a PMX Graphics Engine Hook DLL"
  12.       say "   This is a prerequisite for enabling PMX"
  13.       say "   PseudoColor support using PM Palette Manager functions."
  14.       say "   An entry in OS2.INI must point to the PMX GREHOOK DLL."
  15.       say " "
  16.       say "   HOOKINST manipulates the OS2.INI entry for the PMX GREHOOK DLL."
  17.       say " "
  18.       say "Command formats:"
  19.       say "   hookinst            -- displays current PMX GREHOOK DLL path"
  20.       say "   hookinst delete     -- deletes PMX GREHOOK entry in OS2.INI"
  21.       say "   hookinst d:\tcpip\dll\grehook.dll"
  22.       say "                       -- creates a PMX GREHOOK entry in OS2.INI"
  23.       exit 1
  24.    end
  25.  
  26.    RC=RXFUNCQUERY('SysIni')
  27.    if (RC<>0) then do
  28.      RC=RXFUNCADD('SysIni','REXXUTIL','SysIni')
  29.      if (RC<>0) then do
  30.         say "Rexx failure: rxfuncadd(sysini,rexutil,sysini) rc=" rc
  31.         say "Please check that Rexx has been properly installed on your OS/2 system."
  32.         exit rc
  33.      end
  34.    end
  35.  
  36.    /* -- Check to see if there is a hook currently installed: */
  37.    currHook = SysIni('USER','PM_ED_HOOKS','GREHOOK')
  38.    if (currHook='ERROR:') then do
  39.       say "There is no current PMX GREHOOK installed!"
  40.    end
  41.    else do
  42.       say "The current PMX GREHOOK is located at" currHook "."
  43.    end
  44.  
  45.    if (length(newHookPath)=0) then do
  46.       exit 0
  47.    end
  48.    else if ('DELETE'=translate(newHookPath)) then do
  49.       say "Deleting OS2.INI entry for current PMX GREHOOK.DLL..."
  50.       delHook = SysIni('USER','PM_ED_HOOKS','GREHOOK','DELETE:')
  51.       say "... PMX GREHOOK deleted from OS2.INI."
  52.       say "You now need to reboot OS/2 in order to actually unload the DLL."
  53.       exit 0
  54.    end
  55.    else do
  56.       newHook = stream( newHookPath, 'C', 'query exists' )
  57.  
  58.       if (0=length(newHook)) then do
  59.          say "Cannot locate this PMX GREHOOK file:" newHookPath
  60.          exit 10
  61.       end
  62.  
  63.       say "Adding PMX GREHOOK to OS2.INI:" newHook
  64.       newHook = newHook || d2c(0) /* place NULL char at end */
  65.       okHook = SysIni('USER','PM_ED_HOOKS','GREHOOK', newHook )
  66.  
  67.       if (length(okHook)=0) then do
  68.          say "Successfully added PMX GREHOOK to OS2.INI."
  69.          say "You now need to reboot OS/2 in order to actually load the DLL."
  70.          exit 0
  71.       end
  72.       else do
  73.          say "Error occurred when adding PMX GREHOOK to OS2.INI."
  74.          exit 20
  75.       end
  76.  
  77.       exit 0
  78.    end
  79.