diff --git a/Directory.Build.props b/Directory.Build.props index 3e067f6..4444962 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,8 +1,8 @@  - 2.4.0 - 2.4.0.0 - 2.4.0.0 + 2.5.0 + 2.5.0.0 + 2.5.0.0 LD Uninstaller LD Software LD Software diff --git a/app.ico b/app.ico new file mode 100644 index 0000000..95c632a Binary files /dev/null and b/app.ico differ diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..3dc3b27 Binary files /dev/null and b/logo.png differ diff --git a/release.ps1 b/release.ps1 index a061814..e8d0810 100644 --- a/release.ps1 +++ b/release.ps1 @@ -34,7 +34,7 @@ switch ($Type.ToLowerInvariant()) { $patch += 1 } "current" { - # Keep existing version for initial packaging + # Keep existing version } } @@ -62,13 +62,13 @@ $propsContent = @" Set-Content -Path $propsFile -Value $propsContent -Encoding UTF8 Write-Host "==========================================" -ForegroundColor Cyan -Write-Host " LD UNINSTALLER SÜRÜM YAYINLAMA: v$newVersion" -ForegroundColor Yellow +Write-Host " LD UNINSTALLER SURUM YAYINLAMA: v$newVersion" -ForegroundColor Yellow Write-Host "==========================================" -ForegroundColor Cyan -# 1. Ana klasörde eski sürümleri temizle (Sadece tek ve son sürüm kalacak ÅŸekilde) +# 1. Ana klasorde eski surumleri temizle $oldFolders = Get-ChildItem -Path $root -Directory -Filter "LD Uninstaller v*" foreach ($old in $oldFolders) { - Write-Host "Eski sürüm klasörü temizleniyor: $($old.Name)..." -ForegroundColor Gray + Write-Host "Eski surum klasoru temizleniyor: $($old.Name)..." -ForegroundColor Gray try { Remove-Item -Path $old.FullName -Recurse -Force -ErrorAction SilentlyContinue } catch { } @@ -77,11 +77,11 @@ foreach ($old in $oldFolders) { $targetFolderName = "LD Uninstaller v$newVersion" $targetDir = Join-Path $root $targetFolderName -Write-Host "Yeni sürüm klasörü oluÅŸturuluyor: $targetFolderName..." -ForegroundColor Green +Write-Host "Yeni surum klasoru olusturuluyor: $targetFolderName..." -ForegroundColor Green New-Item -ItemType Directory -Path $targetDir -Force | Out-Null -# 2. Projeleri Release modunda derle ve tek klasöre aktar -Write-Host "Projeler derleniyor ve yayınlanıyor..." -ForegroundColor Cyan +# 2. Projeleri Release modunda derle ve yayinla +Write-Host "Projeler derleniyor ve yayinlaniyor..." -ForegroundColor Cyan $projects = @( "src/LDUninstaller.UI/LDUninstaller.UI.csproj", @@ -92,18 +92,18 @@ $projects = @( foreach ($proj in $projects) { $projPath = Join-Path $root $proj - Write-Host " -> Yayınlanıyor: $proj" -ForegroundColor Gray + Write-Host " -> Yayinlaniyor: $proj" -ForegroundColor Gray dotnet publish $projPath -c Release -o $targetDir --nologo -v q } -# 3. Gereksiz pdb ve log dosyalarını temizle +# 3. Gereksiz pdb ve log dosyalarini temizle Get-ChildItem -Path $targetDir -Filter "*.pdb" | Remove-Item -Force -ErrorAction SilentlyContinue -# 4. Eski publish ve dist klasörlerini de temizle +# 4. Eski publish ve dist klasorlerini de temizle try { Remove-Item -Path (Join-Path $root "publish") -Recurse -Force -ErrorAction SilentlyContinue } catch { } try { Remove-Item -Path (Join-Path $root "dist") -Recurse -Force -ErrorAction SilentlyContinue } catch { } -# 5. Sürüm ZIP ArÅŸivini OluÅŸtur (GitHub Releases için) +# 5. Surum ZIP Arsivini Olustur $oldZips = Get-ChildItem -Path $root -File -Filter "LD-Uninstaller-v*.zip" foreach ($oz in $oldZips) { try { Remove-Item -Path $oz.FullName -Force -ErrorAction SilentlyContinue } catch { } @@ -111,15 +111,15 @@ foreach ($oz in $oldZips) { $zipName = "LD-Uninstaller-v$newVersion.zip" $zipPath = Join-Path $root $zipName -Write-Host "Sürüm arÅŸivi oluÅŸturuluyor: $zipName..." -ForegroundColor Cyan +Write-Host "Surum arsivi olusturuluyor: $zipName..." -ForegroundColor Cyan Compress-Archive -Path "$targetDir\*" -DestinationPath $zipPath -Force -# 6. Git DeÄŸiÅŸiklikleri, Etiket (Tag) ve GitHub Senkronizasyonu +# 6. Git Islemleri ve GitHub Push if (Test-Path (Join-Path $root ".git")) { - Write-Host "`nGit deÄŸiÅŸiklikleri iÅŸleniyor ve GitHub'a aktarılıyor..." -ForegroundColor Cyan + Write-Host "`nGit degisiklikleri isleniyor ve GitHub'a aktariliyor..." -ForegroundColor Cyan try { if ([string]::IsNullOrWhiteSpace($Message)) { - $Message = "Release v${newVersion}: 20 Katmanli Derin Kalinti Temizleme Motoru ve Arayuz SadeleÅŸtirmesi" + $Message = "Release v${newVersion}: Yeni Logo ve Baslangic Yoneticisi Guncellemesi" } git add . git commit -m $Message @@ -127,24 +127,24 @@ if (Test-Path (Join-Path $root ".git")) { $remote = git remote get-url origin 2>$null if ($remote) { - Write-Host "GitHub'a gönderiliyor (origin master --tags)..." -ForegroundColor Yellow + Write-Host "GitHub'a gonderiliyor (origin master --tags)..." -ForegroundColor Yellow git push origin master --tags -u -f } } catch { - Write-Host "Git iÅŸlemi uyarısı: $_" -ForegroundColor Yellow + Write-Host "Git islemi uyarisi: $_" -ForegroundColor Yellow } } -# 7. GitHub Releases API Üzerinde Sürüm ve DeÄŸiÅŸiklik Notlarını Yayınla +# 7. GitHub Releases API Uzerinde Surum ve Notlari Yayinla try { - Write-Host "`nGitHub Releases API üzerinden sürüm ve notlar yayınlanıyor..." -ForegroundColor Cyan + Write-Host "`nGitHub Releases API uzerinden surum ve notlar yayinlaniyor..." -ForegroundColor Cyan $code = @" using System; using System.Runtime.InteropServices; using System.Text; -public class GitCredsPublisher +public class GitCredsEngine { [DllImport("Advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] public static extern bool CredRead(string target, int type, int reservedFlag, out IntPtr credentialPtr); @@ -180,16 +180,16 @@ public class GitCredsPublisher } } "@ - if (-not ([System.Management.Automation.PSTypeName]'GitCredsPublisher').Type) { + if (-not ([System.Management.Automation.PSTypeName]'GitCredsEngine').Type) { Add-Type -TypeDefinition $code -Language CSharp } - $token = [GitCredsPublisher]::GetToken() + $token = [GitCredsEngine]::GetToken() if ($env:GITHUB_TOKEN) { $token = $env:GITHUB_TOKEN } if ($env:GH_TOKEN) { $token = $env:GH_TOKEN } if (-not $token) { - Write-Host "Uyarı: GitHub kimlik belirteci (token) bulunamadı. Release API atlanıyor." -ForegroundColor Yellow + Write-Host "Uyari: GitHub kimlik belirteci bulunamadi. Release API atlaniyor." -ForegroundColor Yellow } else { $apiHeaders = @{ "Authorization" = "Bearer $token" @@ -200,17 +200,17 @@ public class GitCredsPublisher $repoOwner = "LilDosto" $repoName = "LD-Unistaller" - # Changelog / Sürüm Notları (Şablon dosyasından temiz UTF-8 olarak yüklenir) + # Changelog / Surum Notlari (Sablon dosyasindan UTF-8 olarak okunur) $templatePath = Join-Path $root "release_notes_template.md" $releaseNotes = "" if (Test-Path $templatePath) { $releaseNotes = [System.IO.File]::ReadAllText($templatePath, [System.Text.Encoding]::UTF8) $releaseNotes = $releaseNotes.Replace("{VERSION}", $newVersion) } else { - $releaseNotes = "LD Uninstaller v$newVersion güncellemesi." + $releaseNotes = "LD Uninstaller v$newVersion guncellemesi." } - $releaseTitle = "🧹 LDUninstaller-v$newVersion — Derin Kalıntı Temizleme ve Çoklu Disk Güncellemesi" + $releaseTitle = if (![string]::IsNullOrWhiteSpace($Message)) { $Message } else { "LDUninstaller-v$newVersion - Guncelleme" } $releasePayload = @{ tag_name = "v$newVersion" @@ -222,7 +222,6 @@ public class GitCredsPublisher $jsonBytes = [System.Text.Encoding]::UTF8.GetBytes($releasePayload) - # Release var mı kontrol et $releaseUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases/tags/v$newVersion" $ghRelease = $null try { @@ -230,20 +229,19 @@ public class GitCredsPublisher } catch { } if ($ghRelease) { - Write-Host "Mevcut release güncelleniyor (ID: $($ghRelease.id))..." -ForegroundColor Yellow + Write-Host "Mevcut release guncelleniyor (ID: $($ghRelease.id))..." -ForegroundColor Yellow $patchUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases/$($ghRelease.id)" $ghRelease = Invoke-RestMethod -Uri $patchUrl -Headers $apiHeaders -Method Patch -Body $jsonBytes -ContentType "application/json; charset=utf-8" } else { - Write-Host "Yeni release oluÅŸturuluyor..." -ForegroundColor Green + Write-Host "Yeni release olusturuluyor..." -ForegroundColor Green $postUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases" $ghRelease = Invoke-RestMethod -Uri $postUrl -Headers $apiHeaders -Method Post -Body $jsonBytes -ContentType "application/json; charset=utf-8" } - # ZIP dosyasını release asset olarak yükle + # ZIP dosyasini release asset olarak yukle if ($ghRelease -and (Test-Path $zipPath)) { - Write-Host "Sürüm paketi ($zipName) release sayfasına yükleniyor..." -ForegroundColor Cyan + Write-Host "Surum paketi ($zipName) release sayfasina yukleniyor..." -ForegroundColor Cyan - # Eski asset varsa sil if ($ghRelease.assets) { foreach ($asset in $ghRelease.assets) { if ($asset.name -eq $zipName) { @@ -262,23 +260,23 @@ public class GitCredsPublisher } $zipBytes = [System.IO.File]::ReadAllBytes($zipPath) $uploadResult = Invoke-RestMethod -Uri $uploadUri -Headers $uploadHeaders -Method Post -Body $zipBytes -ContentType "application/zip" - Write-Host "Asset baÅŸarıyla yüklendi: $($uploadResult.browser_download_url)" -ForegroundColor Green + Write-Host "Asset basariyla yuklendi: $($uploadResult.browser_download_url)" -ForegroundColor Green } - Write-Host "`nGitHub Release yayında:" -ForegroundColor Yellow + Write-Host "`nGitHub Release yayinda:" -ForegroundColor Yellow Write-Host " -> https://github.com/$repoOwner/$repoName/releases/tag/v$newVersion" -ForegroundColor White } } catch { - Write-Host "GitHub Releases API iÅŸlemi uyarısı: $_" -ForegroundColor Yellow + Write-Host "GitHub Releases API islemi uyarisi: $_" -ForegroundColor Yellow } -Write-Host "`n✅ BaÅŸarıyla Tamamlandı!" -ForegroundColor Green -Write-Host "Ana dizinde oluÅŸturulan son güncel sürüm klasörü:" -ForegroundColor Yellow +Write-Host "`n[+] Basariyla Tamamlandi!" -ForegroundColor Green +Write-Host "Ana dizinde olusturulan son guncel surum klasoru:" -ForegroundColor Yellow Write-Host " -> $targetFolderName" -ForegroundColor White -Write-Host "GitHub Release için hazır paket:" -ForegroundColor White +Write-Host "GitHub Release hazir paketi:" -ForegroundColor White Write-Host " -> $zipName" -ForegroundColor Cyan -Write-Host "Kullanıma hazır yürütülebilir dosyalar:" -ForegroundColor Gray -Write-Host " - LDUninstaller.Launcher.exe (Yönetici yetkili baÅŸlatıcı)" -Write-Host " - LDUninstaller.UI.exe (Modern Fluent Arayüz)" -Write-Host " - LDUninstaller.CLI.exe (Konsol aracı)" -Write-Host " - LDUninstaller.Automatizer.exe (Otomasyon ajanı)`n" +Write-Host "Kullanima hazir yurutulebilir dosyalar:" -ForegroundColor Gray +Write-Host " - LDUninstaller.Launcher.exe (Yonetici yetkili baslatici)" +Write-Host " - LDUninstaller.UI.exe (Modern Fluent Arayuz)" +Write-Host " - LDUninstaller.CLI.exe (Konsol araci)" +Write-Host " - LDUninstaller.Automatizer.exe (Otomasyon ajani)`n" diff --git a/release_notes_template.md b/release_notes_template.md index 9437c42..372c9bc 100644 --- a/release_notes_template.md +++ b/release_notes_template.md @@ -1,28 +1,26 @@ -Bu sürümde, kaldırılan uygulamaların arkasında bıraktığı tüm dosya, kayıt defteri, servis ve görev kalıntılarını eksiksiz temizleyen 20 katmanlı derin tarama motoru ve çoklu sürücü analiz sistemi arayüze entegre edilmiştir. +Bu sürümde, LD Uninstaller için özel tasarlanan modern logo/ikon paketi entegre edilmiş ve Başlangıç Yöneticisi'ndeki yetki ve açılış engelleme sorunları tamamen giderilmiştir. --- ### ✨ Neler Eklendi ve İyileştirildi? -**1. 🧹 20 Katmanlı Derin Kalıntı ve Artık Temizleme Motoru** -- Kaldırma işlemi (tekli veya çoklu) tamamlandığı anda otomatik devreye giren kalıntı temizleme arayüzü eklendi: - - **Servis & Görev Temizliği:** Arka planda unutulan Windows Servisleri (`sc delete`) ve Görev Zamanlayıcı (`Tasks`) updater görevleri otomatik taranıp temizlenir. - - **Kayıt Defteri & COM:** Shell sağ tık menüleri (`ContextMenuHandlers`), `App Paths`, `Run/RunOnce` ve yetim `CLSID` nesneleri temizlenir. - - **Kullanıcı Verileri:** `%AppData%`, `%LocalAppData%`, `%USERPROFILE%` altındaki gizli `.appname` / `.config` klasörleri ve boş kalan yayıncı dizinleri silinir. - - **Güvenli Yedek:** Silme işleminden önce kayıt defteri anahtarları otomatik olarak `.reg` yedeğine aktarılır. +**1. 🎨 Yepyeni Modern Logo ve Uygulama Simgesi (App Icon)** +- Uygulama için modern Windows 11 Fluent tasarımına uyumlu fütüristik 'LD' amblemi ve temizleme girdabı motifli yeni logo tasarlandı. +- **Tüm Alanlara Entegre Edildi:** + - Arayüzün sol üst köşesindeki geçici mavi kutu kaldırılarak yüksek çözünürlüklü yeni logo yerleştirildi. + - Görev Yöneticisi (Task Manager), pencere başlıkları ve Windows Gezgini (klasör) üzerinde görünmesi için çoklu çözünürlüklü (`16x16`'dan `256x256`'ya) `.ico` dosyası yürütülebilir dosyalara gömüldü. -**2. 💾 Çoklu Disk Analizi ve Üst Sekmeler** -- Sistemdeki tüm takılı sürücüler (`C:`, `D:`, harici diskler vb.) otomatik analiz edilerek üst kısıma modern sekme butonları olarak eklendi: - - **Dinamik Disk Haritası:** Sürücü sekmeleri arasında geçiş yapıldığında hem uygulama tablosu hem de görsel Treemap haritası anında seçilen diske göre filtrelenir. - - **Oyun ve Kütüphane Tespiti:** İkincil disklerdeki `Games`, `Oyunlar` ve `SteamLibrary` dizinleri eksiksiz taranır. +**2. ⚡ Başlangıç Yöneticisi ve Yetki Hatası Düzeltmesi** +- Uygulama zaten Yönetici olarak açılmasına rağmen bazı uygulamaları kapatırken ortaya çıkan *"Yönetici yetkisi gerekebilir"* uyarısı ve kapatamama sorunu kökten çözüldü: + - **Başlangıç Klasörü Desteği:** `StartupFolder` altındaki kısayollar için hem `StartupApproved` ikili anahtarı hem de dosya devre dışı bırakma desteği eklendi. + - **HKLM & 32-bit (Run32) Uyumu:** 64-bit Windows sistemlerinde `WOW6432Node` ve `HKLM` anahtarlarına ait programların açılış durumları doğru kayıt defteri dallarına yazılarak sorunsuz hale getirildi. + - **Servis Yönetimi:** Windows Servisleri'nin başlangıç durumları (`Automatic`/`Disabled`) doğrudan `sc.exe config` ve sistem kayıt defteri üzerinden anında değiştirilebilir kılındı. -**3. ⚡ Ultra Akıcı Arayüz ve Sıfır Takılma** -- Arama çubuğuna yazarken UI kilitlenmesini önleyen 160ms gecikmeli filtreleme (debounced search) getirildi. -- Donanım hızlandırmalı sanallaştırılmış liste kaydırması (`Pixel` scroll unit) ile yüksek kare hızında akıcılık sağlandı. +**3. 🧹 20 Katmanlı Derin Kalıntı Temizleme Motoru** +- Kaldırma işlemi bittiğinde arkada kalan tüm öksüz servisler, zamanlanmış görevler, kayıt defteri dalları ve gizli kullanıcı yapılandırma dosyaları eksiksiz taranır ve silinir. -**4. 🗑️ Sadeleştirilmiş Tek Tuşla Kaldırma** -- Arayüzdeki kafa karıştırıcı çoklu kaldırma butonları kaldırılarak tek ve akıllı bir **`🗑️ Kaldır`** butonu eklendi. -- Tek uygulama seçildiğinde doğrudan kaldırma, birden fazla seçildiğinde çakışma önleyici akıllı kuyruk devreye girer. +**4. 💾 Çoklu Sürücü Yönetimi ve Disk Haritası** +- Bilgisayara takılı birden fazla disk (`C:`, `D:` vb.) varsa üst sekme çubuğu üzerinden kolayca geçiş yapılır ve görsel Treemap haritası seçilen diske göre dinamik güncellenir. --- diff --git a/src/LDUninstaller.Core/Models/StartupAndTweaks.cs b/src/LDUninstaller.Core/Models/StartupAndTweaks.cs index 8e0bebc..1b88057 100644 --- a/src/LDUninstaller.Core/Models/StartupAndTweaks.cs +++ b/src/LDUninstaller.Core/Models/StartupAndTweaks.cs @@ -18,6 +18,7 @@ namespace LDUninstaller.Core.Models public string Publisher { get; set; } = string.Empty; public StartupType Type { get; set; } public string Location { get; set; } = string.Empty; + public string ServiceName { get; set; } = string.Empty; public bool IsEnabled { get; set; } = true; public byte[]? StartupApprovedBinary { get; set; } diff --git a/src/LDUninstaller.Core/Startup/StartupManager.cs b/src/LDUninstaller.Core/Startup/StartupManager.cs index c7a180c..82b0d87 100644 --- a/src/LDUninstaller.Core/Startup/StartupManager.cs +++ b/src/LDUninstaller.Core/Startup/StartupManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.ServiceProcess; using LDUninstaller.Core.Models; @@ -14,34 +15,40 @@ namespace LDUninstaller.Core.Startup var list = new List(); // 1. Registry HKCU Run - ScanRegistryRun(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Run", StartupType.RegistryRun, list); + ScanRegistryRun(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Run", StartupType.RegistryRun, list, isHklm: false, isWow64: false); + // 2. Registry HKLM Run - ScanRegistryRun(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", StartupType.RegistryRun, list); + ScanRegistryRun(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", StartupType.RegistryRun, list, isHklm: true, isWow64: false); + // 3. Registry HKLM 32-bit (Wow6432Node) if (Environment.Is64BitOperatingSystem) { - using var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); - using var key = baseKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); - if (key != null) + try { - foreach (var name in key.GetValueNames()) + using var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); + using var key = baseKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); + if (key != null) { - var val = key.GetValue(name)?.ToString() ?? string.Empty; - list.Add(new StartupEntry + foreach (var name in key.GetValueNames()) { - Name = name, - Command = val, - Type = StartupType.RegistryRun, - Location = @"HKLM\Software\Wow6432Node\...\Run", - IsEnabled = CheckStartupApproved(name) - }); + var val = key.GetValue(name)?.ToString() ?? string.Empty; + list.Add(new StartupEntry + { + Name = name, + Command = val, + Type = StartupType.RegistryRun, + Location = @"HKLM\Software\Wow6432Node\...\Run", + IsEnabled = CheckStartupApproved(name, isHklm: true, isWow64: true) + }); + } } } + catch { } } // 4. Startup Folders - ScanFolder(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "User Startup Folder", list); - ScanFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup), "All Users Startup Folder", list); + ScanFolder(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Kullanıcı Başlangıç Klasörü", list, isCommon: false); + ScanFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup), "Tüm Kullanıcılar Başlangıç Klasörü", list, isCommon: true); // 5. Services (3rd party automatic) ScanServices(list); @@ -49,7 +56,7 @@ namespace LDUninstaller.Core.Startup return list; } - private static void ScanRegistryRun(RegistryKey root, string subKey, StartupType type, List list) + private static void ScanRegistryRun(RegistryKey root, string subKey, StartupType type, List list, bool isHklm, bool isWow64) { try { @@ -65,28 +72,40 @@ namespace LDUninstaller.Core.Startup Command = cmd, Type = type, Location = $"{root.Name}\\{subKey}", - IsEnabled = CheckStartupApproved(name) + IsEnabled = CheckStartupApproved(name, isHklm, isWow64) }); } } catch { } } - private static void ScanFolder(string path, string locationDesc, List list) + private static void ScanFolder(string path, string locationDesc, List list, bool isCommon) { if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path)) return; try { foreach (var file in Directory.GetFiles(path)) { - string name = Path.GetFileNameWithoutExtension(file); + string ext = Path.GetExtension(file).ToLowerInvariant(); + if (ext != ".lnk" && ext != ".url" && ext != ".disabled") continue; + + string fileName = Path.GetFileName(file); + string displayName = Path.GetFileNameWithoutExtension(file); + bool isEnabled = !ext.Equals(".disabled", StringComparison.OrdinalIgnoreCase); + + // Check StartupApproved for startup folder + if (isEnabled) + { + isEnabled = CheckStartupFolderApproved(fileName, isCommon); + } + list.Add(new StartupEntry { - Name = name, + Name = displayName, Command = file, Type = StartupType.StartupFolder, Location = locationDesc, - IsEnabled = true + IsEnabled = isEnabled }); } } @@ -106,19 +125,25 @@ namespace LDUninstaller.Core.Startup if (key != null) { int startType = (int)(key.GetValue("Start") ?? 3); - // 2 = Automatic - if (startType == 2) + string imgPath = key.GetValue("ImagePath")?.ToString() ?? ""; + string imgLower = imgPath.ToLowerInvariant(); + + // 2 = Automatic, 3 = Manual, 4 = Disabled + // Exclude internal OS services + if (!imgLower.Contains(@"\windows\system32\svchost.exe") && + !imgLower.Contains(@"\windows\system32\services.exe") && + !imgLower.Contains(@"\windows\system32\lsass.exe")) { - string imgPath = key.GetValue("ImagePath")?.ToString() ?? ""; - if (!imgPath.ToLowerInvariant().Contains(@"windows\system32")) + if (startType == 2 || startType == 4) { list.Add(new StartupEntry { Name = sc.DisplayName, + ServiceName = sc.ServiceName, Command = imgPath, Type = StartupType.Service, - Location = "Windows Service", - IsEnabled = sc.Status == ServiceControllerStatus.Running + Location = "Windows Servisi", + IsEnabled = (startType == 2) }); } } @@ -130,15 +155,57 @@ namespace LDUninstaller.Core.Startup catch { } } - public static bool CheckStartupApproved(string entryName) + public static bool CheckStartupApproved(string entryName, bool isHklm = false, bool isWow64 = false) { try { - using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run"); - if (key?.GetValue(entryName) is byte[] data && data.Length > 0) + string approvedSub = isWow64 ? @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32" + : @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run"; + + // First check HKCU + using (var key = Registry.CurrentUser.OpenSubKey(approvedSub)) { - // 0x02 is enabled, 0x03 or other is disabled - return data[0] == 0x02; + if (key?.GetValue(entryName) is byte[] data && data.Length > 0) + { + return data[0] == 0x02; + } + } + + // If HKLM, also check HKLM StartupApproved + if (isHklm) + { + using var hklmKey = Registry.LocalMachine.OpenSubKey(approvedSub); + if (hklmKey?.GetValue(entryName) is byte[] data && data.Length > 0) + { + return data[0] == 0x02; + } + } + } + catch { } + return true; + } + + public static bool CheckStartupFolderApproved(string fileName, bool isCommon) + { + try + { + const string approvedSub = @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder"; + + using (var key = Registry.CurrentUser.OpenSubKey(approvedSub)) + { + if (key?.GetValue(fileName) is byte[] data && data.Length > 0) + { + return data[0] == 0x02; + } + } + + if (isCommon) + { + using var hklmKey = Registry.LocalMachine.OpenSubKey(approvedSub); + if (hklmKey?.GetValue(fileName) is byte[] data && data.Length > 0) + { + return data[0] == 0x02; + } } } catch { } @@ -149,36 +216,136 @@ namespace LDUninstaller.Core.Startup { try { + byte[] binaryData = enable + ? new byte[] { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + : new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + if (entry.Type == StartupType.RegistryRun) { - using var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run"); - if (key != null) + bool isWow64 = entry.Location.Contains("Wow6432Node", StringComparison.OrdinalIgnoreCase); + bool isHklm = entry.Location.Contains("HKEY_LOCAL_MACHINE", StringComparison.OrdinalIgnoreCase) || entry.Location.Contains("HKLM", StringComparison.OrdinalIgnoreCase); + + string approvedSub = isWow64 ? @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32" + : @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run"; + + // Always write to HKCU + using (var key = Registry.CurrentUser.CreateSubKey(approvedSub)) { - byte[] data = enable - ? new byte[] { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - : new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - key.SetValue(entry.Name, data, RegistryValueKind.Binary); - entry.IsEnabled = enable; - return true; + key?.SetValue(entry.Name, binaryData, RegistryValueKind.Binary); } + + // If it was in HKLM, also write to HKLM + if (isHklm) + { + try + { + using var key = Registry.LocalMachine.CreateSubKey(approvedSub); + key?.SetValue(entry.Name, binaryData, RegistryValueKind.Binary); + } + catch { } + } + + entry.IsEnabled = enable; + return true; + } + else if (entry.Type == StartupType.StartupFolder) + { + string fileName = Path.GetFileName(entry.Command); + bool isCommon = entry.Location.Contains("Tüm Kullanıcılar", StringComparison.OrdinalIgnoreCase) || entry.Location.Contains("All Users", StringComparison.OrdinalIgnoreCase); + + const string approvedFolderSub = @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder"; + + // Write to StartupApproved\StartupFolder in HKCU + using (var key = Registry.CurrentUser.CreateSubKey(approvedFolderSub)) + { + key?.SetValue(fileName, binaryData, RegistryValueKind.Binary); + } + + if (isCommon) + { + try + { + using var key = Registry.LocalMachine.CreateSubKey(approvedFolderSub); + key?.SetValue(fileName, binaryData, RegistryValueKind.Binary); + } + catch { } + } + + // Fallback rename if StartupApproved is not respected + try + { + if (!enable && File.Exists(entry.Command) && !entry.Command.EndsWith(".disabled", StringComparison.OrdinalIgnoreCase)) + { + string newPath = entry.Command + ".disabled"; + File.Move(entry.Command, newPath); + entry.Command = newPath; + } + else if (enable && File.Exists(entry.Command) && entry.Command.EndsWith(".disabled", StringComparison.OrdinalIgnoreCase)) + { + string newPath = entry.Command.Substring(0, entry.Command.Length - ".disabled".Length); + File.Move(entry.Command, newPath); + entry.Command = newPath; + } + } + catch { } + + entry.IsEnabled = enable; + return true; } else if (entry.Type == StartupType.Service) { - using var sc = new ServiceController(entry.Name); - if (enable && sc.Status != ServiceControllerStatus.Running) + string svcName = !string.IsNullOrEmpty(entry.ServiceName) ? entry.ServiceName : entry.Name; + int targetStartType = enable ? 2 : 4; // 2 = Auto, 4 = Disabled + + // 1. Update Registry Start type directly + try { - sc.Start(); - entry.IsEnabled = true; + using var key = Registry.LocalMachine.OpenSubKey($@"SYSTEM\CurrentControlSet\Services\{svcName}", true); + if (key != null) + { + key.SetValue("Start", targetStartType, RegistryValueKind.DWord); + } } - else if (!enable && sc.Status == ServiceControllerStatus.Running) + catch { } + + // 2. Run sc.exe config start= auto / disabled + try { - sc.Stop(); - entry.IsEnabled = false; + string mode = enable ? "auto" : "disabled"; + var psi = new ProcessStartInfo("sc.exe", $"config \"{svcName}\" start= {mode}") + { + CreateNoWindow = true, + UseShellExecute = false + }; + using var p = Process.Start(psi); + p?.WaitForExit(3000); } + catch { } + + // 3. Stop or Start the service + try + { + using var sc = new ServiceController(svcName); + if (!enable && sc.Status == ServiceControllerStatus.Running) + { + sc.Stop(); + sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(3)); + } + else if (enable && sc.Status == ServiceControllerStatus.Stopped) + { + sc.Start(); + } + } + catch { } + + entry.IsEnabled = enable; return true; } } - catch { } + catch (Exception ex) + { + Debug.WriteLine($"ToggleStartupEntry error: {ex.Message}"); + } return false; } } diff --git a/src/LDUninstaller.Launcher/LDUninstaller.Launcher.csproj b/src/LDUninstaller.Launcher/LDUninstaller.Launcher.csproj index 7c327cb..56879da 100644 --- a/src/LDUninstaller.Launcher/LDUninstaller.Launcher.csproj +++ b/src/LDUninstaller.Launcher/LDUninstaller.Launcher.csproj @@ -8,8 +8,13 @@ true LDUninstaller.Launcher LDUninstaller.Launcher + Resources\app.ico + + + + diff --git a/src/LDUninstaller.Launcher/Resources/app.ico b/src/LDUninstaller.Launcher/Resources/app.ico new file mode 100644 index 0000000..95c632a Binary files /dev/null and b/src/LDUninstaller.Launcher/Resources/app.ico differ diff --git a/src/LDUninstaller.UI/Dialogs/BulkWizardWindow.xaml b/src/LDUninstaller.UI/Dialogs/BulkWizardWindow.xaml index 27b5208..7dfee32 100644 --- a/src/LDUninstaller.UI/Dialogs/BulkWizardWindow.xaml +++ b/src/LDUninstaller.UI/Dialogs/BulkWizardWindow.xaml @@ -7,6 +7,7 @@ Background="{StaticResource BrushBgDark}" Foreground="{StaticResource BrushTextPrimary}" FontFamily="Segoe UI" + Icon="pack://application:,,,/Resources/app.ico" BorderBrush="{StaticResource BrushBorder}" BorderThickness="1"> diff --git a/src/LDUninstaller.UI/Dialogs/LeftoverCleanWindow.xaml b/src/LDUninstaller.UI/Dialogs/LeftoverCleanWindow.xaml index ac3cdf2..2a43027 100644 --- a/src/LDUninstaller.UI/Dialogs/LeftoverCleanWindow.xaml +++ b/src/LDUninstaller.UI/Dialogs/LeftoverCleanWindow.xaml @@ -7,6 +7,7 @@ Background="{StaticResource BrushBgDark}" Foreground="{StaticResource BrushTextPrimary}" FontFamily="Segoe UI" + Icon="pack://application:,,,/Resources/app.ico" BorderBrush="{StaticResource BrushBorder}" BorderThickness="1"> diff --git a/src/LDUninstaller.UI/LDUninstaller.UI.csproj b/src/LDUninstaller.UI/LDUninstaller.UI.csproj index bb48ffa..8505e40 100644 --- a/src/LDUninstaller.UI/LDUninstaller.UI.csproj +++ b/src/LDUninstaller.UI/LDUninstaller.UI.csproj @@ -8,8 +8,14 @@ enable LDUninstaller.UI LDUninstaller.UI + Resources\app.ico + + + + + diff --git a/src/LDUninstaller.UI/MainWindow.xaml b/src/LDUninstaller.UI/MainWindow.xaml index e2c0a10..a079049 100644 --- a/src/LDUninstaller.UI/MainWindow.xaml +++ b/src/LDUninstaller.UI/MainWindow.xaml @@ -9,6 +9,7 @@ Background="{StaticResource BrushBgDark}" Foreground="{StaticResource BrushTextPrimary}" FontFamily="Segoe UI" + Icon="pack://application:,,,/Resources/app.ico" BorderBrush="{StaticResource BrushBorder}" BorderThickness="1"> @@ -33,8 +34,8 @@ - - + + diff --git a/src/LDUninstaller.UI/Resources/app.ico b/src/LDUninstaller.UI/Resources/app.ico new file mode 100644 index 0000000..95c632a Binary files /dev/null and b/src/LDUninstaller.UI/Resources/app.ico differ diff --git a/src/LDUninstaller.UI/Resources/logo.png b/src/LDUninstaller.UI/Resources/logo.png new file mode 100644 index 0000000..3dc3b27 Binary files /dev/null and b/src/LDUninstaller.UI/Resources/logo.png differ diff --git a/version.json b/version.json index a490d44..712ec7d 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "major": 2, - "minor": 4, + "minor": 5, "patch": 0, - "version": "2.4.0" + "version": "2.5.0" }