Windows 3.1 Device Drivers (ddag31qh.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WNetGetUser
                                                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
WORD WNetGetUser(szUser, nBufferSize)
LPSTR szUser;
WORD FAR * nBufferSize;
 
The WNetGetUser function retrieves the current user name.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
szUser       Points to the buffer to receive the current user name.
 
nBufferSize  Points to a variable containing the size of the buffer pointed
             to by the szUser parameter. The function copies the actual size
             (in bytes) of the user name to the variable.
 
Return Value
 
The return value is one of the following values.
 
Value             Meaning
────────────────────────────────────────────────────────────────────────────
WN_BAD_POINTER    Invalid pointer.
 
WN_BAD_USER       Not logged in; no current user name.
 
WN_MORE_DATA      The buffer was too small.
 
WN_NET_ERROR      Network error.
 
WN_NOT_SUPPORTED  Function not supported.
 
WN_OUT_OF_MEMORY  Out of memory.
 
WN_SUCCESS        Success.
 
Comments
 
The export ordinal for this function is 16.
 
If the network does not support a string that directly corresponds to the
MS-Net user name, the driver can either return an acceptable substitute or
not support this function.
 
If the function returns WN_MORE_DATA, the function also copies the size (in
bytes) of the buffer required to hold the complete user name.
 
                                      ♦