inetcpl: Add a security propsheet.
This commit is contained in:
parent
c79864f871
commit
137f75328b
|
@ -1,11 +1,12 @@
|
|||
MODULE = inetcpl.cpl
|
||||
IMPORTS = comctl32 shlwapi user32 advapi32
|
||||
DELAYIMPORTS = cryptui wininet
|
||||
DELAYIMPORTS = cryptui wininet ole32 urlmon
|
||||
|
||||
C_SRCS = \
|
||||
content.c \
|
||||
general.c \
|
||||
inetcpl.c
|
||||
inetcpl.c \
|
||||
security.c
|
||||
|
||||
RC_SRCS = \
|
||||
cpl_De.rc \
|
||||
|
|
|
@ -67,6 +67,18 @@ BEGIN
|
|||
|
||||
END
|
||||
|
||||
/* "Security" propsheet */
|
||||
IDD_SECURITY DIALOG 0, 0, 320, 220
|
||||
STYLE WS_CAPTION | WS_CHILD | WS_DISABLED
|
||||
FONT 8, "MS Shell Dlg"
|
||||
CAPTION "Security"
|
||||
BEGIN
|
||||
|
||||
CONTROL "Listview", IDC_SEC_LISTVIEW, "SysListView32",
|
||||
LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL,
|
||||
4, 4, 312, 58
|
||||
END
|
||||
|
||||
/* "Content" propsheet */
|
||||
IDD_CONTENT DIALOG 0, 0, 320, 220
|
||||
STYLE WS_CAPTION | WS_CHILD | WS_DISABLED
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define COBJMACROS
|
||||
#define CONST_VTABLE
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
|
@ -28,6 +30,7 @@
|
|||
#include <winuser.h>
|
||||
#include <commctrl.h>
|
||||
#include <cpl.h>
|
||||
#include "ole2.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -82,10 +85,17 @@ static int CALLBACK propsheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
|
|||
*/
|
||||
static void display_cpl_sheets(HWND parent)
|
||||
{
|
||||
INITCOMMONCONTROLSEX icex;
|
||||
PROPSHEETPAGEW psp[NUM_PROPERTY_PAGES];
|
||||
PROPSHEETHEADERW psh;
|
||||
DWORD id = 0;
|
||||
|
||||
OleInitialize(NULL);
|
||||
/* Initialize common controls */
|
||||
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
|
||||
InitCommonControlsEx(&icex);
|
||||
|
||||
ZeroMemory(&psh, sizeof(psh));
|
||||
ZeroMemory(psp, sizeof(psp));
|
||||
|
||||
|
@ -96,6 +106,12 @@ static void display_cpl_sheets(HWND parent)
|
|||
psp[id].pfnDlgProc = general_dlgproc;
|
||||
id++;
|
||||
|
||||
psp[id].dwSize = sizeof (PROPSHEETPAGEW);
|
||||
psp[id].hInstance = hcpl;
|
||||
psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_SECURITY);
|
||||
psp[id].pfnDlgProc = security_dlgproc;
|
||||
id++;
|
||||
|
||||
psp[id].dwSize = sizeof (PROPSHEETPAGEW);
|
||||
psp[id].hInstance = hcpl;
|
||||
psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_CONTENT);
|
||||
|
@ -115,6 +131,8 @@ static void display_cpl_sheets(HWND parent)
|
|||
|
||||
/* display the dialog */
|
||||
PropertySheetW(&psh);
|
||||
|
||||
OleUninitialize();
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
|
@ -24,11 +24,31 @@
|
|||
|
||||
#include <windef.h>
|
||||
#include <winuser.h>
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
extern HMODULE hcpl;
|
||||
INT_PTR CALLBACK content_dlgproc(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
|
||||
INT_PTR CALLBACK general_dlgproc(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
|
||||
INT_PTR CALLBACK security_dlgproc(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
|
||||
|
||||
/* ## Memory allocation functions ## */
|
||||
|
||||
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc( size_t len )
|
||||
{
|
||||
return HeapAlloc( GetProcessHeap(), 0, len );
|
||||
}
|
||||
|
||||
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero( size_t len )
|
||||
{
|
||||
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
|
||||
}
|
||||
|
||||
static inline BOOL heap_free( void *mem )
|
||||
{
|
||||
return HeapFree( GetProcessHeap(), 0, mem );
|
||||
}
|
||||
|
||||
/* ######### */
|
||||
|
||||
#define NUM_PROPERTY_PAGES 8
|
||||
|
||||
|
@ -57,6 +77,9 @@ INT_PTR CALLBACK general_dlgproc(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
|
|||
#define IDC_DELETE_FORM_DATA 1014
|
||||
#define IDC_DELETE_PASSWORDS 1015
|
||||
|
||||
#define IDD_SECURITY 2000
|
||||
#define IDC_SEC_LISTVIEW 2001
|
||||
|
||||
#define IDD_CONTENT 4000
|
||||
#define IDC_CERT 4100
|
||||
#define IDC_CERT_PUBLISHER 4101
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
* Internet control panel applet: security propsheet
|
||||
*
|
||||
* Copyright 2011 Detlef Riekenberg
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#define CONST_VTABLE
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
#include <prsht.h>
|
||||
#include "commctrl.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "urlmon.h"
|
||||
#include "initguid.h"
|
||||
#include "winreg.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "inetcpl.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(inetcpl);
|
||||
|
||||
typedef struct secdlg_data_s {
|
||||
HWND hsec; /* security propsheet */
|
||||
HWND hlv; /* listview */
|
||||
IInternetSecurityManager *sec_mgr;
|
||||
IInternetZoneManager *zone_mgr;
|
||||
DWORD zone_enumerator;
|
||||
DWORD num_zones;
|
||||
} secdlg_data;
|
||||
|
||||
/*********************************************************************
|
||||
* security_cleanup_zones [internal]
|
||||
*
|
||||
*/
|
||||
static void security_cleanup_zones(secdlg_data *sd)
|
||||
{
|
||||
if (sd->zone_enumerator) {
|
||||
IInternetZoneManager_DestroyZoneEnumerator(sd->zone_mgr, sd->zone_enumerator);
|
||||
}
|
||||
|
||||
if (sd->zone_mgr) {
|
||||
IInternetZoneManager_Release(sd->zone_mgr);
|
||||
}
|
||||
|
||||
if (sd->sec_mgr) {
|
||||
IInternetSecurityManager_Release(sd->sec_mgr);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* security_enum_zones [internal]
|
||||
*
|
||||
*/
|
||||
static HRESULT security_enum_zones(secdlg_data * sd)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoInternetCreateSecurityManager(NULL, &sd->sec_mgr, 0);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = CoInternetCreateZoneManager(NULL, &sd->zone_mgr, 0);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = IInternetZoneManager_CreateZoneEnumerator(sd->zone_mgr, &sd->zone_enumerator, &sd->num_zones, 0);
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* security_on_destroy [internal]
|
||||
*
|
||||
* handle WM_NCDESTROY
|
||||
*
|
||||
*/
|
||||
static INT_PTR security_on_destroy(secdlg_data * sd)
|
||||
{
|
||||
TRACE("(%p)\n", sd);
|
||||
|
||||
security_cleanup_zones(sd);
|
||||
SetWindowLongPtrW(sd->hsec, DWLP_USER, 0);
|
||||
heap_free(sd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* security_on_initdialog [internal]
|
||||
*
|
||||
* handle WM_INITDIALOG
|
||||
*
|
||||
*/
|
||||
static INT_PTR security_on_initdialog(HWND hsec)
|
||||
{
|
||||
secdlg_data *sd;
|
||||
HRESULT hr;
|
||||
|
||||
sd = heap_alloc_zero(sizeof(secdlg_data));
|
||||
SetWindowLongPtrW(hsec, DWLP_USER, (LONG_PTR) sd);
|
||||
if (!sd) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sd->hsec = hsec;
|
||||
sd->hlv = GetDlgItem(hsec, IDC_SEC_LISTVIEW);
|
||||
|
||||
hr = security_enum_zones(sd);
|
||||
if (FAILED(hr)) {
|
||||
ERR("got 0x%x\n", hr);
|
||||
security_on_destroy(sd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TRACE("found %d zones\n", sd->num_zones);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* security_on_notify [internal]
|
||||
*
|
||||
* handle WM_NOTIFY
|
||||
*
|
||||
*/
|
||||
static INT_PTR security_on_notify(WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
NMLISTVIEW *nm;
|
||||
|
||||
nm = (NMLISTVIEW *) lparam;
|
||||
switch (nm->hdr.code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
TRACE("PSN_APPLY (0x%lx, 0x%lx) from %p with code: %d\n", wparam, lparam,
|
||||
nm->hdr.hwndFrom, nm->hdr.code);
|
||||
break;
|
||||
|
||||
default:
|
||||
TRACE("WM_NOTIFY (0x%lx, 0x%lx) from %p with code: %d\n", wparam, lparam,
|
||||
nm->hdr.hwndFrom, nm->hdr.code);
|
||||
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* security_dlgproc [internal]
|
||||
*
|
||||
*/
|
||||
INT_PTR CALLBACK security_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
secdlg_data *sd;
|
||||
|
||||
if (msg == WM_INITDIALOG) {
|
||||
return security_on_initdialog(hwnd);
|
||||
}
|
||||
|
||||
sd = (secdlg_data *)GetWindowLongPtrW(hwnd, DWLP_USER);
|
||||
if (sd) {
|
||||
switch (msg)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
return security_on_notify(wparam, lparam);
|
||||
|
||||
case WM_NCDESTROY:
|
||||
return security_on_destroy(sd);
|
||||
|
||||
default:
|
||||
/* do not flood the log */
|
||||
if ((msg == WM_SETCURSOR) || (msg == WM_NCHITTEST) ||
|
||||
(msg == WM_MOUSEMOVE) || (msg == WM_MOUSEACTIVATE) || (msg == WM_PARENTNOTIFY))
|
||||
return FALSE;
|
||||
|
||||
TRACE("(%p, 0x%08x/%03d, 0x%08lx, 0x%08lx)\n", hwnd, msg, msg, wparam, lparam);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
Loading…
Reference in New Issue