Code to make a Delphi program act as another user. Demo provides to access a file owned by another user.
A blog article with more information is available at https://francois-piette.blogspot.com/.
If you need help with this code, please use StackOverflow to ask for your question, be sure to use the tag #delphi so that I receive a notification. I’ll try to answer your question. Before asking, please review How to Ask and show a minimal, complete, verifiable and reproducible example.