IERegCreateKeyEx function

Calls the standard RegCreateKeyEx from a higher-integrity user context. Creates the specified registry key. If the key already exists, the function opens it. Note that key names are not case sensitive.

Syntax


HRESULT IERegCreateKeyEx(
  _In_  LPCWSTR               lpSubKey,
  _In_  DWORD                 reserved,
  _In_  LPWSTR                lpClass,
  _In_  DWORD                 dwOptions,
  _In_  REGSAM                samDesired,
  _In_  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  _Out_ PHKEY                 phkResult,
  _Out_ LPDWORD               lpdwDisposition
);

Parameters

lpSubKey [in]

The name of a lpSubKey that this function opens or creates with medium integrity. This parameter cannot be NULL

reserved [in]

This parameter is reserved and must be zero.

lpClass [in]

The class (object type) of this key. This parameter is used for both local and remote registry keys. It may be ignored, or it can be NULL.

dwOptions [in]

A full list of options can be found in RegCreateKeyEx.

samDesired [in]

A mask that specifies the access rights for the key.

lpSecurityAttributes [in]

A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpSecurityAttributes is NULL, the handle cannot be inherited.

phkResult [out]

A pointer to a variable that receives a handle to the opened or created key. If the key is not one of the predefined registry keys, call the RegCloseKey function after you have finished using the handle.

lpdwDisposition [out]

A pointer to a variable that receives one of the following disposition values.

d (REG_CREATED_NEW_KEY=0x00000001L)

The key did not exist and was created.

d (REG_OPENED_EXISTING_KEY=0x00000002L)

The key existed and was simply opened without being changed.

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.

If lpdwDisposition is NULL, no disposition information is returned.

The key that the IERegCreateKeyEx function creates has no values. An application can use the IERegSetValueEx function to set key values.

Application extentions in a higher integrity user context may also have access to the following registry keys:

  • HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer
  • HKEY_CURRENT_USER\Software\Microsoft\Windows
  • HKEY_CURRENT_USER\Control Panel

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
IERegisterWritableRegistryValue
IERegSetValueEx
IEUnregisterWritableRegistry

 

 

Show: