How to set the program parameter set by the administrator, which the user cannot change?

My application needs to read the option at startup to check if it should run in read-only mode. The user should not change this parameter.

I usually do this now, using the value set in the HKLM \ Software registry key. The administrator sets the value, and users cannot change it (they do not have rights to modify entries in HKLM).

The problem is that on a terminal server (or Citrix) this affects all users. I would like to figure out a way to do this for each user. How do others deal with this? Is there a section in the registry for this type of user preference that the user cannot change?

Thanks for any suggestions or comments!

+3
source share
6 answers

This is basically a key HKEY_CURRENT_USER\Software\Policies, i.e. a key in the user part of the registry, which by default is read-only to the user.

By convention, a key hierarchy should complement the one you already have under HKEY_CURRENT_USER\Software, for example. if your normal user settings are stored in HKEY_CURRENT_USER\Software\MyCompany\MyProgram, then the protected user settings (or "policies" in MS lingo) should be stored inHKEY_CURRENT_USER\Software\Policies\MyCompany\MyProgram

Please note that it is recommended that you only set values ​​under this key using Group Policy objects and never directly with registry access.

+6
source

, , - , "" () , .

:

, , . , !

+3

?

1) HKLM, , .

2) , , HKCU, .

, , .

+2

? ( 8)) "" . , .

+1

HKCU HKLM? . , , , .

0
  • Take one of the files included in your program that should not be changed (at least not by a limited user). If there is no such file, create it only for this purpose.
  • Let the administrator set read permissions only for this limited user.
  • In the program, check whether you have write access to this file.
0
source

Source: https://habr.com/ru/post/1710812/


All Articles