Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 31-10-2008
Saindoft Saindoft is offline
Miembro
 
Registrado: may 2008
Posts: 22
Poder: 0
Saindoft Va por buen camino
Cita:
Empezado por seoane Ver Mensaje
Vaya, parece que tengo problemas para enviártelo a tu correo. Pues aquí te dejo un enlace en RapidShare, para que lo descargues. Tienes una versión del ejecutable que no se muestra, y un dll que cambia 504 MB por 1,00 GB. Espero que te sirva

http://rapidshare.com/files/8672820/Namaris2.zip.html

Hola seoane soy saindoft uno de tus
colegas y fanatico del foro, he encontrado muy interesante este truco
y quisiera probarlo pero del link.. que pusiste no puedo bajarlo, quisiera
si es posible que pusieras un link con el archivo .zip adjunto. gracias de antemano
Responder Con Cita
  #2  
Antiguo 31-10-2008
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Poder: 26
seoane Va por buen camino
Bien, el código de la dll es el siguiente:
Código Delphi [-]
library Injection;

uses
  Windows, Sysutils, Messages, Psapi, CommCtrl;

type
  TShared = record
    Hook: HHooK;
    AttachCount: Integer;
  end;
  PShared = ^TShared;

  PItem = ^TItem;
  TItem = record
    hWnd: HWND;
    WndProc: Pointer;
    Next: PItem;
  end;

var
  Mutex, Mem: THandle;
  Shared: PShared;
  Injected: Boolean;
  HandleList: PItem;

function FindWindowProc(hWnd: HWND; Item: PItem): Pointer;
begin
  if Item <> nil then
  begin
    if Item.hWnd = hWnd then
      Result:= Item.WndProc
    else
      Result:= FindWindowProc(hWnd,Item.Next);
  end else
    Result:= nil;
end;

function WindowProc(hWnd: HWND; Msg: UINT; WParam: WPARAM; LParam: LPARAM):
  LRESULT; stdcall;
var
  Str: String;
begin
  if (Msg = WM_SETTEXT) then
  begin
    Str:= String(PChar(LParam));
    Str:= StringReplace(Str,'1,00 GB','2,00 GB',[rfReplaceAll,rfIgnoreCase]);
    Str:= StringReplace(Str,'512 MB','1,00 GB',[rfReplaceAll,rfIgnoreCase]);
    LParam:= Longint(PChar(Str));
  end;
  Result:= CallWindowProc(FindWindowProc(hWnd,HandleList),hWnd,Msg,WParam,lParam);
end;

procedure HookWindow(hWnd: HWND);
var
  Item: PItem;
begin
  if FindWindowProc(hWnd, HandleList) = nil then
  begin
    GetMem(Item,Sizeof(TItem));
    Item.hWnd:= hWnd;
    Item.Next:= HandleList;
    Item.WndProc:= Pointer(SetWindowLong(hWnd,GWL_WNDPROC,LongInt(@WindowProc)));
    HandleList:= Item;
  end;
end;

function CallWndProc(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT;
  stdcall;
var
  ClassName: array[0..16] of Char;
begin
  if Code = HC_ACTION then
    if Injected then
    begin
      FillChar(ClassName,Sizeof(ClassName),0);
      if GetClassName(PCWPStruct(lParam).hwnd,@ClassName,Sizeof(ClassName)-1) > 0 then
        if StrIComp(ClassName,'Link Window') = 0 then
        begin
          HookWindow(PCWPStruct(lParam).hwnd);
        end;
    end;
  Result := CallNextHookEx(Shared^.Hook, Code, wParam, lParam);
end;

procedure StartHook; stdcall;
begin
  if Shared <> nil then
  begin
    WaitForSingleObject(Mutex, INFINITE);
    try
      with Shared^ do
      begin
        if Hook = 0 then
          Hook := SetWindowsHookEx(WH_CALLWNDPROC, @CallWndProc, HInstance, 0);
      end;
    finally
      ReleaseMutex(Mutex);
    end;
  end;
end;

procedure StopHook; stdcall;
begin
  if Shared <> nil then
  begin
    WaitForSingleObject(Mutex, INFINITE);
    try
      with Shared^ do
      begin
        if Hook <> 0 then
        begin
          UnhookWindowsHookEx(Hook);
          Hook := 0;
        end;
      end;
    finally
      ReleaseMutex(Mutex);
    end;
  end;
end;

procedure Inject;
var
  Process: THandle;
  ModName: array[0..MAX_PATH] of Char;
  Target: array[0..MAX_PATH] of Char;
begin
  Injected:= FALSE;
  Process := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, FALSE,
    GetCurrentProcessId);
  if Process <> 0 then
  begin
    if GetModuleFileNameEx(Process, 0, ModName,sizeof(ModName)-1) > 0  then
    begin
      FillChar(Target,Sizeof(Target),#0);
      GetSystemDirectory(@Target,Sizeof(Target)-1);
      StrLCat(Target,'\rundll32.exe',Sizeof(Target)-1);
      OutputDebugString(Target);
      if StrIComp(Target,ModName) = 0 then
      begin
        // Un pequeño pitido nos avisa de que no hemos infiltrado
        Windows.Beep(500,100);
        HandleList:= nil;
        Injected:= TRUE;
      end;
    end;
    CloseHandle(Process);
  end;
end;

procedure Attach; stdcall;
var
  isNew: boolean;
begin
  Mutex := CreateMutex(nil, True, '{92366DA1-4F66-472D-BE12-65F0993F62AC}');
  try
    Mem := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, SizeOf(TShared),
      '{D1A38D62-9FAB-4298-A358-579D2D286E40}');
    isNew := GetLastError() = 0;
    if Mem <> 0 then
      Shared := MapViewOfFile(Mem, FILE_MAP_WRITE, 0, 0, 0)
    else
      Shared := nil;
    if Shared <> nil then
      if isNew then
        with Shared^ do
        begin
          Hook := 0;
          AttachCount := 1;
        end
      else
        inc(Shared^.AttachCount);
  finally
    ReleaseMutex(Mutex);
  end;
  // Aqui viene la inyeccion
  Inject;
end;

procedure UnHookWindows(Item: PItem);
begin
  if Item <> nil then
  begin
    UnHookWindows(Item.Next);
    SetWindowLong(Item.hWnd,GWL_WNDPROC,LongInt(Item.WndProc));
    FreeMem(Item);
  end;
end;

procedure Detach; stdcall;
begin
  WaitForSingleObject(Mutex, INFINITE);
  try
    if (Shared <> nil) then
      dec(Shared^.AttachCount);
  finally
    ReleaseMutex(Mutex);
  end;
  if (Shared <> nil) then
    if Shared^.AttachCount <= 0 then
    begin
      StopHook;
      UnmapViewOfFile(Shared);
      CloseHandle(Mem);
      CloseHandle(Mutex);
    end;
  if Injected then
    UnHookWindows(HandleList);
end;

procedure DLLEntryPoint(Reason: integer);
begin
  case Reason of
    Dll_Process_Detach: Detach;
    Dll_Process_Attach: Attach;
  end;
end;

exports
  StartHook,
  StopHook;

begin
  Attach;
  DLLProc:= @DLLEntryPoint;
end.
Exporta dos funciones StartHook y StopHook llamar la primera para activar y la segunda para desactivar el Hook.

PD: Espero que esto sirva para que la gente deje de preguntar por el .zip con el programa. Creo que el código es suficiente para aquellos que quieren saber como funciona, y mantendrá alejados a los que solo quieren gastar una broma a un ¿amigo?
Responder Con Cita
  #3  
Antiguo 04-11-2008
Saindoft Saindoft is offline
Miembro
 
Registrado: may 2008
Posts: 22
Poder: 0
Saindoft Va por buen camino
Thumbs up amigos es lo que sobra en el foro

gracias seoane por editar lo que todos esperabamos con tantas
ansias, ........... amigos es lo que sobra en este foro..............,
y espero que como bien tu dices este codigo no sea utilizado
maliciosamente abusando de las buenas intenciones de personas como tu.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Ventana MDI, "Siempre visible" y "Pantalla completa" ixMike API de Windows 7 11-04-2007 18:36:55
Elegir "No" automaticamente en la ventana de Guardar cambios de Excel Neftali [Germán.Estévez] Varios 4 21-06-2006 00:35:06
Como quitar el "CS_DROPSHADOW" de una ventana? xEsk API de Windows 2 07-02-2006 15:57:34
"Restaurar Sistema" de Win XP...elimina datos. Sergio J. Windows 9 04-11-2004 10:52:34


La franja horaria es GMT +2. Ahora son las 10:07:57.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi