 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Thu Aug 28, 2008 2:12 pm Post subject: |
|
|
| Rot1 wrote: | | HolyBlah wrote: | | From here its easy. If you need some more help or an example just ask. |
thanks, i tried using init in my .dll (importing it from unit.pas) and it won't work ! why =/ ?
can i have an example of a .dll initializing a HWND variable ? thanks man !
i tried doing this:
| Code: | var hWindow:HWND;
procedure Initialize;
begin
hWindow:=FindWindow(Target, nil);
end;
begin
Initialize;
end. |
| You didn't read the link, did you? Read it and then come again.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Thu Aug 28, 2008 2:43 pm Post subject: |
|
|
| HolyBlah wrote: | | Rot1 wrote: | | HolyBlah wrote: | | From here its easy. If you need some more help or an example just ask. |
thanks, i tried using init in my .dll (importing it from unit.pas) and it won't work ! why =/ ?
can i have an example of a .dll initializing a HWND variable ? thanks man !
i tried doing this:
| Code: | var hWindow:HWND;
procedure Initialize;
begin
hWindow:=FindWindow(Target, nil);
end;
begin
Initialize;
end. |
| You didn't read the link, did you? Read it and then come again. |
i did read it !! and i tried it. -_-
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Aug 28, 2008 5:17 pm Post subject: |
|
|
| Rot1 wrote: | | Symbol wrote: | | "a function without making it"...? |
i showed an example, -_-
look, in C you can do it like this:
| Code: | #include <windows.h>
HWND dd = FindWindow(NULL, L"Calc");
void main()
{
if(dd != NULL)
//your code
} |
how can i do it in Delphi ? |
#include <windows.h>
HWND dd;
bool tcall(){
if( dd = FindWindow(NULL, (LPCWSTR)"Calc") )
return true;
else
return false;
}
int main(){
do {
Sleep(10);
} while(!tcall());
return 1;
}
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Thu Aug 28, 2008 5:27 pm Post subject: |
|
|
you need to include windows
under use, put windows;
and declare the hwnd in global which is aboce the {res} thingy I think.
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Fri Aug 29, 2008 1:18 am Post subject: |
|
|
| Initialization is a section, not a procedure.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Fri Aug 29, 2008 1:56 am Post subject: |
|
|
| HolyBlah wrote: | | Initialization is a section, not a procedure. |
omfg, i know !! it's a reserved word, i can't place it in a library.dpr (doesn't have unit.pas), so i added a unit.pas to the project, and put there init and it didn't work i assume, let me try again.
|
|
| Back to top |
|
 |
~NJ Grandmaster Cheater Supreme
Reputation: 0
Joined: 09 Mar 2007 Posts: 1417 Location: sitting outside of the forum
|
Posted: Fri Aug 29, 2008 8:14 am Post subject: |
|
|
Try
| Code: | var
Form1: TForm1;
hWindow:HWND;
implementation
{$R *.dfm}
procedure Initialize;
begin
hWindow:=FindWindow(Target, nil);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Initialize;
end;
end. |
_________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Fri Aug 29, 2008 8:31 am Post subject: |
|
|
zeldaz, it's a routine, not a procedure T.T
also you can already do it OnCreate form, why create another procedure ?
i want for a .dll !!
i think i found it:
| Code: | library OnlyMyDLL;
uses
SysUtils, Windows;
procedure DllMain(reason: integer) ;
var
buf : array[0..MAX_PATH] of char;
loader : string;
begin
case reason of
DLL_PROCESS_ATTACH:
begin
GetModuleFileName(0, buf, SizeOf(buf)) ;
loader := buf;
if Pos('MyCallingApp.exe', loader) > 0 then
ExitCode := -1
end;
DLL_PROCESS_DETACH
begin
//DLL unloading...
end;
end;
end; (*DllMain*)
begin
DllProc := @DllMain;
DllProc(DLL_PROCESS_ATTACH) ;
//more DLL code here...
end. |
| Code: | function Pos(const substr, str: AnsiString): Integer; overload;
asm
push ebx
push esi
add esp, -16
test edx, edx
jz @NotFound
test eax, eax
jz @NotFound
mov esi, [edx-4] //Length(Str)
mov ebx, [eax-4] //Length(Substr)
cmp esi, ebx
jl @NotFound
test ebx, ebx
jle @NotFound
dec ebx
add esi, edx
add edx, ebx
mov [esp+8], esi
add eax, ebx
mov [esp+4], edx
neg ebx
movzx ecx, byte ptr [eax]
mov [esp], ebx
jnz @FindString
sub esi, 2
mov [esp+12], esi
@FindChar2:
cmp cl, [edx]
jz @Matched0ch
cmp cl, [edx+1]
jz @Matched1ch
add edx, 2
cmp edx, [esp+12]
jb @FindChar4
cmp edx, [esp+8]
jb @FindChar2
@NotFound:
xor eax, eax
jmp @Exit0ch
@FindChar4:
cmp cl, [edx]
jz @Matched0ch
cmp cl, [edx+1]
jz @Matched1ch
cmp cl, [edx+2]
jz @Matched2ch
cmp cl, [edx+3]
jz @Matched3ch
add edx, 4
cmp edx, [esp+12]
jb @FindChar4
cmp edx, [esp+8]
jb @FindChar2
xor eax, eax
jmp @Exit0ch
@Matched2ch:
add edx, 2
@Matched0ch:
inc edx
mov eax, edx
sub eax, [esp+4]
@Exit0ch:
add esp, 16
pop esi
pop ebx
ret
@Matched3ch:
add edx, 2
@Matched1ch:
add edx, 2
xor eax, eax
cmp edx, [esp+8]
ja @Exit1ch
mov eax, edx
sub eax, [esp+4]
@Exit1ch:
add esp, 16
pop esi
pop ebx
ret
@FindString4:
cmp cl, [edx]
jz @Test0
cmp cl, [edx+1]
jz @Test1
cmp cl, [edx+2]
jz @Test2
cmp cl, [edx+3]
jz @Test3
add edx, 4
cmp edx, [esp+12]
jb @FindString4
cmp edx, [esp+8]
jb @FindString2
xor eax, eax
jmp @Exit1
@FindString:
sub esi, 2
mov [esp+12], esi
@FindString2:
cmp cl, [edx]
jz @Test0
@AfterTest0:
cmp cl, [edx+1]
jz @Test1
@AfterTest1:
add edx, 2
cmp edx, [esp+12]
jb @FindString4
cmp edx, [esp+8]
jb @FindString2
xor eax, eax
jmp @Exit1
@Test3:
add edx, 2
@Test1:
mov esi, [esp]
@Loop1:
movzx ebx, word ptr [esi+eax]
cmp bx, word ptr [esi+edx+1]
jnz @AfterTest1
add esi, 2
jl @Loop1
add edx, 2
xor eax, eax
cmp edx, [esp+8]
ja @Exit1
@RetCode1:
mov eax, edx
sub eax, [esp+4]
@Exit1:
add esp, 16
pop esi
pop ebx
ret
@Test2:
add edx,2
@Test0:
mov esi, [esp]
@Loop0:
movzx ebx, word ptr [esi+eax]
cmp bx, word ptr [esi+edx]
jnz @AfterTest0
add esi, 2
jl @Loop0
inc edx
@RetCode0:
mov eax, edx
sub eax, [esp+4]
add esp, 16
pop esi
pop ebx
end; |
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Fri Aug 29, 2008 11:04 am Post subject: |
|
|
Why did u program that entire thing in asm @.@
and you need to add 2 "end;" cause you didn't end the asm part.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Fri Aug 29, 2008 11:51 am Post subject: |
|
|
| dnsi0 wrote: | Why did u program that entire thing in asm @.@
and you need to add 2 "end;" cause you didn't end the asm part. |
lol i didn't made that procedure Pos(), someone named Aleksander who works at FastCode.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|