VC PE匯出 輸入表演示 讀檔案版

2021-04-14 08:14:08 字數 3639 閱讀 5464

#include "stdafx.h"

#include "windows.h"

#include "stdio.h"

void printimporttable(lpstr strpath);

void printexporttable(lpstr strpath);

ulong muvaddr=0,mupaddr=0;

int main(int argc, char* argv)

//獲取虛擬位址在檔案中的偏移

dword rvatooffset(pimage_section_header psectionheader,int intnumofsections,dword virtualaddress)

psectionheader++;

}return virtualaddress;

}//檔案中的偏移轉換虛擬位址

dword offsettorva(pimage_section_header psectionheader,int intnumofsections,dword fileoffset)

psectionheader++;

}return fileoffset;

}//列印輸入表

void printimporttable(lpstr strpath)

setfilepointer(hfile,pdosheader->e_lfanew,null,0);

readfile(hfile,&dwoffset,sizeof(dwoffset),&dwreads,null);

//判斷是否為'pe00'標誌,來判斷是否為pe檔案

if (dwoffset!=image_nt_signature)

setfilepointer(hfile,pdosheader->e_lfanew + 4,null,0);

readfile(hfile,pfileheader,sizeof(image_file_header),&dwreads,null);

readfile(hfile,poptional,sizeof(image_optional_header),&dwreads,null);

psection=(pimage_section_header)new byte[sizeof(image_section_header) * pfileheader->numberofsections];

readfile(hfile,psection,sizeof(image_section_header) * pfileheader->numberofsections,&dwreads,null);

intstup=0;

while (true)

else

if (pthunk->u1.addressofdata==0) break;

//獲取函式名在檔案中的真實位址

dwoffset=rvatooffset(psection,pfileheader->numberofsections,(ulong)pthunk->u1.addressofdata->name);

if (dwoffset==0) break;

setfilepointer(hfile,dwoffset,null,0);

memset(strname,0,sizeof(strname));

readfile(hfile,strname,sizeof(strname),&dwreads,null);

//列印函式名

printf("/t函式:%s/n",strname);

intstup1 ++;

} while (dwoffset!=0);

intstup++;

};ret:

if (pdosheader) delete pdosheader;

if (pimport) delete pimport;

if (pfileheader) delete pfileheader;

if (poptional) delete poptional;

if (psection) delete psection;

if (pthunk) delete pthunk;

closehandle(hfile);

}void printexporttable(lpstr strpath)

setfilepointer(hfile,pdosheader->e_lfanew,null,0);

readfile(hfile,&dwoffset,sizeof(dwoffset),&dwreads,null);

if (dwoffset!=image_nt_signature)

setfilepointer(hfile,pdosheader->e_lfanew + 4,null,0);

readfile(hfile,pfileheader,sizeof(image_file_header),&dwreads,null);

readfile(hfile,poptional,sizeof(image_optional_header),&dwreads,null);

psection=(pimage_section_header)new byte[sizeof(image_section_header) * pfileheader->numberofsections];

readfile(hfile,psection,sizeof(image_section_header) * pfileheader->numberofsections,&dwreads,null);

if (poptional->datadirectory[0].virtualaddress==0)

dwoffset=rvatooffset(psection,pfileheader->numberofsections,poptional->datadirectory[0].virtualaddress);

///dwoffset=offsettorva(psection,pfileheader->numberofsections,dwoffset);

setfilepointer(hfile,dwoffset,null,0);

readfile(hfile,pexport,sizeof(image_export_directory),&dwreads,null);

dwoffset=rvatooffset(psection,pfileheader->numberofsections,pexport->name);

setfilepointer(hfile,dwoffset,null,0);

readfile(hfile,strname,sizeof(strname),&dwreads,null);

printf("模組:%s/n",strname);

intstup=0;

do while (dwoffset!=0);

ret:

if (pdosheader) delete pdosheader;

if (pexport) delete pexport;

if (pfileheader) delete pfileheader;

if (poptional) delete poptional;

if (psection) delete psection;

closehandle(hfile);

}

5G邊緣網路虛擬化的利器 vCPE和SD WAN

5g帶來的超快 超可靠的網路將推動物聯網裝置的 式增長。statista 到2024年,全球將有19億移動5g使用者。為了支援這一增長,5g必須提供比上一代無線技術更大的裝置連線和網路容量。對於5g來說,乙個重大的改變是如今的虛擬化趨勢,如sdn nfv 分布式雲和網路切片。正因如此,整個無線網路基...

匯出匯出Execl demo

using npoi.ss.usermodel using system using system.collections.generic using system.io using npoi.hssf.usermodel using npoi.xssf.usermodel namespace 匯出...

匯出Excel 防止匯出整個頁面

前台頁面放乙個gridview什麼的就不說了,要注意的是在 page language c autoeventwireup true codebehind referpriceindex.aspx.cs enableeventvalidation false inherits zte.fol.fun...