Skip to content

Latest commit

 

History

History
124 lines (82 loc) · 4.5 KB

nf-userenv-expandenvironmentstringsforuserw.md

File metadata and controls

124 lines (82 loc) · 4.5 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:userenv.ExpandEnvironmentStringsForUserW
ExpandEnvironmentStringsForUserW function (userenv.h)
Expands the source string by using the environment block established for the specified user. (Unicode)
ExpandEnvironmentStringsForUser
ExpandEnvironmentStringsForUser function [Windows Shell]
ExpandEnvironmentStringsForUserW
_shell_ExpandEnvironmentStringsForUser
shell.ExpandEnvironmentStringsForUser
userenv/ExpandEnvironmentStringsForUser
userenv/ExpandEnvironmentStringsForUserW
shell\ExpandEnvironmentStringsForUser.htm
shell
d32fa6c8-035a-4c84-b210-5366f21b6c17
12/05/2018
ExpandEnvironmentStringsForUser, ExpandEnvironmentStringsForUser function [Windows Shell], ExpandEnvironmentStringsForUserA, ExpandEnvironmentStringsForUserW, _shell_ExpandEnvironmentStringsForUser, shell.ExpandEnvironmentStringsForUser, userenv/ExpandEnvironmentStringsForUser, userenv/ExpandEnvironmentStringsForUserA, userenv/ExpandEnvironmentStringsForUserW
userenv.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
ExpandEnvironmentStringsForUserW (Unicode) and ExpandEnvironmentStringsForUserA (ANSI)
Userenv.lib
Userenv.dll
Windows
19H1
ExpandEnvironmentStringsForUserW
userenv/ExpandEnvironmentStringsForUserW
c++
APIRef
kbSyntax
DllExport
Userenv.dll
ExpandEnvironmentStringsForUser
ExpandEnvironmentStringsForUserA
ExpandEnvironmentStringsForUserW

ExpandEnvironmentStringsForUserW function

-description

Expands the source string by using the environment block established for the specified user.

-parameters

-param hToken [in, optional]

Type: HANDLE

Token for the user, returned from the LogonUser, CreateRestrictedToken, DuplicateToken, OpenProcessToken, or OpenThreadToken function. The token must have TOKEN_IMPERSONATE and TOKEN_QUERY access. In addition, as of Windows 7 the token must also have TOKEN_DUPLICATE access. For more information, see Access Rights for Access-Token Objects.

If hToken is NULL, the environment block contains system variables only.

-param lpSrc [in]

Type: LPCTSTR

Pointer to the null-terminated source string to be expanded.

-param lpDest [out]

Type: LPTSTR

Pointer to a buffer that receives the expanded strings.

-param dwSize [in]

Type: DWORD

Specifies the size of the lpDest buffer, in TCHARs.

-returns

Type: BOOL

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\UserName\ntuser.dat

Note

The userenv.h header defines ExpandEnvironmentStringsForUser as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

User Profiles Overview

User Profiles Reference