小编ore*_*nge的帖子

为什么编译器向左移0?

在我编写这个简单的程序之后,当我在Visual Studio中进入反汇编模式时,我注意到一些奇怪的事情:编译器添加了一个向左移位0位的指令.

为什么这样做?

这是C++代码:

#include <iostream>

using namespace std;

int main(int argc, char **argv) {


    if (argc != 3)
        return 0;

    if (strcmp(argv[1], "-r") == 0) {
        printf("test");
    }

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是汇编代码:

...
        return 0;
00131C94  xor         eax,eax  
00131C96  jmp         main+57h (0131CC7h)  

    if (strcmp(argv[1], "-r") == 0) {
00131C98  push        offset string "-r" (0138B30h)  
00131C9D  mov         eax,4  
00131CA2  shl         eax,0  <------------------------- HERE
00131CA5  mov         ecx,dword ptr [argv]  
00131CA8  mov         edx,dword ptr [ecx+eax]  
00131CAB  push        edx  
00131CAC  call        _strcmp (01313D9h) …
Run Code Online (Sandbox Code Playgroud)

c++ assembly visual-c++

12
推荐指数
1
解决办法
884
查看次数

Windows - 如何在应用程序启动之前在应用程序的内核中注入代码?

我想制作一个恶意软件分析软件,我必须将代码注入到进程的不同kernel32函数中,比如Sleep来覆盖恶意软件尝试进行的任何睡眠,ExitProcess在获取进程被杀死之前转储内存等

我尝试启动该进程暂停然后我尝试枚举库希望我可以得到kernel32 rva但是当我启动进程暂停时看起来甚至没有加载库.

code-injection

2
推荐指数
1
解决办法
563
查看次数

标签 统计

assembly ×1

c++ ×1

code-injection ×1

visual-c++ ×1