A problem

delphi package - getting into other processes
Post Reply
huolong
Posts: 2
Joined: Sun Nov 13, 2005 7:52 am

A problem

Post by huolong »

I'm so weak in English that I don't know if I'll make mistakes when I describe the problem.I hope you can understand what I mean..

That's my program
------------------------------

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MadRemote;


var
Sinfo:TStartupInfo;
Pinfo:TProcessInformation;
Form1: TForm1;
ID,THandle:integer;

procedure Inject(ProcessHandle: longword; EntryPoint: pointer);
var
RemoteEntryPoint:Pointer;
tid : dword;
begin
RemoteEntryPoint:=CopyFunction(EntryPoint, ProcessHandle);
CreateRemoteThreadEx(processHandle, nil, 0, RemoteEntryPoint, nil, 0, tid);
CloseHandle(processHandle);
end;


function TheRemoteThread(dwEntryPoint: Pointer): longword; stdcall;
begin
MessageBox(0, 'Test!!!', 'Huolong Test..', 0);
ExitProcess(0);
Result := 0;
end;


begin
// SInfo.dwFlags:=STARTF_USESHOWWINDOW;
SInfo.wShowWindow:= SW_HIDE;
CreateProcess(
nil,'notepad.exe',nil, nil, False,
NORMAL_PRIORITY_CLASS, nil, nil,
SInfo, PInfo);
ID:=PInfo.dwProcessID;
THandle:= PInfo.hProcess;
Inject(THandle,@TheRemoteThread);
end.
--------------------
It can create a remotethread,
but MessageBox(0, 'Test!!!', 'Huolong Test..', 0);
just show a MessageBox with nothing in it.
It looks like MessageBox(0, ' ', ' ', 0);
WHY?
And how can I do?
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You'll find the answer here:

viewtopic.php?t=826
huolong
Posts: 2
Joined: Sun Nov 13, 2005 7:52 am

Thank you

Post by huolong »

Thank you
Post Reply