Hi,
I'm not sure if you are on the right track by doing such patches....
I can confirm that the ScreenOrientation demo is working with gcc/make, IAR, Keil and Atollic TrueSTUDIO. This was tested and should work without the need for any modifications or patches.
STM32CubeIDE is not supported with version 9.30. However, with our next version 10.00 (available Nov20) we are switching from Atollic TrueSTUDIO to STM32CubeIDE. I hope you can work with TrueSTUDIO or command line gcc/make meanwhile...
Best regards,
Manfred.