Expands the source string by using the environment block established for the specified user.
Syntax
BOOL WINAPI ExpandEnvironmentStringsForUser(
HANDLE hToken,
LPCTSTR lpSrc,
LPTSTR lpDest,
DWORD dwSize
);
Parameters
- hToken
-
[in] Token for the user, returned from the LogonUser, CreateRestrictedToken, DuplicateToken, OpenProcessToken, or OpenThreadToken function. The token must have TOKEN_IMPERSONATE and TOKEN_QUERY access. For more information, see Access Rights for Access-Token Objects.
If this parameter is NULL, the environment block contains system variables only.
- lpSrc
-
[in] Pointer to the null-terminated source string to be expanded.
- lpDest
-
[out] Pointer to a buffer that receives the expanded strings.
- dwSize
-
[in] Specifies the size of the lpDest buffer, in TCHARs.
Return Value
TRUE if successful; otherwise, FALSE. To get extended error information, call GetLastError.
Remarks
The following is an example source string:
When ExpandEnvironmentStringsForUser returns, the destination string expands as follows:
C:\Documents and Settings\Joe\ntuser.dat
Function Information
| Minimum DLL Version | Userenv.dll |
|---|
| Custom Implementation | No |
|---|
| Header | Userenv.h |
|---|
| Import library | Userenv.lib |
|---|
| Minimum operating systems |
Windows 2000 Professional, Windows 2000 Server |
|---|
| Unicode | Implemented as
ANSI and Unicode versions. |
|---|
See Also