⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 driverentry.cpp

📁 Programming the Microsoft Windows driver model.2nd 随书光盘。内有很多作者送的实用工具和随书源码。WDM编程
💻 CPP
字号:
// Main program for whichos driver

// Copyright (C) 2001 by Walter Oney

// All rights reserved



#include "stddcls.h"

#include "driver.h"



enum OSVERSION {

	Win98Gold,				// original release of Win98

	Win98SE,				// Win98 Second Edition

	WinME,					// Windows Millenium

	Win2K,					// Windows 2000

	WinXp,					// Windows Xp

	WinNet,					// Windows .NET

	};



enum OSVERSION WhichOs(PDRIVER_OBJECT DriverObject);



///////////////////////////////////////////////////////////////////////////////



#pragma PAGEDCODE



extern "C" NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)

	{							// DriverEntry

	enum OSVERSION whichos = WhichOs(DriverObject);

	static char* osnames[] = {

		"Win98Gold",

		"Win98SE",

		"WinME",

		"Win2K",

		"WinXp",

		"WinNet",

		};

	DbgPrint(DRIVERNAME " - Running under %s\n", osnames[whichos]);

	return STATUS_UNSUCCESSFUL;

	}							// DriverEntry



///////////////////////////////////////////////////////////////////////////////



#pragma PAGEDCODE



enum OSVERSION WhichOs(PDRIVER_OBJECT DriverObject)

	{							// WhichOs



	// Determine which WDM version this OS supports. This tells us most of what we want to know.



	if (IoIsWdmVersionAvailable(1, 0x30))

		return WinNet;



	else if (IoIsWdmVersionAvailable(1, 0x20))

		return WinXp;



	else if (IoIsWdmVersionAvailable(1, 0x10))

		return Win2K;



	else if (IoIsWdmVersionAvailable(1, 0x05))

		return WinME;



	// To decide between Win98SE and Win98Gold, check the ServiceKeyName field of the

	// driver object extension



	else if (DriverObject->DriverExtension->ServiceKeyName.Length)

		return Win98SE;



	else

		return Win98Gold;

	}							// WhichOs

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -