About the keyboard input simulation of WinIO.DLL
Recently in the way of looking for keyboard simulation, finally found on the Internet a WinIO.DLL IO keyboard simulation button. But there's a problem with that method. I built a global hook to monitor the keyboard information, and found that it was just keydown and keypress messages, KeyUp the information is up a zoom key. After 2 days of having finally found the right way, here is the code (use requires Winio.dll,winio.vxd,winio.sys):public class Winiolab
{
Private Const int kbc_key_cmd = 0x64;
Private Const int kbc_key_data = 0x60;
[DllImport ("Winio.dll")]
private static extern bool Initializewinio ();
[DllImport ("Winio.dll")]
private static extern bool Getportval (INTPTR wportaddr, out int pdwportval, byte bsize);
[DllImport ("Winio.dll")]
private static extern bool Setportval (UINT wportaddr, IntPtr dwportval, byte bsize);
[DllImport ("Winio.dll")]
private static extern byte Mapphystolin (byte pbphysaddr, uint dwphyssize, IntPtr physicalmemoryhandle);
[DllImport ("Winio.dll")]
private static extern bool Unmapphysicalmemory (IntPtr physicalmemoryhandle, byte pblinaddr);
[DllImport ("Winio.dll")]
private static extern bool Getphyslong (IntPtr pbphysaddr, byte pdwphysval);
[DllImport ("Winio.dll")]
private static extern bool Setphyslong (IntPtr pbphysaddr, byte dwphysval);
[DllImport ("Winio.dll")]
private static extern void Shutdownwinio ();
[DllImport ("User32.dll")]
private static extern int Mapvirtualkey (UINT Ucode, uint umaptype);
Private Winiolab ()
{
Isinitialize = true;
}
public static void Initialize ()
{
if (Initializewinio ())
{
Kbcwait4ibe ();
Isinitialize = true;
}
}
public static void Shutdown ()
{
if (isinitialize)
Shutdownwinio ();
Isinitialize = false;
}
private static bool Isinitialize{get; set;}
Wait for the keyboard buffer to be empty
private static void Kbcwait4ibe ()
{
int dwval = 0;
Do
{
BOOL flag = Getportval ((IntPtr) 0x64, out dwval, 1);
}
while ((Dwval & 0x2) > 0);
}
Analog Keyboard Label Press
public static void KeyDown (Keys vkeycoad)
{
if (! Isinitialize) return;
int btscancode = 0;
Btscancode = Mapvirtualkey (UINT) vkeycoad, 0);
Kbcwait4ibe ();
Setportval (Kbc_key_cmd, (INTPTR) 0xd2, 1);
Kbcwait4ibe ();
Setportval (Kbc_key_data, (INTPTR) 0x60, 1);
Kbcwait4ibe ();
Setportval (Kbc_key_cmd, (INTPTR) 0xd2, 1);
Kbcwait4ibe ();
Setportval (Kbc_key_data, (INTPTR) Btscancode, 1);
}
Analog Keyboard Popup
public static void KeyUp (Keys vkeycoad)
{
if (! Isinitialize) return;
int btscancode = 0;
Btscancode = Mapvirtualkey (UINT) vkeycoad, 0);
Kbcwait4ibe ();
Setportval (Kbc_key_cmd, (INTPTR) 0xd2, 1);
Kbcwait4ibe ();
Setportval (Kbc_key_data, (INTPTR) 0x60, 1);
Kbcwait4ibe ();
Setportval (Kbc_key_cmd, (INTPTR) 0xd2, 1);
Kbcwait4ibe ();
Setportval (Kbc_key_data, (INTPTR) (Btscancode | 0x80), 1);
}
}
KeyDown and KeyUp information are 0x60, and KeyUp is a key plus or 0x80 .
But the use of WinIO.dll method in the Win7 64x can not be used, the basic registration can not drive, I do not know if anyone study to arrive at a solution. Some words please contact me: [email protected], thank you.
About the keyboard input simulation of WinIO.DLL