RegistryGetString

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function reads REG_SZ registry values.


HRESULT WINAPI RegistryGetString( 
  HKEY hKey,
  LPCTSTR pszSubKey,
  LPCTSTR pszValueName,
  LPTSTR pszData,
  UINT cchData 
);

hKey

[in] Handle to the open key or a predefined root value.

pszSubKey

[in] Key where the value is stored. If this value is NULL, then pszValueName is assumed to be under hkey.

pszValueName

[in] Named value to retrieve. If this value is NULL, the function retrieves the default value.

pszData

[out] A pointer to the buffer that will receive the data.

cchData

[in] String length of the data pointed to by pszData.

The following table shows the return values for this function.

Value Description

S_OK

Data is copied to the buffer.

E_INVALIDARG

Invalid hkey or pszData.

E_DATATYPE_MISMATCH

The value is not type REG_SZ.

E_INSUFFICIENT_BUFFER

The size of the buffer pointed to by pszData is not large enough to hold the string

An error value returned by RegOpenKey or RegQueryValueEx.

Error value wrapped as a FACILITY_WIN32 HRESULT.

Success indicates that the value is copied to the buffer pointed to by pszData. Failure does cause any change.

The header file snapi.h contains definitions for the registry keys, paths, values, and bitmasks for all the base notifications that are provided by the system.

If the key pointed to by hkey and pszSubkey does not exist, the function fails.

Headerregext.h
Libraryaygshell.lib
Windows Embedded CEWindows Embedded CE 6.0 and later
Windows MobilePocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

Community Additions

Show: