IOCTL in WIN7x64

hey i just write test for ioctl communication but it faile with error 6

#define FILE_DEVICE_UNKOWN 0x00002a7b
#define IOCTL_TRANSFER_TYPE( _iocontrol) (_iocontrol & 0x3)
#define IOCTL_INTPASS (ULONG)CTL_CODE(FILE_DEVICE_UNKOWN ,0x02,METHOD_BUFFERED,FILE_WRITE_ACCESS)

> hey i just write test for ioctl communication but it faile with error 6

#define FILE_DEVICE_UNKOWN 0x00002a7b
#define IOCTL_TRANSFER_TYPE( _iocontrol) (_iocontrol & 0x3)
#define IOCTL_INTPASS (ULONG)CTL_CODE(FILE_DEVICE_UNKOWN
,0x02,METHOD_BUFFERED,FILE_WRITE_ACCESS)

Of course, you looked up error 6 to find out what it means. And for some
reason, neglected to tell us what it translates to. It may surprise you
to learn that very, very few people have bothered to take the time to
memorize the 1300+ error codes in the kernel error codes at the
similar-order-of-magnitude quantity of user-level error codes.

If you truly don’t know what your device is, calling it
“FILE_DEVICE_UNKNOWN” might make sense, but if you know what your device
is, you probably want to choose a more meaningful name.

And what does “0x00002a7b” mean? Particularly since the leading zeros are
pretty meaningless, because the value is only 16 bits wide. But 0x2a7b is
10,875, which means you are trying to use a number in the
reserved-for-Microsoft range; non-Microsoft devices must use values in the
range 32768u…65535u. And I seriously doubt that Microsoft has written a
driver for an unknown device.

And what is 0x02? Surely, this represents some important operation, so
you should have a #define for it, e.g.

#define IOCTL_PAINT_BITS_PURPLE 2050u

or something else informative. Did you RTFM where it states that the
function codes 0…2047u are reserved for Microsoft? And if the device
comes from Microsoft, it is probably not “unknown” to them.

Then, if you have written the driver, presumably you are using the same .h
file for the apps that is used to define the symbols for the driver; it
would make no sense to use two different files. And you have not shown
any of the decoding logic (most typically a ‘switch’ statement) that
decodes the IoControlCode field of the current IRP stack entry’s
Parameters union. So until we see that, what your question is, as posted:

“I tried something and it gave some error and didn’t work. What did I do
wrong?”

and the only answer that is possible is

“You made an error in your code. Fix it and the problem will go away.”
joe


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

xxxxx@gmail.com wrote:

hey i just write test for ioctl communication but it faile with error 6

Error 6 is ERROR_INVALID_HANDLE. Thus, your problem had nothing to do
with the code snippet you posted.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Then it is YOUR responsibility to tell us what “Error 6” means! Had you
looked this up, you would have had your answer immediately!
joe

xxxxx@gmail.com wrote:
> hey i just write test for ioctl communication but it faile with error 6

Error 6 is ERROR_INVALID_HANDLE. Thus, your problem had nothing to do
with the code snippet you posted.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer