home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / 1601_200.zip / UNINSTAL.CMD < prev    next >
OS/2 REXX Batch file  |  1996-07-16  |  8KB  |  206 lines

  1. /********************************************************************/
  2. /********************************************************************/
  3.  
  4. '@echo off'
  5. say ''
  6. 'echo USE: "uninstal clean" to remove all MGA drivers from hard disk"'
  7. say ''
  8. 'echo Press Ctrl+C to abort'
  9. 'pause'
  10.  
  11. CurDir=directory()
  12.  
  13. /********************************************************************/
  14. /* Search for OS2 system path in PATH environement                  */
  15. /********************************************************************/
  16.  
  17. env = 'OS2ENVIRONMENT'
  18. Path = value('PATH',,env)
  19. if Path = '' then signal ENDSEARCH
  20.  
  21. ntmp = pos(':\OS2;', Path)
  22. if ntmp = 0 then signal ENDSEARCH
  23.  
  24. Dstdrv=substr(Path, ntmp-1,2)
  25.  
  26. /*********************************************************************/
  27. /* remove any MGA statement from CONFIG.SYS                          */
  28. /*********************************************************************/
  29.  
  30. NewDir=directory(Dstdrv'\')             /* go to root off OS/2 drive */
  31. InnF=Dstdrv'\CONFIG.MGA'
  32. OutF=Dstdrv'\CONFIG.SYS'
  33. 'copy 'OutF' 'InnF' >nul'
  34. 'del 'OutF
  35.  
  36. do until lines(InnF) = 0
  37.     InStr = linein(InnF)
  38.     select
  39.         when pos('MGAKRNL.SYS', InStr) > 0  then nop    /* Terminator       */
  40.         when pos('MGA=', InStr) > 0         then nop    /* Termin / Millen  */
  41.         when pos('MGARES=', InStr) > 0      then nop    /* Terminator < 2.0 */
  42.         when pos('VIO_MGA', InStr) > 0      then nop    /* Termin / Millen  */
  43.         when pos('RAMBIOS.SYS', InStr) > 0  then nop    /* Terminator < 2.0 */
  44.         when pos('VMGA.SYS', InStr) > 0     then nop    /* Terminator       */
  45.         when pos('KMGAX64.SYS', InStr) > 0  then nop    /* Millennium       */
  46.         when pos('VMGAX64.SYS', InStr) > 0  then nop    /* Millennium       */
  47.         otherwise
  48.         do
  49.             if pos('LIBPATH=', InStr) > 0   then        do
  50.                 itmp = pos(':\MGA\OS', InStr)
  51.                 if itmp > 0 then stmp=delstr(InStr, itmp-1, 11)
  52.                 else stmp=InStr
  53.                 call lineout OutF, stmp
  54.             end
  55.             else do
  56.                 itmp = pos(':\MGA\OS2', InStr)
  57.                 if itmp = 0 then  call lineout OutF, InStr
  58.                 end
  59.         end
  60.     end
  61. end
  62.  
  63. call stream OutF, 'c', 'close'
  64. call stream InnF, 'c', 'close'
  65. 'del 'InnF
  66.  
  67. /**********************************/
  68. /* remove MGAs from  AUTOEXEC.BAT */
  69. /**********************************/
  70.  
  71. 'call 'Dstdrv'\MGA\OS2\FIXAUTO.CMD 'Dstdrv' OFF'
  72.  
  73. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  74. call sysloadfuncs
  75. ver = SysOS2Ver()
  76.  
  77. /************************************/
  78. /* remove MGAHK from Startup folder */
  79. /************************************/
  80.  
  81. Result = SysDestroyObject('<MGAHK>')
  82.  
  83. /********************************************************************/
  84. /* Get arguments if any                                             */
  85. /********************************************************************/
  86.  
  87. Parse Arg all
  88. If words(all) = 1 then OPTION = translate(word(all,1))
  89. if OPTION \= 'CLEAN' then signal Finished
  90.  
  91. /********************************************************************/
  92. /* Search for WinOS2 path in OS2.INI                                */
  93. /********************************************************************/
  94.  
  95. Windrv=Dstdrv                           /* default value */
  96. WinDir=Windrv'\OS2\MDOS\WINOS2'         /* default value */
  97. FoundWindir=0                           /* not found yet */
  98.  
  99. IniFile='USER'
  100. Apps='PM_INSTALL'
  101. AppsKeys='WINOS2_LOCATION'
  102.  
  103. call SysIni IniFile, Apps, AppsKeys
  104. if Result \= 'ERROR:' then
  105. do
  106.     val = SysIni(IniFile, Apps, AppsKeys)
  107.     NewDir=directory(val)
  108.     if NewDir\= '' then do
  109.         WinDir=NewDir
  110.         Windrv=Left(WinDir,2)
  111.         FoundWindir=1                       /* found it     */
  112.     end
  113. end
  114.  
  115. NewDir=directory(Dstdrv'\MGA\OS2')
  116. 'if exist syslevel.mga del syslevel.mga'
  117. 'if exist uninstal.cmd del uninstal.cmd'
  118. 'if exist mgaconf.cmd  del mgaconf.cmd'
  119. 'if exist fixauto.cmd  del fixauto.cmd'
  120. 'if exist mgax64s.dsp  del mgax64s.dsp'
  121. 'if exist rambios.sys  del rambios.sys'
  122. 'if exist KMGAX64.SYS  del KMGAX64.SYS'
  123. 'if exist mgaset.exe   del mgaset.exe'
  124. 'if exist mgaset.hlp   del mgaset.hlp'
  125. 'if exist mgahk.exe    del mgahk.exe'
  126. 'if exist vvga.sys     del vvga.sys'
  127. 'if exist readme.os2   del readme.os2'
  128. 'if exist mga.mon      del mga.mon'
  129. 'if exist mgaobj.cmd   del mgaobj.cmd'
  130. 'if exist mga.inf      del mga.inf'
  131. 'if exist mga.ddc      del mga.ddc'
  132.  
  133. NewDir = directory(Dstdrv'..')
  134. 'rd os2 2>nul'
  135. NewDir = directory(Dstdrv'..')
  136. 'rd mga 2>nul'
  137.  
  138. Result = SysDestroyObject('<MGASET>')
  139.  
  140. Result = SysIni('USER', 'MGA32',                      'DELETE:')
  141. Result = SysIni('USER', 'WIN_RES_MGAX64_SMALL',       'DELETE:')
  142. Result = SysIni('USER', 'WIN_RES_MGAX64_LARGE',       'DELETE:')
  143. Result = SysIni('USER', 'WIN_RES_UNKNOWN',            'DELETE:')
  144. Result = SysIni('USER', 'WIN_RES_640x480x256',        'DELETE:')
  145. Result = SysIni('USER', 'WIN_RES_640x480x65536',      'DELETE:')
  146. Result = SysIni('USER', 'WIN_RES_640x480x16777216',   'DELETE:')
  147. Result = SysIni('USER', 'WIN_RES_800x600x256',        'DELETE:')
  148. Result = SysIni('USER', 'WIN_RES_800x600x65536',      'DELETE:')
  149. Result = SysIni('USER', 'WIN_RES_800x600x16777216',   'DELETE:')
  150. Result = SysIni('USER', 'WIN_RES_1024x768x256',       'DELETE:')
  151. Result = SysIni('USER', 'WIN_RES_1024x768x65536',     'DELETE:')
  152. Result = SysIni('USER', 'WIN_RES_1024x768x16777216',  'DELETE:')
  153. Result = SysIni('USER', 'WIN_RES_1152x864x256',       'DELETE:')
  154. Result = SysIni('USER', 'WIN_RES_1152x864x65536',     'DELETE:')
  155. Result = SysIni('USER', 'WIN_RES_1152x864x16777216',  'DELETE:')
  156. Result = SysIni('USER', 'WIN_RES_1280x1024x256',      'DELETE:')
  157. Result = SysIni('USER', 'WIN_RES_1280x1024x65536',    'DELETE:')
  158. Result = SysIni('USER', 'WIN_RES_1280x1024x16777216', 'DELETE:')
  159. Result = SysIni('USER', 'WIN_RES_1600x1200x256',      'DELETE:')
  160. Result = SysIni('USER', 'WIN_RES_1600x1200x65536',    'DELETE:')
  161. Result = SysIni('USER', 'WIN_RES_1600x1200x16777216', 'DELETE:')
  162. Result = SysIni('USER', 'WIN_RES_1600x1280x256',      'DELETE:')
  163. Result = SysIni('USER', 'WIN_RES_1600x1280x65536',    'DELETE:')
  164. Result = SysIni('USER', 'WIN_RES_1600x1280x16777216', 'DELETE:')
  165. Result = SysIni('USER', 'WIN_RES_1800x1440x256',      'DELETE:')
  166. Result = SysIni('USER', 'WIN_RES_1800x1440x65536',    'DELETE:')
  167. Result = SysIni('USER', 'WIN_RES_1800x1440x16777216', 'DELETE:')
  168. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'DEFAULTDRIVER',           'DELETE:')
  169. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'DEFAULTSYSTEMRESOLUTION', 'DELETE:')
  170. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'PMGAX64',                 'DELETE:')
  171. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'RESOLUTION_CHANGED',      'DELETE:')
  172.  
  173. NewDir=directory(Dstdrv'\OS2\DLL')
  174. 'if exist pmgax64.dll  del pmgax64.dll'
  175. 'if exist bmgax64.dll  del bmgax64.dll'
  176. NewDir=directory(Dstdrv'\OS2\MDOS')
  177. 'if exist vmga.sys del VMGAX64.SYS'
  178.  
  179. if FoundWindir=0 then signal Finished
  180.  
  181. NewDir=directory(WinDir'\SYSTEM')
  182. 'if exist smgax64.drv  del smgax64.drv'
  183. 'if exist mgax64.dll   del mgax64.dll'
  184. /* NewDir=directory(Dstdrv'\OS2\MDOS\WINJOS2\SYSTEM') */
  185. 'if exist 'Dstdrv'\os2\mdos\winjos2 cd \os2\mdos\winjos2\system'
  186. 'if exist smgax64.drv  del smgax64.drv'
  187. 'if exist mgax64.dll   del mgax64.dll'
  188.  
  189. Finished:
  190. call directory CurDir
  191.  
  192. say ''
  193. say 'MGA driver uninstalled.'
  194. say ''
  195. /* say 'RUN DSPINSTL?' */
  196. 'echo Press Ctrl+C to end or another key to run DSPINSTL.'
  197. 'pause'
  198. NewDir=directory(Dstdrv'\OS2\INSTALL')      /* go to root off OS/2 drive    */
  199. 'DSPINSTL.EXE'                              /* install other display driver */
  200.  
  201. call directory CurDir
  202. exit
  203.  
  204. ENDSEARCH:
  205. say 'Cannot locate OS/2 System drive'
  206.