home *** CD-ROM | disk | FTP | other *** search
- {$M 8192,0,0}
- uses crt,dos;
-
- {╙├└┤╡≈╙├command.com═Ω│╔═Γ▓┐├ⁿ┴ε}
- procedure rundoscommand(command:string);
- begin
- Command := '/C ' + Command;
- SwapVectors;
- Exec(GetEnv('COMSPEC'), Command);
- SwapVectors;
- end;
-
- {╝∞▓Γ╩╟╖±╡▒╟░╗╖╛│╩╟╖±╬¬windos╧┬╡─MS-DOS BOX}
- function inwindows:boolean;
- const envname:array[1..6] of char=('w','i','n','d','i','r');
- var temp:boolean;
- six,loop:byte;
- tempstr:string;
- begin
- for loop:=1 to envcount do
- begin
- temp:=true;
- tempstr:=envstr(loop);
- for six:=1 to 6 do
- if tempstr[six]<>envname[six] then temp:=false;
- if temp then
- loop:=envcount;
- end;
- inwindows:=temp;
- end;
-
- {╗±╡├▓ó╖╡╗╪win95╡─░▓╫░┬╖╛╢}
- function getsyspath:string;
- const envname:array[1..10] of char=('w','i','n','b','o','o','t','d','i','r');
- var temppath,tempstr:string;
- ten,loop:byte;
- found:boolean;
- begin
- temppath:='';
- for loop:=1 to envcount do
- begin
- found:=true;
- tempstr:=envstr(loop);
- for ten:=1 to 10 do
- if tempstr[ten]<>envname[ten] then found:=false;
- if found then
- begin
- for loop:=12 to length(tempstr) do
- temppath:=temppath+tempstr[loop];
- loop:=envcount;
- end;
- end;
- getsyspath:=temppath+'\';
- end;
-
- {╗±╚í╓╕╢¿╬─╝■╡─┤≤╨í}
- function filesize(filename:string):longint;
- var
- DirInfo: SearchRec;
- begin
- FindFirst(filename, anyfile, DirInfo);
- filesize:=dirinfo.size;
- end;
-
- {╕∙╛▌▓╬╩²╛÷╢¿╩╟╖±╥¬▒╕╖▌╫ó▓ß▒φ}
- function backup:boolean;
- var loop:byte;
- temp:boolean;
- ch:char;
- begin
- temp:=false;
- if paramcount > 0 then
- for loop:=1 to paramcount do
- begin
- if (paramstr(loop)='/Y') or (paramstr(loop)='/y') then
- temp:=true;
- if temp then loop:=paramcount;
- end
- else
- begin
- write('Do you want to backup the regstry file to REGCBACK.REG? ');
- repeat
- write(chr(7));
- gotoxy(wherex-1,wherey);
- ch:=readkey;
- until ch in ['y','Y','n','N'];
- if ch in ['y','Y'] then
- temp:=true
- else temp:=false;
- writeln(ch);
- end;
- backup:=temp;
- end;
-
- var syspath:string;{win95░▓╫░┬╖╛╢}
- orisize,aftersize:longint;
- needbackup:boolean;
-
- begin
- if dosversion<>7 then {┼╨╢╧╩╟╖±╬¬DOS 7.0╗╖╛│}
- write(chr(7),'Dos Version Error, Require DOS 7.0 to run it.')
- else
- begin
- syspath:=getsyspath;{╗±╚íwin95░▓╫░┬╖╛╢}
- writeln('Chen Danian''s Registry Compressor For win95 Version 2.0');
- writeln('Get technical support at http://hamlet.yeah.net now!');
- writeln('Contact me via e-mail tocdn@163.net',chr(10));
- needbackup:=backup;{╗±╚í╣╪╙┌╙├╗º╩╟╖±╥¬╟≤▒╕╖▌╫ó▓ß▒φ╡├╛÷╢¿}
- rundoscommand('attrib '+syspath+'system.dat -a -s -h -r');
- rundoscommand('attrib '+syspath+'user.dat -a -s -h -r');
- orisize:=filesize(syspath+'system.dat');
- orisize:=orisize+filesize(syspath+'user.dat');
- if inwindows then{╚τ╣√╡▒╟░╘╦╨╨╗╖╛│╩╟windos95╡─MS-DOS BOX ╛══╦│÷}
- write(chr(7),'Do not use it under windows!')
- else
- begin
- writeln('Please wait for preparing...');
- rundoscommand(syspath+'regedit /e regcback.reg');
- writeln('Start compressing...',chr(10));
- rundoscommand(syspath+'regedit /c regcback.reg');
- if not needbackup then
- rundoscommand('delete tempreg.tmp');
- aftersize:=filesize(syspath+'system.dat');
- aftersize:=aftersize+filesize(syspath+'user.dat');
- writeln('Result Report');
- writeln('>>>>>>>>>>>>>');
- writeln('Original Registry Size: ',orisize);
- writeln('After Compress: ',aftersize);
- writeln('===============================');
- writeln('Compressing Rate: ',orisize/aftersize*100:3:2,'%');
- end;
- end;
- end.