Zhiyi Zhang (@zhiyi) commented about dlls/win32u/sysparams.c:
BOOL ret;
sprintf( buffer, "Modes\\%08X", index ); + reg_delete_tree( adapter_key, bufferW, asciiz_to_unicode( bufferW, buffer ) - sizeof(WCHAR) ); if (!(hkey = reg_create_key( adapter_key, bufferW, asciiz_to_unicode( bufferW, buffer ) - sizeof(WCHAR), REG_OPTION_VOLATILE, NULL ))) return FALSE;
-#define set_mode_field( name, field, flag ) \ - if (!(ret = set_reg_value( hkey, (name), REG_DWORD, &mode->field, sizeof(mode->field) ))) goto done; + +#define set_mode_field( name, field, flag ) \ + do \ + { \ + if (!(mode->dmFields & (flag))) ret = (index == ENUM_REGISTRY_SETTINGS); \
Why is ENUM_REGISTRY_SETTINGS getting special treatment? The display mode written into the registry should be a full display mode. Or, are you doing a check for the required flags? If that's case, I don't think it's the responsibility of the macro. What I had in mind for the macro is something like the following and it should be enough. ` if (mode->dmFields & flag) if (!(ret = set_reg_value( hkey, (name), REG_DWORD, &mode->field, sizeof(mode->field) ))) goto done; ` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/665#note_6447