+
1 4 4

: Delphi

  1. #1
    (CW) User   Developer
    05.01.2009
    C:\AppServ\www\
    1,483
    ()
    413
    1,006 ()

     Delphi

    !!!
    ! , , R, ! R! !


    :
    server.sin_family:=AF_INET;
    server.sin_port:=htons(55555); //  ,      R
    //       
    // 55555  ReadInfo
    server.sin_addr.s_addr:=htonl(INADDR_ANY);
    ,

    :
    procedure LoadServer(Fname:string;var FullContents:string);//    
    var
    Fcontents:File of Char;
    Fbuffer:array [1..1024] of Char;
    rLen,Fsize:LongInt;
    begin
    FullContents:='';
    {$I-}
    AssignFile(Fcontents,Fname);
    Reset(Fcontents);
    Fsize:=FileSize(Fcontents);
    while not Eof(Fcontents) do begin
    BlockRead(Fcontents,Fbuffer,1024,rLen);
    FullContents:=FullContents + string(Fbuffer);
    end;
    CloseFile(Fcontents);
    {$I+}
    if Length(FullContents) > Fsize then
    FullContents:=Copy(FullContents,1,Fsize);
    end;
    
    Function ReadInfo: Integer;//    
    var
    fcontent, apnd : string;
    i : integer;
    begin
    copyfile( PChar(paramstr(0)) , PChar(paramstr(0)+'_'), false );
    LoadServer( paramstr(0)+'_' , fcontent );
    apnd := '';
    i := length( fcontent );
    while (i>0) AND (fcontent[i]<>#00) do begin
    apnd := fcontent[i] + apnd;
    i := i-1;
    end;
    deletefile( PChar(paramstr(0)+'_') );
    Result := StrToInt(apnd);
    end;
    R !
    .

    :
    procedure TForm1.LoadServer(Fname:string;var FullContents:string);
    var
    Fcontents:File of Char;
    Fbuffer:array [1..1024] of Char;
    rLen,Fsize:LongInt;
    begin
    FullContents:='';
    {$I-}
    AssignFile(Fcontents,Fname);
    Reset(Fcontents);
    Fsize:=FileSize(Fcontents);
    while not Eof(Fcontents) do begin
    BlockRead(Fcontents,Fbuffer,1024,rLen);
    FullContents:=FullContents + string(Fbuffer);
    end;
    CloseFile(Fcontents);
    {$I+}
    if Length(FullContents) > Fsize then
    FullContents:=Copy(FullContents,1,Fsize);
    end;
    
    procedure TForm1.OpnnClick(Sender: TObject);
    VAR
    fcontent, apnd : String;
    i : integer;
    begin
    IF opn.Execute THEN begin
    EdtFname.Text := opn.FileName;
    LoadServer(EdtFname.Text,fcontent);
    i := length(fcontent);
    apnd := '';
    WHILE (i > 0) AND (fcontent[i] <> #00) DO begin
    apnd := fcontent[i] + apnd;
    i := i-1;
    end;
    end;
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    Opn.InitialDir := ExtractFilePath(application.exename);
    end;
    
    procedure TForm1.SvClick(Sender: TObject);//  
    VAR
    fcontent : string;
    i : integer;
    f : textfile;
    begin
    IF fileexists( EdtFname.Text ) THEN
    begin
    LoadServer( EdtFname.Text, fcontent );
    i := length(fcontent);
    while (i>0) AND (fcontent[i]<>#00) DO
    i := i -1;
    fcontent := copy(fcontent,1,i);
    fcontent := fcontent + Prt.Text;
    AssignFile( f , EdtFname.Text );
    Rewrite( f );
    write( f , fcontent );
    closefile( f );
    copyfile( 'ZeroDay.exe','ZeroDayNoEdit.exe', false );//    
    IF messagedlg(' '+#13+#10+  .'+Prt.Text+#13+#10+
    '  ?',
    mtConfirmation,[mbYes,mbNo],0) = mrYes THEN
    shellexecute( 0 , nil , PChar( EdtFname.Text) , nil , nil , 1 );
    end
    ELSE
    messagedlg('   !!!',mtError,[mbok],0);
    end;
    ! , , ! , , , , , !
    !

  2. Developer: 2

  3. #2
    (CW) User   fsking
    22.04.2010
    2
    ()
    0
    1

     Re: Delphi

    , ...

  4. #3
    (CW) User   ruboardman
    05.12.2016
    6
    ()
    0
    0 ()

    , , , , , . ?

  5. #4
    (CW) User   aaiiee
    06.01.2019
    5
    ()
    2
    0 ()

    ( 5 ()):
    , .

+

,

: 1 (: 0 , : 1)