[CRYPTUI] Let image list be automatically deleted (#5891)

Based on KRosUser's cryptui.patch.
- Don't delete the image list because the list view will delete the image list automatically.
CORE-17290
This commit is contained in:
Katayama Hirofumi MZ 2023-11-16 14:58:49 +09:00 committed by GitHub
parent 24757e30e9
commit 3faa56d2c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -789,11 +789,15 @@ static LRESULT CALLBACK cert_mgr_advanced_dlg_proc(HWND hwnd, UINT msg,
{ {
case IDOK: case IDOK:
save_cert_mgr_usages(hwnd); save_cert_mgr_usages(hwnd);
#ifndef __REACTOS__
ImageList_Destroy((HIMAGELIST)GetWindowLongPtrW(hwnd, DWLP_USER)); ImageList_Destroy((HIMAGELIST)GetWindowLongPtrW(hwnd, DWLP_USER));
#endif
EndDialog(hwnd, IDOK); EndDialog(hwnd, IDOK);
break; break;
case IDCANCEL: case IDCANCEL:
#ifndef __REACTOS__
ImageList_Destroy((HIMAGELIST)GetWindowLongPtrW(hwnd, DWLP_USER)); ImageList_Destroy((HIMAGELIST)GetWindowLongPtrW(hwnd, DWLP_USER));
#endif
EndDialog(hwnd, IDCANCEL); EndDialog(hwnd, IDCANCEL);
break; break;
} }
@ -1153,6 +1157,14 @@ static LRESULT CALLBACK cert_mgr_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
show_store_certs(hwnd, cert_mgr_index_to_store(tab, 0)); show_store_certs(hwnd, cert_mgr_index_to_store(tab, 0));
break; break;
} }
#ifdef __REACTOS__
case WM_DESTROY:
free_certs(GetDlgItem(hwnd, IDC_MGR_CERTS));
close_stores(GetDlgItem(hwnd, IDC_MGR_STORES));
data = (struct CertMgrData *)GetWindowLongPtrW(hwnd, DWLP_USER);
HeapFree(GetProcessHeap(), 0, data);
break;
#endif
case WM_NOTIFY: case WM_NOTIFY:
{ {
NMHDR *hdr = (NMHDR *)lp; NMHDR *hdr = (NMHDR *)lp;
@ -1278,11 +1290,13 @@ static LRESULT CALLBACK cert_mgr_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
cert_mgr_do_remove(hwnd); cert_mgr_do_remove(hwnd);
break; break;
case IDCANCEL: case IDCANCEL:
#ifndef __REACTOS__
free_certs(GetDlgItem(hwnd, IDC_MGR_CERTS)); free_certs(GetDlgItem(hwnd, IDC_MGR_CERTS));
close_stores(GetDlgItem(hwnd, IDC_MGR_STORES)); close_stores(GetDlgItem(hwnd, IDC_MGR_STORES));
data = (struct CertMgrData *)GetWindowLongPtrW(hwnd, DWLP_USER); data = (struct CertMgrData *)GetWindowLongPtrW(hwnd, DWLP_USER);
ImageList_Destroy(data->imageList); ImageList_Destroy(data->imageList);
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
#endif
EndDialog(hwnd, IDCANCEL); EndDialog(hwnd, IDCANCEL);
break; break;
} }
@ -3717,7 +3731,9 @@ static UINT CALLBACK cert_properties_general_callback(HWND hwnd, UINT msg,
data = (struct edit_cert_data *)GetWindowLongPtrW(hwnd, DWLP_USER); data = (struct edit_cert_data *)GetWindowLongPtrW(hwnd, DWLP_USER);
if (data) if (data)
{ {
#ifndef __REACTOS__
ImageList_Destroy(data->imageList); ImageList_Destroy(data->imageList);
#endif
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
} }
break; break;
@ -4219,7 +4235,9 @@ static UINT CALLBACK hierarchy_callback(HWND hwnd, UINT msg,
{ {
case PSPCB_RELEASE: case PSPCB_RELEASE:
data = (struct hierarchy_data *)page->lParam; data = (struct hierarchy_data *)page->lParam;
#ifndef __REACTOS__
ImageList_Destroy(data->imageList); ImageList_Destroy(data->imageList);
#endif
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
break; break;
} }
@ -7321,6 +7339,13 @@ static LRESULT CALLBACK select_cert_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPA
select_cert_update_view_button(hwnd); select_cert_update_view_button(hwnd);
break; break;
} }
#ifdef __REACTOS__
case WM_DESTROY:
free_certs(GetDlgItem(hwnd, IDC_SELECT_CERTS));
data = (struct SelectCertData *)GetWindowLongPtrW(hwnd, DWLP_USER);
HeapFree(GetProcessHeap(), 0, data);
break;
#endif
case WM_NOTIFY: case WM_NOTIFY:
{ {
NMHDR *hdr = (NMHDR *)lp; NMHDR *hdr = (NMHDR *)lp;
@ -7378,17 +7403,21 @@ static LRESULT CALLBACK select_cert_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPA
break; break;
} }
*data->cert = CertDuplicateCertificateContext(cert); *data->cert = CertDuplicateCertificateContext(cert);
#ifndef __REACTOS__
free_certs(GetDlgItem(hwnd, IDC_SELECT_CERTS)); free_certs(GetDlgItem(hwnd, IDC_SELECT_CERTS));
ImageList_Destroy(data->imageList); ImageList_Destroy(data->imageList);
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
#endif
EndDialog(hwnd, IDOK); EndDialog(hwnd, IDOK);
break; break;
} }
case IDCANCEL: case IDCANCEL:
#ifndef __REACTOS__
data = (struct SelectCertData *)GetWindowLongPtrW(hwnd, DWLP_USER); data = (struct SelectCertData *)GetWindowLongPtrW(hwnd, DWLP_USER);
free_certs(GetDlgItem(hwnd, IDC_SELECT_CERTS)); free_certs(GetDlgItem(hwnd, IDC_SELECT_CERTS));
ImageList_Destroy(data->imageList); ImageList_Destroy(data->imageList);
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, data);
#endif
EndDialog(hwnd, IDCANCEL); EndDialog(hwnd, IDCANCEL);
break; break;
case IDC_SELECT_VIEW_CERT: case IDC_SELECT_VIEW_CERT: