RegLoadMUIStringW function (winreg.h)

Loads the specified string from the specified key and subkey.

Syntax

LSTATUS RegLoadMUIStringW(
  [in]            HKEY    hKey,
  [in, optional]  LPCWSTR pszValue,
  [out, optional] LPWSTR  pszOutBuf,
  [in]            DWORD   cbOutBuf,
  [out, optional] LPDWORD pcbData,
  [in]            DWORD   Flags,
  [in, optional]  LPCWSTR pszDirectory
);

Parameters

[in] hKey

A handle to an open registry key. The key must have been opened with the KEY_QUERY_VALUE access right. For more information, see Registry Key Security and Access Rights.

This handle is returned by the RegCreateKeyEx or RegOpenKeyEx function. It can also be one of the following predefined keys:

HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS

[in, optional] pszValue

The name of the registry value.

[out, optional] pszOutBuf

A pointer to a buffer that receives the string.

Strings of the following form receive special handling:

@[path]\dllname,-strID

The string with identifier strID is loaded from dllname; the path is optional. If the pszDirectory parameter is not NULL, the directory is prepended to the path specified in the registry data. Note that dllname can contain environment variables to be expanded.

[in] cbOutBuf

The size of the pszOutBuf buffer, in bytes.

[out, optional] pcbData

A pointer to a variable that receives the size of the data copied to the pszOutBuf buffer, in bytes.

If the buffer is not large enough to hold the data, the function returns ERROR_MORE_DATA and stores the required buffer size in the variable pointed to by pcbData. In this case, the contents of the buffer are undefined.

[in] Flags

This parameter can be 0 or the following value.

Value Meaning
REG_MUI_STRING_TRUNCATE
0x00000001
The string is truncated to fit the available size of the pszOutBuf buffer. If this flag is specified, pcbData must be NULL.

[in, optional] pszDirectory

The directory path.

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a system error code.

If the pcbData buffer is too small to receive the string, the function returns ERROR_MORE_DATA.

The ANSI version of this function returns ERROR_CALL_NOT_IMPLEMENTED.

Remarks

The RegLoadMUIString function is supported only for Unicode. Although both Unicode (W) and ANSI (A) versions of this function are declared, the RegLoadMUIStringA function returns ERROR_CALL_NOT_IMPLEMENTED. Applications should explicitly call RegLoadMUIStringW or specify Unicode as the character set in platform invoke (PInvoke) calls.

To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later. For more information, see Using the Windows Headers.

Note

The winreg.h header defines RegLoadMUIString as an alias that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header winreg.h (include Windows.h)
Library Advapi32.lib
DLL Advapi32.dll

See also

Registry Functions