Onaylı Üye
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();
}
}
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();
}
}
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 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
}
}
Bunu yapanı bulur mu?Regedit kullanım istediğin alternatif yöntemi olarak Microsoft.Win32 kullanın. Aşağıdaki gözatabilirsin
Bağlantıları görmek için lütfen Giriş Yap
anahtar bilgisi al ve yazma (get/set key) bahsediyorsan, evetBunu yapanı bulur mu?
Örnek kod yazabilir misin? Neyse ben yazayım sonra hatamı söylersin.anahtar bilgisi al ve yazma (get/set key) bahsediyorsan, evet
örnek yukardaki link mevcut. Okursan daha faydalı olur.Örnek kod yazabilir misin? Neyse ben yazayım sonra hatamı söylersin.
örnek yukardaki link mevcut. Okursan daha faydalı olur.
konudaki detaylı yok. sadece regedit işlemleri istiyorsun. Onu bıraktımPeki benim yaptığımla ne farkı var?
Evet doğru anladın.Registry'i kolayca win32 kütüphanesi ile değiştirebilecekken, neden local bir veri tabanına SQL ile iletişime geçmeye çalışıyorsun?
Amacını basitçe belirtirsen basit bir yol sunabilirim, ama bu şekilde değiştirmeye yapmak mantıksızca.
Kodunu incelediğimde registry key'ini değiştiren programın ismini bulmaya çalışıyor gibisin? doğru muyum?
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?