 |
GetUserNameEx ..msdn Add comment W32 Constants Translate this page |
 |
 |
|
Retrieves the name of the user or other security principal associated with the calling thread. You can specify the format of the returned name. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
BOOLEAN WINAPI GetUserNameEx(
__in EXTENDED_NAME_FORMAT NameFormat,
__out LPTSTR lpNameBuffer,
__inout PULONG lpnSize
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER GetUserNameEx IN secur32;
INTEGER NameFormat,;
STRING @lpNameBuffer,;
LONG @lpnSize
|
 |
 |
 |
| Parameters: |
 |
NameFormat [in]
The format of the name. This parameter is a value from the EXTENDED_NAME_FORMAT enumeration type.
lpNameBuffer [out]
A pointer to a buffer that receives the name in the specified format.
lpnSize [in, out]
On input, this variable specifies the size of the lpNameBuffer buffer, in TCHARs. |
 |
 |
| Return value: |
 |
| If the function succeeds, the return value is a nonzero value. |
 |
 |
| Usage: |
 |
LOCAL cBuffer, nBufsize
* 1332=ERROR_NONE_MAPPED
* 87=ERROR_INVALID_PARAMETER
FOR nIndex=0 TO 13
nBufsize=250
cBuffer = REPLICATE(CHR(0), nBufsize)
nResult = GetUserNameEx(nIndex, @cBuffer, @nBufsize)
IF nResult <> 0
cBuffer = SUBSTR(cBuffer, 1, nBufsize)
? nIndex, "["+cBuffer+"]"
ELSE
? nIndex, "error:", GetLastError()
ENDIF
NEXT
|
 |
 |
| My comment: |
 |
| If the thread is impersonating a client, GetUserNameEx returns the name of the client. |
 |
 |
| Word Index links for the GetUserNameEx : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2009-01-07 12:38:32 | | Modified: | 2009-01-07 12:44:00 | Visited in last 7 days: 15 |