IVdsLunNumber::GetLunNumber method (vdshwprv.h)

[Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage Management API.]

Retrieves the LUN number for a LUN.


HRESULT GetLunNumber(
  ULONG *pulLunNumber



The address of a variable that receives the LUN number. This value is required and cannot be NULL.

Return value

This method can return standard HRESULT values, such as E_INVALIDARG or E_OUTOFMEMORY, and VDS-specific return values. It can also return converted system error codes using the HRESULT_FROM_WIN32 macro. Errors can originate from VDS itself or from the underlying VDS provider that is being used. Possible return values include the following.

Return code Description
The method completed successfully.


This method returns the LUN number that the VDS hardware provider assigned to the LUN. This number identifies the LUN within the disk array. It is not the same as the "Logical Unit Number" in the disk's SCSI address. Each LUN in the disk array is assigned exactly one LUN number.

This method exists because the DiskRAID utility assigns its own index to each LUN when it enumerates the LUNs in a subsystem. But these indexes can change each time DiskRAID is run, if the hardware provider enumerates the LUNs in a different order. This can be confusing to end users. For disk arrays that have their own (provider-assigned) LUN numbers, this method gives the caller the ability to map the LUN numbers to the LUN indexes that are assigned by DiskRAID.

If a subsystem supports LUN numbering, it can indicate this support by setting the VDS_SF_SUPPORTS_LUN_NUMBER flag in the ulFlags member of the VDS_SUB_SYSTEM_PROP or VDS_SUB_SYSTEM_PROP2 structure. For more information about this flag, see the VDS_SUB_SYSTEM_FLAG enumeration.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header vdshwprv.h
Library Uuid.lib

See also