Before performing any other operations on a communications resource, a client VxD must call the _VCOMM_OpenComm service to open the resource. This service initializes the communications device and the port driver associated with it, and returns a communications handle that is used in subsequent calls to VCOMM client VxD services.
The _VCOMM_CloseComm service closes a communications resource. If the transmit queue is not empty, the close property of the port determines whether the remaining data is sent before the port is closed: if it is PORTCLOSE_WAIT, the service does not close the port and does not return until the characters in the transmit queue have been sent; if it is PORTCLOSE_FLUSH, the service discards the data in the transmit queue and closes the port immediately. You can query and set the close property using the _VCOMM_EscapeCommFunction service.
Client VxDs must close any communications resources they open. A VxD that opens a communications resource for use in a virtual machine (VM) must process the VM_Not_Executeable event so that it can close the resource if the VM terminates.
_VCOMM_CloseComm, _VCOMM_EscapeCommFunction, _VCOMM_OpenComm