Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReadFile buffer in NT/XP

Status
Not open for further replies.

KamalKumar

Industrial
Aug 23, 2003
2
Hi all,
I wrote an assembly language program four years back in Win 95/98.It also works on ME.But now my client wants it NT/XP compatible.Everything works fine except reading the com port.My problem is this-no matter how many bytes I tell the function ReadFile to read,it reads only 258 bytes(the same function reads faithfully in Win98).Not only that it filters few binary characters like 0dH(i.e.,LF,CR) How can I read correctly and more than this in NT?Comm timeouts are zero.
Typical port reading-
mov dword ptr[ol.hEvent],0
mov dword ptrytes_To_Read],1024
mov dword ptr[ol.Offset],0
mov dword ptr[ol.OffsetHigh],0
push offset ol
push offset Bytes_Read
push [Bytes_To_Read]
push offset ReadBuffer
push [hCom]
call ReadFile
Cmp eax,0
jne Noerror
Call GetLastError
;->here I put in Microsoft suggested GetOverlapped result
;to wait till port reading is complete.
Any suggetions as what is missing??
Thanks in advance.
 
Replies continue below

Recommended for you

The problem may be in the way your are calling the COM port for access. XP is based on NT technology which blocks physical access to hardware components directly. Being an assembly program, my guess is that you are trying to access to interface directly which is being blocked by the OS. I'm not a developer, so I can't give you the proper access method, but I can tell you this is a common problem with older applications moving into the XP, Windows 2000 environment.
 
Hi,
Thanks for the reply.To give a slight insight into the COM port access ,I am using Win32 API which in real uses the same Com port driver OS places in between. I got around the problem ,for the time being by setting comm timeouts to null and reading com port in multiples.I could change any damn aspect of com port but could not extend the buffer size.
Thanks again and best regards
Kamal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor