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

📄 scpdemo.cpp

📁 《windows程序设计》王艳平版的书籍源代码
💻 CPP
字号:
// SCPDemo.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <windows.h>
#include <winioctl.h>

#include "Driver.h"
#include "CharConvert.h"

int main(int argc, char* argv[])
{
	// 驱动驱动程序完整目录
	char szPath[256];
	char* p;
	::GetFullPathName("CharConvert.SYS", 256, szPath, &p);
	// 加载启动内核驱动
	CDriver driver(szPath, "slCharConvert");
	if(driver.StartDriver())
	{
		printf(" CharConvert服务成功启动 \n");
		if(driver.OpenDevice())
		{
			printf(" 句柄已经打开 \n");
			printf(" 请输入一个数字(0~9):\n");
			
			char c, strOut[16] = "";
			// 接收数字输入
			scanf("%c", &c);
			// 请求驱动程序转化
			if(driver.IoControl(CHAR_CONVERT, &c, 1, strOut, 2) != -1)
				printf("转化为:%s \n", strOut);
		}
	}

	return 0;
}

⌨️ 快捷键说明

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