Elizabeth Ashurov <[email protected]> writes:
> Add a new guest-get-driver-services command that returns registered
> driver services from the Service Control Manager
> (EnumServicesStatusExW). Each entry includes the service name,
> configured binary path, current SCM status, and FileVersion and
> CompanyName metadata extracted from the driver binary.
>
> Normalize driver binary paths from the service database before
> reading version resources, including SystemRoot,
> environment-variable, NT-prefix, and relative path forms.
>
> Unrecognized SCM service states are reported as "unknown" with a
> log message rather than aborting the enumeration, so that future
> Windows versions do not break the command.
>
> Link against version.dll (-lversion) for the GetFileVersionInfo
> and VerQueryValue APIs.
>
> Signed-off-by: Elizabeth Ashurov <[email protected]>
[...]
> diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
> index 081c99bc74..913fe25924 100644
> --- a/qga/qapi-schema.json
> +++ b/qga/qapi-schema.json
> @@ -1590,6 +1590,33 @@
> 'returns': ['GuestDeviceInfo'],
> 'if': 'CONFIG_WIN32' }
>
> +##
> +# @GuestDriverServiceStatus:
> +#
> +# @stopped: the service is stopped
> +#
> +# @start-pending: the service is starting
> +#
> +# @stop-pending: the service is stopping
> +#
> +# @running: the service is running
> +#
> +# @continue-pending: the service is resuming
> +#
> +# @pause-pending: the service is pausing
> +#
> +# @paused: the service is paused
> +#
> +# @unknown: SCM returned a service state not recognized by this
> +# QGA version
> +#
> +# Since: 11.2
12.0
More of the same below.
> +##
> +{ 'enum': 'GuestDriverServiceStatus',
> + 'data': [ 'stopped', 'start-pending', 'stop-pending', 'running',
> + 'continue-pending', 'pause-pending', 'paused', 'unknown' ],
> + 'if': 'CONFIG_WIN32' }
> +
> ##
> # @GuestDriverPackage:
> #
> @@ -1610,6 +1637,26 @@
> '*vendor': 'str' },
> 'if': 'CONFIG_WIN32' }
>
> +##
> +# @GuestDriverService:
> +#
> +# @name: service name
> +#
> +# @driver-path: driver binary path configured in the service database
> +#
> +# @version: four-part FileVersion from the driver binary
> +#
> +# @vendor: CompanyName from the driver binary
Are "FileVersion" and "CompanyName" established technical terms?
Are they necessary here, or could we simply say something like "driver
version" and "driver vendor name"?
> +#
> +# @status: current service status
> +#
> +# Since: 11.2
> +##
> +{ 'struct': 'GuestDriverService',
> + 'data': { 'name': 'str', '*driver-path': 'str', '*version': 'str',
> + '*vendor': 'str', 'status': 'GuestDriverServiceStatus' },
> + 'if': 'CONFIG_WIN32' }
> +
> ##
> # @guest-get-driver-packages:
> #
> @@ -1621,6 +1668,17 @@
> 'returns': ['GuestDriverPackage'],
> 'if': 'CONFIG_WIN32' }
>
> +##
> +# @guest-get-driver-services:
> +#
> +# Retrieve registered driver services in the guest.
Please use the revised syntax for introductions:
##
# @guest-get-driver-services:
# Retrieve registered driver services in the guest.
> +#
> +# Since: 11.2
> +##
> +{ 'command': 'guest-get-driver-services',
> + 'returns': ['GuestDriverService'],
> + 'if': 'CONFIG_WIN32' }
> +
> ##
> # @GuestAuthorizedKeys:
> #