×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ReadFile buffer in NT/XP

ReadFile buffer in NT/XP

ReadFile buffer in NT/XP

(OP)
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.

RE: ReadFile buffer in NT/XP

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.

RE: ReadFile buffer in NT/XP

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources