package com.wl.util; import java.io.PrintWriter; import java.io.StringWriter; import com.sun.jna.platform.win32.Advapi32Util; import com.sun.jna.platform.win32.Win32Exception; import com.sun.jna.platform.win32.WinReg; public class ResumeDisItemUtil { //禁用任务管理器 public static void redisabledTaskManager() { try { boolean registryKeyExists = Advapi32Util.registryKeyExists(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); if (!registryKeyExists) { Advapi32Util.registryCreateKey(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); } int value = 0;//value 0 不禁用 1 禁用 try { value = Advapi32Util.registryGetIntValue(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "DisableTaskMgr"); } catch (Win32Exception e) { value = 0; } if (value == 1) { Advapi32Util.registrySetIntValue(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "DisableTaskMgr", 0); } } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); } } //屏蔽系统注销功能 public static void recloseLogout(){ try { String registryKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"; boolean registryKeyExists = Advapi32Util.registryKeyExists(WinReg.HKEY_CURRENT_USER, registryKey); if (!registryKeyExists) { Advapi32Util.registryCreateKey(WinReg.HKEY_CURRENT_USER, registryKey); } int value = 0; try { value = Advapi32Util.registryGetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "NoLogoff"); } catch (Win32Exception e) { value = 0; } if (value == 1) { Advapi32Util.registrySetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "NoLogoff", 0); } } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); System.out.println(sw.toString());// 输出日志 } } //屏蔽修改密码功能 public static void rechangeUser(){ try { String registryKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; boolean registryKeyExists = Advapi32Util.registryKeyExists(WinReg.HKEY_CURRENT_USER, registryKey); if (!registryKeyExists) { Advapi32Util.registryCreateKey(WinReg.HKEY_CURRENT_USER, registryKey); } int value = 0; try { value = Advapi32Util.registryGetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "DisableChangePassword"); } catch (Win32Exception e) { value = 0; } if (value == 1) { Advapi32Util.registrySetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "DisableChangePassword", 0); } } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); System.out.println(sw.toString());// 输出日志 } } //屏蔽切换用户功能 public static void reswitchUser(){ try { String registryKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; boolean registryKeyExists = Advapi32Util.registryKeyExists(WinReg.HKEY_CURRENT_USER, registryKey); if (!registryKeyExists) { Advapi32Util.registryCreateKey(WinReg.HKEY_CURRENT_USER, registryKey); } int value = 0; try { value = Advapi32Util.registryGetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "DisableSwitchUserOption"); } catch (Win32Exception e) { value = 0; } if (value == 1) { Advapi32Util.registrySetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "DisableSwitchUserOption", 0); } } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); System.out.println(sw.toString());// 输出日志 } } //屏蔽锁定计算机功能 public static void relockWorkstation(){ try { String registryKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; boolean registryKeyExists = Advapi32Util.registryKeyExists(WinReg.HKEY_CURRENT_USER, registryKey); if (!registryKeyExists) { Advapi32Util.registryCreateKey(WinReg.HKEY_CURRENT_USER, registryKey); } int value = 0; try { value = Advapi32Util.registryGetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "DisableLockWorkstation"); } catch (Win32Exception e) { value = 0; } if (value == 1) { Advapi32Util.registrySetIntValue(WinReg.HKEY_CURRENT_USER, registryKey, "DisableLockWorkstation", 0); } } catch (Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); System.out.println(sw.toString());// 输出日志 } } }
最近下载更多
rongsoft LV8
2022年8月29日
1690356080 LV37
2022年2月28日
dongzhan LV12
2021年11月27日
最代码官方 LV168
2021年10月31日