home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
screen
/
winbang
/
banginst.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-12-03
|
5KB
|
216 lines
{$A+,B+,D-,E-,F-,I+,L+,N-,O-,R-,S-,V+}
{$M 16384,0,0}
program banginst;
uses bangimg1, bangimg2, bangimg3, dos, crt;
var dir : dirstr;
name : namestr;
ext : extstr;
f, fout : text;
c : char;
s, bang, windoom : string;
i, j : integer;
bangline, nobang : boolean;
firlefanz : integer absolute $b800:0000;
label 42;
procedure yeah;
var c : char;
begin
move(yeahdata, firlefanz, yeahdata_length);
while keypressed do c := readkey;
c := readkey
end;
procedure error(s : string);
var c : char;
begin
i := ioresult;
move(errordata, firlefanz, errordata_length);
gotoxy(20, 12);
writeln(s);
while keypressed do c := readkey;
c := readkey;
halt(42);
end;
function upper (s : string) : string;
var i : integer;
begin
for i := 1 to length(s) do s[i] := upcase(s[i]);
upper := s
end;
function loadstr : string;
var s : string;
c : char;
begin
s := '';
repeat
read(f, c);
write(fout, c);
s := s+c
until (c = #$0d) or (c = '=') or eof(f);
if c = #$0d then delete (s, length(s), 1);
if s[1] = #10 then delete(s, 1, 1);
loadstr := s;
end;
begin
bangline := false;
move(imagedata, firlefanz, imagedata_length);
gotoxy(1,24);
nobang := false;
{seek bang.exe}
{$I-}
fsplit(fexpand(paramstr(0)),dir, name, ext);
bang := dir+'bang.exe';
assign(f, bang);
reset (f);
if ioresult <> 0 then
begin
writeln('Can''t find ',bang);
nobang := true;
end;
close(f);
i := ioresult;
{seek win.ini}
write('Enter WINDOWS drive and directory: ');
readln(windoom);
if windoom[length(windoom)] <> '\' then windoom := windoom+'\';
windoom := windoom+'win.ini';
fsplit(fexpand(windoom), dir, name, ext);
windoom := dir+name+ext;
assign(f, windoom);
reset(f);
if ioresult <> 0 then error('Can''t find '+windoom);
close(f);
{copy bang.exe}
swapvectors;
exec(getenv('COMSPEC'),'/c copy '+bang+' '+dir+'*.*>nul');
swapvectors;
if doserror <> 0 then error('Unrecoverable application error');
{erase win.bak}
assign(f, dir+name+'.bak');
erase(f);
i := ioresult;
{$i+}
{seek for 'load=' in win.ini }
assign(f, windoom);
rename(f,dir+name+'.BAK');
assign(fout, windoom);
rewrite(fout);
reset(f);
repeat
s := loadstr
until eof(f) or ((upper(copy(s, 1, 4)) = 'LOAD') and (s[length(s)] = '='));
if eof(f) then {No load= found !!??}
begin
reset(f);
rewrite(fout);
{copy [WinDoom] line}
readln(f, s);
writeln(fout, s);
writeln(fout, 'load='+windoom[1]+':BANG.EXE');
end
else {load= found}
begin
readln(f, s);
i := pos('BANG.EXE', upper(s));
if i <> 0 then
begin
writeln('BANG is already installed. Deinstall (Y/N) ?');
repeat
c := readkey
until pos(c, 'yYnN') <> 0;
if (c = 'y') or (c = 'Y') then
begin
{ Store entries before BANG.EXE }
repeat
j := pos(' ', s);
if j = 0 then j := 255;
if j < i then
begin
write(fout, copy(s, 1, j));
delete(s, 1, j);
i := i-j;
j := -1
end
until j > i;
delete(s, 1, j);
writeln(fout, s);
goto 42;
end
else
begin
writeln(fout, s);
s := ''
end
end;
if s <> '' then
begin
if not nobang then
begin
if s[length(s)] <> ' ' then s := s+' ';
s := s+windoom[1]+':BANG.EXE';
yeah;
end;
writeln(fout, s);
end;
end;
42:
repeat
s := loadstr;
if upper(copy(s, 1, 6)) = '[BANG]' then
bangline := true
until eof(f);
if not bangline then
begin
writeln(fout);
writeln(fout, '[bang]');
writeln(fout);
writeln(fout, ' BBBBBB AA N N GGGGGG');
writeln(fout, ' B B A A NN N G');
writeln(fout, ' B B A A N N N G');
writeln(fout, ' BBBBBB A A N N N G GGG');
writeln(fout, ' B B AAAAAAAA N N N G G');
writeln(fout, ' B B A A N NN G G');
writeln(fout, ' BBBBBB A A N N GGGGGG');
writeln(fout);
writeln(fout, 'Written by REMBRANDT, POWER MIKE and McJOSH');
writeln(fout);
writeln(fout, 'Each WinDoom application is adding some rubbish to the WIN.INI');
writeln(fout, 'file. This one too !!!');
writeln(fout);
writeln(fout, 'Enjoy it');
writeln(fout);
end;
close(fout);
close(f);
end.