• Welcome to Valhalla Legends Archive.
 

Inline asm issue in VC++ 6

Started by Yegg, April 06, 2007, 09:16 PM

Previous topic - Next topic

Yegg

I'm just messing around with inline assembly in MS VC++ 6. Here is the code I am working on:

__asm {
mov eax, 0
push eax
call GetModuleHandle
mov [hInstance], eax
mov eax, [hInstance]
push eax
mov eax, IDD_MAINFORM
push eax
mov eax, NULL
push eax
mov eax, MainDlgProc
push eax
call DialogBoxParam
}


Now, the error I get is:

Quoteerror C2400: inline assembler syntax error in 'second operand'; found ')'

Now, I'm not VC++ expert or asm expert, so I really have no clue why this would happen. For all I know the answer to this is very simple. I'm also not sure where this ')' is located when the error refers to it. Hopefully someone can help me out with this.

MyndFyre

Can you tell us at least which line?

I would guess IDD_MAINFORM since it's #defined in a resource file.  But telling us the line of the error may be helpful...
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Yegg

Sorry about that. I meant to put which line, I just forgot. Here it is:

mov eax, NULL

Hell-Lord

#3
This is just a wild guess but instead of NULL maybe 'False' ?

Yegg

Quote from: Hell-Lord on April 06, 2007, 09:42 PM
This is just a wild guess but instead of NULL maybe 'false'
?

It just tells me that the label 'false' is undefined. Keep in mind that this is the first time I've ever tried messing with inline assembly, so I'm probably not doing something else that I should have done.

MyndFyre

Replace it with 0.  I'm thinking that NULL is in stdio.h:


#define NULL    ((void *)0)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Hell-Lord

#6
Yep it is in the stdio.h header.

Just to my knowledge :
__asm ("assembly code");

Not sure what difference () will make instead of {}

Also i believe you can entirely remove 'NULL'
so it will look like

mov      eax

MyndFyre

Or as is a really common practice:


xor eax, eax
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Yegg

Replacing NULL with 0 causes the application to crash upon execution. Doing xor eax, eax also causes the application to crash upon execution. I'm beginning to think that I've done something else wrong? I'll let you know if I figure anything out.

Hell-Lord

By the way is that an Intel Processor you have right?

Barabajagal

[Intel-based/X86/x64. Intel and AMD have the same base system, so saying Intel isn't quite the correct terminology.]

Hell-Lord


Barabajagal

It's not about knowing, Paul, it's about terminology.

Hell-Lord

Thanks for the lesson Andy :D

Try:
mov      eax, edx

Warrior

Well..he could of been asking it he was using an intel processor, never mind the architecture. :)

But I am just being dense on purpose.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?