INVALID_HANDLE_VALUE, Error code 6.

Hi,

I am getting an error while sending IOCTL call DeviceIoControl. The error code is 6, invalid handle.

But before sending the call, I am checking

if(DeviceHandle[n] == INVALID_HANDLE_VALUE)
OutputDebugString(“Invalid Handle\n”);

But I don’t see the debug information “Invalid Handle”. So why am I getting error code 6?

Thanks,
Harsha


How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.

Ok, luckily it is Be Kind To Ntdev Newbies Week here at Hollis Technology
Solutions.

Your handle is invalid. That does not imply that the value of your handle is
equal to the value INVALID_HANDLE_VALUE. The PlatformSdk simply guarantees
(when it is documented) that the value INVALID_HANDLE_VALUE is always
invalid. In other words, your test is nonsense. Your handle either was not
opened correctly, has been closed, or is being used in a process context
where it is not valid.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Harsha Inamdar
Sent: Friday, June 23, 2006 11:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] INVALID_HANDLE_VALUE, Error code 6.

Hi,

I am getting an error while sending IOCTL call DeviceIoControl. The error
code is 6, invalid handle.

But before sending the call, I am checking

if(DeviceHandle[n] == INVALID_HANDLE_VALUE)
OutputDebugString(“Invalid Handle\n”);

But I don’t see the debug information “Invalid Handle”. So why am I getting
error code 6?

Thanks,
Harsha


How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone
http:t=39663/*http://voice.yahoo.com> call rates. — Questions? First check the
Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To
unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</http:>

Harsha Inamdar wrote:

Hi,

I am getting an error while sending IOCTL call DeviceIoControl. The
error code is 6, invalid handle.

But before sending the call, I am checking

if(DeviceHandle[n] == INVALID_HANDLE_VALUE)
OutputDebugString(“Invalid Handle\n”);

But I don’t see the debug information “Invalid Handle”. So why am I
getting error code 6?

There are billions of invalid handle values other than
INVALID_HANDLE_VALUE. 0xfeedf00d, for instance.

Likely causes: uninitialized variable, handle already closed,
overwritten array.


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