WdfDriverRetrieveVersionString - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdriver.h

NTSTATUS WdfDriverRetrieveVersionString(
  [in] WDFDRIVER Driver,
  [in] WDFSTRING String
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdriver-wdfdriverretrieveversionstring)

WdfDriverRetrieveVersionString function

Description

[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.

Parameters

Driver [in]

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

String [in]

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);
}

See also

WdfDriverCreate

WdfDriverIsVersionAvailable

WdfGetDriver

WdfObjectDelete

WdfStringCreate

WdfStringGetUnicodeString