<small id='etNp0'></small><noframes id='etNp0'>

  • <legend id='etNp0'><style id='etNp0'><dir id='etNp0'><q id='etNp0'></q></dir></style></legend>
    <tfoot id='etNp0'></tfoot>
    1. <i id='etNp0'><tr id='etNp0'><dt id='etNp0'><q id='etNp0'><span id='etNp0'><b id='etNp0'><form id='etNp0'><ins id='etNp0'></ins><ul id='etNp0'></ul><sub id='etNp0'></sub></form><legend id='etNp0'></legend><bdo id='etNp0'><pre id='etNp0'><center id='etNp0'></center></pre></bdo></b><th id='etNp0'></th></span></q></dt></tr></i><div id='etNp0'><tfoot id='etNp0'></tfoot><dl id='etNp0'><fieldset id='etNp0'></fieldset></dl></div>
      • <bdo id='etNp0'></bdo><ul id='etNp0'></ul>

      1. 带有字符串变量指令的 C/C++ 内联汇编器

        C/C++ inline assembler with instructions in string variables(带有字符串变量指令的 C/C++ 内联汇编器)

          <small id='V0W4c'></small><noframes id='V0W4c'>

            <tfoot id='V0W4c'></tfoot>
              <legend id='V0W4c'><style id='V0W4c'><dir id='V0W4c'><q id='V0W4c'></q></dir></style></legend>

                <tbody id='V0W4c'></tbody>

              1. <i id='V0W4c'><tr id='V0W4c'><dt id='V0W4c'><q id='V0W4c'><span id='V0W4c'><b id='V0W4c'><form id='V0W4c'><ins id='V0W4c'></ins><ul id='V0W4c'></ul><sub id='V0W4c'></sub></form><legend id='V0W4c'></legend><bdo id='V0W4c'><pre id='V0W4c'><center id='V0W4c'></center></pre></bdo></b><th id='V0W4c'></th></span></q></dt></tr></i><div id='V0W4c'><tfoot id='V0W4c'></tfoot><dl id='V0W4c'><fieldset id='V0W4c'></fieldset></dl></div>
                  <bdo id='V0W4c'></bdo><ul id='V0W4c'></ul>

                  本文介绍了带有字符串变量指令的 C/C++ 内联汇编器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  正如您在 C 和 C++ 中所知道的,如果使用 Visual-C,您可以使用内嵌汇编指令,例如:

                  So as you know in C and C++ if using Visual-C you can have in line assembly instructions such as:

                  int main() {
                      printf("Hello
                  ");
                      __asm int 3
                      printf("this will not be printed.
                  ");
                      return 0;
                  }
                  

                  这将在可执行文件中创建一个断点.所以我的问题是,是否有某种函数可以使用诸如 char 数组之类的变量来调用 __asm .我在想这样的事情:

                  Which will make a breakpoint inside of the executable. So my question is, is there somekind of function I can use to call __asm using a variable such as a char array. I was thinking something like this:

                  char instruction[100] = "int 3";
                  __asm instruction
                  

                  但这似乎并没有真正起作用,因为它给出了无效的 OP 代码".所以你能帮忙解决这个问题,或者根本不可能.

                  But that doesn't seem to really work since it gives 'Invalid OP code'. So can you help with this or it isn't possible at all.

                  推荐答案

                  你的程序的代码是由编译器在编译期间创建的.
                  您正试图在 运行时 为编译器提供输入 - 当程序已经在执行时.如果您想要即时编译",则必须编写一个增量编译器和链接器,以便在执行时修改代码.

                  The code of your program is created by the compiler, during compilation.
                  You are trying to feed the compiler the input for that at run time - when the program is already executing. If you want ‘on-the-fly-compilation’, you will have to program an incremental compiler and linker that can modify the code while executing it.

                  请注意,即使您会成功,许多操作系统也会阻止此类执行,因为它违反了安全性.这将是构建病毒的好方法,因此通常会被阻止.

                  Note that even if you would be successful, many OS would block such execution, as it violates security. It would be a great way to build viruses, and is therefore typically blocked.

                  这篇关于带有字符串变量指令的 C/C++ 内联汇编器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to print vector#39;s data(如何打印矢量的数据)
                  Visual C++ appends 0xCC (int3) bytes at the end of functions(Visual C++ 在函数末尾附加 0xCC (int3) 字节)
                  How to use a variable inside a _T wrapper?(如何在 _T 包装器中使用变量?)
                  MSVC++ warning flags(MSVC++ 警告标志)
                  How to read file which contains uxxxx in vc++(如何在vc++中读取包含uxxxx的文件)
                  stack overflow error in C++ program(C++程序中的堆栈溢出错误)
                • <legend id='slhpu'><style id='slhpu'><dir id='slhpu'><q id='slhpu'></q></dir></style></legend>

                  • <small id='slhpu'></small><noframes id='slhpu'>

                        <bdo id='slhpu'></bdo><ul id='slhpu'></ul>
                        <i id='slhpu'><tr id='slhpu'><dt id='slhpu'><q id='slhpu'><span id='slhpu'><b id='slhpu'><form id='slhpu'><ins id='slhpu'></ins><ul id='slhpu'></ul><sub id='slhpu'></sub></form><legend id='slhpu'></legend><bdo id='slhpu'><pre id='slhpu'><center id='slhpu'></center></pre></bdo></b><th id='slhpu'></th></span></q></dt></tr></i><div id='slhpu'><tfoot id='slhpu'></tfoot><dl id='slhpu'><fieldset id='slhpu'></fieldset></dl></div>
                          <tbody id='slhpu'></tbody>

                        1. <tfoot id='slhpu'></tfoot>