var f,o : File;
    Buf : array[0..8192] of byte;
    i   : Word;
    s   : String;
begin
 Writeln('.EXE -> .DRV convertor (C)1992 by FRIENDS software');
 if ParamCount<>1 then
    begin
     Writeln('Usage : Exe2Drv <EXE-file-name>');
     Halt(1);
    end;
 Assign(f,ParamStr(1));Reset(f,1);
 if IOResult>0 then
    begin
     Writeln('Can''t find EXE file');
     Halt(1);
    end;
 Seek(f,$42B8);s:=ParamStr(1);
 i:=Length(s);While (s[i]<>'.') and (i>0) do Dec(i);
 if i>0 then s:=Copy(s,1,i-1);
 s:=s+'.drv';Assign(o,s);Rewrite(o,1);
 While not EOF(f) and (InOutRes=0) do
       begin
        BlockRead(f,Buf,8192,i);
        BlockWrite(o,Buf,i);
       end;
 Close(f);Close(o);
 if IOResult>0 then Writeln('I/O error writing .DRV')
               else Writeln(ParamStr(1),'->',s,' Ok');
end.