none
RegGetValue returned data type differs from the data type mentioned in admx file for the gpo setting

    Question

  • For the gpo setting: "Network directories to sync at Logon/Logoff time only", in the corresponding UserProfiles.admx file, datatype is mentioned as REG_EXPAND_SZ:

    <text id="CscSuspendDirectories_Message" valueName="CscSuspendDirs" maxLength="4096" expandable="true" />

    (expandable="true" means REG_EXPAND_SZ instead of REG_SZ as mentioned in here )

    but i get the data type as REG_SZ when reading that subkey value using RegGetValue method.

    Am using the statement: RegGetValue(hKey, NULL, achValue, RRF_RT_ANY, &dataType, NULL, &size);

    dataType and size are of type DWORD.

    hKey is pointing to registry key "Software\Policies\Microsoft\Windows\System"

    and achValue is referring to "CscSuspendDirs"

    am getting dataType as 1 (REG_SZ) when the function call returns which differs from what mentioned in admx file for the setting.

    How to get the correct data type?

    Thursday, April 28, 2016 11:18 AM

Answers

  • Hi,
    Based on my test in lab environment, if we enable policy Network directories to sync at Logon/Logoff time only, a registry key named as CscSuspendDirs with data type REG_EXPAND_SZ will be created in registry editor.
    In this case, you may need to check the scrip if it works well to get correct data type. I would suggest that you could post your question in the following forum:
    https://social.msdn.microsoft.com/Forums/vstudio/en-us/home?forum=vcgeneral
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Wendy

    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, April 29, 2016 5:25 AM
    Moderator

All replies

  • Hi,
    Based on my test in lab environment, if we enable policy Network directories to sync at Logon/Logoff time only, a registry key named as CscSuspendDirs with data type REG_EXPAND_SZ will be created in registry editor.
    In this case, you may need to check the scrip if it works well to get correct data type. I would suggest that you could post your question in the following forum:
    https://social.msdn.microsoft.com/Forums/vstudio/en-us/home?forum=vcgeneral
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Wendy

    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, April 29, 2016 5:25 AM
    Moderator
  • I should use RRF_RT_ANY | RRF_NOEXPAND
    answered by RLWA32 here
    Thursday, May 19, 2016 8:10 AM