Subj : Serial port query To : Vitus Jensen From : Darin McBride Date : Sun Aug 06 2000 04:12 pm Hello Vitus! Replying to a message of Vitus Jensen to Darin McBride: DM>> I've been asked how to do something I'm at a loss as to where to DM>> start - if it's possible at all. To quote the person asking me: DM>> Is there a way 1. to check the state of a port, 2. determine the DM>> application using it? DM>> By #1, I believe he means "determine if a comm port was in use". DM>> Any ideas whatsoever would be appreciated. I believe #1 can be done DM>> by an attempt to open the port as a file in "DENY_ALL" mode - if it DM>> fails, someone is using it. I don't believe #2 is possible. If I DM>> could be corrected, that would be great. :-) VJ> Get OS2UNDOC from hobbes and have a look at the DosQuerySysState API. VJ> It will return infos about all open files of a single or all VJ> processes. There are problems when using it at certain fixpak levels VJ> (older Warp 3 fixpaks). Of course! I forgot all about that. I already use that call for a number of things, so one more is no biggie. :-) Unfortunately, I can't figure out how to trace back from the file to the process(es). I've done some slight modifications to the sample programs given in the undoc INF file, and I get: name: D:\BBS\MAIL\ECHO\FIDONET\BACKBONE\OS2PROG.SQD opencnt: 1 sfn: e0 refcnt: 1 flags: 0 accmode: c2 filesize: 62315 volhnd: 264 attrib: 20 [A-----] Now, *I* know which process this is: PID: 1736 PPID: 30 type: 3 state: 10 session id: 36 mod handle: 1be8 (D:\BBS\FLEET\FLTSTRT.EXE) # of threads: 4 [...] I just can't tell how to get from one to the other. VJ> And Scott Garfinkle posted in C.O.O.P.Misc that it is now possible VJ> getting infos about all open semaphore handles as well. Starting VJ> with FP 13 AFAIR (got the msg stored somewhere). DQSS doesn't seem to get 32-bit sem handles yet... :-( 16-bit doesn't seem to be a problem. (I recently installed FP14.) Darin --- * Origin: Tanktalus' Tower BBS (1:250/102) .