Demo entry 6737309

cpp

   

Submitted by xx on May 01, 2018 at 03:49
Language: C++. Code size: 882 Bytes.

// Panda.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"
#include<windows.h>
#include <iostream>
using namespace std;
#define path L"C:\\Users\\15pb-win7\\Desktop\\test.exe"
int _tmain(int argc, _TCHAR* argv[])
{

	HANDLE hFile = CreateFile(path,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
	DWORD dwSize = GetFileSize(hFile, NULL);
	PBYTE pFile = new BYTE[dwSize];
	ReadFile(hFile, pFile, dwSize, &dwSize, NULL);
	string sLen = "";
	int N = dwSize - 1;
	int i = 0;
	while (pFile[N - i] != 0x00)
		i++;
	while (pFile[N] != 0x2)
	{
		if (pFile[N]!=0x01)
			sLen += pFile[N];
		--N;
	}
	reverse(sLen.begin(), sLen.end());
	int rawSize = atoi(sLen.c_str());
	BYTE* p = pFile + dwSize - (rawSize+(i+1));
	FILE* fp;
	fopen_s(&fp,".\\rawFile.exe","wb+");
	fwrite(p, rawSize, 1, fp);
	fclose(fp);
	system("pause");
	return 0;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).