Handle the ERROR_INVALID_NAME error code

If the user tries to open the serial port with empty
port name, Windows returns this error code.

The error will be exposed as
QSerialPort::DeviceNotFoundError from now.

Tested only on Windows 8 (32 bit) with on-board serial
port as well as an usb dongle (PL2303) using Qt4 and Qt5.

Change-Id: I9a56a7e51dbdab684b6d2a9fdf6398d8d5018e1c
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Optimize of writing sequence algorithm

* The writeSequenceStarted shall be set to true after a successful call
of WriteFile() and to be dropped to false in case of write completion.

* The method startAsyncWrite() shall not call WriteFile() if the
writeBuffer is empty or writing sequence is already started. Also now
there is no sense to check a validity of pointers on data in writeBuffer
before call of WriteFile() because writeBuffer can not be empty.

* It is also expedient to free the writeBuffer in _q_completeAsyncWrite()
method only if numberOfBytesTransferred is not zero.

Tested on Windows 8 with the on-board and the USB (PL2303) serial ports.

Change-Id: Ib70276705fcc3f2396bf7dd6cf6977b62382a64b
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Rewrite the short description of the handle() method

* handle() is duplicated since the description explains that method.

* It is pointless to put the "object" into the sentence.

* It is consistent to start the sentence with the "if".

Here goes a typical example that is worth following with consistency:

"If successful, returns true; otherwise returns false."

Change-Id: I1c7648237c75381b8452b8c47a59445fff58ad34
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Add listing of virtual ports from the "AGG Software"

The current algorithm takes a name of the serial port from
the PortName property which is in the Registry. This value is
filled out by the Ports class installer automatically:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff546514%28v=vs.85%29.aspx

But at using the "AGG Software" software this property is
absent. Therefore the algorithm ignores these serial ports.

The simplest workaround is use of the PortNumber property
which identifies a port number for this software. In this
case a port name defines indirectly, by adding a port number
to the "COM" suffix.

This does not influence other serial ports which are defined
through PortName property.

Tested on Windows XP and Windows 8 with the cenumerator example.

Task-number: QTBUG-32774
Change-Id: I8cda3ed992ff80742511a2952d3fb7e8ac6edc81
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Use the ternary operator meant for this purpose rather than two returns

Change-Id: Ie6b17d95b83ad751130305a6d44cdead3cd46da6
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Add enumeration through the SERIALCOMM registry entry

When using some software that provide an virtual serial
ports functionality is impossible to use the Win32 SetupAPI
feature to enumerate these serial ports.

For example, such software is "Virtual Serial Ports Emulator"
from Eterlogic: http://www.eterlogic.com/Products.VSPE.html

The only possible simple way to detect these serial ports
it to read the registry key HARDWARE\\DEVICEMAP\\SERIALCOMM:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff546502%28v=vs.85%29.aspx

In this case it is possible to get only a name of the serial
port without any additional information.

This method is simply addition to the main SetupAPI functionality.

Task-number: QTBUG-36526
Change-Id: Ib505aee66b74b6a8ebe16cf88c3060c8267397a0
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>