diff --git a/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj b/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj index 87a31f76af61..4e69eba1661c 100644 --- a/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj +++ b/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj @@ -240,7 +240,6 @@ - @@ -268,7 +267,6 @@ Create - diff --git a/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj.filters b/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj.filters index 7256c738b846..d0a249143fa0 100644 --- a/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj.filters +++ b/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj.filters @@ -27,9 +27,6 @@ Header Files - - Header Files - Header Files @@ -59,9 +56,6 @@ Source Files - - Source Files - Source Files diff --git a/src/modules/FileLocksmith/FileLocksmithExt/Registry.cpp b/src/modules/FileLocksmith/FileLocksmithExt/Registry.cpp deleted file mode 100644 index 9117e6c3dc96..000000000000 --- a/src/modules/FileLocksmith/FileLocksmithExt/Registry.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include "pch.h" - -#include "Registry.h" -#include "ExplorerCommand.h" -#include "Constants.h" -#include "dllmain.h" - -#define HKEY_ROOT HKEY_CURRENT_USER - -bool registry_write_string(LPCWSTR path, LPCWSTR property, LPCWSTR value) -{ - HKEY key; - LSTATUS result = RegCreateKeyExW( - HKEY_ROOT, - path, - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &key, - NULL - ); - - if (result != ERROR_SUCCESS) - { - return false; - } - - if (value != NULL) - { - result = RegSetValueExW(key, property, 0, REG_SZ, reinterpret_cast(value), sizeof(WCHAR) * (1ull + lstrlenW(value))); - } - - RegCloseKey(key); - return result == ERROR_SUCCESS; -} - -bool registry_delete_tree(LPCWSTR path) -{ - LSTATUS result = RegDeleteTreeW(HKEY_ROOT, path); - return result == ERROR_SUCCESS; -} - -bool add_registry_keys() -{ - if (!registry_write_string( - L"Software\\Classes\\CLSID\\{" EXPLORER_COMMAND_UUID_STR L"}", - NULL, - constants::nonlocalizable::RegistryKeyDescription - )) - { - return false; - } - - if (!registry_write_string( - L"Software\\Classes\\CLSID\\{" EXPLORER_COMMAND_UUID_STR L"}", - L"ContextMenuOptIn", - L"" - )) - { - return false; - } - - static WCHAR module_file_name[MAX_PATH]; - DWORD result = GetModuleFileNameW(globals::instance, module_file_name, ARRAYSIZE(module_file_name)); - if (result == 0) - { - return false; - } - - if (!registry_write_string( - L"Software\\Classes\\CLSID\\{" EXPLORER_COMMAND_UUID_STR L"}\\InprocServer32", - NULL, - module_file_name - )) - { - return false; - } - - if (!registry_write_string( - L"Software\\Classes\\CLSID\\{" EXPLORER_COMMAND_UUID_STR L"}\\InprocServer32", - L"ThreadingModel", - L"Apartment" - )) - { - return false; - } - - if (!registry_write_string( - L"Software\\Classes\\AllFileSystemObjects\\ShellEx\\ContextMenuHandlers\\" REGISTRY_CONTEXT_MENU_KEY, - L"", - L"{" EXPLORER_COMMAND_UUID_STR L"}" - )) - { - return false; - } - - return true; -} - -bool delete_registry_keys() -{ - bool ok = true; - ok &= registry_delete_tree( - L"Software\\Classes\\CLSID\\{" EXPLORER_COMMAND_UUID_STR "}" - ); - - ok &= registry_delete_tree( - L"Software\\Classes\\AllFileSystemObjects\\ShellEx\\ContextMenuHandlers\\" REGISTRY_CONTEXT_MENU_KEY - ); - - return ok; -} diff --git a/src/modules/FileLocksmith/FileLocksmithExt/Registry.h b/src/modules/FileLocksmith/FileLocksmithExt/Registry.h deleted file mode 100644 index 1657c2ce1164..000000000000 --- a/src/modules/FileLocksmith/FileLocksmithExt/Registry.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include "pch.h" - -bool add_registry_keys(); -bool delete_registry_keys(); diff --git a/src/modules/FileLocksmith/FileLocksmithExt/dllmain.cpp b/src/modules/FileLocksmith/FileLocksmithExt/dllmain.cpp index 32405d61e93f..6951081625c6 100644 --- a/src/modules/FileLocksmith/FileLocksmithExt/dllmain.cpp +++ b/src/modules/FileLocksmith/FileLocksmithExt/dllmain.cpp @@ -4,7 +4,6 @@ // Additional libraries to link #pragma comment(lib, "shlwapi") -#include "Registry.h" #include "ClassFactory.h" #include "Trace.h" @@ -35,19 +34,12 @@ BOOL APIENTRY DllMain( HMODULE hModule, STDAPI DllRegisterServer() { - if (!add_registry_keys()) - { - // Best effort here - delete_registry_keys(); - return E_FAIL; - } - return S_OK; } STDAPI DllUnregisterServer() { - return delete_registry_keys() ? S_OK : E_FAIL; + return S_OK; } STDAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void** ppv)