Compartilhar via


NKRegCreateKeyExW (Compact 2013)

10/16/2014

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

Syntax

LONG NKRegCreateKeyExW(
  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

    The following values are not supported:

    • HKEY_CURRENT_CONFIG
    • HKEY_PERFORMANCE_DATA
    • HKEY_DYN_DATA predefined reserved handle values

    The key that NKRegCreateKeyEx opens or creates is a subkey of the key that the hKey parameter identifies.

  • lpSubKey
    [in] Pointer to a null-terminated string that specifies the name of a subkey that this function opens or creates.

    The subkey specified must be a subkey of the key that hKey identifies.

    This subkey must not begin with the backslash character (\).

    If the parameter is set to NULL, this function behaves like NKRegOpenKeyExW, where it opens the key that hKey specifies.

    In Windows Embedded Compact, the maximum length of a key name is 255 characters, not including the terminating NULL character. The maximum number of subkey levels that can be nested is 16.

  • Reserved
    [in] Reserved; set to 0 (zero).
  • 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 Compact, the maximum length of a class string is 255 characters, not including the terminating NULL character.

  • dwOptions
    [in] Ignored; set to 0 (zero).
  • samDesired
    [in] Ignored; set to 0 (zero).
  • lpSecurityAttributes
    [in] Set to NULL.

    The key is assigned 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

The following table shows the possible return values.

Value

Description

ERROR_SUCCESS

Success.

ERROR_NOT_READY

Registry is not ready.

The function might return other standard error codes defined in Winerror.h, as appropriate.

Remarks

This function is only available for use by the OAL. The pfnRegCreateKeyExW member of NKGLOBAL points to this function.

Requirements

Header

pkfuncs.h

Library

coredll.lib

See Also

Reference

Kernel Functions Available to the OAL
NKRegOpenKeyExW
NKRegCloseKey
NKRegQueryValueExW
NKRegSetValueExW