Esporta (0) Stampa
Espandi tutto
EN
Il contenuto non è disponibile nella lingua di destinazione, ma solo in inglese.

SHRegGetPath function

Retrieves a file path from the registry, expanding environment variables as needed.

Syntax


LSTATUS SHRegGetPath(
  _In_   HKEY hkey,
  _In_   LPCTSTR pszSubkey,
  _In_   LPCTSTR pszValue,
  _Out_  LPTSTR pszPath,
  DWORD dwFlags
);

Parameters

hkey [in]

Type: HKEY

A handle to a key that is currently open, or a registry root key.

pszSubkey [in]

Type: LPCTSTR

A pointer to a null-terminated string that contains the name of the subkey.

pszValue [in]

Type: LPCTSTR

A pointer to a null-terminated string that contains the name of the value that holds the unexpanded path string.

pszPath [out]

Type: LPTSTR

A buffer to hold the expanded path. You should set the size of this buffer to MAX_PATH to ensure that it is large enough to hold the returned string.

dwFlags

Type: DWORD

Reserved.

Return value

Type: LSTATUS

Returns ERROR_SUCCESS if successful, or a Windows error code otherwise.

Remarks

The data type of the specified registry value must be either REG_EXPAND_SZ or REG_SZ. If it has the REG_EXPAND_SZ type, any environment variables in the registry string will be expanded with ExpandEnvironmentStrings. If it has the REG_SZ data type, environment variables will not be expanded and the string pointed to by pszPath will be identical to the string in the registry.

The following environment strings will be replaced by their equivalent path.

Environment stringFolder
%USERPROFILE% The current user's profile folder
%ALLUSERSPROFILE% The All Users profile folder
%ProgramFiles% The Program Files folder
%SystemRoot% The system root folder
%SystemDrive% The system drive letter

 

Note  %USERPROFILE% is relative to the user making the call. This function does not work if the user is being impersonated from a service.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 5.0 or later)

Unicode and ANSI names

SHRegGetPathW (Unicode) and SHRegGetPathA (ANSI)

 

 

Aggiunte alla community

AGGIUNGI
Microsoft sta conducendo un sondaggio in linea per comprendere l'opinione degli utenti in merito al sito Web di MSDN. Se si sceglie di partecipare, quando si lascia il sito Web di MSDN verrà visualizzato il sondaggio in linea.

Si desidera partecipare?
Mostra:
© 2014 Microsoft