GetIScsiTargetInformationW function (iscsidsc.h)

The GetIscsiTargetInformation function retrieves information about the specified target.


ISDSC_STATUS ISDSC_API GetIScsiTargetInformationW(
  [in]           PWSTR                    TargetName,
  [in, optional] PWSTR                    DiscoveryMechanism,
  [in]           TARGET_INFORMATION_CLASS InfoClass,
  [in, out]      PULONG                   BufferSize,
  [out]          PVOID                    Buffer


[in] TargetName

The name of the target for which information is retrieved.

[in, optional] DiscoveryMechanism

A text description of the mechanism that was used to discover the target (for example, "iSNS:", "SendTargets:" or "HBA:"). A value of null indicates that no discovery mechanism is specified.

[in] InfoClass

A value of type TARGET_INFORMATION_CLASS that indicates the type of information to retrieve.

[in, out] BufferSize

A pointer to a location that, on input, contains the size (in bytes) of the buffer that Buffer points to. If the operation succeeds, the location receives the number of bytes retrieved. If the operation fails, the location receives the size of the buffer required to contain the output data.

[out] Buffer

The buffer that contains the output data. The output data consists in null-terminated strings, with a double null termination after the last string.

Return value

Returns ERROR_SUCCESS if successful and ERROR_INSUFFICIENT_BUFFER if the buffer size at Buffer was insufficient to contain the output data. Otherwise, GetIscsiTargetInformation returns the appropriate Win32 or iSCSI error code on failure.


The iSCSI initiator service can acquire information about a single target through multiple discovery mechanisms and initiators, and the information can be different in each case, so the iSCSI initiator service maintains a list of target instances which are organized according to the discovery method.

For instance, if a single target is discovered by multiple initiators, each of which uses a different target portal group to discover the target, the iSCSI initiator will create multiple target instances for the target, each of which refers to a different target portal group.

Since the information associated with a target is relative to the way in which it was discovered, the caller must specify the discovery mechanism in the DiscoveryMechanism parameter, using a correctly formatted string identifier for the discovery mechanism. The caller can retrieve a list of valid identifiers for discovery mechanisms by setting the InfoClass parameter to null.


The iscsidsc.h header defines GetIScsiTargetInformation as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header iscsidsc.h
Library Iscsidsc.lib
DLL Iscsidsc.dll

See also