Hmm soweit hab ich das ganze jetzt verstanden... muss ich jetzt aber doch das Berechnen von Sprungadressen lernen :/ muss ja irgendwie das je in der Codecave schreiben...
Berechnung ist klar... Zieladresse - Startadresse - 6, klappt auch, wenn ich das manuell mache in CE, nur wie setze ich das ganze in Delphi jetzt um?
LG Darius83
Edit1: Ah, ich glaube, ich habs schon... mal schaun
Edit2: So habs mal so gelöst:
[code=delphi]
// Konstanten
PROCESS : String = 'game.dat'; // Prozessname des Spiels
GOLDSAMMELN: Integer = $0050A65D; // Adresse Gold
JmpGoldCave:array[0..10] of byte = ($68,$00,$00,$00,$00,$C3,$90,$90,$90,$90,$90);
GoldCaveByte:array[0..0] of byte = ($01);
GoldCave:array[0..43] of byte = ($80,$3D,$00,$00,$00,$00,$01,$75,$0E,$81,$40,$38,
$10,$27,$00,$00,$C6,$05,$00,$00,$00,$00,$00,$8B,
$58,$38,$39,$1D,$68,$69,$9E,$00,$0F,$84,$00,$00,
$00,$00,$68,$00,$00,$00,$00,$C3);
//bei Spielstart
BaseAddr := VirtualAllocEx(Pidhandle,NIL,2048,MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
Caveadress1 := Cardinal(BaseAddr)+$0000;
WriteBytesToMem(Pidhandle, GOLDSAMMELN, Written, JmpGoldCave);
Caveadress1 := Caveadress1+$0010;
WriteProcessMemory(Pidhandle, Pointer(GOLDSAMMELN+$01), @Caveadress1, 4, Written);
WriteBytesToMem(Pidhandle,Caveadress1,Written,GoldCave);
Caveadress1 := Caveadress1-$0010;
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$12), @Caveadress1, 4, Written);
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$22), @Caveadress1, 4, Written);
ByteVar := $50A6C8-(Caveadress1+$30)-$6;
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$32), @ByteVar, 4, Written);
ByteVar := $50A668;
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$37), @ByteVar, 4, Written);
//bei Hotkey
WriteBytesToMem(Pidhandle,Caveadress1,Written,GoldCaveByte);
[/code]
Berechnung ist klar... Zieladresse - Startadresse - 6, klappt auch, wenn ich das manuell mache in CE, nur wie setze ich das ganze in Delphi jetzt um?
LG Darius83
Edit1: Ah, ich glaube, ich habs schon... mal schaun
Edit2: So habs mal so gelöst:
[code=delphi]
// Konstanten
PROCESS : String = 'game.dat'; // Prozessname des Spiels
GOLDSAMMELN: Integer = $0050A65D; // Adresse Gold
JmpGoldCave:array[0..10] of byte = ($68,$00,$00,$00,$00,$C3,$90,$90,$90,$90,$90);
GoldCaveByte:array[0..0] of byte = ($01);
GoldCave:array[0..43] of byte = ($80,$3D,$00,$00,$00,$00,$01,$75,$0E,$81,$40,$38,
$10,$27,$00,$00,$C6,$05,$00,$00,$00,$00,$00,$8B,
$58,$38,$39,$1D,$68,$69,$9E,$00,$0F,$84,$00,$00,
$00,$00,$68,$00,$00,$00,$00,$C3);
//bei Spielstart
BaseAddr := VirtualAllocEx(Pidhandle,NIL,2048,MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
Caveadress1 := Cardinal(BaseAddr)+$0000;
WriteBytesToMem(Pidhandle, GOLDSAMMELN, Written, JmpGoldCave);
Caveadress1 := Caveadress1+$0010;
WriteProcessMemory(Pidhandle, Pointer(GOLDSAMMELN+$01), @Caveadress1, 4, Written);
WriteBytesToMem(Pidhandle,Caveadress1,Written,GoldCave);
Caveadress1 := Caveadress1-$0010;
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$12), @Caveadress1, 4, Written);
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$22), @Caveadress1, 4, Written);
ByteVar := $50A6C8-(Caveadress1+$30)-$6;
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$32), @ByteVar, 4, Written);
ByteVar := $50A668;
WriteProcessMemory(Pidhandle, Pointer(Caveadress1+$37), @ByteVar, 4, Written);
//bei Hotkey
WriteBytesToMem(Pidhandle,Caveadress1,Written,GoldCaveByte);
[/code]
Es gibt 10 verschiedene Typen von Personen, die, die ich mag und die, die ich nicht verstehen kann...