Share via


IRAPISession::CeRegCreateKeyEx

Send Feedback

This method creates a registry key on a remote Microsoft® Windows® CE–based device. If the key already exists in the registry, this method opens it.

LONG CeRegCreateKeyEx( 
  HKEY hKey, 
  LPCWSTR lpszSubKey, 
  DWORD Reserved, 
  LPWSTR lpszClass, 
  DWORD dwOptions, 
  REGSAM samDesired, 
  LPSECURITY_ATTRIBUTES lpSecurityAttributes, 
  PHKEY phkResult, 
  LPDWORD lpdwDisposition 
);

Parameters

  • hKey
    [in] Handle to a currently open key or one of the following predefined reserved handle values:

    HKEY_CLASSES_ROOT

    HKEY_CURRENT_USER

    HKEY_LOCAL_MACHINE

    HKEY_USERS

    Windows CE does not support the HKEY_CURRENT_CONFIG, HKEY_PERFORMANCE_DATA, or HKEY_DYN_DATA predefined reserved handle values.

    The key opened or created by the IRAPISession::CeRegCreateKeyEx method is a subkey of the key identified by the hKey parameter.

  • lpszSubKey
    [in] Pointer to a null-terminated string specifying the name of a subkey that this method opens or creates. The subkey specified must be a subkey of the key identified by the hKey parameter. This subkey must not begin with the backslash character (\). If the parameter is NULL, then IRAPISession::CeRegCreateKeyEx behaves like IRAPISession::CeRegOpenKey, where it opens the key specified by hKey. In Windows CE, the maximum length of a key name is 255 characters, not including the terminating NULL character. You can also only nest 16 levels of sub-keys in Windows CE.

  • Reserved
    [in] Reserved; set to 0.

  • lpszClass
    [in] Pointer to a null-terminated string that specifies the class (object type) of this key. This parameter is ignored if the key already exists. In Windows CE, the maximum length of a class string is 255 characters, not including the terminating NULL character.

  • dwOptions
    [in] Ignored; set to 0 to ensure compatibility with future versions of Windows CE.

  • samDesired
    [in] Ignored; set to 0 to ensure compatibility with future versions of Windows CE.

  • lpSecurityAttributes
    [in] Set to NULL. Windows CE automatically assigns the key a default security descriptor.

  • phkResult
    [out] Pointer to a variable that receives a handle to the opened or created key. When you no longer need the returned handle, call the IRAPISession::CeRegCloseKey function to close it.

  • lpdwDisposition
    [out] Pointer to a variable that receives one of the following values.

    Value Description
    REG_CREATED_NEW_KEY The key did not exist and was created.
    REG_OPENED_EXISTING_KEY The key existed and was simply opened without being changed.

Return Values

ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call FormatMessage with the FORMAT_MESSAGE_FROM_SYSTEM flag set.

Remarks

The key that the IRAPISession::CeRegCreateKeyEx method creates has no value. An application can use the IRAPISession::CeRegSetValueEx function to set the key value.

IRAPISession::CeRegCreateKeyEx can create keys under the HKEY_LOCAL_MACHINE and HKEY_USERS registries.

An application can use IRAPISession::CeRegCreateKeyEx to temporarily lock a portion of the registry. When the locking process creates a new key, it receives the disposition value REG_CREATED_NEW_KEY, indicating that it "owns" the lock. Another process attempting to create the same key receives the disposition value REG_OPENED_EXISTING_KEY, indicating that another process already owns the lock.

Requirements

OS Versions: Windows CE 5.01 and later.
Header: Rapi2.h.
Link Library: Ole32.lib, Rapiuuid.lib

See Also

IRAPISession::IUnknown | IRAPISession::CeRegCreateKeyEx | IRAPISession::CeRegDeleteKey | IRAPISession::CeRegOpenKeyEx | IRAPISession::CeRegSetValueEx

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.