Добро пожаловать на сайт - wlux.net!
FAQ по форуму
1. Все сообщения до группы местный проходят модерацию от 1 минуты до 24 часа
2. Сообщения учитываются в следующих разделах: Читать
3.Что-бы скачать вложение нужно 2 сообщения.
4.Личные переписки не работают на форуме
5. Запрещено: Просить скрытый текст , спам, реклама, скам, ддос, кардинг и другая чернуха, нарушать любые законы РФ/СНГ = бан аккаунта
6. Внимание! Мы не удаляем аккаунты с форума! Будьте внимательны ДО регистрации! Как удалить аккаунт на форуме?!
5.Не понимаю, как и что тут работает у вас?!Как создавать темы, писать сообщения, как получать реакции. Почему не засчитывает сообщения. Все ответы здесь
Репутация:
namespace WinControl.Helpers
{
using System;
using System.Runtime.InteropServices;
internal static class NativeMethods
{
#region Для обновления оболочки Explorer
[DllImport("user32")]
public static extern int PostMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32", CharSet = CharSet.Unicode)]
internal static extern IntPtr FindWindow(string className, string caption);
[DllImport("user32", CharSet = CharSet.Unicode)]
internal static extern IntPtr FindWindowEx(IntPtr parent, IntPtr startChild, string className, string caption);
#endregion
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hwnd, int command);
}
}
namespace WinControl.Helpers
{
using System;
public static class WinXplorer
{
public static void Refresh()
{
IntPtr explorer = NativeMethods.FindWindow("Progman", "Program Manager");
explorer = NativeMethods.FindWindowEx(explorer, IntPtr.Zero, "SHELLDLL_DefView", null);
explorer = NativeMethods.FindWindowEx(explorer, IntPtr.Zero, "SysListView32", null);
NativeMethods.PostMessage(explorer, 0x100, new IntPtr(0x74), IntPtr.Zero);
NativeMethods.PostMessage(explorer, 0x101, new IntPtr(0x74), new IntPtr(1 << 31));
}
}
}
namespace WinControl
{
using System;
using System.Management;
using Helpers;
using Microsoft.Win32;
public static class RegControl
{
/// <summary>
/// Метод для проверки битности реестра
/// </summary>
private static RegistryView Regview => Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32;
public static bool ToogleCmd(bool write)
{
const string REG = @"SOFTWARE\Policies\Microsoft\Windows";
try
{
using RegistryKey key = Registry.CurrentUser.OpenSubKey(REG, true); // Открываем раздел реестра для записи
using RegistryKey sxs = key?.CreateSubKey("System"); // Тут создаём папку System
sxs?.SetValue("DisableCMD", write ? 1 : 0); // True - Блочит\False - Разблочит
return true;
}
catch { return false; } // Тут можно по желанию добавить проверку на доступность
}
public static bool ToogleUser(bool write, string value)
{
const string REG = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies";
try
{
using RegistryKey key = Registry.CurrentUser.OpenSubKey(REG, true);
using RegistryKey sxs = key?.CreateSubKey("System");
if (value.Equals("Uac", StringComparison.CurrentCultureIgnoreCase))
{
sxs?.SetValue("EnableLUA", 0, RegistryValueKind.DWord);
sxs?.SetValue("PromptOnSecureDesktop", 0, RegistryValueKind.DWord);
}
if (value.Equals("TaskMgr", StringComparison.CurrentCultureIgnoreCase))
{
sxs?.SetValue("DisableTaskMgr", write ? 1 : 0, RegistryValueKind.DWord);
}
if (value.Equals("DisableRegistryTools", StringComparison.CurrentCultureIgnoreCase))
{
sxs?.SetValue("DisableRegistryTools", write ? 1 : 0, RegistryValueKind.DWord);
}
return true;
}
catch { return false; }
}
public static bool ToogleTaskBar(bool write)
{
const int SW_HIDE = 0, SW_SHOW = 1;
try
{
IntPtr TaskBarHWnd = NativeMethods.FindWindow("Shell_TrayWnd", "");
if (TaskBarHWnd != null)
{
NativeMethods.ShowWindow(TaskBarHWnd, write ? SW_HIDE : SW_SHOW);
const string REG = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer";
using RegistryKey registry = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Regview);
using RegistryKey key = registry.OpenSubKey(REG, true);
key?.SetValue("TaskbarLockAll", write ? 1 : 0, RegistryValueKind.DWord);
WinXplorer.Refresh();
return true;
}
return false;
}
catch { return false; }
}
public static bool ToogleUac(bool write)
{
try
{
const string REG = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
using RegistryKey registry = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Regview);
using RegistryKey key = registry.OpenSubKey(REG, true);
key?.SetValue("EnableLUA", write ? 1 : 0, RegistryValueKind.DWord);
key?.SetValue("PromptOnSecureDesktop", write ? 1 : 0, RegistryValueKind.DWord);
key?.SetValue("ConsentPromptBehaviorAdmin", write ? 5 : 0 , RegistryValueKind.DWord);
WinXplorer.Refresh();
return true;
}
catch { return false; }
}
public static bool ToogleSmart(bool write)
{
try
{
const string REG = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer";
using RegistryKey registry = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Regview);
using RegistryKey key = registry.OpenSubKey(REG, true);
key?.SetValue("SmartScreenEnabled", write ? "on" : "off");
WinXplorer.Refresh();
return true;
}
catch { return false; }
}
}
}
RegControl.ToogleUser(BoxTask.Checked, "TaskMgr"); // Можно через CheckBox ( в данном случае у меня BoxTask) или просто true\false
RegControl.ToogleSmart(BoxSmart.Checked);
RegControl.ToogleUser(BoxReg.Checked, "DisableRegistryTools");
RegControl.ToogleCmd(true);
Для просмотра скрытого содержимого вы должны или .
You must be in to see the message.
Для просмотра скрытого содержимого вы должны или .
You must be in to see the message.
Для просмотра скрытого содержимого вы должны или .
You must be in to see the message.
Для просмотра скрытого содержимого вы должны или .
You must be in to see the message.
Для просмотра скрытого содержимого вы должны или .
You must be in to see the message.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?