4

Windows 7のキー機能を交換する必要がありAltます。大企業は、左側に発音区別符号のキーがあるタイプライターで書いていた老人のためにそれを必要としていますが、彼らが現在取り組んでいるWin7はAltこの目的に適しています。

2日間の調査により、私はドライバーソリューションにたどり着きました。オリジナルのWindows7ドライバー(2つの.sysファイルはキーボードドライバーのようです)のソースコードが必要であり、WindowsDDKでそれらを変更する可能性があります。または、デフォルトのドライバーで動作する追加のドライバーを作成する必要があります。ご覧のとおり、ソリューションはCまたはC++になります。しかし、これを達成するために私はどのように行かなければなりませんか?どのような手順を踏む必要がありますか?

制限は次のとおりです。

  1. 1つのシステムは、ドライバーのインストールのためにのみ再起動します。
  2. AltWin7での作業中にキーを交換する簡単な方法(Alt両方を押してキーを交換します)。
  3. 再起動が必要なWin7キーボードの再マッピングはありません。

後で追加:必要なものはすべて揃っていますが、スワッピングを処理するコードはありません。たとえば、送信されるスキャンコードは1つしかないため、rightShiftとを切り替えました。Enterしかし、左はAlt1つを送信し、右はAlt2つのスキャンコードを送信します。

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);
}

だから私は単に両方のキーを個別に押したり離したりするスキャンコードを交換します。右は2つのスキャンコードを送信していますが、この関数を2回呼び出すことで送信するのか、構造体Altで2つのスキャンコードを作成するのかはわかりません。InputDataStart私はすべてのスキャンコードをビープ音でAlt鳴らそうとしますが、あなたの助けをいただければ幸いです。

4

1 に答える 1

1

解決:

if (InputDataStart->MakeCode==0x38 || InputDataStart->MakeCode==0xb8)
    InputDataStart->Flags^=KEY_E0;

これは、左右のAltキー機能を交換します。

次に、スワッピングを構成可能にする必要があります。最良の場合-両方のAltキーを押します。

于 2012-09-30T07:07:14.007 に答える