[fpc-pascal] How to detect if my program is running with root/elevated privileges?
Bart
bartjunk64 at gmail.com
Sun Oct 27 19:23:00 CET 2013
Hi,
In my program I have some functions that must only be enabled if the
program is invoked as root (linux) / administrator (windows).
Is there some cross platform way to detect this?
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.
Bart
More information about the fpc-pascal
mailing list