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

📄 apcxapp.c

📁 武安河书第一版(vxd)Windows 驱动例子
💻 C
字号:
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <winioctl.h>
#include "apcx.h"

HANDLE	hDevice;
char	 f[8];

DWORD WINAPI CallBackAPC(PVOID param)
{
	char	i,ch,cp;
	DeviceIoControl(hDevice, READ, 0, 0, 0, 0, 0, 0);
	for (i=0;i<8;i++)
	{
	ch=f[i];
	cp=ch>>4;
	ch=ch&0xf;
	if (cp<=9) cp=cp+0x30;
	else cp=cp+0x37;
	putchar(cp);
	cp=ch&0xf;
	if (cp<=9) cp=cp+0x30;
	else cp=cp+0x37;
	putchar(cp);
	putchar(' ');
	};
	printf("\n");
	return 0;
}

void main(int ac, char* av[])
{
	hDevice = CreateFile("\\\\.\\WAH002.VXD", 0,0,0,
                        CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);

	if (hDevice == INVALID_HANDLE_VALUE)
	{
        	fprintf(stderr, "Cannot load VxD, error=%08lx\n",	GetLastError());
	 	exit(1);
	}

	if ( !DeviceIoControl(hDevice, REGISTER, CallBackAPC, 0, 0, 0, 0, 0) )
	{
   	 	fprintf(stderr, "Failed to register APC\n");
	 	exit(1);
	}

	if ( !DeviceIoControl(hDevice, DMASET, f, sizeof(f), 0, 0, 0, 0) )
	{
    		fprintf(stderr, "Failed to SetDMA...\n");
	 	exit(1);
	}
	else
    	fprintf(stderr, "DMASet is correct\n");

	printf("press ctrl-C to exit . . .\n");
	while(TRUE)	SleepEx(INFINITE,TRUE);
	CloseHandle(hDevice);
}

⌨️ 快捷键说明

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