PE-Filebuffer-ImageBuffer-NewBuffer-已经修正-可正常执行

globle.h文件头

// globle.h: interface for the globle class.
//
//

#if !defined(AFX_GLOBLE_H__3D77A66B_EE77_4B6B_997F_15924F62332B__INCLUDED_)
#define AFX_GLOBLE_H__3D77A66B_EE77_4B6B_997F_15924F62332B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class globle  
{
   
public:
	globle();
	virtual ~globle();

};


#include <windows.h>
#include <stdio.h>

//#define FILEPATH_IN         "C:\\WINDOWS\\system32\\kernel32.dll"
//#define FilePath_In         "C:\\cntfpe\\notepad.exe"
#define FilePath_In         "C:\\cntfpe\\ipmsg.exe"
//#define FilePath_Out        "C:\\cntfpe\\notepadnewpes.exe"
#define FilePath_Out        "C:\\cntfpe\\ipmsgnewpes.exe"
#define MessageBoxAddr      0x77E5425F
#define ShellCodeLength     0x12

extern BYTE ShellCode[];

DWORD ReadPEFile(IN LPSTR lpszFile,OUT LPVOID* pFileBuffer);

DWORD CopyFileBufferToImageBuffer(IN LPVOID pFileBuffer,OUT LPVOID* pImageBuffer);

DWORD CopyImageBufferToNewBuffer(IN LPVOID pImageBuffer,OUT LPVOID* pNewBuffer);

BOOL MemeryTOFile(IN LPVOID pMemBuffer,IN size_t size,OUT LPSTR lpszFile);

//DWORD RvaToFileOffset(IN LPVOID pFileBuffer,IN DWORD dwRva);


void Fun();


#endif // !defined(AFX_GLOBLE_H__3D77A66B_EE77_4B6B_997F_15924F62332B__INCLUDED_)

##具体代码部分globle.cpp

// globle.cpp: implementation of the globle class.
//
//

#include "stdafx.h"
#include "globle.h"
#include <string.h>
#include <windows.h>
#include <stdlib.h>
/*#include <tchar.h>
#include <iostream>
#include <stdio.h>
*/

//
// Construction/Destruction
//

 // globle.cpp: implementation of the globle class.
//
//

// Globle Varible  
BYTE ShellCode[] =
{
   
    0x6A,00,0x6A,00,0x6A,00,0x6A,00,
    0xE8,00,00,00,00,
    0xE9,00,00,00,00
};

//
// Construction/Destruction
//
//ExeFile->FileBuffer  返回值为计算所得文件大小

DWORD ReadPEFile(IN LPSTR lpszFile, OUT LPVOID* pFileBuffer)
{
   
    FILE* pFile = NULL;
    DWORD fileSize = 0;
    LPVOID pTempFileBuffer = NULL;
    
    //Open The Files
    pFile = fopen(lpszFile,"rb");
    if (!pFile)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值