0

I had an application that emulated tablet inputs (im using a Wacom Intuos). It send them with InjectSyntheticPointerInput. This worked great, using EnumDisplayMonitors I can get the dimensions of my virtual workspace, and normalize the values coming from the tablet to send inputs to the monitors. I can isolate the input to a single monitor, or send the inputs to a workspace that spans both of my monitors.

I want the tablet to also touch UAC prompts and the log-in screen. These are in Session 0, so I cant easily do that, there is PSExec elevation to Session 0 with inputs, but its wonky at best, and with windows updates recently I have had troubles with it working consistently.

So my new option is a kernel driver. Specifically using VHF. This is all working great (obviously I am in test mode to install it, but that's fine). With VHF I can send inputs from my mouse, keyboard, and tablet to windows through IOCTLs sent to my VHF driver.

One problem. The tablet pen is always stuck to the monitor set as my "main display". My values X and Y go from (0,0) to (65535,65535). (0,0) always is the top right corner of any resolution monitor I try, and (65535,65535) is the bottom left corner of any resolution monitor I try. Before I would normalize the values to the EnumDisplayMonitors properties, which would give me a workspace in pixels to normalize my incoming values to.

So my question is how do i map my inputs to both monitors at the same time? Im using the HIDInjector Sample from Microsoft for my driver.

My question has two possible avenues for a solution.

  1. My VHF Driver is incorrect, specifically there is something within the HID Report Descriptor (shown bellow) I need to fix, though there is nothing in the 1_11 docs or the 1_4 docs for HID Report Descriptors that talk about multimonitor or anything related to what i want. So my guess is this avenue is a dead end. VHF itself also doesnt mention anything about monitors or mapping screens.

  2. There is some setting within windows, some registry key or else to change my tablet input from single monitor to multi monitor. This is the avenue that makes the most sense, though Im kinda lost on what registry keys, posts like this dont help, since those registry keys dont even exist in my system.

My VHF HID Descriptor:

0x05, 0x0D,                    // Usage Page (Digitizer)
0x09, 0x02,                    // Usage (Pen)
0xA1, 0x01,                    // Collection (Application)
0x09, 0x20,                    //   Usage (Stylus)
0x85, HID_PEN_ID,              //   Report ID (3)
0xA1, 0x00,                    //   Collection (Physical)
0x09, 0x32,                    //     Usage (In Range)
0x09, 0x42,                    //     Usage (Tip Switch)
0x09, 0x44,                    //     Usage (Barrel Switch)
0x15, 0x00,                    //     Logical Minimum (0)
0x25, 0x01,                    //     Logical Maximum (1)
0x95, 0x03,                    //     Report Count (3)
0x75, 0x01,                    //     Report Size (1)
0x81, 0x02,                    //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x95, 0x01,                    //     Report Count (1)
0x75, 0x05,                    //     Report Size (5)
0x81, 0x03,                    //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)

0x05, 0x01,                    //     Usage Page (Generic Desktop Ctrls)
0x09, 0x30,                    //     Usage (X)
0x09, 0x31,                    //     Usage (Y)
0x15, 0x00,                    //     Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00,  //     Logical Maximum (65535)
0x75, 0x10,                    //     Report Size (16)
0x95, 0x02,                    //     Report Count (2)
0x81, 0x02,                    //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)

0x05, 0x0D,                    // Usage Page (Digitizer)
0x09, 0x30,                    //     Usage (Tip Pressure)
0x15, 0x00,                    //     Logical Minimum (0)
0x26, 0x00, 0x04,              //     Logical Maximum (1024)
0x35, 0x00,                    //     Physical Minimum (0)
0x46, 0x00, 0x04,              //     Physical Maximum (1024)
0x75, 0x10,                    //     Report Size (16)
0x95, 0x01,                    //     Report Count (1)
0x81, 0x02,                    //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)

My C struct for my HID Descriptor

typedef struct _HIDINJECTOR_INPUT_REPORT {
unsigned char ReportId;
    struct {
        UCHAR Flags; // In Range, Tip Switch, Barrel Switch
        USHORT AbsoluteX;
        USHORT AbsoluteY;
        USHORT Pressure;
    } Pen;
} HIDINJECTOR_INPUT_REPORT, *PHIDINJECTOR_INPUT_REPORT;
vulkur
  • 21
  • 5

1 Answers1

0

You must change this

0x09, 0x02,                    // Usage (Pen)

to

0x09, 0x01,                    // Usage (Digitizer)

which maps the pen to virtual desktop instead of main monitor

vulkur
  • 21
  • 5