Thanks for your advice. It's a lot of work, but I don't see another solution.
You're welcome. If I can think of something that is less work and also effective, I'll mention it but, for now, that's the only thing that comes to mind and, you're right, it will likely be a lot of work.
if you could post various pieces of code that suffer from the problem, anywhere from 1000 to 5000 lines, maybe looking at it would bring other ideas.
ETA: one thing that comes to mind is simply replacing all the occurrences of cardinal and dword with PtrUInt, that's fairly easy, should be safe (of course, to be safe and prudent, test it on a copy of the code) and can be automated. At least for those two types, it should take care of the problem you mentioned. The integer typecasts are definitely problematic because those are simply wrong in any bitness.
By replacing the occurrences of dword and cardinal with PtrUInt, that would make the list of typecasts to review smaller.
HTH.