why ButtonFlags is always zero on win7 X64?

I have build a mouse filter driver based on WDK moufiltr example.

Here is the structure in driver for mouse data,

typedef struct MOUSE_INPUT_DATA {
USHORT UnitId;
USHORT Flags;
union {
ULONG Buttons;
struct {
USHORT ButtonFlags;
USHORT ButtonData;
};
};
ULONG RawButtons;
LONG LastX;
LONG LastY;
ULONG ExtraInformation;
} MOUSE_INPUT_DATA, *PMOUSE_INPUT_DATA;

ButtonFlags is used to Specifies the transition state of the mouse buttons, like MOUSE_LEFT_BUTTON_DOWN etc.

But in my test, on Win7 X64, the value of ButtonFlags is always 0 (means no button status change) even if you click buttons. Why ? How system can get the mouse button click correct ?

The flags are set on a click up or down. What does your code look like? Are you sure you are filtering the particular mouse that you are clicking?

d

Doron Holan:

Thanks for your response.

I just add some code in MouFilter_ServiceCallback, code looks like this:

PMOUSE_INPUT_DATA move = InputDataStart;

while (move != InputDataEnd)
{
if (move->ButtonFlags != 0)
{
// add break point here.
move->ButtonFlags = 0;
}
move++;
}

When I debug this code, the break point never runs into.

And another test is, I reset right button flag to left button flag, like this:

if (move->ButtonFlags == MOUSE_RIGHT_BUTTON_DOWN)
move->ButtonFlag = MOUSE_LEFT_BUTTON_DOWN;

The same code run correct on XP, but all failed on win7.

BTW, I run win7 x64 on vmware.