+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Senior Member PWDhunter's Avatar
    Join Date
    Jun 2009
    Location
    Georgia
    Posts
    109

    [Delphi] Server Editor Better Way

    this is editor:
    add in uses "madRes"

    this guy will write some strings in EXE file
    1) parameter: server fullpath
    2) strings to write
    Code:
    procedure WriteSettings(ServerFile: string; Settings: string);
    var
      ResourceHandle: THandle;
      pwServerFile: PWideChar;
    begin
      GetMem(pwServerFile, (Length(ServerFile) + 1) * 2);
      try
        StringToWideChar(ServerFile, pwServerFile, Length(ServerFile) * 2);
        ResourceHandle := BeginUpdateResourceW(pwServerFile, False);
        UpdateResourceW(ResourceHandle, MakeIntResourceW(10), 'SETTINGS', 0, @Settings[1], Length(Settings) + 1);
        EndUpdateResourceW(ResourceHandle, False);
      finally
        FreeMem(pwServerFile);
      end;
    end;
    ------------------------------------------------

    this guy will read written data from modified exe file
    1) parameter: server's fullpath

    Code:
    function ReadSettings(ServerFile: string): string;
    var
      ServerModule: HMODULE;
      ResourceLocation: HRSRC;
      ResourceSize: dword;
      ResourceHandle: THandle;
      ResourcePointer: pointer;
    begin
      ServerModule := LoadLibrary(pchar(ServerFile));
      try
        ResourceLocation := FindResource(ServerModule, 'SETTINGS', RT_RCDATA);
        ResourceSize := SizeofResource(ServerModule, ResourceLocation);
        ResourceHandle := LoadResource(ServerModule, ResourceLocation);
        ResourcePointer := LockResource(ResourceHandle);
        if ResourcePointer <> nil then
        begin
          SetLength(Result, ResourceSize - 1);
          CopyMemory(@Result[1], ResourcePointer, ResourceSize);
          FreeResource(ResourceHandle);
        end;
      finally
        FreeLibrary(ServerModule);
      end;
    end;
    usage of functions in editor
    Code:
    var
      Settings: string;
    
    begin
      Settings := 'here String to write';
      WriteSettings('here server.exe path', Settings);
      WriteLn(ReadSettings('server.exe')); // <--- this guy will read written data from server.exe
    end.
    ---------------------------------------------------

    now code server
    this guy will load written data

    Code:
    function LoadSettings: string;
    var
      ResourceLocation: HRSRC;
      ResourceSize: dword;
      ResourceHandle: THandle;
      ResourcePointer: pointer;
    begin
      ResourceLocation := FindResource(hInstance, 'SETTINGS', RT_RCDATA);
      ResourceSize := SizeofResource(hInstance, ResourceLocation);
      ResourceHandle := LoadResource(hInstance, ResourceLocation);
      ResourcePointer := LockResource(ResourceHandle);
      if ResourcePointer <> nil then
      begin
        SetLength(Result, ResourceSize - 1);
        CopyMemory(@Result[1], ResourcePointer, ResourceSize);
        FreeResource(ResourceHandle);
      end;
    end;
    usage of this function in server
    Code:
    PROCEDURE somefuckedupproc (yowazzup; RockMeBaby)
    var buffer : string;
    begin
    buffer := LoadSettings;
    end.
    here u can download full source and compiled .exe files too
    Attached Files Attached Files
    Last edited by PWDhunter; 08-03-2010 at 15:34.
    From Georgian Hacking Community

  2. #2
    Senior Member PWDhunter's Avatar
    Join Date
    Jun 2009
    Location
    Georgia
    Posts
    109
    mdoers and admins please move it in Delphi simples section
    From Georgian Hacking Community

  3. #3
    Senior Member counterstrikewi's Avatar
    Join Date
    Apr 2009
    Location
    \??\.\PhysicalDrive0:\+00h
    Posts
    1,982
    been looking for this thanks!
    DelphiBasics - Ultimate Delphi Resource for Beginners
    www.delphibasics.info

  4. #4
    Senior Member cracksman's Avatar
    Join Date
    Dec 2006
    Location
    behind your little sister
    Posts
    1,611
    how is this the 'better way'?
    isn't this what everybody uses these days, your making it sound new&cool.

    but thanks for the snippet, its in lots of projects but i don't think anyone has posted just the snippet before.
    I Retired. stop asking me questions. you can find me on msn or ic0de.

  5. #5
    Senior Member PWDhunter's Avatar
    Join Date
    Jun 2009
    Location
    Georgia
    Posts
    109
    dude its very simple and easy way
    easy means cool
    From Georgian Hacking Community

  6. #6
    Senior Member PWDhunter's Avatar
    Join Date
    Jun 2009
    Location
    Georgia
    Posts
    109
    and guys can anyone write more information about ways how to write settings in Executable
    here i got one
    http://edn.embarcadero.com/article/27979
    and are more ways?
    From Georgian Hacking Community

  7. #7
    Senior Member PWDhunter's Avatar
    Join Date
    Jun 2009
    Location
    Georgia
    Posts
    109
    and guys can anyone write more information about ways how to write settings in Executable
    here i got one
    http://edn.embarcadero.com/article/27979
    and are more ways?
    From Georgian Hacking Community

  8. #8
    Banned Mrbatrik's Avatar
    Join Date
    Jan 2011
    Posts
    22
    very very good
    but if i have 2 var(string) ;
    exp :
    var
    Settings: string;
    client
    begin
    x1 := 'here String to write';
    x2:='here String to write2.'
    server
    var port,mail : string;
    begin
    port := LoadSettings;
    mail := LoadSettings;
    end.
    pls fix this it is dont work !!

  9. #9
    Banned Mrbatrik's Avatar
    Join Date
    Jan 2011
    Posts
    22
    and usage of functions in editor
    edit1.text :=ReadSettings('ServerFile.exe');
    if i want read more variable !!

  10. #10
    yua
    yua is offline
    Member yua's Avatar
    Join Date
    Mar 2011
    Location
    Algeria
    Posts
    56
    thank you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 13
    Last Post: 14-06-2011, 02:26
  2. Server Editor in Delphi ... with source :D
    By counterstrikewi in forum Delphi Help
    Replies: 5
    Last Post: 06-06-2009, 17:38
  3. server editor
    By neropower in forum General Programming Help
    Replies: 1
    Last Post: 29-04-2009, 16:14
  4. Resource Editor For IDE [Delphi]
    By Departure in forum Components
    Replies: 1
    Last Post: 19-08-2008, 05:55
  5. need a Loader and an Editor for my vb dll Server
    By r-eturner in forum Delphi Help
    Replies: 0
    Last Post: 14-06-2007, 02:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.