Saves given path to registry for ShellExtension, and Context Menu settings
| 323 | |
| 324 | /// Saves given path to registry for ShellExtension, and Context Menu settings |
| 325 | void PropShell::SaveMergePath() |
| 326 | { |
| 327 | tchar_t temp[MAX_PATH] = {0}; |
| 328 | LONG retVal = 0; |
| 329 | GetModuleFileName(AfxGetInstanceHandle(), temp, MAX_PATH); |
| 330 | |
| 331 | CRegKeyEx reg; |
| 332 | retVal = reg.Open(HKEY_CURRENT_USER, RegDir); |
| 333 | if (retVal != ERROR_SUCCESS) |
| 334 | { |
| 335 | String msg = strutils::format(_T("Failed to open registry key HKCU/%s:\n\t%d : %s"), |
| 336 | RegDir, retVal, GetSysError(retVal)); |
| 337 | RootLogger::Error(msg); |
| 338 | return; |
| 339 | } |
| 340 | |
| 341 | // Save path to WinMerge(U).exe |
| 342 | retVal = reg.WriteString(f_RegValuePath, temp); |
| 343 | if (retVal != ERROR_SUCCESS) |
| 344 | { |
| 345 | String msg = strutils::format(_T("Failed to set registry value %s:\n\t%d : %s"), |
| 346 | f_RegValuePath, retVal, GetSysError(retVal)); |
| 347 | RootLogger::Error(msg); |
| 348 | } |
| 349 | |
| 350 | // Determine bitmask for shell extension |
| 351 | DWORD dwContextEnabled = reg.ReadDword(f_RegValueEnabled, 0); |
| 352 | if (m_bContextAdded) |
| 353 | dwContextEnabled |= CONTEXT_F_ENABLED; |
| 354 | else |
| 355 | dwContextEnabled &= ~CONTEXT_F_ENABLED; |
| 356 | |
| 357 | if (m_bContextAdvanced) |
| 358 | dwContextEnabled |= CONTEXT_F_ADVANCED; |
| 359 | else |
| 360 | dwContextEnabled &= ~CONTEXT_F_ADVANCED; |
| 361 | |
| 362 | if (m_bContextCompareAs) |
| 363 | dwContextEnabled |= CONTEXT_F_COMPARE_AS; |
| 364 | else |
| 365 | dwContextEnabled &= ~CONTEXT_F_COMPARE_AS; |
| 366 | |
| 367 | retVal = reg.WriteDword(f_RegValueEnabled, dwContextEnabled); |
| 368 | if (retVal != ERROR_SUCCESS) |
| 369 | { |
| 370 | String msg = strutils::format(_T("Failed to set registry value %s to %d:\n\t%d : %s"), |
| 371 | f_RegValueEnabled, dwContextEnabled, retVal, GetSysError(retVal)); |
| 372 | RootLogger::Error(msg); |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | /// Enable/Disable "Advanced menu" checkbox. |
| 377 | void PropShell::AdvancedContextMenuCheck() |
nothing calls this directly
no test coverage detected