国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

讀PE文件的3大結構體_PE文件加載器

2019-11-11 06:08:52
字體:
來源:轉載
供稿:網友
#include"stdio.h"#include"stdlib.h"#include"windows.h"int main(){	IMAGE_DOS_HEADER imafe_dos_header;//dos頭	IMAGE_NT_HEADERS image_nt_headers;//pe頭	IMAGE_SECTION_HEADER *image_section_header;//區塊	HANDLE jubing1;	DWord shijichicuen=0;//實際讀取大小	BOOL zhenjia;	LARGE_INTEGER pianyi;	LARGE_INTEGER pianyi_xin;//文件指針的新值 	int j = 0;//區塊的大小	jubing1 =CreateFile(L"C://Users//lisaisai//Desktop//第15課第01節加工資加賬號系統完善.exe", FILE_ALL_access, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); //FILE_ATTRIBUTE_NORMAL 普通文件	zhenjia=ReadFile(jubing1, &imafe_dos_header, sizeof(IMAGE_DOS_HEADER), &shijichicuen, NULL);	PRintf("是否讀取成功真假%d/n", zhenjia);	printf("開頭%s/n", (char*)&imafe_dos_header.e_magic);	printf("PE頭開始位置(指出PE頭文件的偏移位置)%x/n", imafe_dos_header.e_lfanew);	pianyi.QuadPart = imafe_dos_header.e_lfanew;	SetFilePointerEx(jubing1,pianyi,&pianyi_xin, FILE_BEGIN);//移動指針位置 128個	//printf("文件指針的新值%x/n",pianyi_xin);	zhenjia = ReadFile(jubing1, &image_nt_headers, sizeof(IMAGE_NT_HEADERS), &shijichicuen, NULL);	printf("開頭%s",(char*) &image_nt_headers.Signature);	j = image_nt_headers.FileHeader.NumberOfSections;	printf("區塊的數量%d/n", image_nt_headers.FileHeader.NumberOfSections);	printf("PE頭里的 第3個結構體的大小%x/n", image_nt_headers.FileHeader.SizeOfOptionalHeader);	pianyi.QuadPart += sizeof(IMAGE_NT_HEADERS);	SetFilePointerEx(jubing1, pianyi, &pianyi_xin, FILE_BEGIN);//IMAGE_NT_HEADERS的大小是固定的 一般情況這樣寫 精準要0x18+e0    	image_section_header = malloc(sizeof(IMAGE_SECTION_HEADER)*j); //IMAGE_SECTION_HEADER 大小不固定	zhenjia = ReadFile(jubing1, image_section_header, sizeof(IMAGE_SECTION_HEADER)*j, &shijichicuen, NULL);	for (int i=0;i<j;i++)	{		printf("區塊的名字%s/n", &image_section_header[i].Name);	}	CloseHandle(jubing1);	free(image_section_header);	system("pause");	return 1;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 澄江县| 兴宁市| 广河县| 贡山| 德庆县| 清水河县| 北宁市| 墨竹工卡县| 安徽省| 巧家县| 平南县| 论坛| 阿鲁科尔沁旗| 开远市| 双牌县| 财经| 彩票| 清新县| 宜都市| 新巴尔虎左旗| 威信县| 黄浦区| 贡山| 曲周县| 长乐市| 息烽县| 唐山市| 崇义县| 博罗县| 大同市| 林口县| 鄄城县| 京山县| 商丘市| 清新县| 绵竹市| 延庆县| 卓尼县| 甘泉县| 绵竹市| 化州市|