dll注入

作者: Fa1se003 | 来源:发表于2017-05-16 22:17 被阅读19次
        DWORD pid = 0x590;  
           
            // 得到目标进程句柄
            HANDLE hRemoteProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
        
            char fileName[] = "c:\\my.dll";
            int cb = (1 + sizeof(fileName));
    
            LPVOID remoteAddress = (LPVOID) VirtualAllocEx( hRemoteProcess, NULL, 0x1000, MEM_COMMIT, PAGE_READWRITE);
            int iReturnCode = WriteProcessMemory(hRemoteProcess, remoteAddress, (PVOID) fileName, cb, NULL);
            
            LPTHREAD_START_ROUTINE  pfnStartAddr = (LPTHREAD_START_ROUTINE )GetProcAddress(GetModuleHandle("Kernel32.dll"), "LoadLibraryA");
            CreateRemoteThread( hRemoteProcess, NULL, 0, pfnStartAddr, remoteAddress, 0, NULL);
          
            //VirtualFreeEx();
            VirtualFreeEx(hRemoteProcess, remoteAddress, 0x1000, MEM_DECOMMIT);
    

    相关文章

      网友评论

          本文标题:dll注入

          本文链接:https://www.haomeiwen.com/subject/wzrrxxtx.html