Edit

Share via


NPGetUser function (npapi.h)

Retrieves the value of the current default user name or the user name used to establish a network connection.

Syntax

DWORD NPGetUser(
  [in]      LPWSTR  lpName,
  [out]     LPWSTR  lpUserName,
  [in, out] LPDWORD lpnBufferLen
);

Parameters

[in] lpName

Pointer to the name of the local device the caller is interested in, or a remote name for a resource that the user has made a connection to. This parameter may be NULL or the empty string if the caller is interested in the name of the user currently logged on to the system. If a remote name for a resource is passed in, and the user is connected to that resource using different names, it is possible that a provider cannot resolve which user name to return. In this case the provider may make an arbitrary choice amongst the possible user names.

[out] lpUserName

Pointer to a buffer to receive the user name. This should be a name that can be passed into the NPAddConnection or NPAddConnection3 function to re-establish the connection with the same user name.

[in, out] lpnBufferLen

Pointer to the size, in characters, of the lpUserName buffer. If the call fails because the buffer is not big enough, this ___location will be used to return the required buffer size.

Return value

If the function succeeds, it should return WN_SUCCESS. Otherwise it should return an error code, which can be one of the following.

Return code Description
WN_NOT_CONNECTED
The value in the lpName parameter is not the name of a redirected device or a connected remote name.
WN_MORE_DATA
The buffer, lpUserName, is too small.
WN_NO_NETWORK
The network is not present.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header npapi.h