Hi all,

I'm currently trying to get my AGFA ePhoto 780c PhotoWise software to work.
To make a long story short: win32 comm support is a whole mess.

The program calls such functions as:
Call KERNEL32.158: CreateFileA(40d75e08 
"COM2",c0000000,00000000,00000000,00000003,00000000,00000000) ret=40d91063 fs=024f
Call KERNEL32.287: GetCommState(00000050,40d958d0) ret=40d91090 fs=024f
Call KERNEL32.619: SetCommState(00000050,40d958d0) ret=40d910d1 fs=024f
Call KERNEL32.288: GetCommTimeouts(00000050,40d75e14) ret=40d910f3 fs=024f
Call KERNEL32.620: SetCommTimeouts(00000050,40d75e14) ret=40d91123 fs=024f
Call KERNEL32.677: SetupComm(00000050,00001000,00001000) ret=40d91149 fs=024f

and then it happens:
Call KERNEL32.577: ReadFile(00000050,40d75e38,00000001,40d75de8,00000000) ret=40d91249 
fs=024f
Call KERNEL32.738: WriteFile(00000050,40d75e70,00000001,40d75e38,00000000) 
ret=40d912f6 fs=024f
Call KERNEL32.260: FlushFileBuffers(00000050) ret=40d91314 fs=024f

COM2 gets created as follows:
CreateFileA -> DOSFS_GetDevice/DOSFS_OpenDevice -> FILE_CreateFile (-> so it's anormal 
server file object instead of marked as comm device !!)

The problem with all this is that we need special handling for all different
win32 objects.
I know that we already try to handle this a bit (struct object_ops in
server/*.c comes to my mind).
So what I want to know is simply:
How to add proper handling of FlushFileBuffers(), the timeout reading and
setting and such to the server ?
And maybe even more important: we need a good way of identifying the type
of object passed to CreateFile() and other horribly general beasts:
E.g. ReadFile() urgently needs to figure out whether it's a comm device:
if I do a read() immediately (as it's done now - we're assuming *file*
objects), I'll simply get 0 bytes read, even though the device just answered
a bit too slowly for that ReadFile().
Instead ReadFile needs to wait for the whole comm timeout adjusted by
SetCommTimeouts() to pass before it might eventually finally decide that the
device connected to the comm port really didn't send anything.
So IMHO ReadFile() doesn't work at all for comm ports at the moment.

I can't see exactly where/how the COM ports are supposed to fit into
server/*.c, that's why I'm asking all this.
Just some general enlightenment, please. :-))

Andreas Mohr

Reply via email to