Compiling Lazarus/Windows in typed pointers mode
Currently Lazarus does not immediately provide for project-wide safe pointers: #40262 (closed)
Luckily, FPC provides for -Sy
command line switch. However, after specifying it in Project Options / Compiler Options/ Additions and Overrides it becomes impossible to compile alsmot any Windows GUI program.
Attached is the patch that fixes this type check errors.
By a cursory glance, the code logic there was correct and just explicitly declaring to cancel type safety was doing the trick (or dumping C notion "array si pointer" and taking array element pointer explicitly).