Compartilhar via


CeRegTestSetValueW (Compact 2013)

3/26/2014

This function sets information about a registry change notification.

Syntax

LONG CeRegTestSetValueW(
    __in HKEY hKey, 
    __in LPCWSTR lpValueName, 
     DWORD dwType, 
    __in_bcount(cbOldData) __opt CONST BYTE* lpOldData, 
     DWORD cbOldData,
    __in_bcount(cbNewData) __opt CONST BYTE* lpNewData, 
     DWORD cbNewData,
     DWORD dwFlags
    ); 

Parameters

  • hKey
    [in] Handle to a currently open key or to any of the following re-defined values:

    • HKEY_CLASSES_ROOT
    • HKEY_CURRENT_USER
    • HKEY_LOCAL_MACHINE
    • HKEY_USERS
  • lpValueName
    [in] Pointer to a string containing the name of the value to set.

    If a value with this name is not already present in the key, the function adds it to the key. If this parameter is set to NULL or an empty string, the function sets the type and data for the key's unnamed value. Registry keys do not have default values, but they can have one unnamed value, which can be of any type. The maximum length of a value name is 255, not including the terminating NULL character.

  • dwType
    [in] Type code for the value entry. The following table shows possible values.

    Value

    Description

    REG_BINARY

    Specifies binary data in any form.

    REG_DWORD

    Specifies a 32-bit number.

    REG_DWORD_BIG_ENDIAN

    Specifies a 32-bit number in big-endian format. In big-endian format, a multibyte value is stored in memory from the highest byte to the lowest byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format.

    REG_DWORD_LITTLE_ENDIAN

    Specifies a 32-bit number in little-endian format. This is equivalent to REG_DWORD. In little-endian format, a multibyte value is stored in memory from the lowest byte to the highest byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format.

    REG_EXPAND_SZ

    Specifies a null-terminated string that contains unexpanded references to environment variables, for example, %PATH%. It is a Unicode or ANSI string, depending on whether you use the Unicode or ANSI functions.

    REG_LINK

    Specifies a Unicode symbolic link. Reserved.

    REG_MULTI_SZ

    Specifies an array of null-terminated strings, terminated by two null characters.

    REG_NONE

    No defined value type.

    REG_RESOURCE_LIST

    Specifies a device-driver resource list.

    REG_SZ

    Specifies a null-terminated Unicode string.

  • lpOldData
    [in] An input buffer that contains the contents to be compared with the existing value.
  • cbOldData
    Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by lpOldData. When the function returns, the variable pointed to by the this parameter contains the number of bytes stored in the buffer. This parameter can be set to NULL only if lpOldData is set to NULL.
  • lpNewData
    [in] Input buffer that contains the new contents to be store with the value if the comparison succeeds.
  • cbNewData
    [in, out] Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by lpNewData. When the function returns, the variable pointed to by this parameter contains the number of bytes stored in the buffer. This parameter can be set to NULL only if lpNewData is NULL.
  • dwFlags
    [in] The following table shows possible values.

    Value

    Description

    REG_FLAGS_TESTSET_NEW

    If the value does not exist, creates it, and sets it to the new value.

    REG_FLAGS_TESTSET_NOMATCH

    Sets the new value only if the old value does not match lpOldData.

    Zero

    Default value. Sets value to lpNewData only if the value exists and lpOldData matches

Return Values

The following table shows possible values.

Value

Description

ERROR_SUCCESS

The value was successfully changed.

ERROR_FILE_NOT_FOUND

The value does not exist, and REG_FLAGS_TESTSET_NEW was not specified.

ERROR_NO_MATCH

The value does not exist, and REG_FLAGS_TESTSET_NOMATCH was not specified.

Remarks

To be considered a match, the value contents, size, and type must all match.

Requirements

Header

winreg.h

Library

coredll.lib

See Also

Reference

Registry Notification Functions
RegSetValueEx
RegQueryValueEx