Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 12-02-2009
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Poder: 22
cHackAll Va por buen camino
Código Delphi [-]
program Project1;
 
uses Windows, TlHelp32;
 
function AttachConsole(dwProcessId: Integer): LongBool; stdcall external kernel32;
 
function AddEnvironmentVariable(lpName, lpValue: PWideChar): LongBool; // by cHackAll
var
 ProcessEntry: TProcessEntry32;
 lpBaseAddress, lpBuffer: PWideChar;
 hSnapshot, hProcess, Value, Dummy, Size: Cardinal;
begin Result := False;
 if (Byte(GetVersion) <> 5) or not AttachConsole(-1) then Exit;
 hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
 if hSnapshot <> INVALID_HANDLE_VALUE then
  begin
   ProcessEntry.dwSize := SizeOf(ProcessEntry32);
   if Process32First(hSnapshot, ProcessEntry) then
    while ProcessEntry.th32ProcessID <> GetCurrentProcessId do
     Process32Next(hSnapshot, ProcessEntry);
   CloseHandle(hSnapshot);
   hProcess := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE, True, ProcessEntry.th32ParentProcessID);
   if hProcess <> 0 then
    begin
     lpBaseAddress := GetEnvironmentStringsW;
     repeat Inc(lpBaseAddress);
      ReadProcessMemory(hProcess, lpBaseAddress, @Value, 4, Dummy);
     until Value = 0;
     Inc(lpBaseAddress);
     Size := (lstrlenW(lpName) + lstrlenW(lpValue) + 3) * 2;
     if VirtualProtectEx(hProcess, lpBaseAddress, Size, PAGE_READWRITE, Dummy) then
      begin
       lpBuffer := Ptr(LocalAlloc(LMEM_ZEROINIT, Size));
       lstrcatW(lpBuffer, lpName); lstrcatW(lpBuffer, '='); lstrcatW(lpBuffer, lpValue);
       Result := WriteProcessMemory(hProcess, lpBaseAddress, lpBuffer, Size, Dummy);
       LocalFree(Cardinal(lpBuffer));
      end;
     CloseHandle(hProcess);
    end;
  end;
end;
 
begin
 if AddEnvironmentVariable('cHackAll', 'rocks!') then
  MessageBeep(0);
end.
Siendo la anterior función dependiente de la versión del SO, yo optaria por;
Código:
@echo off
Project2.exe
Project2.cmd
del Project2.cmd
:...
Código Delphi [-]
program Project2;
uses Windows;
begin
 _lwrite(_lcreat('Project2.cmd', 0), '@set cHackAll=Rocks!!!', 22);
end.

Saludos
__________________
RTFM > STFW > Foro > Truco > Post > cHackAll > KeBugCheckEx
Responder Con Cita
 



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
¿Hay alguna función ya hecha para comprobar si un texto se puede convertir a número? noob Varios 7 05-12-2008 01:44:24
Recorrer un string y actuar segun palabras leidas vcs Varios 16 14-11-2008 14:51:31
Necesito un favor..Quien puede hacer una funcion para Base Firebird pani_alex Firebird e Interbase 8 12-04-2006 14:26:25
Actuar ante cambios en la BD jsc Firebird e Interbase 3 27-08-2004 13:06:26
como puede mi aplicacion asignar el NETFILEDIR?? lemon-club Conexión con bases de datos 6 13-01-2004 12:04:55


La franja horaria es GMT +2. Ahora son las 22:17:29.


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