Enable / disable task manager using win32 API function, not Windows registry

Currently, in a Windows application developed in C #, I will disable Task managerand user switching optionby setting a value below the registry:

Disable task manager:

HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableTaskMgr Value 1

Disable (hide) user switching:

HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\HideFastUserSwitching value 1

But when testing this Windows application on a computer running Windows 7, where a user who is not a member of the group entered Administrators, encountered a permission problem, here is the exception text:

12/16/2015 12:11:24 PM: access to the registry key 'HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System' denied .: Win32Error (0,0)

DisableTaskMgr regedit, Access is Denied.

requestedExecutionLevel, : <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />. exe Run as Administrator.

Administrators, .

, / API Win32 user32.dll? vc++?

-:

, , (-, ..), , . "", ctrl + alt + del (), switch user ctrl + alt + del.

+4

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


All Articles