[fpc-pascal] How to detect if my program is running with root/elevated privileges?

Marco van de Voort marcov at stack.nl
Sun Oct 27 20:05:13 CET 2013

In our previous episode, Bart said:
> I thought of trying to write to a "protected" location (/etc/something
> on linux, C:\ProgramData\something on Windows), but the problem is
> that Windows virtualizes these calls (it'll end up somewhere lse,
> where your program will never find it again), so writing will succeed
> even if user has no administrator rights.

For windows there is winutils.iswindowsadmin(), for unix likes there is
fpgeteuid (which should return zero for root).


More information about the fpc-pascal mailing list