Reputation: 477
once again I appeal to your help. More to the experts in the Inno Setup code.
I've tried several ways. But without success.
I need to block the installation of my application to users (entering in session of the operating system) with the username: EX?????
Ie. if the username is: Ennnnnn -> OK EXnnnnn -> No permission
(n is a number)
Can you help me. Thank you.
Upvotes: 1
Views: 134
Reputation: 41776
I've tried several ways. But without success.
Show us some code. What have you tried so far? Anyway..
How to block installation, in case a certain username is used?
In order to get the username:
The manual lists the available constants http://www.jrsoftware.org/ishelp/index.php?topic=consts You will find {username}
there, which is the name of the user who is running Setup or the Uninstall program.
You can also return the username by using the GetUserNameString()
function.
It returns the name of the user currently logged onto the system.
http://www.jrsoftware.org/ishelp/topic_isxfunc_getusernamestring.htm
For the comparison:
Pos()
might help you http://www.jrsoftware.org/ishelp/topic_isxfunc_pos.htm . Copy()
, to copy the first two chars and compare them
Prefix := Copy(GetUserNameString(), 0, 2);
Upvotes: 1