驅動中解析pe檔案之pdb

2021-07-23 03:42:10 字數 1339 閱讀 3333

驅動中解析pe檔案的pdb,一切盡在**中,本部落格不負責科普,能立即用的**你都有了,標頭檔案、結構體、注釋都整理好你還想要啥?

#include #include #include "ntimage.h"

#define nb10_sig '01bn'

#define rsds_sig 'sdsr'

typedef struct cv_header

cv_header;

typedef struct cv_info_pdb20

cv_info_pdb20;

typedef struct cv_info_pdb70

cv_info_pdb70;

bool peisregionvalid(pvoid base, dword size, pvoid addr, dword regionsize)

//返回true 但pdbstr為空意思是找過了確實沒有pdb

boolean pegetpdb(pvoid imagebase, dword imagesize, pchar pdbstr)

else // pe32 x86

dbgdir = (pimage_debug_directory)(base + dbgdirrva);

if (!dbgdir)

break;

probeforread(dbgdir, sizeof(image_debug_directory), 1);

result = true;//到此表示解析正常 能不能找到pdb就看有沒有了

if (!dbgdir->addressofrawdata || dbgdir->type != image_debug_type_codeview)

break;

cvinfo = (cv_header*)(base + dbgdir->addressofrawdata);

if (!peisregionvalid(base, imagesize, cvinfo, sizeof(cv_header)))

break;

if (cvinfo->signature == nb10_sig) (gbk)

else if (cvinfo->signature == rsds_sig) //vs2003+ (utf-8)

} while (0);

} __except (exception_execute_handler)

return result;

}boolean pegetfilepdb(punicode_string pfilepath, pchar pdbstr)

本部落格旨在提供高穩定性和良好風格的**。

PE檔案解析之資源表解析

根據pe檔案格式我們可以快速找到目錄表陣列位置,在目錄表陣列中我們可以找到資源表在 我們看出資源表位置為0x4000,大小為0xb20。資源表所對應資料結構為image resource directory typedef struct image resource directory image ...

PE檔案詳解之PE檔案頭

1,pe檔案頭 pe header 緊挨著 dos stub 2,pe header 是pe相關結構nt映像頭 image nt header 的簡稱。裡面包含著許多pe裝載器用到的重要字段。3,執行體在支援pe檔案結構的作業系統中執行時,pe裝載器將從 image dos header 結構中的 ...

PE檔案詳解之PE檔案頭

1,pe檔案頭 pe header 緊挨著 dos stub 2,pe header 是pe相關結構nt映像頭 image nt header 的簡稱。裡面包含著許多pe裝載器用到的重要字段。3,執行體在支援pe檔案結構的作業系統中執行時,pe裝載器將從 image dos header 結構中的 ...