资源简介
windows下过滤鼠标信息的驱动, 能允许和禁止鼠标
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
#include “../inc/common.h“
#include
#include
#include
void ErrorExit(LPTSTR lpszFunction)
{
// Retrieve the system error message for the last-error code
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS
NULL
dw
MAKELANGID(LANG_NEUTRAL SUBLANG_DEFAULT)
(LPTSTR) &lpMsgBuf
0 NULL );
// Display the error message and exit the process
lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT
(lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) * sizeof(TCHAR));
StringCchPrintf((LPTSTR)lpDisplayBuf
LocalSize(lpDisplayBuf) / sizeof(TCHAR)
TEXT(“%s failed with error %d: %s“)
lpszFunction dw lpMsgBuf);
//MessageBox(NULL (LPCTSTR)lpDisplayBuf TEXT(“Error“) MB_OK);
printf(“dw: %d\r\n“ dw);
printf(“%s\r\n“ (LPCTSTR)lpDisplayBuf);
LocalFree(lpMsgBuf);
LocalFree(lpDisplayBuf);
ExitProcess(dw);
}
VOID __cdecl
main(
__in ULONG argc
__in_ecount(argc) PCHAR argv[]
)
{
HANDLE hDevice;
BOOL bRc;
ULONG bytesReturned;
DWORD errNum = 0;
TCHAR driverLocation[MAX_PATH];
ULONG enable = 0;
if (argc < 2)
{
printf(“%s enable|disable\r\n“ argv[0]);
return;
}
if (strcmp(argv[1] “enable“) == 0)
{
enable = 1;
}
if (strcmp(argv[1] “disable“) == 0)
{
enable = 0;
}
printf(“open the device\r\n“);
if ((hDevice = CreateFile( “\\\\.\\mou_filter“
0
FILE_SHARE_READ | FILE_SHARE_WRITE
NULL
OPEN_EXISTING
0
NULL)) == INVALID_HANDLE_VALUE) {
errNum = GetLastError();
printf(“errNum %d\r\n“ errNum);
if (errNum != ERROR_FILE_NOT_FOUND) {
printf(“CreateFile failed! ERROR_FILE_NOT_FOUND = %d\n“ errNum);
return ;
}
}
printf(“hDevice %08x\r\n“ hDevice);
if (enable)
{
bRc = DeviceIoControl ( hDevice
(DWORD) IOCTL_FILTER_ENABLE
NULL 0 NULL 0 &bytesReturned NULL);
}
else
{
bRc = DeviceIoControl ( hDevice
(DWORD) IOCTL_FILTER_DISABLE
NULL 0 NULL 0 &bytesReturned NULL);
}
if ( !bRc )
{
printf ( “Error in DeviceIoControl : %d“ GetLastError());
ErrorExit(““);
return;
}
printf(“finish“);
CloseHandle ( hDevice );
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-12-23 18:46 mou_filter\
文件 16 2012-12-20 15:42 mou_filter\dirs
文件 21 2012-12-20 15:35 mou_filter\disable.bat
文件 20 2012-12-20 15:35 mou_filter\enable.bat
目录 0 2012-12-23 18:46 mou_filter\exe\
文件 374 2010-02-08 19:29 mou_filter\exe\makefile
文件 2996 2012-12-23 18:34 mou_filter\exe\mou_set.c
文件 332 2012-12-20 15:35 mou_filter\exe\mou_set.rc
文件 491 2012-12-20 15:36 mou_filter\exe\sources
目录 0 2012-12-23 18:32 mou_filter\inc\
文件 218 2012-12-23 18:32 mou_filter\inc\common.h
文件 2353 2012-12-23 14:49 mou_filter\mou_filter.inf
文件 9216 2012-12-23 18:43 mou_filter\mou_filter.sys
文件 8192 2012-12-23 18:43 mou_filter\mou_set.exe
目录 0 2012-12-23 18:46 mou_filter\sys\
文件 374 2003-03-25 00:00 mou_filter\sys\makefile
文件 15127 2012-12-23 18:43 mou_filter\sys\mou_filter.c
文件 271 2012-12-20 15:36 mou_filter\sys\mou_filter.rc
文件 185 2012-12-20 15:42 mou_filter\sys\sources
文件 1248 2012-10-21 15:31 mou_filter\win7 x86 Checked Build Environment.lnk
相关资源
- SeleniumWebdriver自动化测试设计视频课程
- dualband_coupling_matrix_synthesis v 1.0
- AD7768 Verilog Driver
- Eltima_Virtual.Serial.Port.Driver.8.0.412.Reg.
- datagrid-filter
- 三轴芯片lis2dh12驱动代码
- 驱动加载工具DriverMonitor
- Virtual Serial Port Driver64虚拟串口+虚拟串
- Virtual_Serial_Port_Driver8.zip
- vspd 虚拟串口 Virtual Serial Port Driver 7
- DNF脚本驱动源码MyDriver.zip
- Developing_drivers_with_the_Microsoft_Windows_
- geckodriver
- 瑞芯微Windows驱动DriverAssitant_v4.2
- seed xds510plus driver
- 苹果手机USB驱动32位
- POC filter 原理和设计说明
- adb interface usb driver(adb驱动 32bit64bi
- HUAWEI USB Driver
- chromedriver.exe
- chromedriver-win64可用版本
- 360Wifi Driver for Ubuntu编译安装
- USB 2.0PC Camera Driver 驱动
- Delphi 7 mongodb driver DLL封装及源代码.
- ODBC Driver for Cache 64位
- Firefox浏览器xpath插件webdriver_element_l
- geckodriver-v0.18.0-win64.zip
- geckodriver-v0.23.0
- 火狐浏览器驱动geckodriver.exe
-
XL Driver Library - Desc
ription
评论
共有 条评论