Re: IOCTL_MOUSE_QUERY_ATTRIBUTES usage?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Nuno Sousa (nunofgs_at_gmail.com)
Date: 09/10/04


Date: 9 Sep 2004 19:51:24 -0700

Thanks for the replies.

My driver should be \\Device\lmouse. I tried that but bResult came
False... it works with \\.\lmouse, but maybe that's not it.

Regarding the WIN32 API, it might not do what I want. I intend to send
actual control codes to the mouse driver to change certain settings.
Doubt there's a API that does that... would make my life easier tho :)

--
Nuno Sousa
Doron Holan [MS] wrote:
> aer you sure bResult is true and that you actually created the handle
> properly?  if \\.\lmouse is your driver,the driver needs to handle
this
> IOCTL separate in its control device object and not rely on the
filter
> device object.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
> "Nuno Sousa" <nunofgs@gmail.com> wrote in message
> news:chqjmj$qcc@odak26.prod.google.com...
> > I'm very new to driver development, but I was trying to grab the
> > information from my mouse. I wrote this in like 5 mins but I'm
getting
> > output like:
> >
> > MouseIdentifier = 52428
> > NumberOfButtons = 52428
> > SampleRate = 52428
> > InputDataQueueLength = -858993460
> >
> >>From what I was reading at
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intinput/hh/intinput/mref_078cb198-31ca-4b11-bc5b-33553bcb71a0.xml.asp
> > I'm kind of working in the dark here, so was hoping someone could
shed
> > some light on this.
> >
> >
> > Here's the code:
> > ----------------------------
> > #include <windows.h>
> > #include <winioctl.h>
> > #include <stdio.h>
> > #include <ntddmou.h>
> >
> >
> > int main() {
> > HANDLE hDevice;
> > BOOL bResult;
> > DWORD junk;
> > MOUSE_ATTRIBUTES ma;
> >
> > hDevice = CreateFile("\\\\.\\\\lmouse",
> > GENERIC_READ,
> > 0,
> > NULL,
> > OPEN_EXISTING,
> > 0,
> > NULL);
> >
> > if (hDevice == INVALID_HANDLE_VALUE)
> > {
> > return (FALSE);
> > }
> >
> > bResult = DeviceIoControl(hDevice,
> > IOCTL_MOUSE_QUERY_ATTRIBUTES,
> > NULL, 0, // no input buffer
> > &ma, sizeof(ma),     // output buffer
> > &junk,                 // # bytes returned
> > (LPOVERLAPPED) NULL);
> >
> >
> >
> > printf("MouseIdentifier = %u\n", ma.MouseIdentifier);
> > printf("NumberOfButtons = %u\n", ma.NumberOfButtons);
> > printf("SampleRate = %u\n", ma.SampleRate);
> > printf("InputDataQueueLength = %ld\n", (ULONG)
> > ma.InputDataQueueLength);
> >
> >  CloseHandle(hDevice);
> >
> > }
> >

Quantcast