WNetGetProviderName

The WNetGetProviderName function obtains the provider name for a specific type of network.

DWORD WNetGetProviderName(
  DWORD dwNetType,    // specifies network type
  LPTSTR lpProvider,  // pointer to buffer to receive provider name
  LPDWORD lpBufferSize
                      // size of buffer
);
 

Parameters

dwNetType
Specifies the network type unique to the network. If two networks claim the same type, the function returns the name of the type loaded first. Only the high word of the network type is used. If a network reports a subtype in the low word, it is ignored.
lpProvider
Pointer to a buffer in which to return the provider name.
lpBufferSize
The size, in characters, of the buffer passed to the function call. If the result is WN_MORE_DATA, lpBufferSize contains the buffer size required (in characters) to hold the provider name.

Windows 95: Size is in bytes, not characters. Also, the buffer must be at least 1 byte long.

Return Values

If the function succeeds, the return value is WN_SUCCESS. If the function fails, one of the following errors will occur:

Value Meaning
WN_MORE_DATA The buffer is too small to hold the provider name.
WN_NO_NETWORK The network is not present.
WN_BAD_POINTER lpProvider or lpBufferSize is invalid.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Use version 2.0 or later.
  Header: Declared in winnetwk.h.
  Import Library: Use mpr.lib.

See Also

Windows Networking (WNet) Overview, Windows Networking Functions, WNetGetNetworkInformation