/*****************************************************************************/ /* REXX cmd file to restore SYSLEVEL.OS2 to XR06200 when it has been updated */ /* by one of the Display driver packages like S3_16M so FixPaks like BRKLPK, */ /* BRWPPK and BRAPPK can be applied. */ /* */ /* Check the following: */ /* 1. GRE is ver 2.11 and CSD level XR06200 */ /* 2. OS2 is ver 2.11 and not XR06300 - this is OS24WIN, not supported */ /* 2. OS2 is not XR06200 - needs to be updated to XR06200 */ /* */ /* If above checks are okay then update the SYSLEVEL.OS2 to XR06200 (and */ /* keep a copy of the current one for reference). Preserve the R/O attribute */ /* if it is on for the current file. */ /*****************************************************************************/ '@Echo off' 'CLS' Call Beep 440,300 Say Say center('This REXX CMD file is for the full OS/2 Version 2.11 only.',79) Say center('It WILL NOT work with OS/2 for Windows Version 2.11.',79) Say Say center('Run this program to restore the SYSLEVEL.OS2 file in the \OS2\INSTALL',79) Say center('directory to CSD Level XR06200. A backup copy of the current file',79) Say center('to SYSLEVO.OS2 will be done before any changes are made.',79) Say Say center('It is known that installing the S3_16M Display drivers can cause this problem.',79) Say Say Say 'Enter GO to continue. Anything else will terminate this program.' Pull ans . If ans<>'GO' then Signal Done /*****************************************************************************/ /* Register all REXXUTIL functions */ /*****************************************************************************/ rc=RxFuncAdd('SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs') If rc>1 then Do Say 'Unable to register REXXUTIL functions, cannot continue.' Signal Done End Call SysLoadFuncs Arg parm . env='OS2ENVIRONMENT' /* Environment name */ boot=Filespec("DRIVE",value('COMSPEC',,env)) /* Find Boot drive */ If boot='' | length(boot)<>2 | right(boot,1)<>':' then Do Say 'Unable to locate your boot drive via the COMSPEC environment' Say 'variable. Cannot continue.' Signal Done End Say 'Boot drive is 'boot /****************************************/ /* Read SYSLEVEL.GRE into rexx variable */ /****************************************/ gre=boot||'\OS2\INSTALL\SYSLEVEL.GRE' Say 'Reading 'gre size=stream(gre,'C','Query Size') greline=charin(gre,1,size) call stream gre,'C','Close' /*************************************************************/ /* Now we need the compound version number and the CSD level */ /*************************************************************/ Parse var greline sign +2 sig +8 . +5 . +2 . +16 toff +4 . If sign<>'FFFF'x | sig<>'SYSLEVEL' then Do Say gre 'header invalid. Should start with x"FFFF"SYSLEVEL.' Signal Done End toff=ulong2d(toff)+1 line=substr(greline,toff) Parse var line . +2 . +1 sysver +1 sysmod +1 . +2 grecsd +8, . +8 . +80 . +9 refr +1 . xver=c2x(sysver) xmod=c2x(sysmod) xrefr=c2x(refr) grever=left(xver,1)'.'right(xver,1)||right(xmod,1) grecsd=left(grecsd,7) Say 'Graphics Engine Version is 'grever', CSD level is 'grecsd If grever<>'2.11' then Do Say 'Version must be 2.11, cannot continue.' Signal Done End If grecsd<>'XR06200' then Do Say 'CSD level must be XR06200, cannot continue.' Signal Done End /****************************************/ /* Read SYSLEVEL.OS2 into rexx variable */ /****************************************/ os2=boot||'\OS2\INSTALL\SYSLEVEL.OS2' Say 'Reading 'os2 size=stream(os2,'C','Query Size') os2line=charin(os2,1,size) call stream os2,'C','Close' /*************************************************************/ /* Now we need the compound version number and the CSD level */ /*************************************************************/ Parse var os2line sign +2 sig +8 . +5 . +2 . +16 toff +4 . If sign<>'FFFF'x | sig<>'SYSLEVEL' then Do Say gre 'header invalid. Should start with x"FFFF"SYSLEVEL.' Signal Done End toff=ulong2d(toff)+1 line=substr(os2line,toff) Parse var line . +2 . +1 sysver +1 sysmod +1 . +2 os2csd +8, . +8 . +80 . +9 refr +1 . xver=c2x(sysver) xmod=c2x(sysmod) xrefr=c2x(refr) os2ver=left(xver,1)'.'right(xver,1)||right(xmod,1) os2csd=left(os2csd,7) Say 'Base Operating System/2 Version is 'os2ver', CSD level is 'os2csd If os2ver<>'2.11' then Do Say 'Version must be 2.11, cannot continue.' Signal Done End If os2csd='XR06200' then Do Say 'No changes required.' Signal Done End If os2csd='XR06300' then Do Say 'This is a OS/2 for Windows system, cannot continue.' Signal Done End /******************************************************************/ /* Tell user what we will do and give one last chance to bail out */ /******************************************************************/ os2save=boot||'\OS2\INSTALL\SYSLEVO.OS2' Say os2 'will be changed from CSD Level 'os2csd' to XR06200' Say Say 'Enter GO to continue, anything else will terminate this program.' Pull ans . If ans='GO' then Do os2line=overlay('XR06200',os2line,45,7) 'COPY 'os2 os2save' > NUL' Call SysFileTree os2,'SFILE','F' /* Get file specs */ Parse value sfile.1 with . . . atts . /* Just attributes */ os2ro=pos('R',atts)>0 then /* Read Only bit set? */ If os2ro then /* Was it? */ 'ATTRIB -R' os2 /* Yes, turn of so can delete */ 'DEL 'os2 Call charout os2,os2line /* Write updated file */ Call Stream os2,'C','Close' Call Stream os2,'C','Open Read' os2levn=substr(Linein(os2),45,7) /* Get the updated level */ Call Stream os2,'C','Close' Say If os2levn='XR06200' then /* All well? */ Say os2 'has been successfully updated.' Else /* No, problem, restore backup */ Do Say 'Update of 'os2' failed. CSD Level not updated to XR06200.' Say 'Restoring backup copy.' 'COPY 'os2save os2' > NUL' 'DEL 'os2save End If os2ro then /* Turn on R/O bit if on before */ 'ATTRIB +R' os2 /* Handles pass/fail case */ End /*******************************/ /* Only exit from this program */ /*******************************/ Done: Exit /*****************************************/ /* Convert a C Ulong to a decimal number */ /*****************************************/ Ulong2d: procedure Parse arg in If length(in)<>4 then Do Say 'Invalid ULONG' Signal Done End out=0 pow=1 Do j=0 to 3 out=out+(c2d(substr(in,j+1,1))*pow) pow=pow*16 End Return out