Share via


DUA Fails to Set Value of a Registry Key

5/10/2007

Learn what to do when DUA creates a new registry key but fails to set the value.

Resolution

  • In your Device update script, in the REGSETVALUE, you should only include the Size parameter and comma delimiter if the Type value is one of the following: DAREG_NONE, DAREG_BINARY, DAREG_LINK,DAREG_RESOURCE_LIST, or DAREG_MULTI_SZ. If the Type parameter is not one of these values, omit the Size parameter and comma delimiter entirely.

    The command syntax for REGSETVALUE is:

    11, [ErrorMode], hKey, [ExpandMode], Key, [ExpandMode], ValueName, Type,
    [Size,] Value
    

    When the DUA script compiler reads the REGSETVALUE command and the Type parameter is one of the listed values, it expects the size parameter to immediately follow. If the Type is not one of the ones listed, the DUA script compiler expects the next parameter to be the Value of the registry key.

    For example, the following command will fail to set the registry key because the type does not require a size parameter and there is an additional comma delimiter. In this example, the value of the registry key is set to NULL.

    REGSETVALUE,,HKEY_LOCAL_MACHINE,,SYSTEM\CurrentControlSet\SampleKey,,SampleValue,DAREG_SZ,,Hello World
    

    The following command succeeds in setting the value because the extra comma delimiter after Type is removed:

    REGSETVALUE,,HKEY_LOCAL_MACHINE,,SYSTEM\CurrentControlSet\SampleKey,,SampleValue,DAREG_SZ,Hello World
    
  • In your Device update script, in the REGSETVALUE, you should only include the Size parameter and comma delimiter if the Type value is one of the following: DAREG_NONE, DAREG_BINARY, DAREG_LINK,DAREG_RESOURCE_LIST, or DAREG_MULTI_SZ. If the Type parameter is not one of these values, omit the Size parameter and comma delimiter entirely.

    The command syntax for REGSETVALUE is:

    11, [ErrorMode], hKey, [ExpandMode], Key, [ExpandMode], ValueName, Type,
    [Size,] Value
    

    When the DUA script compiler reads the REGSETVALUE command and the Type parameter is one of the listed values, it expects the size parameter to immediately follow. If the Type is not one of the ones listed, the DUA script compiler expects the next parameter to be the Value of the registry key.

    For example, the following command will fail to set the registry key because the type does not require a size parameter and there is an additional comma delimiter. In this example, the value of the registry key is set to NULL.

    REGSETVALUE,,HKEY_LOCAL_MACHINE,,SYSTEM\CurrentControlSet\SampleKey,,SampleValue,DAREG_SZ,,Hello World
    

    The following command succeeds in setting the value because the extra comma delimiter after Type is removed:

    REGSETVALUE,,HKEY_LOCAL_MACHINE,,SYSTEM\CurrentControlSet\SampleKey,,SampleValue,DAREG_SZ,Hello World
    

Example

The device update program (.dup) file includes a new registry key and setting, the registry key is created, but the value is not set.

See Also

Reference

REGSETVALUE

Other Resources

Troubleshooting Device Update Agent