qtd3dservice: Restructure handling for service mode

This moves qtd3dservice from a shared process to its own process. This
is required to fix problems with accessing the emulators from multiple
threads and to run qtd3dservice as the logged-on user.

- The service process which provides a thread for each worker, and can
  add and remove workers as needed.
- The same threading model is used in service and direct modes to
  reduce complexity and behavioral differences between modes.
- Device handlers can be quit from the main thread by setting their
  run lock event.

Change-Id: I8734348011a87f0f69549a11a45d70fe3a2df69d
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
qtd3dservice: Improve error messaging

Fix a number of bad error messages and make the formatting more
consistent. Also correct the error ID structure that gets passed to the
event log.

Change-Id: Ia21b87b777e8b1bd456cb3ddde21054bb1051373
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
qtd3dservice: Add output file option

This is useful for logging purposes, particularly in service mode where
it is not possible to redirect the output.

Change-Id: I965d58b1b375eb11844b486e50ccc645aa84baf5
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
qtd3dservice: Add triggers for Windows Phone devices and emulators

This adds event triggers which allow for detecting when a device or
emulator is activated. When a device comes online, it is checked for
applications, and workers are created to monitor each application.

This changes the behavior for device connections. Instead of retrying the
connection repeatedly for 30 seconds, the worker returns after the first
failure. This is acceptable, because the worker will automatically be
reactivated when the device comes online.

Change-Id: Idab622d85de314edd18fad8bf721cbae1c17ca75
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
qtd3dservice: Add self-elevation and credentials request

When installing the service, administrative privileges are required, and
the service user must be the logged-on user. This adds a self-elevation
routine to the install/remove options, and requests the user's credentials
using the native credentials UI.

Change-Id: Ib21769dc62682bf7055a3c80b9becf224612835b
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
qtd3dservice: Don't continue if XDE isn't running

For emulator operations, exit the current worker thread if the emulator
does not appear to be running.

Change-Id: Icd2dff2fff92c172dbad2cd894cd11966c3472a1
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
qtd3dservice: Add verbosity option

This adds control over the logging level, as done in related tools
winrtrunner and windeployqt.

Change-Id: If8de677c4435bac55cbecafaaf60e642a36325a5
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
CoreCon: Remove incorrect argument from SendFile()

This argument is apparently a typo in the MSDN docs. It is not
documented and not present in assembly of actual users of this API.
This change corrects all the users of the API in qttools.

Change-Id: I9cad60b3218a55271d805dad95cda4068aead21a
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>