16进制写入PE头
HANDLE hFile; CString path="c:\\aa.7z"; hFile=CreateFile(Path,GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); if (hFile==NULL) { AfxMessageBox("打开失败"); } unsigned char mz[]={0x4D,0x5A,0x90,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00}; SetFilePointer(hFile,0,NULL,FILE_BEGIN); WriteFile(hFile,(LPCVOID)mz,16,&dwWritten,NULL);//写MZ头 CloseHandle(hFile);