| View previous topic :: View next topic |
| Author |
Message |
azfk Cheater
Reputation: 0
Joined: 26 May 2009 Posts: 37
|
Posted: Fri Jul 31, 2009 12:42 pm Post subject: Inline Assembly/ |
|
|
| Code: |
__declspec(naked) void SendInputM(UINT nInputs, LPINPUT pInputs, int cbSize)
{
asm(
"pushl %ebp;"
"movl %ebp, %esp;"
"jmp DWORD PTR [myAddress];"
);
}
|
How do I place a jump in at&t syntax, searched for a long time... compiler keeps telling me that PTR is junk lolz.
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Fri Jul 31, 2009 12:54 pm Post subject: Re: Inline Assembly/ |
|
|
| azfk wrote: | | Code: |
__declspec(naked) void SendInputM(UINT nInputs, LPINPUT pInputs, int cbSize)
{
asm(
"pushl %ebp;"
"movl %ebp, %esp;"
"jmp DWORD PTR [myAddress];"
);
}
|
How do I place a jump in at&t syntax, searched for a long time... compiler keeps telling me that PTR is junk lolz. |
__declspec(naked) void SendInputM(UINT nInputs, LPINPUT pInputs, int cbSize)
{
__asm{
push ebp
mov ebp,esp
jmp DWORD PTR [myAddress]
}
}
|
|
| Back to top |
|
 |
azfk Cheater
Reputation: 0
Joined: 26 May 2009 Posts: 37
|
Posted: Fri Jul 31, 2009 1:05 pm Post subject: |
|
|
| GCC compiler = at&t
|
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 61
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Fri Jul 31, 2009 1:20 pm Post subject: |
|
|
| jmpl myAddress(,1)
|
|
| Back to top |
|
 |
azfk Cheater
Reputation: 0
Joined: 26 May 2009 Posts: 37
|
Posted: Fri Jul 31, 2009 1:49 pm Post subject: |
|
|
HOHO GREAT
that works but.. now i'm getting some dumb error
| Code: |
DWORD myAddress = NULL;
__declspec(naked) void SendInputM(UINT nInputs, LPINPUT pInputs, int cbSize)
{
asm(
"pushl %ebp;"
"movl %esp, %ebp;"
"jmpl myAddress(,1);"
);
}
int main(void)
{
int length, repeats, c, a, dwMilliseconds;
CHAR string_input [1024];
|
Says 'undefined reference to myaddress' but i thought i made it global O.O
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Jul 31, 2009 5:19 pm Post subject: |
|
|
why is MyAddress NULL.
_________________
|
|
| Back to top |
|
 |
azfk Cheater
Reputation: 0
Joined: 26 May 2009 Posts: 37
|
Posted: Fri Jul 31, 2009 5:57 pm Post subject: |
|
|
I thought i had to initialize it as NULL
| Code: |
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <string.h>
DWORD myAddress;
__declspec(naked) void SendInputM(UINT nInputs, LPINPUT pInputs, int cbSize)
{
asm(
"pushl %ebp;"
"movl %esp, %ebp;"
"jmpl myAddress(,1);"
);
}
int main(void)
{
int length, repeats, c, a, dwMilliseconds;
myAddress = (DWORD)GetProcAddress(LoadLibrary("user32.dll"),"SendInput")+5;
|
taking stabs here
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Jul 31, 2009 7:25 pm Post subject: |
|
|
| azfk wrote: | I thought i had to initialize it as NULL
| Code: |
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <string.h>
DWORD myAddress;
__declspec(naked) void SendInputM(UINT nInputs, LPINPUT pInputs, int cbSize)
{
asm(
"pushl %ebp;"
"movl %esp, %ebp;"
"jmpl myAddress(,1);"
);
}
int main(void)
{
int length, repeats, c, a, dwMilliseconds;
myAddress = (DWORD)GetProcAddress(LoadLibrary("user32.dll"),"SendInput")+5;
|
taking stabs here |
does that still not work? And you didn't even show initializing myAddress to something other than NULL in the other example
_________________
|
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Sat Aug 01, 2009 1:26 pm Post subject: |
|
|
| Code: | mov eax,myAddress
jmp eax |
or
| Code: | mov eax,[myAddress]
jmp eax |
Not sure
oib111 posted this, might be a help aswell:
| Code: | DWORD myDIP = (DWORD)GetProcAddress(LoadLibrary("d3d9.dll"), "DrawIndexedPrimitive")+5;
_declspec(naked) HRESULT DIP(D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT PrimitiveCount) {
_asm {
push ebp
mov ebp, esp
jmp dword ptr ds:[myDIP];
}
} |
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Sat Aug 01, 2009 7:45 pm Post subject: |
|
|
bad code.. globals..use all the code in separated functions..
_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you. |
|
| Back to top |
|
 |
azfk Cheater
Reputation: 0
Joined: 26 May 2009 Posts: 37
|
Posted: Sat Aug 01, 2009 8:55 pm Post subject: |
|
|
umm this code is determined at runtime (the address), not at compile, and I did put this code outside like this
| Code: |
#include <windows.h>
#include <string.h>
DWORD myAddress = (DWORD)GetProcAddress(LoadLibrary("user32.dll"),"SendInput")+5;
__declspec(naked) void SendInputM(UINT nInputs, LPINPUT pInputs, int cbSize)
{
asm(
"pushl %ebp;"
"movl %esp, %ebp;"
"jmpl myAddress(,1);"
);
}
|
but i recently noticed that, I thought I would put it inside the main function, I know some compilers allow this, I'll just switch compilers I guess.
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Sat Aug 01, 2009 9:55 pm Post subject: |
|
|
cant do that..unless you make the strings for it in the code..so that when the hook is written to the target code it doesnt rely on 'data that isnt there'...so you can't just force inline the GetProcAddress function like your thinking...you could use a heap by allocating it dynamicily in the hook routine using RtlProcessHeap..and RtlAllocateHeap you could then use the heap to store your strings or other parameters or w/e..or you could make your dll always load at a certain location and use hardcode offsets..
_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you. |
|
| Back to top |
|
 |
|