How to call assembler

I assigned assembler codes into array buf,and I want to call the codes,
when I compile it,the statement jmp buf display error: illegal size for operand和illegal instruction size，
who could help me how to call it?

But, you should also know that many OSs (eg. any version of windows since XP sp1) will include "Data Execution Prevention" and will report access violation errors on what you are trying to do. Getting code to execute instructions in memory data is a prime route for exploits and trojans so it's likely to *at least* trigger virus scanners.

Why on earth would you want to do that? To print them out? As CommonTater already pointed out you can not have code execution in the data section of your program. The OS will not allow it.

Originally Posted by leetow2003

error: illegal size for operand illegal instruction size

Because when you write assemble code do you write it to jmp and then just put in what operand you want it to jmp to? No you don't, that would be silly.

Originally Posted by leetow2003

who could help me how to call it?

No one will

Just some words of advice my friend, you have been on this board for just over a month and so far all your posts have been involved with networking. Now, you ask this question about trying to run assembly code from the data section of a program. I would tread carefully and begin to explain in a lot more detail on what it is you are really trying to accomplish.

Some acceptable questions:
Can you explain to me how to call C funtions with inline assembly? - yes
Can you explain to me how to access C variables for use inside my inline assembly? - yes
Can you explain to me how to jmp around between inline assemble and my C code - yes
....
Can you show me how to be a "script kiddie"? - NO

Why on earth would you want to do that? To print them out? As CommonTater already pointed out you can not have code execution in the data section of your program. The OS will not allow it.

Actually, you can. I just tried it on a fully updated Windows XP installation with MS Security Essentials running with no complaints. There's an awful lot of hoops to jump through though to get it to do so. A simple jmp is wrong and what will the code do when its there? Can it exit? Can it terminate the process? Can it do anything meaningful? And in truth, as already mentioned, why would you want to do it?

Haha...thanks for that one Fordy. I'm sure you can actually still do many things; I generally tend to go with a positive "no" on this one due to as you pointed out: "There's an awful lot of hoops to jump through though to get it to do so". Basically, my assumption is that if you know how to do it, then you won't be asking how.

Actually, you can. I just tried it on a fully updated Windows XP installation with MS Security Essentials running with no complaints. There's an awful lot of hoops to jump through though to get it to do so. A simple jmp is wrong and what will the code do when its there? Can it exit? Can it terminate the process? Can it do anything meaningful? And in truth, as already mentioned, why would you want to do it?

Now take that XP Installation... go Control Panel -> System -> Performance -> Advanced -> Data Execution Prevention -> Turn on DEP for all ...

Try that again.

Also note that Windows can be set to boot up with DEP fully on, as well as an option on the bootstrap line...

Haha...thanks for that one Fordy. I'm sure you can actually still do many things; I generally tend to go with a positive "no" on this one due to as you pointed out: "There's an awful lot of hoops to jump through though to get it to do so". Basically, my assumption is that if you know how to do it, then you won't be asking how.

EDIT: Well, a much more informed question I should say.

Not to mention that DEP is a major attack vector used by trojans and malware...

Still works with DEP set to all processes. Haven't tested this on 7 or Vista though...and I cant get hardware DEP on the virtual machine I run, only software

Software DEP is quite limited compared to the hardware version. It only protects exception handlers on binaries built to be software DEP aware. It does not check if the memory page is marked as executable or not.