问题描述
最近,我试图扩展对C语言的了解,并且遇到了一个使用emit可能会 emit 字节的程序.
I recently tried to expand my knowledge of the C language and I came across a program that used emit, to possibly emit a byte.
__declspec(naked) void marker_begin() {
__asm {
_emit 0x51;
_emit 0x21;
_emit 0x1A;
_emit 0x14;
_emit 0x2C;
_emit 0x5B;
}
}
这可以用来做什么?预先感谢.
What could this be used for?Thanks in advance.
推荐答案
您的C程序正在使用_asm
关键字执行内联汇编代码. _asm是MSDN
中使用的Microsoft特定关键字. __asm
关键字调用内联汇编器.它后面必须是汇编指令,用大括号括起来的一组指令,或者至少是一对空括号.
Your C program is executing inline assembly code by using the _asm
keyword. _asm is a Microsoft specific keyword used in MSDN
. The __asm
keyword invokes the inline assembler. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at least, an empty pair of braces.
_emit
伪指令类似于MASM
的DB
指令. _emit
是MSDN
特定的伪指令. _emit
用于在当前文本段的当前位置定义单个立即字节. _emit
一次只能定义一个字节,并且只能在文本段中定义.
The _emit
pseudo instruction is similar to the DB
directive of MASM
. _emit
is an MSDN
specific pseudo instruction. _emit
is used to define a single immediate byte at the current location in the current text segment. _emit
can define only one byte at a time and only in the text segment.
这篇关于在C编程中,“发射"是什么?做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!