This is used to determine either the current default username, or the user identification used to establish a network connection.
DWORD WNetGetUser(
LPTSTR lpName,
LPTSTR lpUserID,
LPDWORD lpBufferSize
);
If the name passed in is a network provider and the network does not have a network wide logon, then an empty string is returned.
If a network resource name is passed in, and the user is connected to that resource using different names, it is possible that a NP cannot resolve which user profile name to return. In this case the NP may make an arbitrary choice amongst the possible usernames.
WN_NOT_LOGGED_ON | the user is not logged on to the system (lpName empty) or network (lpName a valid provider name). |
WN_NOT_CONNECTED | lpName not a redirected device nor a connected network name. |
WN_NOT_SUPPORTED | lpName is the name of a network that does not support network wide logon. |
WN_MORE_DATA | the buffer is too small |
WN_FUNCTION_BUSY | The MPR or NP is busy (possibly initializing). The caller should retry. |
WN_NO_NETWORK | network is not present. |
WN_EXTENDED_ERROR | a network specific error occurred. WNetGetLastError should be called to obtain a description of the error. |