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

📄 win32app.c

📁 ASM编写调用VxD。 以及VxD编写的科普 源代码
💻 C
字号:
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include "apcvxd.h"

HANDLE	hDevice;     
char     buf[80];
DWORD WINAPI CallbackFromVxD(PVOID param);


DWORD WINAPI CallbackFromVxD(PVOID param)
{
   VMINFO *pVmInfo = param;

   printf("VM %08lx was %s\r\n", pVmInfo->hVM, 
           pVmInfo->bVmCreated ? "created" : "destroyed" );
   DeviceIoControl(hDevice, APCVXD_RELEASEMEM, pVmInfo, sizeof(pVmInfo),0,0,0,0);
   return 0;
}

void main(int ac, char* av[])
{
   DWORD err;
	const PCHAR VxDName = "\\\\.\\APCVXD.VXD";

	hDevice = CreateFile(VxDName, 0,0,0,
                        CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);

	if (hDevice == INVALID_HANDLE_VALUE)
	{
		err = GetLastError();
   	printf("Cannot load VxD, error=%08lx\n", err );
		if (err == ERROR_NOT_SUPPORTED)
		{
			DeleteFile("\\\\.\\DMABUF");
		}
	 	exit(1);
	}

	if ( !DeviceIoControl(hDevice, APCVXD_REGISTER,
               &CallbackFromVxD, sizeof(void *),
               NULL, 0, NULL, NULL))
	{
   		printf("DeviceIoControl failed, error=%d\n", GetLastError() );
	}
   else
   {
   	printf("press ctrl-C to exit . . .\n");

   	while (TRUE)
   	{
   		SleepEx(-1, TRUE);
   	}
   }
}

⌨️ 快捷键说明

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