diff --git a/src/d_protocol.c b/src/d_protocol.c index bd6d799c5..3aa5c1717 100644 --- a/src/d_protocol.c +++ b/src/d_protocol.c @@ -54,35 +54,6 @@ static char *GetExePath(void) return buf; } -static void DeleteProtocols(void) -{ -#if defined (__WIN32) - - HKEY hKey; - RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open\\command"), 0, KEY_ALL_ACCESS, &hKey); - RegDeleteValue(hKey, _T("")); - RegCloseKey(hKey); - RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open\\command")); - RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open"), 0, KEY_ALL_ACCESS, &hKey); - RegDeleteValue(hKey, _T("")); - RegCloseKey(hKey); - RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open")); - RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell"), 0, KEY_ALL_ACCESS, &hKey); - RegDeleteValue(hKey, _T("")); - RegCloseKey(hKey); - RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell")); - RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart"), 0, KEY_ALL_ACCESS, &hKey); - RegDeleteValue(hKey, _T("URL Protocol")); - RegDeleteValue(hKey, _T("")); - RegCloseKey(hKey); - RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart")); -#elif defined (__unix__) || defined (UNIXCOMMON) - struct passwd *pw = getpwuid(getuid()); - const char *homedir = pw->pw_dir; - remove(va("%s/.local/share/applications/srb2kart-handler.desktop", homedir)); -#endif -} - static boolean RegisterProtocols(const char *path) { #if defined (__WIN32) @@ -161,6 +132,35 @@ static boolean RegisterProtocols(const char *path) return true; } +static void DeleteProtocols(void) +{ +#if defined (__WIN32) + + HKEY hKey; + RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open\\command"), 0, KEY_ALL_ACCESS, &hKey); + RegDeleteValue(hKey, _T("")); + RegCloseKey(hKey); + RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open\\command")); + RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open"), 0, KEY_ALL_ACCESS, &hKey); + RegDeleteValue(hKey, _T("")); + RegCloseKey(hKey); + RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell\\open")); + RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell"), 0, KEY_ALL_ACCESS, &hKey); + RegDeleteValue(hKey, _T("")); + RegCloseKey(hKey); + RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart\\shell")); + RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart"), 0, KEY_ALL_ACCESS, &hKey); + RegDeleteValue(hKey, _T("URL Protocol")); + RegDeleteValue(hKey, _T("")); + RegCloseKey(hKey); + RegDeleteKey(HKEY_CURRENT_USER, _T("Software\\Classes\\srb2kart")); +#elif defined (__unix__) || defined (UNIXCOMMON) + struct passwd *pw = getpwuid(getuid()); + const char *homedir = pw->pw_dir; + remove(va("%s/.local/share/applications/srb2kart-handler.desktop", homedir)); +#endif +} + #if defined (__WIN32) static HKEY OpenKey(HKEY hRootKey, const char* strKey) { diff --git a/src/d_protocol.h b/src/d_protocol.h index 07d9fee73..43220fb95 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -11,8 +11,8 @@ void D_SetupProtocol(void); -void D_DeleteProtocol(void); void D_CreateProtocol(void); +void D_DeleteProtocol(void); #ifdef HAVE_CURL void D_DownloadReplay(const char *url, const char *path); #endif diff --git a/src/m_menu.c b/src/m_menu.c index 5628cee79..5fe8dde41 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -326,7 +326,6 @@ static void M_Addons(INT32 choice); static void M_AddonsOptions(INT32 choice); static patch_t *addonsp[NUM_EXT+5]; -static void M_RegisterProtocol(void); static void M_DeleteProtocol(void); #define numaddonsshown 4 @@ -1429,7 +1428,7 @@ enum static menuitem_t OP_ProtocolMenu[] = { - {IT_STRING | IT_CALL, NULL, "Register protocol", M_RegisterProtocol, 10}, + {IT_STRING | IT_CALL, NULL, "Register protocol", D_CreateProtocol, 10}, {IT_STRING | IT_CALL, NULL, "\x85" "Disable and delete protocols", M_DeleteProtocol, 20}, }; @@ -9895,11 +9894,6 @@ static void M_ScreenshotOptions(INT32 choice) M_SetupNextMenu(&OP_ScreenshotOptionsDef); } -static void M_RegisterProtocol(void) -{ - D_CreateProtocol(); -} - static void M_DeleteProtocol(void) { M_StartMessage("Are you sure you want to disable and delete protocol registers?\n"