Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Shell Functions
 ExpandEnvironmentStringsForUser Fun...
ExpandEnvironmentStringsForUser Function

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:

%USERPROFILE%\ntuser.dat

When ExpandEnvironmentStringsForUser returns, the destination string expands as follows:

C:\Documents and Settings\Joe\ntuser.dat

Function Information

Minimum DLL VersionUserenv.dll
Custom ImplementationNo
HeaderUserenv.h
Import libraryUserenv.lib
Minimum operating systems Windows 2000 Professional, Windows 2000 Server
UnicodeImplemented as ANSI and Unicode versions.

See Also

User Profiles Overview, User Profiles Reference
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker