Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Calling ReadFile after DeviceIOControl (Unexpected Results)

Reply
Thread Tools Display Modes

Calling ReadFile after DeviceIOControl (Unexpected Results)

 
 
WiredRacing
Guest
Posts: n/a

 
      11-18-2009
Hi folks,
I'm using "LPT1" via CreateFile for Overlapped communications. I use
WaitSingleObject and then GetOverlapped Result to collect ReadFile results.

All that code, including overlapped WriteFile's work great and have been for
years.

However, now I need to get the BUSY state of the port. It appears the only
way to do this in the context of Win32 is via:

DeviceIOControl(Handle, IOCTL_PAR_QUERY_INFORMATION, Nil, 0, @status,
SizeOf(status), @OVERLAPPED);

This call works great, repeated adnausem and yields the proper results every
time, in realtime. Brilliant!

That is, until I call ReadFile.

Structure is as follows.

CreateFile
Repeat
Setup Overlapped
Check DeviceIOControl (WaitSingle and GetOverlapped)
Free Overlapped

Setup Overlapped
Check ReadFile (WaitSingle and GetOverlapped)
Free Overlapped
Until StopRequested
CloseHandle

What happens here is the Status returned from DeviceIOControl starts filling
with 0's and 4's after the first successful proper result is returned the
first time through the loop. These subsequent results are invalid results.
I've also tried a ResetEvent rather than freeing and setting up a new Event
each time. Same results.

NOW, If I close the file handle and reopen in inside the loop, it works. But
that's not desirable for obvious reasons.

Also this is under WinXP and intended for WinXP+ releases.

Thoughts?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop 0x0000007b after Setup BobMiller Windows Vista Installation 8 08-05-2006 09:29 PM
Stop 0x0000007b at end of Install BobMiller Windows Vista Installation 2 08-03-2006 06:52 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59