Skip to content

Commit 85cdb75

Browse files
authored
[SHELL32] SHOpenWithDialog: Write DefaultIcon registry key (reactos#8634)
JIRA issue: CORE-19670 - Write DefaultIcon registry key when association changes. - Call SHChangeNotify( SHCNE_ASSOCCHANGED, ...).
1 parent 00bbac6 commit 85cdb75

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

dll/win32/shell32/COpenWithMenu.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,16 @@ BOOL COpenWithList::SetDefaultHandler(SApp *pApp, LPCWSTR pwszFilename)
877877
return FALSE;
878878
}
879879

880+
/* Create "DefaultIcon" key */
881+
HKEY hDefIconKey;
882+
if (RegCreateKeyExW(hKey, L"DefaultIcon", 0, NULL, 0, KEY_WRITE, NULL,
883+
&hDefIconKey, NULL) == ERROR_SUCCESS)
884+
{
885+
RegSetString(hDefIconKey, NULL, pApp->wszFilename, REG_EXPAND_SZ);
886+
RegCloseKey(hDefIconKey);
887+
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, NULL, NULL);
888+
}
889+
880890
/* Copy static verbs from Classes\Applications key */
881891
/* FIXME: SHCopyKey does not copy the security attributes of the keys */
882892
/* FIXME: Windows does not actually copy the verb keys */
@@ -1183,11 +1193,7 @@ VOID COpenWithDialog::Accept()
11831193
{
11841194
/* Set programm as default handler */
11851195
if (IsDlgButtonChecked(m_hDialog, 14003) == BST_CHECKED && (m_InFlags & OAIF_REGISTER_EXT))
1186-
{
11871196
m_pAppList->SetDefaultHandler(pApp, m_pInfo->pcszFile);
1188-
// FIXME: Update DefaultIcon registry
1189-
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, NULL, NULL);
1190-
}
11911197

11921198
/* Execute program */
11931199
if (m_InFlags & OAIF_EXEC)

0 commit comments

Comments
 (0)