Detailed explanation of this issue on WinXP SP3:
https://github.com/3dyd/pyinstaller-builds/issues/2#issuecomment-3464525813
Excerpt form PyInst-6.0.0 documentation:
https://pyinstaller.org/en/v6.0.0/CHANGES.html#incompatible-changes
The psapi.dll in question (with the missing function) is the system one, while the one inside the "_internal" dir (which isn't being loaded when PyInst-6.16.0-xpmod has been used) is PSAPI.DLL, one of the four wrapper DLLs (kernelXP.dll, ntextl.dll, psapi.dll, ws2_xx.dll) that are used to backport py3.11.4 to XP ...