Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


define dword (dd) on c++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
gunminiho
Expert Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Tue Jul 13, 2010 1:16 pm    Post subject: define dword (dd) on c++ Reply with quote

OK guys there's some scripts liek this:

[
Code:
ENABLE]
alloc(lol,400)
label check
label return
label skip

lol:
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
dd 00256315
.
.
.
dd 00

check:
cmp eax,lol
je skip
cmp eax,0
je return
add eax,4
jmp check

return:
jmp Address+6


how do i do that dd on C++?

i've seen doing it on builder like this:


Code:

void __declspec(naked) lol()
{
   __asm

   {
      dd 0x001F6EE0
      dd 0x001F72C8
      dd 0x001F6EE1
      dd 0x001F72C9
                 .
                 .
                 .


and then use another naked function to emule this

Code:
check:
cmp eax,lol
je skip
cmp eax,0
je return
add eax,4
jmp check

return:
jmp Address+6


and i did it on C++ ( Visual Studio 2008 )

and it throws me an error on dd

Quote:
error C2400: syntax error inline assembly code in 'opcode', found 'constant'


am i doing something wrong? or isn't dd a way to recreate it.

PS: i already declared a array of DWORDs but it doesn't work.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jul 13, 2010 2:10 pm    Post subject: Reply with quote

just create an array of DWORDS normally outside of the inline asm block
Back to top
View user's profile Send private message
gunminiho
Expert Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Tue Jul 13, 2010 3:45 pm    Post subject: Reply with quote

slovach wrote:
just create an array of DWORDS normally outside of the inline asm block


i tried it doesn't work
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jul 13, 2010 5:17 pm    Post subject: Reply with quote

Code:
#include <Windows.h>
int main()
{
   DWORD scrote[] = { 1, 2, 3 };

   __asm
   {
      mov eax, dword ptr [scrote]
      mov ecx, dword ptr [scrote + 4]
      mov edx, dword ptr [scrote + 8]
      nop

   }

   return 0;
}
Back to top
View user's profile Send private message
gunminiho
Expert Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Tue Jul 13, 2010 6:49 pm    Post subject: Reply with quote

slovach wrote:
Code:
#include <Windows.h>
int main()
{
   DWORD scrote[] = { 1, 2, 3 };

   __asm
   {
      mov eax, dword ptr [scrote]
      mov ecx, dword ptr [scrote + 4]
      mov edx, dword ptr [scrote + 8]
      nop

   }

   return 0;
}


OK this mov eax, dword ptr [scrote] will put a pointer in scrote.

i dont need that i need to state the real value instead of a pointer to first data.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jul 13, 2010 7:54 pm    Post subject: Reply with quote

the array decays into a pointer, yes.

eax will be 1, not the address of scrote.


same as doing something like:
Code:
#include <Windows.h>
int main()
{
   DWORD scrote[] = { 1, 2, 3 };
   DWORD butt;

   butt = *scrote;

   return 0;
}




but i'm not entirely sure what you're trying to do anyway
Back to top
View user's profile Send private message
gunminiho
Expert Cheater
Reputation: 0

Joined: 15 Dec 2008
Posts: 144
Location: peru

PostPosted: Tue Jul 13, 2010 9:02 pm    Post subject: Reply with quote

slovach wrote:
the array decays into a pointer, yes.

eax will be 1, not the address of scrote.


same as doing something like:
Code:
#include <Windows.h>
int main()
{
   DWORD scrote[] = { 1, 2, 3 };
   DWORD butt;

   butt = *scrote;

   return 0;
}




but i'm not entirely sure what you're trying to do anyway


holy crap Laughing Laughing Laughing Laughing this doesn't worked on Delphi xD!!

and works on C++ Very Happy!!!!! <3333333333333333333333

i was lazy to test it still <33333

im trying to make a item filter
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Jul 14, 2010 3:46 am    Post subject: Reply with quote

it's just dereferencing the pointer

if you wanted to move the address into eax, you could use the lea instruction.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites