program AftermathSwitcher; uses crt, dos, windows; var aminstalled:byte; const rareg='Red Alert Windows 95 Edition'; {rareg='Alarmstufe Rot Windows 95 Edition';} {rareg='Alerte Rouge version Windows 95';} ralan='English'; {ralan='German ';} {ralan='French ';} procedure cntin; var pause: char; begin writeln('Press any key to continue.'); repeat until keypressed; pause:=ReadKey(); end; {cntin} Procedure checkreg; var am_inst : DWORD; key : HKEY; bl, ret : DWORD; s : string; begin s :='AftermathInstalled'; bl:=8; RegOpenKeyEx( HKEY_LOCAL_MACHINE, concat('SOFTWARE\Westwood\',rareg), 0, KEY_QUERY_VALUE, key ); ret := RegQueryValueEx( key, @s[1], nil, nil, @am_inst, @bl); RegCloseKey( key ); if ret<>0 then aminstalled:=2 else begin aminstalled:=am_inst; end; end; {checkreg} Procedure changeReg; begin if aminstalled = 1 then begin swapvectors; Exec(GetEnv('COMSPEC'),'/C reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Westwood\Red Alert Windows 95 Edition" /v AftermathInstalled /t REG_DWORD /d 0x0 /f'); swapvectors; writeln; writeln; writeln('Aftermath disabled.'); end else begin swapvectors; Exec(GetEnv('COMSPEC'),'/C reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Westwood\Red Alert Windows 95 Edition" /v AftermathInstalled /t REG_DWORD /d 0x1 /f'); swapvectors; writeln; writeln; writeln('Aftermath enabled.'); end; end; {changeReg} Procedure menu; var choice:char; begin writeln(concat('Aftermath disabler/enabler tool (',ralan,') Written by Nyerguds')); writeln('-------------------------------'); writeln; write ('Aftermath is currently '); if aminstalled = 1 then writeln('enabled.') else writeln('disabled.'); write('Press the spacebar to '); if aminstalled = 1 then write('disable') else write('enable'); writeln(' Aftermath, or any other key to abort.'); writeln; choice:= '0'; repeat until keypressed; choice:=ReadKey(); if (choice = ' ') then begin changeReg; end else begin writeln('No action taken.'); end end; {menu} begin checkreg; if aminstalled=2 Then writeln ('Error: Aftermath does not appear to be installed.') else menu; cntin; end.