安全研发----64位和32位程序在Visual Studio中使用汇编方法总结

目录

一.32位程序使用方法

二.64位程序使用方法


一.32位程序使用方法

直接可以在代码中直接嵌入

    __asm  
    {  
        lea eax, shellcode;  
        jmp eax;  
    } 

二.64位程序使用方法

64位中不像32位程序一样能够在程序中书写代码段,要嵌入到文件中

新建一个.asm文件

.code

fun1 proc
	mov rax, 120
	add rax, 34
	sub rax, 130
	ret
fun1 endp;
end

在需要使用的cpp文件中声明

extern "C" int fun1(int);

以下是main文件的所有代码,可以看到直接声明了fun1函数,然后直接调用即可。

#include 

extern "C" int fun1(int);

int main()
{
	fun1(0);
    std::cout 

你可能感兴趣的:(Windows终端安全,安全研发,visual,studio,ide,visualstudio)