Hi, I've been trying to gain control of the COM1 port from windows. I think I may be on the right track this time (yeh, sure you are LOL). However I am a bit confused about a call that needs to be made.
I have to get the address of the ports contention handler, and then call to that address with the request to "Aquire" the port. It seems a reasonable thing to do, but the PC always blue screen when I make the call. (everything in the VxD is either in LOCKED_DATA or LOCKED_CODE)

Here's where I get the address, (It doesn't seem to fail)

VxDCall _VCOMM_Get_Contention_Handler,<OFFSET32 PortName>

or eax, eax
jz VxdErr
mov Cont_Hand, eax


Here's where I call to the address

; jmp Init_End
cCall ,<ACQUIRE_RESOURCE,OFFSET32 R4_Handle,OFFSET32 OnNotify,OFFSET32 Notif_Data,STEAL_RESOURCE>

or eax, eax
jz VxdErr
mov eax, R4_Handle


Here's the link to MSDN's blurb on it

http://msdn.microsoft.com/library/en-us/wmeother/comm_0t2x.asp?frame=true

I've never done a call to an address in a varable before. SO I am a bit unsure why it fails. Anyone know if I have to massage the address given to me first or maybe something else?

Thanks,
sceptor
Posted on 2002-06-22 06:46:10 by sceptor
OK, you guys are killing me here. I gotta answer my own post? LOL.

I found the problem. It was the handle of the port being passed to the contention handler (dwResourceHandle).
I was passing the address of the variable that held the handle in it. Soon as I changed that to loading eax with the handle's value, and passing eax it started working.

Soon as I get this all sorted out I will post a tutorial thingie on how to use the serial port under windows. No small feat indeed.

No blue screens

mov eax, R4_Handle
cCall ,<ACQUIRE_RESOURCE,eax,OFFSET32 OnNotify,OFFSET32 Notif_Data,STEAL_RESOURCE>
Posted on 2002-06-22 21:09:03 by sceptor