IERegisterWritableRegistryValue function

This function calls the standard RegCreateKeyEx from a higher-integrity user context. It registers a value in a path during installation so that low-integrity processes can write into this location during run time.

Syntax

HRESULT IERegisterWritableRegistryValue(
                 GUID    guid,
  _In_           LPCWSTR lpPath,
  _In_           LPCWSTR lpValueName,
                 DWORD   dwType,
  _In_opt_ const BYTE    *lpData,
                 DWORD   cbMaxData
);

Parameters

  • guid
    Defaults to null. This attribute can be set to a string representing the path of a registry value within HKEY_CURRENT_USER.

  • lpPath [in]
    The path to write the registry value to.

  • lpValueName [in]
    The name of the value to be set. For more information, see Registry Element Size Limits.

  • dwType
    The type of data pointed to by the lpData parameter. For a list of the possible types, see Registry Value Types.

  • lpData [in, optional]
    Pointer to the data to be stored.

  • cbMaxData
    The size of the information pointed to by the lpData parameter, in BYTE. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, cbMaxData must include the size of the terminating NULL character or characters.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

hKey in RegCreateKeyEx is locked to HKCU - this interface cannot be used to elevate to admin privilege, high integrity, and write HKLM or HKCR settings.

Only supported in Windows Vista or later. If called from earlier versions of Microsoft Windows, this function returns E_NOTIMPL.

If a value with lpValueName is not already present in the key, the function adds it to the key. If lpValueName is NULL or an empty string, the function sets the type and data for the key's unnamed or default value. Registry keys do not have default values, but they can have one unnamed value, which can be of any type.

Requirements

Minimum supported client

Windows XP with SP2

Minimum supported server

Windows Server 2003

Product

Internet Explorer 8

Header

Iepmapi.h

Library

Iepmapi.lib

DLL

Ieframe.dll

See also

Reference

IERegisterWritableRegistryKey

IERegCreateKeyEx

IERegSetValueEx

IEUnregisterWritableRegistry