Daffodil

文件捆绑:两种释放文件的CPP实现

一、资源释放

这种方法优点是体积小 缺点是容易检测 网上有很多资料

BOOL ReleaseResFile(WORD wResID, LPCTSTR szResType, LPCTSTR szFileName)
{
	if (szResType == NULL || szFileName == NULL)
		return FALSE;

	// 创建文件 
	DWORD dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
	HANDLE  hFile = CreateFile(szFileName, GENERIC_WRITE, dwShareMode, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
	if (hFile == INVALID_HANDLE_VALUE)
		return FALSE;
	
	HRSRC  hrsc = FindResource(NULL, MAKEINTRESOURCE(wResID), szResType);	// 查找资源
	HGLOBAL hG = LoadResource(NULL, hrsc);			// 加载资源
	DWORD  dwSize = SizeofResource(NULL, hrsc);	// 获取资源大小
	if (dwSize <= 0)
		return FALSE;
	
	// 写入文件 
	DWORD   dwWrite = 0;
	WriteFile(hFile, hG, dwSize, &dwWrite, NULL);

	CloseHandle(hFile);
	return dwWrite > 0;
}
ReleaseResFile(IDR_EXE1, L"EXE", L"C:\\test.exe");

二、文件转为byte编译释放

这种方式优点是不易被检测 缺点是体积大、麻烦

1、将文件转化为byte生成源码

BOOL SaveCode(char *FileName) 
{
	HANDLE hDllFile;
	DWORD dwDllSize;
	LPVOID pDllBuff;
	DWORD BytesRead;
	LPVOID pOutBuff;
	HANDLE hOutFile;
	DWORD BytesWritten;
	
	hDllFile = CreateFile(FileName, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (hDllFile == INVALID_HANDLE_VALUE)
		return FALSE;
	dwDllSize  = GetFileSize(hDllFile, 0);
	
	pDllBuff = VirtualAlloc(NULL, dwDllSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
	if (pDllBuff == NULL)
	{
		CloseHandle(hDllFile);
		return FALSE;
	}
	if (!ReadFile(hDllFile, pDllBuff, dwDllSize, &BytesRead, NULL))
	{
		VirtualFree(pDllBuff, 0, MEM_RELEASE);
		CloseHandle(hDllFile);
		return FALSE;
	}
	CloseHandle(hDllFile);
	
	pOutBuff = VirtualAlloc(NULL, (dwDllSize*5-1)+((dwDllSize+32-1)/32*2), MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
	if (pOutBuff == NULL)
	{
		VirtualFree(pDllBuff, 0, MEM_RELEASE);
		return FALSE;
	}
	
	char *pDllChar = (char *)pDllBuff;
	char *pOutChar = (char *)pOutBuff;
	for (DWORD i = 0; i < dwDllSize; i++)
	{
		if (i == dwDllSize - 1)
		{
			sprintf(pOutChar, "0x%0.2X", (unsigned char)*pDllChar++);
			pOutChar += 4;
		}
		else
		{
			sprintf(pOutChar, "0x%0.2X,", (unsigned char)*pDllChar++);
			pOutChar += 5;
		}
		
		if (i % 32 == 31 || i == dwDllSize - 1)
		{
			*pOutChar++ = '\r';
			*pOutChar++ = '\n';
		}
	}
	VirtualFree(pDllBuff, 0, MEM_RELEASE);
	
	char OutData1[] = "/*\r\n AnyFilesToByte By daffodil\r\n \r\n"
		" 使用 SaveFile(\"xxx.xxx\");即可生成文件\r\n*/\r\n\r\n";
	char OutData2[] = "#include <windows.h>\r\n\r\n";
	char OutData3[64] = {0};
	sprintf(OutData3, "const g_FileSize = %d;\r\n", dwDllSize);
	char OutData4[] = "unsigned char g_FileBuff[] = {\r\n";
	char OutData5[] = "};\r\n\r\n";
	char OutData6[] = "\r\nbool SaveFile(char *FileName)\r\n{\r\n\tbool Result = false;"
		"\r\n\tHANDLE hFile;\r\n\tDWORD dwBytesWritten;\r\n"
		"\thFile = CreateFile(FileName,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,NULL,NULL);\r\n"
		"\tif (hFile == INVALID_HANDLE_VALUE) Result = false;\r\n"
		"\tif (WriteFile(hFile, g_FileBuff, g_FileSize, &dwBytesWritten, NULL)) Result = true;\r\n"
		"\tCloseHandle(hFile);\r\n\treturn Result;\r\n}\r\n\r\n\r\n\r\nint main(){\r\nSaveFile(\"xxxxx\");\r\nreturn 0;\r\n}";
	
	hOutFile = CreateFile("file.cpp", GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, NULL);
	if (hOutFile == INVALID_HANDLE_VALUE)
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		return FALSE;
	}
	if (!WriteFile(hOutFile, OutData1, strlen(OutData1), &BytesWritten, NULL))
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		CloseHandle(hOutFile);
		return FALSE;
	}
	if (!WriteFile(hOutFile, OutData2, strlen(OutData2), &BytesWritten, NULL))
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		CloseHandle(hOutFile);
		return FALSE;
	}
	if (!WriteFile(hOutFile, OutData3, strlen(OutData3), &BytesWritten, NULL))
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		CloseHandle(hOutFile);
		return FALSE;
	}
	if (!WriteFile(hOutFile, OutData4, strlen(OutData4), &BytesWritten, NULL))
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		CloseHandle(hOutFile);
		return FALSE;
	}
	if (!WriteFile(hOutFile, pOutBuff, (dwDllSize*5-1)+((dwDllSize+32-1)/32*2), &BytesWritten, NULL))
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		CloseHandle(hOutFile);
		return FALSE;
	}
	if (!WriteFile(hOutFile, OutData5, strlen(OutData5), &BytesWritten, NULL))
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		CloseHandle(hOutFile);
		return FALSE;
	}
	if (!WriteFile(hOutFile, OutData6, strlen(OutData6), &BytesWritten, NULL))
	{
		VirtualFree(pOutBuff, 0, MEM_RELEASE);
		CloseHandle(hOutFile);
		return FALSE;
	}
	VirtualFree(pOutBuff, 0, MEM_RELEASE);
	CloseHandle(hOutFile);
	return TRUE;
}

int main(int argc, char* argv[])
{
	printf("File is %s\n", argv[1]);
	SaveCode(argv[1]);
    printf("OK\n");
	return 0;
}

编译源码

/*
 AnyFilesToByte By daffodil
 
 使用 SaveFile("xxx.xxx");即可生成文件
*/

#include <windows.h>

const g_FileSize = 2721;
unsigned char g_FileBuff[] = {
0xFF,0xD8,0xFF,0xE0,0x00,0x10,0x4A,0x46,0x49,0x46,0x00,0x01,0x01,0x01,0x00,0x60,0x00,0x60,0x00,0x00,0xFF,0xDB,0x00,0x43,0x00,0x08,0x06,0x06,0x07,0x06,0x05,0x08,
0x07,0x07,0x07,0x09,0x09,0x08,0x0A,0x0C,0x14,0x0D,0x0C,0x0B,0x0B,0x0C,0x19,0x12,0x13,0x0F,0x14,0x1D,0x1A,0x1F,0x1E,0x1D,0x1A,0x1C,0x1C,0x20,0x24,0x2E,0x27,0x20,
0x22,0x2C,0x23,0x1C,0x1C,0x28,0x37,0x29,0x2C,0x30,0x31,0x34,0x34,0x34,0x1F,0x27,0x39,0x3D,0x38,0x32,0x3C,0x2E,0x33,0x34,0x32,0xFF,0xDB,0x00,0x43,0x01,0x09,0x09,
0x09,0x0C,0x0B,0x0C,0x18,0x0D,0x0D,0x18,0x32,0x21,0x1C,0x21,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,
0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0xFF,0xC2,
0x00,0x11,0x08,0x00,0x56,0x01,0x2B,0x03,0x01,0x22,0x00,0x02,0x11,0x01,0x03,0x11,0x01,0xFF,0xC4,0x00,0x19,0x00,0x00,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0xFF,0xC4,0x00,0x19,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x02,0x03,0x04,0x05,0xFF,0xDA,0x00,0x0C,0x03,0x01,0x00,0x02,0x10,0x03,0x10,0x00,0x00,0x01,0xF2,0x86,0xBD,0xDF,0x0D,0x81,0x54,0x4B,0x86,0xD3,0x4A,
0x43,0x81,0x37,0x49,0xB2,0x06,0xAA,0xB6,0xE9,0xCF,0xA7,0x9F,0xA2,0x96,0x70,0x6C,0x25,0xA5,0x37,0x26,0x9B,0xC9,0xC6,0xC4,0x33,0x40,0x2A,0xA7,0x25,0x21,0xCD,0x5B,
0x87,0x5A,0xD6,0x74,0x6B,0xC0,0x19,0xDB,0xC8,0x80,0xA0,0x6A,0x9B,0x54,0x85,0x27,0x65,0xB4,0xE0,0x07,0x0B,0x7C,0xFA,0x0D,0x6B,0xA7,0x36,0x99,0xED,0xB7,0x2E,0x98,
0x46,0x97,0x86,0xD5,0xB6,0x17,0x06,0xCA,0x8B,0x9A,0x0A,0x34,0xB3,0x73,0x1A,0x19,0xBA,0xD1,0x27,0x2D,0xE7,0x45,0xAB,0x95,0x3E,0x31,0x6B,0xB7,0x92,0x1B,0x75,0x25,
0x14,0x8A,0x21,0x50,0xE1,0x36,0x42,0x66,0xF2,0x6B,0x98,0x25,0xE6,0xA9,0xC2,0xA7,0x3A,0x5C,0xCE,0x7A,0x5A,0x82,0x74,0xA8,0xBC,0xF4,0xA4,0x83,0x52,0xAA,0x52,0xC4,
0x0B,0x21,0xA3,0xA9,0xB1,0xD2,0x28,0xB5,0xE7,0x4E,0x87,0x6F,0x0E,0x46,0xB3,0x32,0xAC,0xA8,0x2C,0xA9,0x6C,0xA1,0xBA,0xB2,0xB5,0x6A,0x1C,0xB2,0x96,0x5A,0x44,0xCE,
0x82,0x9D,0x73,0x46,0x5D,0x25,0xAB,0x77,0xA6,0x77,0x9E,0x92,0x85,0x2D,0x80,0xD2,0x4E,0x92,0x21,0x35,0xA8,0x66,0xA8,0x89,0xAE,0x2B,0xE6,0xBD,0xF0,0xE9,0x7C,0xF5,
0xAC,0xEC,0x67,0x76,0x68,0x96,0x94,0x87,0x06,0x93,0x56,0x68,0x44,0x17,0x3A,0x0E,0x33,0x69,0x88,0xD6,0x07,0x36,0xC9,0x02,0x8D,0xEB,0x2F,0x3C,0xF4,0x6A,0x53,0x9D,
0x66,0x28,0x5D,0x62,0x26,0x92,0xD4,0xEB,0x22,0xCF,0x5A,0x94,0x57,0x99,0x40,0x8D,0x85,0x9B,0x60,0xE5,0xD8,0x39,0x28,0x2C,0xE8,0x03,0x96,0xC2,0x18,0x14,0x30,0x46,
0x80,0x65,0x03,0x5E,0xA1,0x9E,0xB8,0x48,0x3C,0xD3,0x0A,0x40,0x43,0x41,0x29,0x81,0xA6,0x01,0xD0,0x00,0x7F,0xFF,0xC4,0x00,0x21,0x10,0x00,0x02,0x02,0x02,0x03,0x01,
0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x10,0x11,0x20,0x30,0x02,0x31,0x41,0x40,0x21,0x12,0x22,0x32,0xFF,0xDA,0x00,0x08,0x01,0x01,0x00,0x01,
0x05,0x02,0xF8,0x38,0xA1,0x23,0xA2,0xC7,0x85,0x97,0x17,0x85,0xE0,0x9F,0xC4,0x8E,0x3C,0x68,0xF2,0xED,0xF2,0x72,0xA5,0x16,0x58,0xBE,0x9E,0x08,0x51,0xD1,0xED,0xEA,
0xB8,0x58,0x2F,0x81,0x45,0x89,0x9C,0xDC,0xA2,0xE5,0x6A,0x5F,0x0F,0x11,0x9E,0xF4,0xAE,0x6C,0xBD,0xF5,0xB9,0x2F,0xEA,0x87,0xFE,0x52,0x39,0x42,0x10,0xFB,0xA3,0xD1,
0x69,0x42,0xFC,0xDE,0x90,0xCF,0x3C,0xBA,0x50,0x87,0xD7,0xA7,0x51,0xE6,0x85,0x85,0xC5,0x69,0x4B,0x17,0x15,0x82,0x84,0x87,0x1E,0xC2,0xC3,0xCC,0x2C,0xBD,0x2B,0x04,
0x9B,0x1C,0x25,0xA5,0x77,0x0B,0x2B,0x9B,0x8B,0x2C,0xBD,0x57,0xF9,0x9A,0x47,0x8D,0x8A,0x54,0xAC,0x16,0x8B,0x2E,0x7C,0xB2,0xCB,0xC9,0xCF,0x13,0xF8,0x8F,0x47,0x45,
0x88,0x62,0x8F,0xFF,0xC4,0x00,0x1F,0x11,0x00,0x03,0x00,0x02,0x02,0x02,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0x02,0x10,0x12,0x20,0x21,
0x30,0x31,0x41,0x51,0xFF,0xDA,0x00,0x08,0x01,0x03,0x01,0x01,0x3F,0x01,0xF4,0x60,0xBC,0x1C,0x85,0xAB,0xEE,0xC4,0x59,0x19,0x64,0x62,0xCB,0xB6,0xFA,0x52,0xF7,0x4F,
0xC0,0x9C,0x3E,0x4B,0x0E,0x42,0x7D,0x28,0xB5,0x4A,0x52,0xEE,0x9C,0x8A,0x52,0xDD,0x22,0xEA,0x8D,0x88,0xA3,0xC4,0xE2,0x4D,0xBD,0x62,0xBF,0x7A,0x21,0xE4,0x72,0x39,
0x9C,0xF5,0x4B,0xEA,0x5A,0xC4,0x7D,0x11,0xF4,0x23,0xFF,0xC4,0x00,0x19,0x11,0x00,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x11,0x30,0x40,0x20,0xFF,0xDA,0x00,0x08,0x01,0x02,0x01,0x01,0x3F,0x01,0xC1,0x93,0x85,0x8D,0x0B,0x86,0x77,0xD2,0xFA,0x7E,0xA1,0x09,0xBB,0xC3,0xFF,0xC4,0x00,
0x16,0x10,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x50,0x80,0xFF,0xDA,0x00,0x08,0x01,0x01,0x00,0x06,0x3F,0x02,0x9C,
0x03,0x2F,0xFF,0xC4,0x00,0x22,0x10,0x00,0x03,0x00,0x03,0x01,0x00,0x03,0x01,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0x10,0x21,0x31,0x41,0x20,0x51,
0x61,0x30,0x71,0x81,0x91,0xA1,0xFF,0xDA,0x00,0x08,0x01,0x01,0x00,0x01,0x3F,0x21,0xCA,0xFE,0x28,0x99,0xA2,0x1D,0x3F,0xC1,0x34,0x97,0xD1,0x46,0xC6,0xAE,0xA2,0xF4,
0x5B,0x16,0x98,0xE1,0x8A,0xBD,0x1F,0x29,0xC4,0x28,0xBF,0x31,0xB2,0x98,0x5B,0x37,0x82,0x9A,0xFE,0x4B,0x13,0xE0,0x97,0x43,0xBA,0x23,0x54,0x7F,0xC0,0x42,0xB8,0x98,
0xB9,0x84,0xD6,0xC6,0xFB,0x86,0x34,0x58,0x7D,0x8B,0x18,0xB6,0xCB,0xBD,0x88,0xB1,0x97,0x78,0x5C,0x17,0xF2,0x5F,0x2D,0xA9,0x8D,0x1D,0x38,0xE3,0xE3,0x12,0x56,0xFC,
0x2D,0xA7,0xEE,0x08,0xBA,0x74,0x6C,0xA4,0xD1,0xE1,0xE1,0x61,0x5E,0x84,0x2F,0xB8,0x7B,0x8B,0x70,0xA4,0xF8,0xC1,0x0B,0xE6,0x9B,0x13,0x6B,0x5E,0x0F,0x68,0x6D,0x5F,
0x47,0x80,0xDF,0xE1,0xB7,0x83,0xF2,0x3D,0xE1,0x8F,0x47,0x06,0xF7,0x0B,0x8B,0x05,0xD1,0xE9,0x9D,0x67,0x45,0x2A,0xF8,0x4F,0xE6,0xAB,0xD1,0x94,0x1B,0x17,0x68,0xEF,
0x67,0x44,0x9A,0x4B,0x63,0x84,0x45,0x54,0x6F,0xBF,0xF8,0x24,0x2E,0x09,0x8F,0x63,0x3C,0x10,0xC4,0xE0,0xFE,0xF0,0xB6,0xE7,0xA3,0xFC,0xC2,0x13,0x10,0x84,0xCC,0xCC,
0x12,0x23,0xB0,0x8A,0x68,0xA6,0x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,0x03,0x00,0x00,0x00,0x10,0x15,0x13,0xF1,0x5D,0xE9,0xE6,0x0C,0xD1,0x18,0xE7,0xA8,0x91,0xF8,0x46,0xCA,0x10,0x6C,0x33,0x0D,0x3E,0xD8,0xCA,
0x95,0x44,0x63,0x23,0x38,0xB8,0x5E,0xB9,0x8D,0x38,0xE3,0x10,0x93,0x95,0x24,0xCF,0xDA,0xD3,0xEB,0x73,0x05,0xF1,0x93,0x3C,0x60,0xF6,0x7E,0x5C,0x03,0x64,0x6F,0x63,
0xF5,0x4C,0x65,0x3C,0xCA,0xDC,0x66,0x73,0xA3,0x35,0x78,0xDC,0xCF,0x84,0xE4,0x21,0xC8,0x20,0x7D,0xF8,0xFF,0x00,0x04,0x30,0xBE,0x0C,0x17,0x60,0x7B,0xF8,0x83,0x03,
0xDF,0xFF,0xC4,0x00,0x1C,0x11,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x11,0x21,0x10,0x31,0x20,0x41,0x61,0xFF,
0xDA,0x00,0x08,0x01,0x03,0x01,0x01,0x3F,0x10,0xF1,0x24,0xF3,0x6D,0xB3,0x6C,0x63,0x82,0x4D,0xF2,0x3A,0xB4,0x8B,0x6D,0x86,0x1B,0x7D,0x66,0x7C,0x07,0xD8,0xBE,0x45,
0xB6,0xB3,0xA8,0xBF,0xBE,0x03,0xE6,0xEF,0x82,0x6D,0xB6,0xCD,0xB1,0xD8,0x48,0x83,0x59,0x55,0x70,0x85,0x69,0x2F,0x9B,0xCF,0x43,0x2D,0x1F,0x84,0x59,0x67,0x9C,0xF0,
0x34,0xC6,0x30,0xCD,0x0F,0x09,0x67,0x6E,0xAF,0x91,0xA2,0x12,0x5C,0xB8,0xF0,0x62,0x89,0x2E,0xCA,0xC8,0x16,0x2E,0x38,0x5B,0xA4,0x33,0xEC,0x21,0x73,0xDB,0xBB,0xE2,
0xDD,0xEC,0x71,0x61,0x9F,0x12,0x42,0x4E,0x59,0x25,0x97,0xEE,0x03,0x11,0x33,0x65,0xD9,0xF9,0xE1,0x26,0xD6,0x7C,0x5F,0xFF,0xC4,0x00,0x1B,0x11,0x00,0x03,0x01,0x01,
0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0x10,0x20,0x21,0x30,0x41,0xFF,0xDA,0x00,0x08,0x01,0x02,0x01,0x01,0x3F,0x10,0x16,0x2D,
0x85,0x83,0x0A,0x98,0xD6,0x42,0x7D,0x8C,0x11,0x8D,0x10,0x79,0x08,0x42,0x64,0x21,0x38,0x63,0xF4,0x44,0xD9,0x21,0x29,0x06,0x4E,0xE1,0x08,0x42,0x10,0x68,0x90,0x94,
0x90,0x83,0x44,0xC8,0x24,0x32,0x08,0x20,0x99,0x78,0x66,0x4C,0x64,0x12,0xE1,0x42,0x7B,0xAB,0x13,0x2F,0x4F,0x08,0x5A,0xD1,0xFA,0x33,0xFF,0xC4,0x00,0x23,0x10,0x01,
0x00,0x03,0x01,0x01,0x01,0x00,0x03,0x01,0x00,0x02,0x03,0x00,0x00,0x00,0x00,0x01,0x00,0x11,0x21,0x31,0x41,0x51,0x10,0x61,0x71,0x81,0xA1,0xB1,0x91,0xC1,0xF0,0xFF,
0xDA,0x00,0x08,0x01,0x01,0x00,0x01,0x3F,0x10,0x44,0xEC,0x21,0xC9,0x61,0x9E,0xCE,0x41,0x83,0x0F,0xC1,0xC9,0x50,0x64,0x2A,0x43,0x0A,0x85,0x42,0x9A,0x95,0x10,0xCF,
0x18,0xD2,0xA5,0x66,0xC5,0x57,0xB3,0x3C,0xF6,0x58,0x38,0xA8,0x68,0x40,0x22,0xC0,0xAF,0xE8,0x32,0xD5,0x7F,0x88,0x68,0x75,0xB5,0x04,0xA4,0x69,0x84,0xD3,0x5F,0x23,
0x55,0xF0,0xC6,0xC7,0x18,0x59,0x5D,0x96,0xAF,0xEA,0x35,0x35,0xEC,0x69,0xC7,0x58,0xB7,0x49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,0x4C,0x65,0x2A,0x0E,0x02,0xC1,0x76,0xA2,0x17,0x79,0x51,0x4B,0x83,0xDE,0xC4,0x0C,0x2B,0x62,0xB7,0x3F,0xFF,
0xD9
};

bool SaveFile(char *FileName)
{
	bool Result = false;
	HANDLE hFile;
	DWORD dwBytesWritten;
	hFile = CreateFile(FileName,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,NULL,NULL);
	if (hFile == INVALID_HANDLE_VALUE) Result = false;
	if (WriteFile(hFile, g_FileBuff, g_FileSize, &dwBytesWritten, NULL)) Result = true;
	CloseHandle(hFile);
	return Result;
}

int main(){
SaveFile("1.jpg");
return 0;
}

编译运行释放文件