- Katılım
- 12 Mayıs 2016
- Mesajlar
- 1.559
- Çözümler
- 5
Yok yine aynı hatayı verdi. SELECT * FROM RegistryValueChangeEvent WHERE Hive = 'HKEY_LOCAL_MACHINE' AND KeyPath = bu kısma kadar her şey doğruymuş.
Unparsable query diyor.
İlerleme kat ettim. Invalid paramater diyor.
Böyle yapınca hata mesajı çıkmıyor.
Düzeldi. Son bir test yapayım çalışıyor mu diye.
Çalışmıyor taskmgr kitlendi.
While yok mu diye olmadı acaba?
Eğer genel çözümü benim mesajımla bulduysan çözüm işaretlemeyi unutma.
Unparsable query diyor.
İlerleme kat ettim. Invalid paramater diyor.
C#:
private void BackgroundWorker_DoWork(object? sender, DoWorkEventArgs e)
{
string scopePath = @"\\.\root\\Microsoft\\Windows\\Registry";
string queryText = "SELECT * FROM RegistryValueChangeEvent WHERE Hive = 'HKEY_LOCAL_MACHINE' AND KeyPath = '\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System'";
WqlEventQuery query = new WqlEventQuery(queryText);
using (ManagementEventWatcher watcher = new ManagementEventWatcher(new ManagementScope(scopePath), query))
{
watcher.EventArrived += RegistryValueChangedEventArrived;
watcher.Start();
}
}
C#:
private void BackgroundWorker_DoWork(object? sender, DoWorkEventArgs e)
{
string scopePath = @"\\.\root\\\\Microsoft\\\\Windows\\\\Registry";
string queryText = "SELECT * FROM RegistryValueChangeEvent WHERE Hive = 'HKEY_LOCAL_MACHINE' AND KeyPath = '\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System'";
WqlEventQuery query = new WqlEventQuery(queryText);
using (ManagementEventWatcher watcher = new ManagementEventWatcher(new ManagementScope(scopePath), query))
{
watcher.EventArrived += RegistryValueChangedEventArrived;
watcher.Start();
}
}
C#:
private void BackgroundWorker_DoWork(object? sender, DoWorkEventArgs e)
{
try
{
string scopePath = @"\\.\root\\\\Microsoft\\\\Windows\\\\Registry";
string queryText = "SELECT * FROM RegistryValueChangeEvent WHERE Hive = 'HKEY_LOCAL_MACHINE' AND KeyPath = '\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\System'\r\n";
WqlEventQuery query = new WqlEventQuery(queryText);
using (ManagementEventWatcher watcher = new ManagementEventWatcher(new ManagementScope(scopePath), query))
{
watcher.EventArrived += RegistryValueChangedEventArrived;
watcher.Start();
}
}
catch (ManagementException ex)
{
// Log or display the exception message for troubleshooting
Console.WriteLine("ManagementException: " + ex.Message);
}
}
Çalışmıyor taskmgr kitlendi.
C#:
private void BackgroundWorker_DoWork(object? sender, DoWorkEventArgs e)
{
try
{
string scopePath = @"\\.\root\\\\Microsoft\\\\Windows\\\\Registry";
string queryText = "SELECT * FROM RegistryValueChangeEvent WHERE Hive = 'HKEY_LOCAL_MACHINE' AND KeyPath = '\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\System'\r\n";
WqlEventQuery query = new WqlEventQuery(queryText);
using (ManagementEventWatcher watcher = new ManagementEventWatcher(new ManagementScope(scopePath), query))
{
watcher.EventArrived += RegistryValueChangedEventArrived;
watcher.Start();
}
}
catch (ManagementException ex)
{
// Log or display the exception message for troubleshooting
Console.WriteLine("ManagementException: " + ex.Message);
}
}
private void RegistryValueChangedEventArrived(object sender, EventArrivedEventArgs e)
{
// Get the name of the process that made the registry value change
var processNameProperty = e.NewEvent.Properties["ProcessName"];
string processName = processNameProperty?.Value?.ToString() ?? string.Empty;
// Check if the process executed the "reg add" command
if (string.Equals(processName, "reg", StringComparison.OrdinalIgnoreCase))
{
// Show a message indicating the process that made the registry value change
MessageBox.Show($"The process '{processName}' made changes to the registry value: DisableTaskMgr");
// Perform any desired actions here
}
}
While yok mu diye olmadı acaba?
Son düzenleme: