您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“如何獲取ntoskrnl.exe基址”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
目錄
驅(qū)動(dòng)對(duì)象講解
1.1 結(jié)構(gòu)
1.2 輸出代碼輸出基本的驅(qū)動(dòng)對(duì)象信息
1.3 結(jié)果
在內(nèi)核中. 每一個(gè)驅(qū)動(dòng)模塊都是一個(gè)驅(qū)動(dòng)對(duì)象. 都有一個(gè) DRIVER_OBJECT結(jié)構(gòu)體代表. 可以想象成驅(qū)動(dòng)對(duì)象是一個(gè)進(jìn)程容器. 容納百川.
下面針對(duì)驅(qū)動(dòng)對(duì)象做一下簡單的成員輸出.以熟悉驅(qū)動(dòng)對(duì)象.
驅(qū)動(dòng)對(duì)象結(jié)構(gòu)如下:
typedef struct _DRIVER_OBJECT {CSHORT Type;CSHORT Size;//// The following links all of the devices created by a single driver// together on a list, and the Flags word provides an extensible flag// location for driver objects.//PDEVICE_OBJECT DeviceObject;ULONG Flags;//// The following section describes where the driver is loaded. The count// field is used to count the number of times the driver has had its// registered reinitialization routine invoked.//PVOID DriverStart; //驅(qū)動(dòng)對(duì)象的起始地址ULONG DriverSize; //驅(qū)動(dòng)對(duì)象的大小PVOID DriverSection; //驅(qū)動(dòng)對(duì)象結(jié)構(gòu).可以解析為_LDR_DATA_TABLE_ENTRY 是一個(gè)鏈表存儲(chǔ)著下一個(gè)驅(qū)動(dòng)對(duì)象 PDRIVER_EXTENSION DriverExtension; //驅(qū)動(dòng)的擴(kuò)展信息.可以自定義存放我們的數(shù)據(jù) //// The driver name field is used by the error log thread// determine the name of the driver that an I/O request is/was bound.//UNICODE_STRING DriverName; //驅(qū)動(dòng)對(duì)象的名字//// The following section is for registry support. This is a pointer// to the path to the hardware information in the registry//PUNICODE_STRING HardwareDatabase;//// The following section contains the optional pointer to an array of// alternate entry points to a driver for "fast I/O" support. Fast I/O// is performed by invoking the driver routine directly with separate// parameters, rather than using the standard IRP call mechanism. Note// that these functions may only be used for synchronous I/O, and when// the file is cached.//PFAST_IO_DISPATCH FastIoDispatch;PDRIVER_INITIALIZE DriverInit;PDRIVER_STARTIO DriverStartIo;PDRIVER_UNLOAD DriverUnload; //驅(qū)動(dòng)對(duì)象的卸載地址PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1]; } DRIVER_OBJECT;typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
#include <ntddk.h> VOID MyDriverUnLoad( _In_ struct _DRIVER_OBJECT* DriverObject ) { DbgPrint("驅(qū)動(dòng)卸載了\r\n"); }extern "C" NTSTATUS DriverEntry( _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath ){ ULONG64 uImage = 0; DriverObject->DriverUnload = MyDriverUnLoad; DbgPrint("驅(qū)動(dòng)加載了開始打印輸出\r\n"); DbgPrint("驅(qū)動(dòng)名字 = %wZ \r\n", DriverObject->DriverName); DbgPrint("驅(qū)動(dòng)起始地址 %x 大小 %x 結(jié)束地址 %x\r\n", DriverObject->DriverStart, DriverObject->DriverSize, uImage = ((ULONG64)DriverObject->DriverStart + DriverObject->DriverSize)); DbgPrint("驅(qū)動(dòng)對(duì)象的卸載地址 = %p\r\n", DriverObject->DriverUnload); //輸出驅(qū)動(dòng)對(duì)象的所有回調(diào)地址. DbgPrint("驅(qū)動(dòng)對(duì)象的IoControl回調(diào)地址 = %p\r\n", DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL]); DbgPrint("驅(qū)動(dòng)對(duì)象的讀回調(diào)地址 = %p\r\n",DriverObject->MajorFunction[IRP_MJ_READ]); DbgPrint("驅(qū)動(dòng)對(duì)象的寫回調(diào)地址 = %p\r\n",DriverObject->MajorFunction[IRP_MJ_WRITE]); DbgPrint("驅(qū)動(dòng)對(duì)象的創(chuàng)建回調(diào)地址 = %p\r\n",DriverObject->MajorFunction[IRP_MJ_CREATE]); DbgPrint("驅(qū)動(dòng)對(duì)象的關(guān)閉回調(diào)地址 = %p\r\n",DriverObject->MajorFunction[IRP_MJ_CLOSE]); DbgPrint("-------遍歷回調(diào)輸出------------\r\n"); //宏從DrverObject對(duì)象中查找for (auto i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++) { DbgPrint("回調(diào)的IRP_MJ 調(diào)用號(hào) = %d 回調(diào)函數(shù)地址 = %p \r\n", i, DriverObject->MajorFunction[i]); } DbgPrint("執(zhí)行所有功能完畢"); return STATUS_SUCCESS; }
“如何獲取ntoskrnl.exe基址”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。