读不合法msr寄存器例子

#include<ntifs.h>
#include<ntddk.h>
#include<wdm.h>
#include<intrin.h>

//#include "ia32.hpp"

template<typename... types>
void print(types... args)
{
	DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, args...);
}

void unload(PDRIVER_OBJECT DriverUnload) {
	return;
}

extern "C" NTSTATUS DriverEntry(PDRIVER_OBJECT drv, PUNICODE_STRING reg) {

	drv->DriverUnload = unload;
	
	__try {
		__readmsr(0x400000F0);
		print("[+] 没有异常\n");
	}
	__except (1) {
		print("[+] 发生异常\n");
	}



	return STATUS_SUCCESS;
}
1