diff options
author | Christian Kamm <mail@ckamm.de> | 2018-08-15 11:46:16 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2018-11-26 14:53:30 +0300 |
commit | 06928a40377deeb5053365e88d805f753bf478f2 (patch) | |
tree | 2b37ed68aa4e8a58b02cd6e2e805f446ebabffb7 /shell_integration | |
parent | 96df14f897ebf4fb1f423149cba9f2972e5f280d (diff) |
winvfs: initial work
Done by ckamm and dschmidt
Diffstat (limited to 'shell_integration')
-rw-r--r-- | shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp b/shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp index 1bbfc6605..f9d1f6385 100644 --- a/shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp +++ b/shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp @@ -33,14 +33,24 @@ HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PCWSTR if (SUCCEEDED(hr)) { + DWORD cbData; + const BYTE * lpData; + if (pszData != NULL) { // Set the specified value of the key. - DWORD cbData = lstrlen(pszData) * sizeof(*pszData); - hr = HRESULT_FROM_WIN32(RegSetValueEx(hKey, pszValueName, 0, - REG_SZ, reinterpret_cast<const BYTE *>(pszData), cbData)); + cbData = lstrlen(pszData) * sizeof(*pszData); + lpData = reinterpret_cast<const BYTE *>(pszData); + } + else + { + cbData = 0; + lpData = NULL; } + hr = HRESULT_FROM_WIN32(RegSetValueEx(hKey, pszValueName, 0, + REG_SZ, lpData, cbData)); + RegCloseKey(hKey); } @@ -90,6 +100,11 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL { hr = SetHKCRRegistryKeyAndValue(szSubkey, NULL, pszFriendlyName); + // Create the HKCR\CLSID\{<CLSID>}\ContextMenuOptIn subkey. + if (SUCCEEDED(hr)) { + hr = SetHKCRRegistryKeyAndValue(szSubkey, L"ContextMenuOptIn", NULL); + } + // Create the HKCR\CLSID\{<CLSID>}\InprocServer32 key. if (SUCCEEDED(hr)) { @@ -215,4 +230,4 @@ HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler( } return hr; -}
\ No newline at end of file +} |