RegGetValue 返回的数据类型与 admx 文件中针对 gpo 设置提到的数据类型不同

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

对于 gpo 设置:“仅在 Logon/Logoff 时间同步的网络目录”,在相应的 UserProfiles.admx 文件,数据类型为 REG_EXPAND_SZ:

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

(expandable="true" 表示 REG_EXPAND_SZ 而不是 here 中提到的 REG_SZ )

但是在使用 RegGetValue 方法读取该子键值时,我得到的数据类型为 REG_SZ。

我正在使用语句:RegGetValue(hKey, NULL, achValue, RRF_RT_ANY, &dataType, NULL, &size);

dataType 和 size 都是 DWORD 类型。

hKey 指向注册表项 "Software\Policies\Microsoft\Windows\System"

并且 achValue 指的是 "CscSuspendDirs"

当函数调用 returns 时,我得到的数据类型为 1 (REG_SZ),这与 admx 文件中提到的设置不同。

如何获取正确的数据类型?

我应该使用 RRF_RT_ANY | RRF_NOEXPANDin RegGetValue 方法来防止自动将字符串扩展为 REG_SZ。