Partager via


NKRegCreateKeyEx (Windows Embedded CE 6.0)

1/5/2010

This function creates a specified key. If the key already exists, the function opens it.

Syntax

LONG NKRegCreateKeyEx(
  HKEY hKey, 
  LPCWSTR lpSubKey, 
  DWORD Reserved, 
  LPWSTR lpClass, 
  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 Embedded 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 NKRegCreateKeyEx is a subkey of the key identified by the hKey parameter.

  • lpSubKey
    [in] Pointer to a null-terminated string specifying the name of a subkey that this function 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, NKRegCreateKeyEx behaves like NKRegOpenKeyEx where it opens the key specified by hKey.

    In Windows Embedded 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 subkeys in Windows Embedded CE.

  • Reserved
    [in] Reserved; set to 0.
  • lpClass
    [in] Pointer to a null-terminated string that specifies the class (object type) of this key.

    This parameter is ignored if the key exists.

    In Windows Embedded 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 Embedded CE.
  • samDesired
    [in] Ignored; set to 0 to ensure compatibility with future versions of Windows Embedded CE.
  • lpSecurityAttributes
    [in] Set to NULL.

    Windows Embedded CE 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 NKRegCloseKey function to close it.

  • lpdwDisposition
    [out] Pointer to a variable that receives disposition values.

    The following table shows possible values for this parameter.

    Value Description

    REG_CREATED_NEW_KEY

    The key did not exist and was created.

    REG_OPENED_EXISTING_KEY

    The key existed and was opened without being changed.

Return Value

ERROR_SUCCESS indicates success.

A nonzero error code defined in Winerror.h indicates failure.

Remarks

This function is only available for use by the OAL.

Requirements

Header pkfuncs.h
Library Nkstub.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

Other OAL Functions
NKRegOpenKeyEx
NKRegCloseKey
NKRegQueryValueEx
NKRegSetValueEx