• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Delphi Clonador de Informacion de Ejecutable [Delphi]

Status
Not open for further replies.

sQuo

~ KillmeMories ~
Shadow
User
Joined
Oct 16, 2011
Messages
5,851
Reputation
0
Reaction score
22,904
Points
688
Credits
0
‎13 Years of Service‎
24%
Code:
>   //******************************************************************************
   //* UNIT:         UNT_CloneFileInfo
   //* AUTOR:        Fakedo0r
   //* FECHA:        10.04.2012
   //* CORREO:       [email protected]
   //* BLOG:         Sub-Soul.blogspot.com
   //* REFERENCIA:   MSDN
   //* USO:          CloneFileInfoA('Ruta\Origen.exe', 'Ruta\Destino.exe');
   //******************************************************************************
   unit UNT_CloneFileInfo;
   //******************************************************************************
   //DECLARACION DE LIBRERIAS / CLASES
   //******************************************************************************
   interface
    
   uses
     Windows, Messages, Dialogs, SysUtils, ShlObj;
   //******************************************************************************
   //DECLARACION DE FUNCIONES / METODOS
   //******************************************************************************
   function CloneFileInfoA(sSource: String; sDestin: String): Bool;
   //******************************************************************************
   implementation
   //******************************************************************************
   //
   //******************************************************************************
   function CloneFileInfoA(sSource: String; sDestin: String): Bool;
   var
     dwRes:        DWORD;
     dwFile:       DWORD;
     dwSize:       DWORD;
     dwLangID:     DWORD;
     dwSrcSize:    DWORD;
     dwDestSize:   DWORD;
     bSrcData:     TBytes;
     bDestData:    TBytes;
     ptrBuffer:    Pointer;
   begin
     Result := True;
     dwRes:= 0;
     dwLangID := 0;
     dwSrcSize := 0;
     dwDestSize := 0;
    
     dwSrcSize := GetFileVersionInfoSize(PChar(sSource), dwFile);
    
     if dwSrcSize = 0 then
     begin
       Result := False;
       Exit;
     end;
    
     SetLength(bSrcData, dwSrcSize);
     GetFileVersionInfo(PChar(sSource), dwFile, dwSrcSize, @bSrcData[0]);
    
     dwDestSize := GetFileVersionInfoSize(PChar(sSource), dwFile);
    
     if dwDestSize = 0 then
     begin
       Result := False;
       Exit;
     end;
    
     SetLength(bDestData, dwDestSize);
     GetFileVersionInfo(PChar(sDestin), dwFile, dwDestSize, @bDestData[0]);
    
     VerQueryValue(@bDestData[0], PChar('\VarFileInfo\Translation'), ptrBuffer, dwSize);
     dwRes := BeginUpdateResource(PChar(sDestin), False);
    
     CopyMemory(@dwLangID, ptrBuffer, 2);
     UpdateResource(dwRes, RT_VERSION, PChar(VS_VERSION_INFO), dwLangID, @bSrcData[0], dwSrcSize);
     EndUpdateResource(dwRes, False);
   end;
    
   end.
 
Status
Not open for further replies.
Back
Top