From 23ee01ff8f13461619cd42f8d574fc8e69d2ae24 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Fri, 19 Jan 2007 12:52:02 +0000 Subject: [PATCH] File-types are now registered in HKCU instead of HKLM, making Vista UAC shut up and associations be user-specific. Originally committed to SVN as r844. --- aegisub/dialog_associations.cpp | 4 ++-- aegisub/main.cpp | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/aegisub/dialog_associations.cpp b/aegisub/dialog_associations.cpp index dd0813393..16d99edd0 100644 --- a/aegisub/dialog_associations.cpp +++ b/aegisub/dialog_associations.cpp @@ -87,7 +87,7 @@ DialogAssociations::~DialogAssociations() { // Associates a type with Aegisub void DialogAssociations::AssociateType(wxString type) { type.Lower(); - wxRegKey *key = new wxRegKey(_T("HKEY_CLASSES_ROOT\\.") + type); + wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type); if (!key->Exists()) key->Create(); key->SetValue(_T(""),_T("Aegisub")); delete key; @@ -98,7 +98,7 @@ void DialogAssociations::AssociateType(wxString type) { // Checks if a type is associated with Aegisub bool DialogAssociations::CheckAssociation(wxString type) { type.Lower(); - wxRegKey *key = new wxRegKey(_T("HKEY_CLASSES_ROOT\\.") + type); + wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type); if (!key->Exists()) { delete key; return false; diff --git a/aegisub/main.cpp b/aegisub/main.cpp index a13553c2a..36c7b8281 100644 --- a/aegisub/main.cpp +++ b/aegisub/main.cpp @@ -262,26 +262,28 @@ void AegisubApp::RegistryAssociate () { command << _T("\"") << fullPath << _T("\" \"%1\""); // Main program association - wxRegKey *key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub")); +#ifndef DEBUG + wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub")); if (!key->Exists()) key->Create(); key->SetValue(_T(""),_T("Aegisub Subtitle Script")); delete key; - key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\DefaultIcon")); + key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\DefaultIcon")); if (!key->Exists()) key->Create(); - key->SetValue(_T(""),fullPath); + key->SetValue(_T(""),fullPath); delete key; - key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\Shell")); + key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell")); if (!key->Exists()) key->Create(); - key->SetValue(_T(""),_T("open")); + key->SetValue(_T(""),_T("open")); delete key; - key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\Shell\\Open")); + key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell\\Open")); if (!key->Exists()) key->Create(); - key->SetValue(_T(""),_T("&Open with Aegisub")); + key->SetValue(_T(""),_T("&Open with Aegisub")); delete key; - key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\Shell\\Open\\Command")); + key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell\\Open\\Command")); if (!key->Exists()) key->Create(); - key->SetValue(_T(""),command); + key->SetValue(_T(""),command); delete key; +#endif // Check associations if (Options.AsBool(_T("Show associations"))) {