WdfDriverRetrieveVersionString function (wdfdriver.h)

[Applies to KMDF and UMDF]

The WdfDriverRetrieveVersionString method retrieves a Unicode string that identifies the version of the Kernel-Mode Driver Framework that the driver is running with.

Syntax

NTSTATUS WdfDriverRetrieveVersionString(
  [in] WDFDRIVER Driver,
  [in] WDFSTRING String
);

Parameters

[in] Driver

A handle to the driver's framework driver object that the driver obtained from a previous call to WdfDriverCreate or WdfGetDriver.

[in] String

A handle to a framework string object that the driver obtained from a previous call to WdfStringCreate. The framework assigns the version string to the string object.

Return value

WdfDriverRetrieveVersionString returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return one of the following values:

Return code Description
STATUS_INSUFFICIENT_RESOURCES
The framework could not allocate a buffer for the Unicode string.
 

This method might also return other NTSTATUS values.

A system bug check occurs if the Driver handle is invalid.

Remarks

Your driver can call WdfDriverRetrieveVersionString if you want to display a string that identifies the framework library's version. The string's format might change from one version to another, so the driver must not attempt to interpret the string's format or content.

For more information about library versions, see Framework Library Versioning.

Examples

The following code example creates a string object, assigns the version string to the object, and displays the string if a debugger is running.

WDFSTRING string;
UNICODE_STRING us;

status = WdfStringCreate(
                         NULL,
                         WDF_NO_OBJECT_ATTRIBUTES,
                         &string
                         );
if (NT_SUCCESS(status)) {
    status = WdfDriverRetrieveVersionString(
                                            driver,
                                            string
                                            );
    if (NT_SUCCESS(status)) {
        WdfStringGetUnicodeString(
                                  string,
                                  &us
                                  );
        DbgPrint(
                 "WDF Version string:  %wZ\n",
                 &us
                 );
    }
    WdfObjectDelete(string);
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfdriver.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL PASSIVE_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WdfDriverCreate

WdfDriverIsVersionAvailable

WdfGetDriver

WdfObjectDelete

WdfStringCreate

WdfStringGetUnicodeString