S/GetCommState

biffer os bifferos at yahoo.co.uk
Sun Aug 7 18:21:49 CDT 2005


--- Uwe Bonnes
<bon at elektron.ikp.physik.tu-darmstadt.de> wrote:

> >>>>> "biffer" == biffer os <bifferos at yahoo.co.uk>
> writes:
> 
>     biffer> I have an application failing to
> communicate at 19200, but
>     biffer> working at 57600.  I've got about 40k of
> logs of DCB dumps for a
>     biffer> case it fails (19200 baud) and the case
> it succeeds (57600
>     biffer> baud).  If anyone wants I can post them
> here.
> 
>     biffer> But...
> 
>     biffer> Any particular reason why GetCommState
> doesn't first zero the
>     biffer> passed structure, or set the size with
> sizeof()?
> 
>     biffer> If an app fails to zero its supplied DCB
> structure for a Get,
>     biffer> and Windows *does* then code might work
> for Windows and fail for
>     biffer> Wine?  I don't have a windows box to
> test this though.
> 
>     biffer> It also strikes me that ignored DCB
> elements from a Set
>     biffer> operation should be stored in a map
> associated with the
>     biffer> underlying ports so the values can be
> retrieved on the next Get
>     biffer> call and the 'Set' will appear to have
> succeeded, don't know if
>     biffer> anyone would like to comment on that.
> 
> What happens if you correct what you suspect an
> error? Does the application
> succeed?

No such luck :-(

I did something like this:

comm.c:
------8<---------------8<---------------8<---------
DCB g_dcb;
int g_dcb_set = 0;
 
BOOL WINAPI SetCommState()
{
     memcpy( &g_dcb, lpdcb, sizeof( DCB ) );
     g_dcb_set = 1;
 
     ----- wine stuff -----
}


BOOL WINAPI GetCommState(
{
     if (g_dcb_set) {
        memcpy( lpdcb, &g_dcb, sizeof( DCB ) );
     } else {
        memset( lpdcb, 0, sizeof( DCB ) );
     }

     ---- wine stuff -----
}

------8<---------------8<---------------8<---------


.. but I'm really fishing here.


In fact this isn't a big deal, because choosing the
correct baud rate makes it work, but I was just
curious.  On the face of it, it seemed an odd way to
implement the two functions, but if it works for the
majority like it is all well and good.

cheers,

-biff.




	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com



More information about the wine-devel mailing list