Windows 交换alt键功能
我需要在Windows7中交换Alt键功能。一家大公司需要为那些在打字机上写字的老年人提供这种功能,因为打字机的左边有变音字符键,但他们正在开发的Win7现在有了用于此目的的右Alt 经过两天的研究,我找到了一个驱动程序解决方案。我需要原始Windows 7驱动程序的源代码(两个Windows 交换alt键功能,windows,swap,alt-key,Windows,Swap,Alt Key,我需要在Windows7中交换Alt键功能。一家大公司需要为那些在打字机上写字的老年人提供这种功能,因为打字机的左边有变音字符键,但他们正在开发的Win7现在有了用于此目的的右Alt 经过两天的研究,我找到了一个驱动程序解决方案。我需要原始Windows 7驱动程序的源代码(两个.sys文件似乎是键盘驱动程序),并可能在Windows DDK中修改它们。或者我需要制作一个额外的驱动程序,它可以与默认的驱动程序一起工作。正如我所见,解决方案将是C或C++。但我要怎么做才能做到这一点呢?我应该采取什
.sys
文件似乎是键盘驱动程序),并可能在Windows DDK中修改它们。或者我需要制作一个额外的驱动程序,它可以与默认的驱动程序一起工作。正如我所见,解决方案将是C或C++。但我要怎么做才能做到这一点呢?我应该采取什么步骤
限制如下:
VOID
KbFilter_ServiceCallback(
IN PDEVICE_OBJECT DeviceObject,
IN PKEYBOARD_INPUT_DATA InputDataStart,
IN PKEYBOARD_INPUT_DATA InputDataEnd,
IN OUT PULONG InputDataConsumed
)
/*++
Routine Description:
Called when there are keyboard packets to report to the Win32 subsystem.
You can do anything you like to the packets. For instance:
o Drop a packet altogether
o Mutate the contents of a packet
o Insert packets into the stream
Arguments:
DeviceObject - Context passed during the connect IOCTL
InputDataStart - First packet to be reported
InputDataEnd - One past the last packet to be reported. Total number of
packets is equal to InputDataEnd - InputDataStart
InputDataConsumed - Set to the total number of packets consumed by the RIT
(via the function pointer we replaced in the connect
IOCTL)
Return Value:
Status is returned.
--*/
{
PDEVICE_EXTENSION devExt;
WDFDEVICE hDevice;
hDevice = WdfWdmDeviceGetWdfDeviceHandle(DeviceObject);
devExt = FilterGetData(hDevice);
if (InputDataStart->MakeCode==0x1c)
InputDataStart->MakeCode=0x36;
else if (InputDataStart->MakeCode==0x36)
InputDataStart->MakeCode=0x1c;
else if (InputDataStart->MakeCode==0x9c)
InputDataStart->MakeCode=0xb6;
else if (InputDataStart->MakeCode==0xb6)
InputDataStart->MakeCode=0x9c;
(*(PSERVICE_CALLBACK_ROUTINE)(ULONG_PTR) devExt->UpperConnectData.ClassService)(
devExt->UpperConnectData.ClassDeviceObject,
InputDataStart,
InputDataEnd,
InputDataConsumed);
}
因此,我只需交换分别按下和释放两个键的扫描码。Right Alt正在发送两个扫描码,我不确定它是通过两次调用此函数来发送,还是在InputDataStart
结构中发送两个扫描码。我将尝试按每一个Alt扫描码发出蜂鸣声,但我们将感谢您的帮助。解决方案:
if (InputDataStart->MakeCode==0x38 || InputDataStart->MakeCode==0xb8)
InputDataStart->Flags^=KEY_E0;
交换左右Alt键的功能
现在我需要使交换可配置。为了达到最佳效果,您可能希望编写一个类过滤器驱动程序(位于低级设备驱动程序和kbdclass之间),而不是试图修改现有的驱动程序。DDK包含一个示例键盘筛选器驱动程序和kbdclass的源代码,这些代码可能会用作参考。我会尝试一下,并给出反馈。我已将kbfilter(示例键盘筛选器驱动程序)构建到.sys,安装了它(如说明所示,在设备管理器中),并重新启动Windows-键盘停止工作,它只是对按键没有反应。我需要卸载此驱动程序才能使键盘再次工作(通过屏幕键盘)。看起来,DDK(确切地说是WDK 7.1.0)中的原始kbfilter在没有任何更改的情况下工作良好,但它没有工作。我已经完成了整个过程,如kbfilter.htm文件所示。除了build.exe和安装驱动程序所需的一个文件之外,我没有使用Visual Studio或其他任何东西。任何帮助?需要启动Win 7没有驱动程序签名要求。您是否考虑使用键盘重新映射器(注册表修复)像SharpKeys?上述解决方案适用于按Alt键(闭合)和释放键(断开)。我已经制作了一个过滤器驱动程序,其中打印屏幕键在Windows 7 x64中正常工作时交换Alts。我认为可以通过同时按下两个按钮来交换Alt。这只是多一点代码。现在没必要这么做。