interface
implementation
uses windows;
const NewName='
Hallo'#0;
//Neuer ClassName des MainWindow
type PJmp=^TJmp;
TJmp=packed
record
JmpFar:word;
adr:longint;
end;
type PJmpnew=^TJmpNew;
TJmpNew=packed
record
Jmp:byte;
adr:longInt;
nop:byte;
end;
var oldAdr:LongInt;
procedure change(ret:pointer;instance:cardinal;
Name:PChar;WndClass:PWndclass);
cdecl;
var mbi:memory_basic_information;
temp,old:cardinal;
oldJmp:PJmp;
Jmp:PJmpNew;
begin
if Name='
TApplication'
then
begin
//TApplication nach [NewName] ändern
assert(
not virtualquery(
name,mbi,sizeof(mbi))<>sizeof(mbi),'
VirtualQuery');
assert(virtualprotect(mbi.BaseAddress,mbi.RegionSize,Page_Execute_ReadWrite,old),'
VirtualProtect');
move(NewName,
name^,length(newname));
assert(virtualprotect(mbi.BaseAddress,mbi.RegionSize,old,temp),'
VirtualProtect');
//Sprung von GetClassInfo(A) zurücksetzen
oldJmp:=@getclassinfo;
Jmp:=pointer(oldJmp);
assert((jmp^.Jmp=$E9)
and(jmp^.nop=$90),'
GetclassInfo');
assert(
not virtualquery(jmp,mbi,sizeof(mbi))<>sizeof(mbi),'
VirtualQuery');
assert(virtualprotect(mbi.BaseAddress,mbi.RegionSize,Page_Execute_ReadWrite,old),'
VirtualProtect');
OldJmp^.JMPFar:=$25FF;
oldJmp^.adr:=oldAdr;
assert(virtualprotect(mbi.BaseAddress,mbi.RegionSize,old,temp),'
VirtualProtect');
end;
end;
procedure NewClassInfo;
//change aufrufen und dann zur ursprünglichen getClassInfo(A) springen
asm
call change
mov eax,oldAdr
jmp [eax]
end;
procedure changeWindowclass;
//Sprung von GetClassInfo(A) auf NewClassInfo ändern
var jmp:PJmp;
jmpNew:PJmpNew;
temp,old:cardinal;
mbi:Memory_Basic_Information;
begin
jmp:=@getclassinfo;
assert(jmp^.JMPFar=$25FF,'
GetClassInfo');
oldAdr:=jmp^.adr;
JmpNew:=pointer(jmp);
assert(
not virtualquery(jmp,mbi,sizeof(mbi))<>sizeof(mbi),'
VirtualQuery');
assert(virtualprotect(mbi.BaseAddress,mbi.RegionSize,Page_Execute_ReadWrite,old),'
VirtualProtect');
JmpNew^.Jmp:=$E9;
JmpNew^.Adr:=integer(@newClassInfo)-integer(jmp)-5;
JmpNew^.nop:=$90;
assert(virtualprotect(mbi.BaseAddress,mbi.RegionSize,old,temp),'
VirtualProtect');
end;
initialization
changeWindowClass;
end.