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 


[C++] Inline ASM

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

Joined: 26 Nov 2006
Posts: 404

PostPosted: Thu Dec 11, 2008 5:12 pm    Post subject: [C++] Inline ASM Reply with quote

what kind of template should i use? I'm using CLR Windows Form Application. I doubt that should be the one to use. Which one is better?

Oh i'm using VC++ Microsoft.
thanks.

_________________
Back to top
View user's profile Send private message AIM Address
BirdsEye
Advanced Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 94

PostPosted: Thu Dec 11, 2008 5:24 pm    Post subject: Reply with quote

...Dont use C++.NET... Ever... Stick with Win32 and before you start API learn basic C++ [Here]. Once you can make medium applications on your own, go to Win32. This is what got me started. After that you, you incorporate new APIs (Use MSDN) as your move through projects.

EDIT: noz3001 is right... What does this have to do with inline assembly?


Last edited by BirdsEye on Thu Dec 11, 2008 5:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Thu Dec 11, 2008 5:27 pm    Post subject: Reply with quote

Inline ASM?
Back to top
View user's profile Send private message MSN Messenger
FerrisBuellerYourMyHero
Master Cheater
Reputation: 0

Joined: 14 Feb 2007
Posts: 401
Location: Inside your <kernel>

PostPosted: Thu Dec 11, 2008 5:39 pm    Post subject: Reply with quote

I believe CLR is for writing managed code...

If you want to write unmanaged native code create a Win32 project. If you want to make a console app select Win32 Console Application, for a DLL, or Win32 GUI select Win32 Project...

And I always just select blank project, and create the main file myself, as I think the pre-compiled header + the default projects contain unnecessary things that just bloat your code...

There is a way to create forms and controls with a resource editor, but I don't like doing it that way and just use CreateWindowEx to create every window/control Wink

anyway what does this have to do with inline asm? lol

inline asm in MSVC++ is very nicely done... Dev C++ on the other hand, I don't like, by default it uses att&t syntax(which i hate) and you have to use quotes "" and its just a mess!!

But since your using VC++ you don't have to worry about that...

Some things that I should point out though about using it...

Ok you know like in auto assembler (with CE)

say Value is a 4 byte allocated value.

if you write it like this

Code:

mov eax, Value


it moves the address of Value instead of the actual value of Value into eax...

and doing this

Code:

mov eax, [Value]


will move the value of it into eax...

well in MSVC++ if you write it like this

Code:

DWORD Value = 0x539;

_asm
{
     mov eax, Value
}


No matter if you put the brackets([]) around 'Value' or not, it still moves the value of it into eax instead of the address!!

So to overcome that, I just use lea

Code:

DWORD Value = 0x539;

_asm
{
     lea eax, [Value]
}



you could also write it like

Code:

DWORD Value = 0x539;

_asm
{
     mov eax, offset Value
}


I think? or maybe I'm just thinking of masm32...


also you cannot mov a hard coded address like this for example

Code:

_asm
{
     mov eax, [0x974EE8]
}


It just won't let you!

so instead you have to put that address into a 4 byte variable and then moving the value of that into a register, then moving the value of that register will give you the intended result

Code:

DWORD address = 0x974EE8;

_asm
{
     mov eax, [address]
     mov eax, [eax]
}


So those are some things you should be aware of, that I had to figure out when using inline assembly in MSVC++ Wink

_________________
You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!

Back to top
View user's profile Send private message MSN Messenger
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Thu Dec 11, 2008 6:03 pm    Post subject: Reply with quote

for poiunters,

Code:
mov eax,dword ptr ds:[0x400000]


will also work.

_________________
Back to top
View user's profile Send private message Send e-mail
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Thu Dec 11, 2008 9:46 pm    Post subject: Reply with quote

soo... you're saying... don't use vc++? but i like it D:
_________________
Back to top
View user's profile Send private message AIM Address
FerrisBuellerYourMyHero
Master Cheater
Reputation: 0

Joined: 14 Feb 2007
Posts: 401
Location: Inside your <kernel>

PostPosted: Fri Dec 12, 2008 2:05 am    Post subject: Reply with quote

When did I say that?

I never said don't use it! In fact that's what I use! I use MSVC++ 2008 express edition.

I also use dev c++ but only when I'm away from my computer. I have the portable version on a flash drive.

But I like VC++ alot more! especially since the inline asm syntax.

So DO use it, I recommend it.

What I wouldn't recommend is an old version like VC++ 6.0, its too old skool. 2008 is probably the best to use.

However there seems to be a problem with it. Can anyone else confirm that its not just my computer and it happens to everyone?

Sometimes when trying to create a new project, the first window that pops up, I select Win32 Project for example, name it, then press okay. Sometimes the next window doesn't popup and it says project creation failed in the status window of the IDE. Then other times the next window comes up, but kind of freezes, and stays blank white, until you hit x. The whole IDE doesn't freeze just the window. I close it and try again. And some other times I even get farther than that, and the window pops up and I hit next, which takes it to the next screen where you select between, "Windows Application", "Console Application", "DLL", "Static Library" and the checkbox for "Empty Project"

at any point in between getting to that window or clicking finish, it could say project creation failed in the status window again!!

Its really annoying and sometimes I have to make several attempts when creating new projects...

So has anyone else encountered the same? or am I special?

_________________
You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!

Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Dec 12, 2008 2:08 am    Post subject: Reply with quote

I've never had that problem
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Fri Dec 12, 2008 2:31 am    Post subject: Reply with quote

Me neither, though a quick google shows some possible solutions:-
http://petesbloggerama.blogspot.com/2007/10/visual-studio-2008-orcas-creation.html
http://www.google.com/search?q=project+creation+failed+visual+studio
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Fri Dec 12, 2008 7:05 am    Post subject: Reply with quote

I remember something similar happened to me too...
Try starting MVC++ through the command prompt:
VCExpress /resetskippkgs
Back to top
View user's profile Send private message
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Fri Dec 12, 2008 4:55 pm    Post subject: Reply with quote

umm... so you want me to use empty win32 ?
_________________
Back to top
View user's profile Send private message AIM Address
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Fri Dec 12, 2008 5:14 pm    Post subject: Reply with quote

hacksign23 wrote:
umm... so you want me to use empty win32 ?


yes...then program the bot/thing from there.

_________________
Back to top
View user's profile Send private message Send e-mail
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Sat Dec 13, 2008 12:06 am    Post subject: Reply with quote

k thx

edit: what's the difference between managed and not?

_________________
Back to top
View user's profile Send private message AIM Address
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