ReactOS 0.4.17-dev-573-g8315b8c
sec_mgr.c File Reference
#include <stdio.h>
#include "urlmon_main.h"
#include "winreg.h"
#include "wininet.h"
#include "shlwapi.h"
#include "wine/debug.h"
Include dependency graph for sec_mgr.c:

Go to the source code of this file.

Classes

struct  SecManagerImpl
 
struct  ZoneMgrImpl
 

Macros

#define NO_SHLWAPI_REG
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (urlmon)
 
static BOOL is_drive_path (const WCHAR *path)
 
static BOOL is_hierarchical_scheme (URL_SCHEME type)
 
static void get_string_from_reg (HKEY hcu, HKEY hklm, LPCWSTR name, LPWSTR out, DWORD maxlen)
 
static void get_dword_from_reg (HKEY hcu, HKEY hklm, LPCWSTR name, LPDWORD out)
 
static HRESULT get_zone_from_reg (LPCWSTR schema, DWORD *zone)
 
static BOOL matches_domain_pattern (LPCWSTR pattern, LPCWSTR str, BOOL implicit_wildcard, LPCWSTR *matched)
 
static BOOL get_zone_for_scheme (HKEY key, LPCWSTR schema, DWORD *zone)
 
static HRESULT search_domain_for_zone (HKEY domains, LPCWSTR domain, DWORD domain_len, LPCWSTR schema, LPCWSTR host, DWORD host_len, DWORD *zone)
 
static HRESULT search_for_domain_mapping (HKEY domains, LPCWSTR schema, LPCWSTR host, DWORD host_len, DWORD *zone)
 
static HRESULT get_zone_from_domains (IUri *uri, DWORD *zone)
 
static HRESULT map_security_uri_to_zone (IUri *uri, DWORD *zone)
 
static HRESULT map_url_to_zone (LPCWSTR url, DWORD *zone, LPWSTR *ret_url)
 
static HRESULT map_uri_to_zone (IUri *uri, DWORD *zone, IUri **ret_uri)
 
static HRESULT open_zone_key (HKEY parent_key, DWORD zone, HKEY *hkey)
 
static HRESULT get_action_policy (DWORD zone, DWORD action, BYTE *policy, DWORD size, URLZONEREG zone_reg)
 
static HRESULT generate_security_id (IUri *uri, BYTE *secid, DWORD *secid_len, DWORD zone)
 
static HRESULT get_security_id_for_url (LPCWSTR url, BYTE *secid, DWORD *secid_len)
 
static HRESULT get_security_id_for_uri (IUri *uri, BYTE *secid, DWORD *secid_len)
 
static SecManagerImplimpl_from_IInternetSecurityManagerEx2 (IInternetSecurityManagerEx2 *iface)
 
static HRESULT WINAPI SecManagerImpl_QueryInterface (IInternetSecurityManagerEx2 *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI SecManagerImpl_AddRef (IInternetSecurityManagerEx2 *iface)
 
static ULONG WINAPI SecManagerImpl_Release (IInternetSecurityManagerEx2 *iface)
 
static HRESULT WINAPI SecManagerImpl_SetSecuritySite (IInternetSecurityManagerEx2 *iface, IInternetSecurityMgrSite *pSite)
 
static HRESULT WINAPI SecManagerImpl_GetSecuritySite (IInternetSecurityManagerEx2 *iface, IInternetSecurityMgrSite **ppSite)
 
static HRESULT WINAPI SecManagerImpl_MapUrlToZone (IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, DWORD *pdwZone, DWORD dwFlags)
 
static HRESULT WINAPI SecManagerImpl_GetSecurityId (IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
 
static HRESULT WINAPI SecManagerImpl_ProcessUrlAction (IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
 
static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy (IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
 
static HRESULT WINAPI SecManagerImpl_SetZoneMapping (IInternetSecurityManagerEx2 *iface, DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags)
 
static HRESULT WINAPI SecManagerImpl_GetZoneMappings (IInternetSecurityManagerEx2 *iface, DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
 
static HRESULT WINAPI SecManagerImpl_ProcessUrlActionEx (IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved, DWORD *pdwOutFlags)
 
static HRESULT WINAPI SecManagerImpl_MapUrlToZoneEx2 (IInternetSecurityManagerEx2 *iface, IUri *pUri, DWORD *pdwZone, DWORD dwFlags, LPWSTR *ppwszMappedUrl, DWORD *pdwOutFlags)
 
static HRESULT WINAPI SecManagerImpl_ProcessUrlActionEx2 (IInternetSecurityManagerEx2 *iface, IUri *pUri, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD_PTR dwReserved, DWORD *pdwOutFlags)
 
static HRESULT WINAPI SecManagerImpl_GetSecurityIdEx2 (IInternetSecurityManagerEx2 *iface, IUri *pUri, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
 
static HRESULT WINAPI SecManagerImpl_QueryCustomPolicyEx2 (IInternetSecurityManagerEx2 *iface, IUri *pUri, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD_PTR dwReserved)
 
HRESULT SecManagerImpl_Construct (IUnknown *pUnkOuter, LPVOID *ppobj)
 
static ZoneMgrImplimpl_from_IInternetZoneManagerEx2 (IInternetZoneManagerEx2 *iface)
 
static LPDWORD build_zonemap_from_reg (void)
 
static HRESULT WINAPI ZoneMgrImpl_QueryInterface (IInternetZoneManagerEx2 *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI ZoneMgrImpl_AddRef (IInternetZoneManagerEx2 *iface)
 
static ULONG WINAPI ZoneMgrImpl_Release (IInternetZoneManagerEx2 *iface)
 
static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributes (IInternetZoneManagerEx2 *iface, DWORD dwZone, ZONEATTRIBUTES *pZoneAttributes)
 
static HRESULT WINAPI ZoneMgrImpl_SetZoneAttributes (IInternetZoneManagerEx2 *iface, DWORD dwZone, ZONEATTRIBUTES *pZoneAttributes)
 
static HRESULT WINAPI ZoneMgrImpl_GetZoneCustomPolicy (IInternetZoneManagerEx2 *iface, DWORD dwZone, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, URLZONEREG ulrZoneReg)
 
static HRESULT WINAPI ZoneMgrImpl_SetZoneCustomPolicy (IInternetZoneManagerEx2 *iface, DWORD dwZone, REFGUID guidKey, BYTE *ppPolicy, DWORD cbPolicy, URLZONEREG ulrZoneReg)
 
static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicy (IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg)
 
static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicy (IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg)
 
static HRESULT WINAPI ZoneMgrImpl_PromptAction (IInternetZoneManagerEx2 *iface, DWORD dwAction, HWND hwndParent, LPCWSTR pwszUrl, LPCWSTR pwszText, DWORD dwPromptFlags)
 
static HRESULT WINAPI ZoneMgrImpl_LogAction (IInternetZoneManagerEx2 *iface, DWORD dwAction, LPCWSTR pwszUrl, LPCWSTR pwszText, DWORD dwLogFlags)
 
static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator (IInternetZoneManagerEx2 *iface, DWORD *pdwEnum, DWORD *pdwCount, DWORD dwFlags)
 
static HRESULT WINAPI ZoneMgrImpl_GetZoneAt (IInternetZoneManagerEx2 *iface, DWORD dwEnum, DWORD dwIndex, DWORD *pdwZone)
 
static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator (IInternetZoneManagerEx2 *iface, DWORD dwEnum)
 
static HRESULT WINAPI ZoneMgrImpl_CopyTemplatePoliciesToZone (IInternetZoneManagerEx2 *iface, DWORD dwTemplate, DWORD dwZone, DWORD dwReserved)
 
static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicyEx (IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg, DWORD dwFlags)
 
static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicyEx (IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg, DWORD dwFlags)
 
static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributesEx (IInternetZoneManagerEx2 *iface, DWORD dwZone, ZONEATTRIBUTES *pZoneAttributes, DWORD dwFlags)
 
static HRESULT WINAPI ZoneMgrImpl_GetZoneSecurityState (IInternetZoneManagerEx2 *iface, DWORD dwZoneIndex, BOOL fRespectPolicy, LPDWORD pdwState, BOOL *pfPolicyEncountered)
 
static HRESULT WINAPI ZoneMgrImpl_GetIESecurityState (IInternetZoneManagerEx2 *iface, BOOL fRespectPolicy, LPDWORD pdwState, BOOL *pfPolicyEncountered, BOOL fNoCache)
 
static HRESULT WINAPI ZoneMgrImpl_FixInsecureSettings (IInternetZoneManagerEx2 *iface)
 
HRESULT ZoneMgrImpl_Construct (IUnknown *pUnkOuter, LPVOID *ppobj)
 
HRESULT WINAPI CoInternetCreateSecurityManager (IServiceProvider *pSP, IInternetSecurityManager **ppSM, DWORD dwReserved)
 
HRESULT WINAPI CoInternetCreateZoneManager (IServiceProvider *pSP, IInternetZoneManager **ppZM, DWORD dwReserved)
 
static HRESULT parse_security_url (const WCHAR *url, PSUACTION action, WCHAR **result)
 
HRESULT WINAPI CoInternetGetSecurityUrl (LPCWSTR pwzUrl, LPWSTR *ppwzSecUrl, PSUACTION psuAction, DWORD dwReserved)
 
HRESULT WINAPI CoInternetGetSecurityUrlEx (IUri *pUri, IUri **ppSecUri, PSUACTION psuAction, DWORD_PTR dwReserved)
 
HRESULT WINAPI CompareSecurityIds (BYTE *secid1, DWORD size1, BYTE *secid2, DWORD size2, DWORD reserved)
 
BOOL WINAPI IsInternetESCEnabledLocal (void)
 

Variables

static const WCHAR wszZonesKey []
 
static const WCHAR zone_map_keyW []
 
static const WCHAR wszZoneMapDomainsKey []
 
static const IInternetSecurityManagerEx2Vtbl VT_SecManagerImpl
 
static const IInternetZoneManagerEx2Vtbl ZoneMgrImplVtbl
 

Macro Definition Documentation

◆ NO_SHLWAPI_REG

#define NO_SHLWAPI_REG

Definition at line 30 of file sec_mgr.c.

Function Documentation

◆ build_zonemap_from_reg()

static LPDWORD build_zonemap_from_reg ( void  )
static

Definition at line 1250 of file sec_mgr.c.

1251{
1252 WCHAR name[32];
1253 HKEY hkey;
1254 LPDWORD data = NULL;
1255 DWORD allocated = 6; /* space for the zonecount and Zone "0" up to Zone "4" */
1256 DWORD used = 0;
1257 DWORD res;
1258 DWORD len;
1259
1260
1262 if (res)
1263 return NULL;
1264
1265 data = malloc(allocated * sizeof(DWORD));
1266 if (!data)
1267 goto cleanup;
1268
1269 while (!res) {
1270 name[0] = '\0';
1271 len = ARRAY_SIZE(name);
1272 res = RegEnumKeyExW(hkey, used, name, &len, NULL, NULL, NULL, NULL);
1273
1274 if (!res) {
1275 used++;
1276 if (used == allocated) {
1277 LPDWORD new_data;
1278
1279 allocated *= 2;
1280 new_data = realloc(data, allocated * sizeof(DWORD));
1281 if (!new_data)
1282 goto cleanup;
1283
1284 data = new_data;
1285 }
1286 data[used] = wcstol(name, NULL, 10);
1287 }
1288 }
1289 if (used) {
1290 RegCloseKey(hkey);
1291 data[0] = used;
1292 return data;
1293 }
1294
1295cleanup:
1296 /* something failed */
1297 RegCloseKey(hkey);
1298 free(data);
1299 return NULL;
1300}
static int used
Definition: adh-main.c:39
#define ARRAY_SIZE(A)
Definition: main.h:20
#define RegCloseKey(hKey)
Definition: registry.h:49
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
static void cleanup(void)
Definition: main.c:1335
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
static const WCHAR wszZonesKey[]
Definition: sec_mgr.c:36
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722
short WCHAR
Definition: pedump.c:58
Definition: name.c:39
uint32_t * LPDWORD
Definition: typedefs.h:59
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by ZoneMgrImpl_CreateZoneEnumerator().

◆ CoInternetCreateSecurityManager()

HRESULT WINAPI CoInternetCreateSecurityManager ( IServiceProvider pSP,
IInternetSecurityManager **  ppSM,
DWORD  dwReserved 
)

Definition at line 1799 of file sec_mgr.c.

1801{
1802 TRACE("%p %p %ld\n", pSP, ppSM, dwReserved );
1803
1804 if(pSP)
1805 FIXME("pSP not supported\n");
1806
1807 return SecManagerImpl_Construct(NULL, (void**) ppSM);
1808}
#define FIXME(fmt,...)
Definition: precomp.h:53
HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
Definition: sec_mgr.c:1206
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by HTMLOuterWindow_Create(), and security_enum_zones().

◆ CoInternetCreateZoneManager()

HRESULT WINAPI CoInternetCreateZoneManager ( IServiceProvider pSP,
IInternetZoneManager **  ppZM,
DWORD  dwReserved 
)

Definition at line 1813 of file sec_mgr.c.

1814{
1815 TRACE("(%p %p %lx)\n", pSP, ppZM, dwReserved);
1816 return ZoneMgrImpl_Construct(NULL, (void**)ppZM);
1817}
HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
Definition: sec_mgr.c:1781

Referenced by security_enum_zones().

◆ CoInternetGetSecurityUrl()

HRESULT WINAPI CoInternetGetSecurityUrl ( LPCWSTR  pwzUrl,
LPWSTR ppwzSecUrl,
PSUACTION  psuAction,
DWORD  dwReserved 
)

Definition at line 1935 of file sec_mgr.c.

1936{
1937 WCHAR *secure_url;
1938 HRESULT hres;
1939
1940 TRACE("(%p,%p,%u,%lu)\n", pwzUrl, ppwzSecUrl, psuAction, dwReserved);
1941
1942 hres = parse_security_url(pwzUrl, psuAction, &secure_url);
1943 if(FAILED(hres))
1944 return hres;
1945
1946 if(psuAction != PSU_SECURITY_URL_ONLY) {
1947 PARSEDURLW parsed_url = { sizeof(parsed_url) };
1948 DWORD size;
1949
1950 /* FIXME: Use helpers from uri.c */
1951 if(SUCCEEDED(ParseURLW(secure_url, &parsed_url))) {
1952 WCHAR *new_url;
1953
1954 switch(parsed_url.nScheme) {
1955 case URL_SCHEME_FTP:
1956 case URL_SCHEME_HTTP:
1957 case URL_SCHEME_HTTPS:
1958 size = lstrlenW(secure_url)+1;
1959 new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
1960 if(new_url)
1962 else
1964 CoTaskMemFree(secure_url);
1965 if(hres != S_OK) {
1966 WARN("UrlGetPart failed: %08lx\n", hres);
1967 CoTaskMemFree(new_url);
1968 return FAILED(hres) ? hres : E_FAIL;
1969 }
1970 secure_url = new_url;
1971 }
1972 }
1973 }
1974
1975 *ppwzSecUrl = secure_url;
1976 return S_OK;
1977}
#define WARN(fmt,...)
Definition: precomp.h:61
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define lstrlenW
Definition: compat.h:750
HRESULT WINAPI ParseURLW(const WCHAR *url, PARSEDURLW *result)
Definition: path.c:2807
HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD part, DWORD flags)
Definition: path.c:4628
static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **result)
Definition: sec_mgr.c:1819
GLsizeiptr size
Definition: glext.h:5919
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
@ URL_SCHEME_HTTPS
Definition: shlwapi.h:555
@ URL_SCHEME_FTP
Definition: shlwapi.h:545
@ URL_SCHEME_HTTP
Definition: shlwapi.h:546
@ URL_PART_HOSTNAME
Definition: shlwapi.h:587
#define URL_PARTFLAG_KEEPSCHEME
Definition: shlwapi.h:594

Referenced by map_url_to_zone().

◆ CoInternetGetSecurityUrlEx()

HRESULT WINAPI CoInternetGetSecurityUrlEx ( IUri pUri,
IUri **  ppSecUri,
PSUACTION  psuAction,
DWORD_PTR  dwReserved 
)

Definition at line 1982 of file sec_mgr.c.

1983{
1984 URL_SCHEME scheme_type;
1985 BSTR secure_uri;
1986 WCHAR *ret_url;
1987 HRESULT hres;
1988
1989 TRACE("(%p,%p,%u,%Iu)\n", pUri, ppSecUri, psuAction, dwReserved);
1990
1991 if(!pUri || !ppSecUri)
1992 return E_INVALIDARG;
1993
1994 hres = IUri_GetDisplayUri(pUri, &secure_uri);
1995 if(FAILED(hres))
1996 return hres;
1997
1998 hres = parse_security_url(secure_uri, psuAction, &ret_url);
1999 SysFreeString(secure_uri);
2000 if(FAILED(hres))
2001 return hres;
2002
2003 /* File URIs have to hierarchical. */
2004 hres = IUri_GetScheme(pUri, (DWORD*)&scheme_type);
2005 if(SUCCEEDED(hres) && scheme_type == URL_SCHEME_FILE) {
2006 const WCHAR *tmp = ret_url;
2007
2008 /* Check and see if a "//" is after the scheme name. */
2009 tmp += ARRAY_SIZE(L"file");
2010 if(*tmp != '/' || *(tmp+1) != '/')
2012 }
2013
2014 if(SUCCEEDED(hres))
2015 hres = CreateUri(ret_url, Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, 0, ppSecUri);
2016 CoTaskMemFree(ret_url);
2017 return hres;
2018}
#define E_INVALIDARG
Definition: ddrawi.h:101
OLECHAR * BSTR
Definition: compat.h:2293
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5382
#define L(x)
Definition: resources.c:13
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:273
URL_SCHEME
Definition: shlwapi.h:542
@ URL_SCHEME_FILE
Definition: shlwapi.h:553

Referenced by map_uri_to_zone().

◆ CompareSecurityIds()

HRESULT WINAPI CompareSecurityIds ( BYTE secid1,
DWORD  size1,
BYTE secid2,
DWORD  size2,
DWORD  reserved 
)

Definition at line 2023 of file sec_mgr.c.

2024{
2025 FIXME("(%p %ld %p %ld %lx)\n", secid1, size1, secid2, size2, reserved);
2026 return E_NOTIMPL;
2027}
#define E_NOTIMPL
Definition: ddrawi.h:99
r reserved
Definition: btrfs.c:3006
static const BYTE secid2[]
Definition: sec_mgr.c:121
static const BYTE secid1[]
Definition: sec_mgr.c:120

◆ generate_security_id()

static HRESULT generate_security_id ( IUri uri,
BYTE secid,
DWORD secid_len,
DWORD  zone 
)
static

Definition at line 679 of file sec_mgr.c.

680{
681 DWORD len;
683 DWORD scheme_type;
684
685 if(zone == URLZONE_INVALID)
686 return E_INVALIDARG;
687
688 hres = IUri_GetScheme(uri, &scheme_type);
689 if(FAILED(hres))
690 return hres;
691
692 /* Windows handles opaque URLs differently then hierarchical ones. */
693 if(!is_hierarchical_scheme(scheme_type) && scheme_type != URL_SCHEME_WILDCARD) {
694 BSTR display_uri;
695
696 hres = IUri_GetDisplayUri(uri, &display_uri);
697 if(FAILED(hres))
698 return hres;
699
700 len = WideCharToMultiByte(CP_ACP, 0, display_uri, -1, NULL, 0, NULL, NULL)-1;
701
702 if(len+sizeof(DWORD) > *secid_len) {
703 SysFreeString(display_uri);
705 }
706
707 WideCharToMultiByte(CP_ACP, 0, display_uri, -1, (LPSTR)secid, len, NULL, NULL);
708 SysFreeString(display_uri);
709
710 *(DWORD*)(secid+len) = zone;
711 } else {
713 DWORD host_len, scheme_len;
714 BYTE *ptr;
715
716 hres = IUri_GetHost(uri, &host);
717 if(FAILED(hres))
718 return hres;
719
720 /* The host can't be empty for Wildcard URIs. */
721 if(scheme_type == URL_SCHEME_WILDCARD && !*host) {
723 return E_INVALIDARG;
724 }
725
726 hres = IUri_GetSchemeName(uri, &scheme);
727 if(FAILED(hres)) {
729 return hres;
730 }
731
732 host_len = WideCharToMultiByte(CP_ACP, 0, host, -1, NULL, 0, NULL, NULL)-1;
733 scheme_len = WideCharToMultiByte(CP_ACP, 0, scheme, -1, NULL, 0, NULL, NULL)-1;
734
735 len = host_len+scheme_len+sizeof(BYTE);
736
737 if(len+sizeof(DWORD) > *secid_len) {
741 }
742
745
746 ptr = secid+scheme_len;
747 *ptr++ = ':';
748
749 WideCharToMultiByte(CP_ACP, 0, host, -1, (LPSTR)ptr, host_len, NULL, NULL);
751
752 ptr += host_len;
753
754 *(DWORD*)ptr = zone;
755 }
756
757 *secid_len = len+sizeof(DWORD);
758
759 return S_OK;
760}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
static BOOL is_hierarchical_scheme(URL_SCHEME type)
Definition: sec_mgr.c:49
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * uri
Definition: sec_mgr.c:1564
DWORD zone
Definition: sec_mgr.c:1728
const BYTE * secid
Definition: sec_mgr.c:1730
#define DWORD
Definition: nt_native.h:44
@ URL_SCHEME_WILDCARD
Definition: shlwapi.h:570
DWORD scheme
Definition: txthost.c:37
char * LPSTR
Definition: typedefs.h:51
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:3437
unsigned char BYTE
Definition: xxhash.c:193

Referenced by get_security_id_for_uri(), and get_security_id_for_url().

◆ get_action_policy()

static HRESULT get_action_policy ( DWORD  zone,
DWORD  action,
BYTE policy,
DWORD  size,
URLZONEREG  zone_reg 
)
static

Definition at line 626 of file sec_mgr.c.

627{
628 HKEY parent_key;
629 HKEY hkey;
630 LONG res;
632
633 switch(action) {
634 case URLACTION_SCRIPT_OVERRIDE_SAFETY:
635 case URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY:
636 *(DWORD*)policy = URLPOLICY_DISALLOW;
637 return S_OK;
638 }
639
640 switch(zone_reg) {
641 case URLZONEREG_DEFAULT:
642 case URLZONEREG_HKCU:
643 parent_key = HKEY_CURRENT_USER;
644 break;
645 case URLZONEREG_HKLM:
646 parent_key = HKEY_LOCAL_MACHINE;
647 break;
648 default:
649 WARN("Unknown URLZONEREG: %d\n", zone_reg);
650 return E_FAIL;
651 };
652
653 hres = open_zone_key(parent_key, zone, &hkey);
654 if(SUCCEEDED(hres)) {
655 WCHAR action_str[16];
656 DWORD len = size;
657
658 wsprintfW(action_str, L"%X", action);
659
660 res = RegQueryValueExW(hkey, action_str, NULL, NULL, policy, &len);
661 if(res == ERROR_MORE_DATA) {
663 }else if(res == ERROR_FILE_NOT_FOUND) {
664 hres = E_FAIL;
665 }else if(res != ERROR_SUCCESS) {
666 ERR("RegQueryValue failed: %ld\n", res);
668 }
669
670 RegCloseKey(hkey);
671 }
672
673 if(FAILED(hres) && zone_reg == URLZONEREG_DEFAULT)
674 return get_action_policy(zone, action, policy, size, URLZONEREG_HKLM);
675
676 return hres;
677}
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:78
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
static HRESULT get_action_policy(DWORD zone, DWORD action, BYTE *policy, DWORD size, URLZONEREG zone_reg)
Definition: sec_mgr.c:626
static HRESULT open_zone_key(HKEY parent_key, DWORD zone, HKEY *hkey)
Definition: sec_mgr.c:609
action
Definition: namespace.c:707
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
long LONG
Definition: pedump.c:60
#define E_UNEXPECTED
Definition: winerror.h:3528
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by get_action_policy(), SecManagerImpl_ProcessUrlAction(), ZoneMgrImpl_GetZoneActionPolicy(), and ZoneMgrImpl_GetZoneActionPolicyEx().

◆ get_dword_from_reg()

static void get_dword_from_reg ( HKEY  hcu,
HKEY  hklm,
LPCWSTR  name,
LPDWORD  out 
)
static

Definition at line 89 of file sec_mgr.c.

90{
92 DWORD len = sizeof(DWORD);
93 DWORD res;
94
96
97 if (res && hklm) {
98 len = sizeof(DWORD);
100 res = RegQueryValueExW(hklm, name, NULL, &type, (LPBYTE) out, &len);
101 }
102
103 if (res) {
104 TRACE("%s failed: %ld\n", debugstr_w(name), res);
105 *out = 0;
106 }
107}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
#define REG_DWORD
Definition: sdbapi.c:615
unsigned char * LPBYTE
Definition: typedefs.h:53
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by ZoneMgrImpl_GetZoneAttributes().

◆ get_security_id_for_uri()

static HRESULT get_security_id_for_uri ( IUri uri,
BYTE secid,
DWORD secid_len 
)
static

Definition at line 784 of file sec_mgr.c.

785{
787 IUri *secur_uri;
788 DWORD zone = URLZONE_INVALID;
789
790 hres = map_uri_to_zone(uri, &zone, &secur_uri);
791 if(FAILED(hres))
792 return hres;
793
794 hres = generate_security_id(secur_uri, secid, secid_len, zone);
795 IUri_Release(secur_uri);
796
797 return hres;
798}
static HRESULT map_uri_to_zone(IUri *uri, DWORD *zone, IUri **ret_uri)
Definition: sec_mgr.c:591
static HRESULT generate_security_id(IUri *uri, BYTE *secid, DWORD *secid_len, DWORD zone)
Definition: sec_mgr.c:679

Referenced by SecManagerImpl_GetSecurityIdEx2().

◆ get_security_id_for_url()

static HRESULT get_security_id_for_url ( LPCWSTR  url,
BYTE secid,
DWORD secid_len 
)
static

Definition at line 762 of file sec_mgr.c.

763{
765 DWORD zone = URLZONE_INVALID;
766 LPWSTR secur_url = NULL;
767 IUri *uri;
768
769 hres = map_url_to_zone(url, &zone, &secur_url);
770 if(FAILED(hres))
771 return hres == 0x80041001 ? E_INVALIDARG : hres;
772
773 hres = CreateUri(secur_url, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, &uri);
774 CoTaskMemFree(secur_url);
775 if(FAILED(hres))
776 return hres;
777
778 hres = generate_security_id(uri, secid, secid_len, zone);
779 IUri_Release(uri);
780
781 return hres;
782}
static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url)
Definition: sec_mgr.c:555
static const WCHAR url[]
Definition: encode.c:1384
uint16_t * LPWSTR
Definition: typedefs.h:56

Referenced by SecManagerImpl_GetSecurityId().

◆ get_string_from_reg()

static void get_string_from_reg ( HKEY  hcu,
HKEY  hklm,
LPCWSTR  name,
LPWSTR  out,
DWORD  maxlen 
)
static

Definition at line 63 of file sec_mgr.c.

64{
66 DWORD len = maxlen * sizeof(WCHAR);
67 DWORD res;
68
70
71 if (res && hklm) {
72 len = maxlen * sizeof(WCHAR);
73 type = REG_SZ;
74 res = RegQueryValueExW(hklm, name, NULL, &type, (LPBYTE) out, &len);
75 }
76
77 if (res) {
78 TRACE("%s failed: %ld\n", debugstr_w(name), res);
79 *out = '\0';
80 }
81}
#define REG_SZ
Definition: layer.c:22

Referenced by ZoneMgrImpl_GetZoneAttributes().

◆ get_zone_for_scheme()

static BOOL get_zone_for_scheme ( HKEY  key,
LPCWSTR  schema,
DWORD zone 
)
static

Definition at line 234 of file sec_mgr.c.

235{
236 DWORD res;
237 DWORD size = sizeof(DWORD);
238 DWORD type;
239
240 /* See if the key contains a value for the scheme first. */
242 if(res == ERROR_SUCCESS) {
243 if(type == REG_DWORD)
244 return TRUE;
245 WARN("Unexpected value type %ld for value %s, expected REG_DWORD\n", type, debugstr_w(schema));
246 }
247
248 /* Try to get the zone for the wildcard scheme. */
249 size = sizeof(DWORD);
250 res = RegQueryValueExW(key, L"*", NULL, &type, (BYTE*)zone, &size);
251 if(res != ERROR_SUCCESS)
252 return FALSE;
253
254 if(type != REG_DWORD) {
255 WARN("Unexpected value type %ld for value %s, expected REG_DWORD\n", type, debugstr_w(L"*"));
256 return FALSE;
257 }
258
259 return TRUE;
260}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const WCHAR * schema
Definition: copy.c:22

Referenced by search_domain_for_zone().

◆ get_zone_from_domains()

static HRESULT get_zone_from_domains ( IUri uri,
DWORD zone 
)
static

Definition at line 425 of file sec_mgr.c.

426{
429 DWORD res;
430 HKEY domains;
431 DWORD scheme_type;
432
433 hres = IUri_GetScheme(uri, &scheme_type);
434 if(FAILED(hres))
435 return hres;
436
437 /* Windows doesn't play nice with unknown scheme types when it tries
438 * to check if a host name maps into any domains.
439 */
440 if(scheme_type == URL_SCHEME_UNKNOWN)
441 return S_FALSE;
442
443 hres = IUri_GetHost(uri, &host);
444 if(FAILED(hres))
445 return hres;
446
447 /* Known hierarchical scheme types must have a host. If they don't Windows
448 * assigns URLZONE_INVALID to the zone.
449 */
450 if((scheme_type != URL_SCHEME_UNKNOWN && scheme_type != URL_SCHEME_FILE)
451 && is_hierarchical_scheme(scheme_type) && !*host) {
452 *zone = URLZONE_INVALID;
453
455
456 /* The MapUrlToZone functions return S_OK when this condition occurs. */
457 return S_OK;
458 }
459
460 hres = IUri_GetSchemeName(uri, &scheme);
461 if(FAILED(hres)) {
463 return hres;
464 }
465
466 /* First try CURRENT_USER. */
468 if(res == ERROR_SUCCESS) {
470 RegCloseKey(domains);
471 } else
472 WARN("Failed to open HKCU's %s key\n", debugstr_w(wszZoneMapDomainsKey));
473
474 /* If that doesn't work try LOCAL_MACHINE. */
475 if(hres == S_FALSE) {
477 if(res == ERROR_SUCCESS) {
479 RegCloseKey(domains);
480 } else
481 WARN("Failed to open HKLM's %s key\n", debugstr_w(wszZoneMapDomainsKey));
482 }
483
486 return hres;
487}
static const WCHAR wszZoneMapDomainsKey[]
Definition: sec_mgr.c:40
static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR host, DWORD host_len, DWORD *zone)
Definition: sec_mgr.c:386
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:198
@ URL_SCHEME_UNKNOWN
Definition: shlwapi.h:544
#define S_FALSE
Definition: winerror.h:3451

Referenced by map_security_uri_to_zone().

◆ get_zone_from_reg()

static HRESULT get_zone_from_reg ( LPCWSTR  schema,
DWORD zone 
)
static

Definition at line 109 of file sec_mgr.c.

110{
111 DWORD res, size;
112 HKEY hkey;
113
114 static const WCHAR wszZoneMapProtocolKey[] =
115 L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\ProtocolDefaults";
116
117 res = RegOpenKeyW(HKEY_CURRENT_USER, wszZoneMapProtocolKey, &hkey);
118 if(res != ERROR_SUCCESS) {
119 ERR("Could not open key %s\n", debugstr_w(wszZoneMapProtocolKey));
120 return E_UNEXPECTED;
121 }
122
123 size = sizeof(DWORD);
125 RegCloseKey(hkey);
126 if(res == ERROR_SUCCESS)
127 return S_OK;
128
129 res = RegOpenKeyW(HKEY_LOCAL_MACHINE, wszZoneMapProtocolKey, &hkey);
130 if(res != ERROR_SUCCESS) {
131 ERR("Could not open key %s\n", debugstr_w(wszZoneMapProtocolKey));
132 return E_UNEXPECTED;
133 }
134
135 size = sizeof(DWORD);
137 RegCloseKey(hkey);
138 if(res == ERROR_SUCCESS)
139 return S_OK;
140
141 *zone = 3;
142 return S_OK;
143}
BYTE * PBYTE
Definition: pedump.c:66

Referenced by map_security_uri_to_zone().

◆ impl_from_IInternetSecurityManagerEx2()

◆ impl_from_IInternetZoneManagerEx2()

static ZoneMgrImpl * impl_from_IInternetZoneManagerEx2 ( IInternetZoneManagerEx2 *  iface)
inlinestatic

◆ is_drive_path()

static BOOL is_drive_path ( const WCHAR path)
inlinestatic

Definition at line 43 of file sec_mgr.c.

44{
45 return iswalpha(*path) && *(path+1) == ':';
46}
#define iswalpha(_c)
Definition: ctype.h:664

Referenced by map_security_uri_to_zone().

◆ is_hierarchical_scheme()

static BOOL is_hierarchical_scheme ( URL_SCHEME  type)
inlinestatic

Definition at line 49 of file sec_mgr.c.

49 {
50 return(type == URL_SCHEME_HTTP || type == URL_SCHEME_FTP ||
55}
@ URL_SCHEME_TELNET
Definition: shlwapi.h:551
@ URL_SCHEME_WAIS
Definition: shlwapi.h:552
@ URL_SCHEME_RES
Definition: shlwapi.h:562
@ URL_SCHEME_NNTP
Definition: shlwapi.h:550
@ URL_SCHEME_GOPHER
Definition: shlwapi.h:547

Referenced by generate_security_id(), and get_zone_from_domains().

◆ IsInternetESCEnabledLocal()

BOOL WINAPI IsInternetESCEnabledLocal ( void  )

Definition at line 2034 of file sec_mgr.c.

2035{
2036 static BOOL esc_initialized, esc_enabled;
2037
2038 TRACE("()\n");
2039
2040 if(!esc_initialized) {
2041 DWORD type, size, val;
2042 HKEY zone_map;
2043
2045 size = sizeof(DWORD);
2046 if(RegQueryValueExW(zone_map, L"IEHarden", NULL, &type, (BYTE*)&val, &size) == ERROR_SUCCESS)
2047 esc_enabled = type == REG_DWORD && val != 0;
2048 RegCloseKey(zone_map);
2049 }
2050 esc_initialized = TRUE;
2051 }
2052
2053 return esc_enabled;
2054}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
static const WCHAR zone_map_keyW[]
Definition: sec_mgr.c:38
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLfloat * val
Definition: glext.h:7180
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019

◆ map_security_uri_to_zone()

static HRESULT map_security_uri_to_zone ( IUri uri,
DWORD zone 
)
static

Definition at line 489 of file sec_mgr.c.

490{
492 BSTR scheme;
493
494 *zone = URLZONE_INVALID;
495
496 hres = IUri_GetSchemeName(uri, &scheme);
497 if(FAILED(hres))
498 return hres;
499
500 if(!wcsicmp(scheme, L"file")) {
501 BSTR path;
502 WCHAR *ptr, *path_start, root[20];
503
504 hres = IUri_GetPath(uri, &path);
505 if(FAILED(hres)) {
507 return hres;
508 }
509
510 if(*path == '/' && is_drive_path(path+1))
511 path_start = path+1;
512 else
513 path_start = path;
514
515 if((ptr = wcschr(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
516 UINT type;
517
518 memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
519 root[ptr-path_start+1] = 0;
520
522
523 switch(type) {
524 case DRIVE_UNKNOWN:
526 break;
527 case DRIVE_REMOVABLE:
528 case DRIVE_FIXED:
529 case DRIVE_CDROM:
530 case DRIVE_RAMDISK:
531 *zone = URLZONE_LOCAL_MACHINE;
532 hres = S_OK;
533 break;
534 case DRIVE_REMOTE:
535 *zone = URLZONE_INTERNET;
536 hres = S_OK;
537 break;
538 default:
539 FIXME("unsupported drive type %d\n", type);
540 }
541 }
543 }
544
545 if(*zone == URLZONE_INVALID) {
547 if(hres == S_FALSE)
549 }
550
552 return hres;
553}
#define wcschr
Definition: compat.h:17
#define wcsicmp
Definition: compat.h:15
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
static HRESULT get_zone_from_domains(IUri *uri, DWORD *zone)
Definition: sec_mgr.c:425
static BOOL is_drive_path(const WCHAR *path)
Definition: sec_mgr.c:43
static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone)
Definition: sec_mgr.c:109
unsigned int UINT
Definition: sysinfo.c:13
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DRIVE_UNKNOWN
Definition: winbase.h:281
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:282
#define DRIVE_REMOTE
Definition: winbase.h:278
#define DRIVE_RAMDISK
Definition: winbase.h:280
#define DRIVE_CDROM
Definition: winbase.h:279
#define DRIVE_FIXED
Definition: winbase.h:277
#define DRIVE_REMOVABLE
Definition: winbase.h:276

Referenced by map_uri_to_zone(), and map_url_to_zone().

◆ map_uri_to_zone()

static HRESULT map_uri_to_zone ( IUri uri,
DWORD zone,
IUri **  ret_uri 
)
static

Definition at line 591 of file sec_mgr.c.

592{
594 IUri *secur_uri;
595
596 hres = CoInternetGetSecurityUrlEx(uri, &secur_uri, PSU_SECURITY_URL_ONLY, 0);
597 if(FAILED(hres))
598 return hres;
599
600 hres = map_security_uri_to_zone(secur_uri, zone);
601 if(FAILED(hres) || !ret_uri)
602 IUri_Release(secur_uri);
603 else
604 *ret_uri = secur_uri;
605
606 return hres;
607}
static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
Definition: sec_mgr.c:489
HRESULT WINAPI CoInternetGetSecurityUrlEx(IUri *pUri, IUri **ppSecUri, PSUACTION psuAction, DWORD_PTR dwReserved)
Definition: sec_mgr.c:1982

Referenced by get_security_id_for_uri(), and SecManagerImpl_MapUrlToZoneEx2().

◆ map_url_to_zone()

static HRESULT map_url_to_zone ( LPCWSTR  url,
DWORD zone,
LPWSTR ret_url 
)
static

Definition at line 555 of file sec_mgr.c.

556{
557 IUri *secur_uri;
558 LPWSTR secur_url;
560
561 *zone = URLZONE_INVALID;
562
563 hres = CoInternetGetSecurityUrl(url, &secur_url, PSU_SECURITY_URL_ONLY, 0);
564 if(hres != S_OK) {
565 DWORD size = lstrlenW(url)*sizeof(WCHAR);
566
567 secur_url = CoTaskMemAlloc(size);
568 if(!secur_url)
569 return E_OUTOFMEMORY;
570
571 memcpy(secur_url, url, size);
572 }
573
574 hres = CreateUri(secur_url, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, &secur_uri);
575 if(FAILED(hres)) {
576 CoTaskMemFree(secur_url);
577 return hres;
578 }
579
580 hres = map_security_uri_to_zone(secur_uri, zone);
581 IUri_Release(secur_uri);
582
583 if(FAILED(hres) || !ret_url)
584 CoTaskMemFree(secur_url);
585 else
586 *ret_url = secur_url;
587
588 return hres;
589}
HRESULT WINAPI CoInternetGetSecurityUrl(LPCWSTR pwzUrl, LPWSTR *ppwzSecUrl, PSUACTION psuAction, DWORD dwReserved)
Definition: sec_mgr.c:1935

Referenced by get_security_id_for_url(), SecManagerImpl_MapUrlToZone(), and SecManagerImpl_ProcessUrlAction().

◆ matches_domain_pattern()

static BOOL matches_domain_pattern ( LPCWSTR  pattern,
LPCWSTR  str,
BOOL  implicit_wildcard,
LPCWSTR matched 
)
static

Definition at line 155 of file sec_mgr.c.

156{
158 DWORD pattern_len = lstrlenW(pattern);
160
161 TRACE("(%d) Checking if %s matches %s\n", implicit_wildcard, debugstr_w(str), debugstr_w(pattern));
162
163 *matched = NULL;
164 if(str_len >= pattern_len) {
165 /* Check if there's an explicit wildcard in the pattern. */
166 if(pattern[0] == '*' && pattern[1] == '.') {
167 /* Make sure that 'str' matches the wildcard pattern.
168 *
169 * Example:
170 * pattern = "*.google.com"
171 *
172 * So in this case 'str' would have to end with ".google.com" in order
173 * to map to this pattern.
174 */
175 if(str_len >= pattern_len+1 && !wcsicmp(str+(str_len-pattern_len+1), pattern+1)) {
176 /* Check if there's another '.' inside of the "unmatched" portion
177 * of 'str'.
178 *
179 * Example:
180 * pattern = "*.google.com"
181 * str = "test.testing.google.com"
182 *
183 * The currently matched portion is ".google.com" in 'str', we need
184 * see if there's a '.' inside of the unmatched portion ("test.testing"), because
185 * if there is and 'implicit_wildcard' isn't set, then this isn't
186 * a match.
187 */
188 const WCHAR *ptr;
189 for (ptr = str + str_len - pattern_len; ptr > str; ptr--) if (ptr[-1] == '.') break;
190 if (ptr == str || implicit_wildcard) {
191 matches = TRUE;
192 *matched = ptr;
193 }
194 }
195 } else if(implicit_wildcard && str_len > pattern_len) {
196 /* When the pattern has an implicit wildcard component, it means
197 * that anything goes in 'str' as long as it ends with the pattern
198 * and that the beginning of the match has a '.' before it.
199 *
200 * Example:
201 * pattern = "google.com"
202 * str = "www.google.com"
203 *
204 * Implicitly matches the pattern, where as:
205 *
206 * pattern = "google.com"
207 * str = "wwwgoogle.com"
208 *
209 * Doesn't match the pattern.
210 */
211 if(str[str_len-pattern_len-1] == '.' && !wcsicmp(str+(str_len-pattern_len), pattern)) {
212 matches = TRUE;
213 *matched = str+(str_len-pattern_len);
214 }
215 } else {
216 /* The pattern doesn't have an implicit wildcard, or an explicit wildcard,
217 * so 'str' has to be an exact match to the 'pattern'.
218 */
219 if(!wcsicmp(str, pattern)) {
220 matches = TRUE;
221 *matched = str;
222 }
223 }
224 }
225
226 if(matches)
227 TRACE("Found a match: matched=%s\n", debugstr_w(*matched));
228 else
229 TRACE("No match found\n");
230
231 return matches;
232}
GLubyte * pattern
Definition: glext.h:7787
#define matches(FN)
Definition: match.h:70
const WCHAR * str
BOOL matched
Definition: taskkill.c:46
#define str_len
Definition: treelist.c:89

Referenced by search_domain_for_zone().

◆ open_zone_key()

static HRESULT open_zone_key ( HKEY  parent_key,
DWORD  zone,
HKEY hkey 
)
static

Definition at line 609 of file sec_mgr.c.

610{
612 DWORD res;
613
615
616 res = RegOpenKeyW(parent_key, key_name, hkey);
617
618 if(res != ERROR_SUCCESS) {
619 WARN("RegOpenKey failed\n");
620 return E_INVALIDARG;
621 }
622
623 return S_OK;
624}

Referenced by get_action_policy(), ZoneMgrImpl_GetZoneAttributes(), and ZoneMgrImpl_SetZoneAttributes().

◆ parse_security_url()

static HRESULT parse_security_url ( const WCHAR url,
PSUACTION  action,
WCHAR **  result 
)
static

Definition at line 1819 of file sec_mgr.c.

1819 {
1821 WCHAR *tmp, *new_url = NULL, *alloc_url = NULL;
1823 HRESULT hres = S_OK, parse_hres;
1824
1825 while(1) {
1826 TRACE("parsing %s\n", debugstr_w(url));
1827
1829 if(!protocol_info)
1830 break;
1831
1832 size = lstrlenW(url)+1;
1833 new_url = CoTaskMemAlloc(size*sizeof(WCHAR));
1834 if(!new_url) {
1836 break;
1837 }
1838
1839 new_size = 0;
1840 parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_URL, 0, new_url, size, &new_size, 0);
1841 if(parse_hres == S_FALSE) {
1842 if(!new_size) {
1844 break;
1845 }
1846
1847 tmp = CoTaskMemRealloc(new_url, new_size*sizeof(WCHAR));
1848 if(!tmp) {
1850 break;
1851 }
1852 new_url = tmp;
1853 parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_URL, 0, new_url,
1854 new_size, &new_size, 0);
1855 if(parse_hres == S_FALSE) {
1856 hres = E_FAIL;
1857 break;
1858 }
1859 }
1860
1861 if(parse_hres != S_OK || !wcscmp(url, new_url))
1862 break;
1863
1864 CoTaskMemFree(alloc_url);
1865 url = alloc_url = new_url;
1866 new_url = NULL;
1867 }
1868
1869 CoTaskMemFree(new_url);
1870
1871 if(hres != S_OK) {
1872 WARN("failed: %08lx\n", hres);
1873 CoTaskMemFree(alloc_url);
1874 return hres;
1875 }
1876
1877 if(action == PSU_DEFAULT && (protocol_info = get_protocol_info(url))) {
1878 size = lstrlenW(url)+1;
1879 new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
1880 if(new_url) {
1881 new_size = 0;
1882 parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_DOMAIN, 0,
1883 new_url, size, &new_size, 0);
1884 if(parse_hres == S_FALSE) {
1885 if(new_size) {
1886 tmp = CoTaskMemRealloc(new_url, new_size*sizeof(WCHAR));
1887 if(tmp) {
1888 new_url = tmp;
1889 parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_DOMAIN, 0, new_url,
1890 new_size, &new_size, 0);
1891 if(parse_hres == S_FALSE)
1892 hres = E_FAIL;
1893 }else {
1895 }
1896 }else {
1898 }
1899 }
1900
1901 if(hres == S_OK && parse_hres == S_OK) {
1902 CoTaskMemFree(alloc_url);
1903 url = alloc_url = new_url;
1904 new_url = NULL;
1905 }
1906
1907 CoTaskMemFree(new_url);
1908 }else {
1910 }
1911 IInternetProtocolInfo_Release(protocol_info);
1912 }
1913
1914 if(FAILED(hres)) {
1915 WARN("failed %08lx\n", hres);
1916 CoTaskMemFree(alloc_url);
1917 return hres;
1918 }
1919
1920 if(!alloc_url) {
1921 size = lstrlenW(url)+1;
1922 alloc_url = CoTaskMemAlloc(size * sizeof(WCHAR));
1923 if(!alloc_url)
1924 return E_OUTOFMEMORY;
1925 memcpy(alloc_url, url, size * sizeof(WCHAR));
1926 }
1927
1928 *result = alloc_url;
1929 return S_OK;
1930}
void *WINAPI CoTaskMemRealloc(void *ptr, SIZE_T size)
Definition: malloc.c:397
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
IInternetProtocolInfo * get_protocol_info(LPCWSTR url)
Definition: session.c:173
size_t const new_size
Definition: expand.cpp:66
GLuint64EXT * result
Definition: glext.h:11304
static IInternetProtocolInfo protocol_info
Definition: misc.c:929

Referenced by CoInternetGetSecurityUrl(), and CoInternetGetSecurityUrlEx().

◆ search_domain_for_zone()

static HRESULT search_domain_for_zone ( HKEY  domains,
LPCWSTR  domain,
DWORD  domain_len,
LPCWSTR  schema,
LPCWSTR  host,
DWORD  host_len,
DWORD zone 
)
static

Definition at line 270 of file sec_mgr.c.

272{
273 BOOL found = FALSE;
274 HKEY domain_key;
275 DWORD res;
277
278 if(host_len >= domain_len && matches_domain_pattern(domain, host, TRUE, &matched)) {
279 res = RegOpenKeyW(domains, domain, &domain_key);
280 if(res != ERROR_SUCCESS) {
281 ERR("Failed to open domain key %s: %ld\n", debugstr_w(domain), res);
282 return E_UNEXPECTED;
283 }
284
285 if(matched == host)
286 found = get_zone_for_scheme(domain_key, schema, zone);
287 else {
288 INT domain_offset;
289 DWORD subdomain_count, subdomain_len;
290 BOOL check_domain = TRUE;
291
292 find_domain_name(domain, domain_len, &domain_offset);
293
294 res = RegQueryInfoKeyW(domain_key, NULL, NULL, NULL, &subdomain_count, &subdomain_len,
295 NULL, NULL, NULL, NULL, NULL, NULL);
296 if(res != ERROR_SUCCESS) {
297 ERR("Unable to query info for key %s: %ld\n", debugstr_w(domain), res);
298 RegCloseKey(domain_key);
299 return E_UNEXPECTED;
300 }
301
302 if(subdomain_count) {
303 WCHAR *subdomain;
304 WCHAR *component;
305 DWORD i;
306
307 subdomain = malloc((subdomain_len + 1) * sizeof(WCHAR));
308 if(!subdomain) {
309 RegCloseKey(domain_key);
310 return E_OUTOFMEMORY;
311 }
312
313 component = strndupW(host, matched-host - 1);
314 if(!component) {
315 free(subdomain);
316 RegCloseKey(domain_key);
317 return E_OUTOFMEMORY;
318 }
319
320 for(i = 0; i < subdomain_count; ++i) {
321 DWORD len = subdomain_len+1;
322 const WCHAR *sub_matched;
323
324 res = RegEnumKeyExW(domain_key, i, subdomain, &len, NULL, NULL, NULL, NULL);
325 if(res != ERROR_SUCCESS) {
326 free(component);
327 free(subdomain);
328 RegCloseKey(domain_key);
329 return E_UNEXPECTED;
330 }
331
332 if(matches_domain_pattern(subdomain, component, FALSE, &sub_matched)) {
333 HKEY subdomain_key;
334
335 res = RegOpenKeyW(domain_key, subdomain, &subdomain_key);
336 if(res != ERROR_SUCCESS) {
337 ERR("Unable to open subdomain key %s of %s: %ld\n", debugstr_w(subdomain),
339 free(component);
340 free(subdomain);
341 RegCloseKey(domain_key);
342 return E_UNEXPECTED;
343 }
344
345 found = get_zone_for_scheme(subdomain_key, schema, zone);
346 check_domain = FALSE;
347 RegCloseKey(subdomain_key);
348 break;
349 }
350 }
351 free(subdomain);
352 free(component);
353 }
354
355 /* There's a chance that 'host' implicitly mapped into 'domain', in
356 * which case we check to see if 'domain' contains zone information.
357 *
358 * This can only happen if 'domain' is its own domain name.
359 * Example:
360 * "google.com" (domain name = "google.com")
361 *
362 * So if:
363 * host = "www.google.com"
364 *
365 * Then host would map directly into the "google.com" domain key.
366 *
367 * If 'domain' has more than just its domain name, or it does not
368 * have a domain name, then we don't perform the check. The reason
369 * for this is that these domains don't allow implicit mappings.
370 * Example:
371 * domain = "org" (has no domain name)
372 * host = "www.org"
373 *
374 * The mapping would only happen if the "org" key had an explicit subkey
375 * called "www".
376 */
377 if(check_domain && !domain_offset && !wcschr(host, matched-host-1))
378 found = get_zone_for_scheme(domain_key, schema, zone);
379 }
380 RegCloseKey(domain_key);
381 }
382
383 return found ? S_OK : S_FALSE;
384}
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_wildcard, LPCWSTR *matched)
Definition: sec_mgr.c:155
static BOOL get_zone_for_scheme(HKEY key, LPCWSTR schema, DWORD *zone)
Definition: sec_mgr.c:234
void find_domain_name(const WCHAR *host, DWORD host_len, INT *domain_start)
Definition: uri.c:477
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: cookie.c:42
const uint16_t * LPCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
static WCHAR * strndupW(LPCWSTR str, int len)
Definition: urlmon_main.h:236

Referenced by search_for_domain_mapping().

◆ search_for_domain_mapping()

static HRESULT search_for_domain_mapping ( HKEY  domains,
LPCWSTR  schema,
LPCWSTR  host,
DWORD  host_len,
DWORD zone 
)
static

Definition at line 386 of file sec_mgr.c.

387{
388 WCHAR *domain;
389 DWORD domain_count, domain_len, i;
390 DWORD res;
392
393 res = RegQueryInfoKeyW(domains, NULL, NULL, NULL, &domain_count, &domain_len,
394 NULL, NULL, NULL, NULL, NULL, NULL);
395 if(res != ERROR_SUCCESS) {
396 WARN("Failed to retrieve information about key\n");
397 return E_UNEXPECTED;
398 }
399
400 if(!domain_count)
401 return S_FALSE;
402
403 domain = malloc((domain_len + 1) * sizeof(WCHAR));
404 if(!domain)
405 return E_OUTOFMEMORY;
406
407 for(i = 0; i < domain_count; ++i) {
408 DWORD len = domain_len+1;
409
410 res = RegEnumKeyExW(domains, i, domain, &len, NULL, NULL, NULL, NULL);
411 if(res != ERROR_SUCCESS) {
412 free(domain);
413 return E_UNEXPECTED;
414 }
415
416 hres = search_domain_for_zone(domains, domain, len, schema, host, host_len, zone);
417 if(FAILED(hres) || hres == S_OK)
418 break;
419 }
420
421 free(domain);
422 return hres;
423}
static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain_len, LPCWSTR schema, LPCWSTR host, DWORD host_len, DWORD *zone)
Definition: sec_mgr.c:270

Referenced by get_zone_from_domains().

◆ SecManagerImpl_AddRef()

static ULONG WINAPI SecManagerImpl_AddRef ( IInternetSecurityManagerEx2 iface)
static

Definition at line 842 of file sec_mgr.c.

843{
845 ULONG refCount = InterlockedIncrement(&This->ref);
846
847 TRACE("(%p) ref=%lu\n", This, refCount);
848
849 return refCount;
850}
#define InterlockedIncrement
Definition: armddk.h:53
static SecManagerImpl * impl_from_IInternetSecurityManagerEx2(IInternetSecurityManagerEx2 *iface)
Definition: sec_mgr.c:813
uint32_t ULONG
Definition: typedefs.h:59

◆ SecManagerImpl_Construct()

HRESULT SecManagerImpl_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 1206 of file sec_mgr.c.

1207{
1209
1210 TRACE("(%p,%p)\n",pUnkOuter,ppobj);
1211 This = malloc(sizeof(*This));
1212
1213 /* Initialize the virtual function table. */
1214 This->IInternetSecurityManagerEx2_iface.lpVtbl = &VT_SecManagerImpl;
1215
1216 This->ref = 1;
1217 This->mgrsite = NULL;
1218 This->custom_manager = NULL;
1219
1220 *ppobj = This;
1221
1223
1224 return S_OK;
1225}
static const IInternetSecurityManagerEx2Vtbl VT_SecManagerImpl
Definition: sec_mgr.c:1186
static void URLMON_LockModule(void)
Definition: urlmon_main.h:64

Referenced by CoInternetCreateSecurityManager().

◆ SecManagerImpl_GetSecurityId()

static HRESULT WINAPI SecManagerImpl_GetSecurityId ( IInternetSecurityManagerEx2 iface,
LPCWSTR  pwszUrl,
BYTE pbSecurityId,
DWORD pcbSecurityId,
DWORD_PTR  dwReserved 
)
static

Definition at line 953 of file sec_mgr.c.

955{
957
958 TRACE("(%p)->(%s %p %p %08Ix)\n", iface, debugstr_w(pwszUrl), pbSecurityId,
959 pcbSecurityId, dwReserved);
960
961 if(This->custom_manager) {
963
964 hres = IInternetSecurityManager_GetSecurityId(This->custom_manager,
965 pwszUrl, pbSecurityId, pcbSecurityId, dwReserved);
966 if(hres != INET_E_DEFAULT_ACTION)
967 return hres;
968 }
969
970 if(!pwszUrl || !pbSecurityId || !pcbSecurityId)
971 return E_INVALIDARG;
972
973 if(dwReserved)
974 FIXME("dwReserved is not supported\n");
975
976 return get_security_id_for_url(pwszUrl, pbSecurityId, pcbSecurityId);
977}
static HRESULT get_security_id_for_url(LPCWSTR url, BYTE *secid, DWORD *secid_len)
Definition: sec_mgr.c:762

◆ SecManagerImpl_GetSecurityIdEx2()

static HRESULT WINAPI SecManagerImpl_GetSecurityIdEx2 ( IInternetSecurityManagerEx2 iface,
IUri pUri,
BYTE pbSecurityId,
DWORD pcbSecurityId,
DWORD_PTR  dwReserved 
)
static

Definition at line 1161 of file sec_mgr.c.

1163{
1165 TRACE("(%p)->(%p %p %p %08Ix) stub\n", This, pUri, pbSecurityId, pcbSecurityId, dwReserved);
1166
1167 if(dwReserved)
1168 FIXME("dwReserved is not supported yet\n");
1169
1170 if(!pUri || !pcbSecurityId || !pbSecurityId)
1171 return E_INVALIDARG;
1172
1173 return get_security_id_for_uri(pUri, pbSecurityId, pcbSecurityId);
1174}
static HRESULT get_security_id_for_uri(IUri *uri, BYTE *secid, DWORD *secid_len)
Definition: sec_mgr.c:784

◆ SecManagerImpl_GetSecuritySite()

static HRESULT WINAPI SecManagerImpl_GetSecuritySite ( IInternetSecurityManagerEx2 iface,
IInternetSecurityMgrSite **  ppSite 
)
static

Definition at line 909 of file sec_mgr.c.

911{
913
914 TRACE("(%p)->(%p)\n", This, ppSite);
915
916 if(!ppSite)
917 return E_INVALIDARG;
918
919 if(This->mgrsite)
920 IInternetSecurityMgrSite_AddRef(This->mgrsite);
921
922 *ppSite = This->mgrsite;
923 return S_OK;
924}

◆ SecManagerImpl_GetZoneMappings()

static HRESULT WINAPI SecManagerImpl_GetZoneMappings ( IInternetSecurityManagerEx2 iface,
DWORD  dwZone,
IEnumString **  ppenumString,
DWORD  dwFlags 
)
static

Definition at line 1077 of file sec_mgr.c.

1079{
1081 HRESULT hres;
1082
1083 TRACE("(%p)->(%08lx %p %08lx)\n", iface, dwZone, ppenumString,dwFlags);
1084
1085 if(This->custom_manager) {
1086 hres = IInternetSecurityManager_GetZoneMappings(This->custom_manager, dwZone,
1087 ppenumString, dwFlags);
1088 if(hres != INET_E_DEFAULT_ACTION)
1089 return hres;
1090 }
1091
1092 FIXME("Default action is not implemented\n");
1093 return E_NOTIMPL;
1094}
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141

◆ SecManagerImpl_MapUrlToZone()

static HRESULT WINAPI SecManagerImpl_MapUrlToZone ( IInternetSecurityManagerEx2 iface,
LPCWSTR  pwszUrl,
DWORD pdwZone,
DWORD  dwFlags 
)
static

Definition at line 926 of file sec_mgr.c.

929{
932
933 TRACE("(%p)->(%s %p %08lx)\n", iface, debugstr_w(pwszUrl), pdwZone, dwFlags);
934
935 if(This->custom_manager) {
936 hres = IInternetSecurityManager_MapUrlToZone(This->custom_manager,
937 pwszUrl, pdwZone, dwFlags);
938 if(hres != INET_E_DEFAULT_ACTION)
939 return hres;
940 }
941
942 if(!pwszUrl) {
943 *pdwZone = URLZONE_INVALID;
944 return E_INVALIDARG;
945 }
946
947 if(dwFlags)
948 FIXME("not supported flags: %08lx\n", dwFlags);
949
950 return map_url_to_zone(pwszUrl, pdwZone, NULL);
951}

◆ SecManagerImpl_MapUrlToZoneEx2()

static HRESULT WINAPI SecManagerImpl_MapUrlToZoneEx2 ( IInternetSecurityManagerEx2 iface,
IUri pUri,
DWORD pdwZone,
DWORD  dwFlags,
LPWSTR ppwszMappedUrl,
DWORD pdwOutFlags 
)
static

Definition at line 1106 of file sec_mgr.c.

1108{
1110
1111 TRACE("(%p)->(%p %p %08lx %p %p)\n", This, pUri, pdwZone, dwFlags, ppwszMappedUrl, pdwOutFlags);
1112
1113 if(This->custom_manager) {
1114 HRESULT hres;
1116
1117 hres = IInternetSecurityManager_QueryInterface(This->custom_manager, &IID_IInternetSecurityManagerEx2,
1118 (void**)&sec_mgr2);
1119 if(SUCCEEDED(hres)) {
1120 hres = IInternetSecurityManagerEx2_MapUrlToZoneEx2(sec_mgr2, pUri, pdwZone, dwFlags, ppwszMappedUrl, pdwOutFlags);
1121 IInternetSecurityManagerEx2_Release(sec_mgr2);
1122 } else {
1123 BSTR url;
1124
1125 hres = IUri_GetDisplayUri(pUri, &url);
1126 if(FAILED(hres))
1127 return hres;
1128
1129 hres = IInternetSecurityManager_MapUrlToZone(This->custom_manager, url, pdwZone, dwFlags);
1131 }
1132
1133 if(hres != INET_E_DEFAULT_ACTION)
1134 return hres;
1135 }
1136
1137 if(!pdwZone)
1138 return E_INVALIDARG;
1139
1140 if(!pUri) {
1141 *pdwZone = URLZONE_INVALID;
1142 return E_INVALIDARG;
1143 }
1144
1145 if(dwFlags)
1146 FIXME("Unsupported flags: %08lx\n", dwFlags);
1147
1148 return map_uri_to_zone(pUri, pdwZone, NULL);
1149}

◆ SecManagerImpl_ProcessUrlAction()

static HRESULT WINAPI SecManagerImpl_ProcessUrlAction ( IInternetSecurityManagerEx2 iface,
LPCWSTR  pwszUrl,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
BYTE pContext,
DWORD  cbContext,
DWORD  dwFlags,
DWORD  dwReserved 
)
static

Definition at line 980 of file sec_mgr.c.

985{
989
990 TRACE("(%p)->(%s %08lx %p %08lx %p %08lx %08lx %08lx)\n", iface, debugstr_w(pwszUrl), dwAction,
991 pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
992
993 if(This->custom_manager) {
994 hres = IInternetSecurityManager_ProcessUrlAction(This->custom_manager, pwszUrl, dwAction,
995 pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
996 if(hres != INET_E_DEFAULT_ACTION)
997 return hres;
998 }
999
1000 if(dwFlags || dwReserved)
1001 FIXME("Unsupported arguments\n");
1002
1003 if(!pwszUrl)
1004 return E_INVALIDARG;
1005
1006 hres = map_url_to_zone(pwszUrl, &zone, NULL);
1007 if(FAILED(hres))
1008 return hres;
1009
1010 hres = get_action_policy(zone, dwAction, (BYTE*)&policy, sizeof(policy), URLZONEREG_DEFAULT);
1011 if(FAILED(hres))
1012 return hres;
1013
1014 TRACE("policy %lx\n", policy);
1015 if(cbPolicy >= sizeof(DWORD))
1016 *(DWORD*)pPolicy = policy;
1017
1018 switch(GetUrlPolicyPermissions(policy)) {
1019 case URLPOLICY_ALLOW:
1020 case URLPOLICY_CHANNEL_SOFTDIST_PRECACHE:
1021 return S_OK;
1022 case URLPOLICY_DISALLOW:
1023 return S_FALSE;
1024 case URLPOLICY_QUERY:
1025 FIXME("URLPOLICY_QUERY not implemented\n");
1026 return E_FAIL;
1027 default:
1028 FIXME("Not implemented policy %lx\n", policy);
1029 }
1030
1031 return E_FAIL;
1032}

◆ SecManagerImpl_ProcessUrlActionEx()

static HRESULT WINAPI SecManagerImpl_ProcessUrlActionEx ( IInternetSecurityManagerEx2 iface,
LPCWSTR  pwszUrl,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
BYTE pContext,
DWORD  cbContext,
DWORD  dwFlags,
DWORD  dwReserved,
DWORD pdwOutFlags 
)
static

Definition at line 1096 of file sec_mgr.c.

1099{
1101 FIXME("(%p)->(%s %08lx %p %ld %p %ld %08lx %08lx %p) stub\n", This, debugstr_w(pwszUrl), dwAction, pPolicy, cbPolicy,
1102 pContext, cbContext, dwFlags, dwReserved, pdwOutFlags);
1103 return E_NOTIMPL;
1104}

◆ SecManagerImpl_ProcessUrlActionEx2()

static HRESULT WINAPI SecManagerImpl_ProcessUrlActionEx2 ( IInternetSecurityManagerEx2 iface,
IUri pUri,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
BYTE pContext,
DWORD  cbContext,
DWORD  dwFlags,
DWORD_PTR  dwReserved,
DWORD pdwOutFlags 
)
static

Definition at line 1151 of file sec_mgr.c.

1154{
1156 FIXME("(%p)->(%p %08lx %p %ld %p %ld %08lx %08Ix %p) stub\n", This, pUri, dwAction, pPolicy,
1157 cbPolicy, pContext, cbContext, dwFlags, dwReserved, pdwOutFlags);
1158 return E_NOTIMPL;
1159}

◆ SecManagerImpl_QueryCustomPolicy()

static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy ( IInternetSecurityManagerEx2 iface,
LPCWSTR  pwszUrl,
REFGUID  guidKey,
BYTE **  ppPolicy,
DWORD pcbPolicy,
BYTE pContext,
DWORD  cbContext,
DWORD  dwReserved 
)
static

Definition at line 1035 of file sec_mgr.c.

1040{
1042 HRESULT hres;
1043
1044 TRACE("(%p)->(%s %s %p %p %p %08lx %08lx )\n", iface, debugstr_w(pwszUrl), debugstr_guid(guidKey),
1045 ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
1046
1047 if(This->custom_manager) {
1048 hres = IInternetSecurityManager_QueryCustomPolicy(This->custom_manager, pwszUrl, guidKey,
1049 ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
1050 if(hres != INET_E_DEFAULT_ACTION)
1051 return hres;
1052 }
1053
1054 WARN("Unknown guidKey %s\n", debugstr_guid(guidKey));
1056}
#define debugstr_guid
Definition: kernel32.h:35
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_NOT_FOUND
Definition: winerror.h:1014

◆ SecManagerImpl_QueryCustomPolicyEx2()

static HRESULT WINAPI SecManagerImpl_QueryCustomPolicyEx2 ( IInternetSecurityManagerEx2 iface,
IUri pUri,
REFGUID  guidKey,
BYTE **  ppPolicy,
DWORD pcbPolicy,
BYTE pContext,
DWORD  cbContext,
DWORD_PTR  dwReserved 
)
static

Definition at line 1176 of file sec_mgr.c.

1179{
1181 FIXME("(%p)->(%p %s %p %p %p %ld %08Ix) stub\n", This, pUri, debugstr_guid(guidKey), ppPolicy, pcbPolicy,
1182 pContext, cbContext, dwReserved);
1183 return E_NOTIMPL;
1184}

◆ SecManagerImpl_QueryInterface()

static HRESULT WINAPI SecManagerImpl_QueryInterface ( IInternetSecurityManagerEx2 iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 818 of file sec_mgr.c.

819{
821
822 TRACE("(%p)->(%s %p)\n",This,debugstr_guid(riid),ppvObject);
823
824 if(!ppvObject)
825 return E_INVALIDARG;
826
828 IsEqualIID(&IID_IInternetSecurityManager, riid) ||
829 IsEqualIID(&IID_IInternetSecurityManagerEx, riid) ||
830 IsEqualIID(&IID_IInternetSecurityManagerEx2, riid)) {
831 *ppvObject = iface;
832 } else {
833 WARN("not supported interface %s\n", debugstr_guid(riid));
834 *ppvObject = NULL;
835 return E_NOINTERFACE;
836 }
837
838 IInternetSecurityManagerEx2_AddRef(iface);
839 return S_OK;
840}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ SecManagerImpl_Release()

static ULONG WINAPI SecManagerImpl_Release ( IInternetSecurityManagerEx2 iface)
static

Definition at line 852 of file sec_mgr.c.

853{
855 ULONG refCount = InterlockedDecrement(&This->ref);
856
857 TRACE("(%p) ref=%lu\n", This, refCount);
858
859 /* destroy the object if there are no more references on it */
860 if (!refCount){
861 if(This->mgrsite)
862 IInternetSecurityMgrSite_Release(This->mgrsite);
863 if(This->custom_manager)
864 IInternetSecurityManager_Release(This->custom_manager);
865
866 free(This);
867
869 }
870
871 return refCount;
872}
#define InterlockedDecrement
Definition: armddk.h:52
static void URLMON_UnlockModule(void)
Definition: urlmon_main.h:65

◆ SecManagerImpl_SetSecuritySite()

static HRESULT WINAPI SecManagerImpl_SetSecuritySite ( IInternetSecurityManagerEx2 iface,
IInternetSecurityMgrSite pSite 
)
static

Definition at line 874 of file sec_mgr.c.

876{
878
879 TRACE("(%p)->(%p)\n", This, pSite);
880
881 if(This->mgrsite)
882 IInternetSecurityMgrSite_Release(This->mgrsite);
883
884 if(This->custom_manager) {
885 IInternetSecurityManager_Release(This->custom_manager);
886 This->custom_manager = NULL;
887 }
888
889 This->mgrsite = pSite;
890
891 if(pSite) {
892 IServiceProvider *servprov;
894
895 IInternetSecurityMgrSite_AddRef(pSite);
896
897 hres = IInternetSecurityMgrSite_QueryInterface(pSite, &IID_IServiceProvider,
898 (void**)&servprov);
899 if(SUCCEEDED(hres)) {
900 IServiceProvider_QueryService(servprov, &SID_SInternetSecurityManager,
901 &IID_IInternetSecurityManager, (void**)&This->custom_manager);
902 IServiceProvider_Release(servprov);
903 }
904 }
905
906 return S_OK;
907}

◆ SecManagerImpl_SetZoneMapping()

static HRESULT WINAPI SecManagerImpl_SetZoneMapping ( IInternetSecurityManagerEx2 iface,
DWORD  dwZone,
LPCWSTR  pwszPattern,
DWORD  dwFlags 
)
static

Definition at line 1058 of file sec_mgr.c.

1060{
1062 HRESULT hres;
1063
1064 TRACE("(%p)->(%08lx %s %08lx)\n", iface, dwZone, debugstr_w(pwszPattern),dwFlags);
1065
1066 if(This->custom_manager) {
1067 hres = IInternetSecurityManager_SetZoneMapping(This->custom_manager, dwZone,
1068 pwszPattern, dwFlags);
1069 if(hres != INET_E_DEFAULT_ACTION)
1070 return hres;
1071 }
1072
1073 FIXME("Default action is not implemented\n");
1074 return E_NOTIMPL;
1075}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( urlmon  )

◆ ZoneMgrImpl_AddRef()

static ULONG WINAPI ZoneMgrImpl_AddRef ( IInternetZoneManagerEx2 *  iface)
static

Definition at line 1338 of file sec_mgr.c.

1339{
1341 ULONG refCount = InterlockedIncrement(&This->ref);
1342
1343 TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
1344
1345 return refCount;
1346}
static ZoneMgrImpl * impl_from_IInternetZoneManagerEx2(IInternetZoneManagerEx2 *iface)
Definition: sec_mgr.c:1238

◆ ZoneMgrImpl_Construct()

HRESULT ZoneMgrImpl_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 1781 of file sec_mgr.c.

1782{
1783 ZoneMgrImpl *ret = calloc(1, sizeof(ZoneMgrImpl));
1784
1785 TRACE("(%p %p)\n", pUnkOuter, ppobj);
1786 ret->IInternetZoneManagerEx2_iface.lpVtbl = &ZoneMgrImplVtbl;
1787 ret->ref = 1;
1788 *ppobj = &ret->IInternetZoneManagerEx2_iface;
1789
1791
1792 return S_OK;
1793}
static const IInternetZoneManagerEx2Vtbl ZoneMgrImplVtbl
Definition: sec_mgr.c:1754
return ret
Definition: mutex.c:146
#define calloc
Definition: rosglue.h:14

Referenced by CoInternetCreateZoneManager().

◆ ZoneMgrImpl_CopyTemplatePoliciesToZone()

static HRESULT WINAPI ZoneMgrImpl_CopyTemplatePoliciesToZone ( IInternetZoneManagerEx2 *  iface,
DWORD  dwTemplate,
DWORD  dwZone,
DWORD  dwReserved 
)
static

Definition at line 1637 of file sec_mgr.c.

1641{
1642 FIXME("(%p)->(%08lx %08lx %08lx) stub\n", iface, dwTemplate, dwZone, dwReserved);
1643 return E_NOTIMPL;
1644}

◆ ZoneMgrImpl_CreateZoneEnumerator()

static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator ( IInternetZoneManagerEx2 *  iface,
DWORD pdwEnum,
DWORD pdwCount,
DWORD  dwFlags 
)
static

Definition at line 1543 of file sec_mgr.c.

1547{
1549 LPDWORD * new_maps;
1550 LPDWORD data;
1551 DWORD new_map_count;
1552 DWORD i;
1553
1554 TRACE("(%p)->(%p, %p, 0x%08lx)\n", This, pdwEnum, pdwCount, dwFlags);
1555 if (!pdwEnum || !pdwCount || (dwFlags != 0))
1556 return E_INVALIDARG;
1557
1559 TRACE("found %ld zones\n", data ? data[0] : -1);
1560
1561 if (!data)
1562 return E_FAIL;
1563
1564 for (i = 0; i < This->zonemap_count; i++) {
1565 if (This->zonemaps && !This->zonemaps[i]) {
1566 This->zonemaps[i] = data;
1567 *pdwEnum = i;
1568 *pdwCount = data[0];
1569 return S_OK;
1570 }
1571 }
1572
1573 /* try to double the number of pointers in the array */
1574 new_map_count = This->zonemaps ? This->zonemap_count * 2 : 2;
1575 new_maps = _recalloc(This->zonemaps, new_map_count, sizeof(DWORD*));
1576 if (!new_maps) {
1577 free(data);
1578 return E_FAIL;
1579 }
1580 This->zonemaps = new_maps;
1581 This->zonemap_count = new_map_count;
1582 This->zonemaps[i] = data;
1583 *pdwEnum = i;
1584 *pdwCount = data[0];
1585 return S_OK;
1586}
_ACRTIMP void *__cdecl _recalloc(void *, size_t, size_t) __WINE_ALLOC_SIZE(2
static LPDWORD build_zonemap_from_reg(void)
Definition: sec_mgr.c:1250

◆ ZoneMgrImpl_DestroyZoneEnumerator()

static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator ( IInternetZoneManagerEx2 *  iface,
DWORD  dwEnum 
)
static

Definition at line 1616 of file sec_mgr.c.

1618{
1620 LPDWORD data;
1621
1622 TRACE("(%p)->(0x%08lx)\n", This, dwEnum);
1623 /* make sure, that dwEnum is valid */
1624 if (dwEnum < This->zonemap_count) {
1625 if ((data = This->zonemaps[dwEnum])) {
1626 This->zonemaps[dwEnum] = NULL;
1627 free(data);
1628 return S_OK;
1629 }
1630 }
1631 return E_INVALIDARG;
1632}

◆ ZoneMgrImpl_FixInsecureSettings()

static HRESULT WINAPI ZoneMgrImpl_FixInsecureSettings ( IInternetZoneManagerEx2 *  iface)
static

Definition at line 1745 of file sec_mgr.c.

1746{
1747 FIXME("(%p) stub\n", iface);
1748 return S_OK;
1749}

◆ ZoneMgrImpl_GetIESecurityState()

static HRESULT WINAPI ZoneMgrImpl_GetIESecurityState ( IInternetZoneManagerEx2 *  iface,
BOOL  fRespectPolicy,
LPDWORD  pdwState,
BOOL pfPolicyEncountered,
BOOL  fNoCache 
)
static

Definition at line 1725 of file sec_mgr.c.

1730{
1731 FIXME("(%p)->(%d, %p, %p, %d) stub\n", iface, fRespectPolicy, pdwState,
1732 pfPolicyEncountered, fNoCache);
1733
1734 *pdwState = SECURITY_IE_STATE_GREEN;
1735
1736 if (pfPolicyEncountered)
1737 *pfPolicyEncountered = FALSE;
1738
1739 return S_OK;
1740}

◆ ZoneMgrImpl_GetZoneActionPolicy()

static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicy ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
URLZONEREG  urlZoneReg 
)
static

Definition at line 1484 of file sec_mgr.c.

1486{
1487 TRACE("(%p)->(%ld %08lx %p %ld %d)\n", iface, dwZone, dwAction, pPolicy,
1488 cbPolicy, urlZoneReg);
1489
1490 if(!pPolicy)
1491 return E_INVALIDARG;
1492
1493 return get_action_policy(dwZone, dwAction, pPolicy, cbPolicy, urlZoneReg);
1494}

◆ ZoneMgrImpl_GetZoneActionPolicyEx()

static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicyEx ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
URLZONEREG  urlZoneReg,
DWORD  dwFlags 
)
static

Definition at line 1649 of file sec_mgr.c.

1656{
1657 TRACE("(%p)->(%ld, 0x%lx, %p, %ld, %d, 0x%lx)\n", iface, dwZone,
1658 dwAction, pPolicy, cbPolicy, urlZoneReg, dwFlags);
1659
1660 if(!pPolicy)
1661 return E_INVALIDARG;
1662
1663 if (dwFlags)
1664 FIXME("dwFlags 0x%lx ignored\n", dwFlags);
1665
1666 return get_action_policy(dwZone, dwAction, pPolicy, cbPolicy, urlZoneReg);
1667}

◆ ZoneMgrImpl_GetZoneAt()

static HRESULT WINAPI ZoneMgrImpl_GetZoneAt ( IInternetZoneManagerEx2 *  iface,
DWORD  dwEnum,
DWORD  dwIndex,
DWORD pdwZone 
)
static

Definition at line 1591 of file sec_mgr.c.

1595{
1597 LPDWORD data;
1598
1599 TRACE("(%p)->(0x%08lx, %ld, %p)\n", This, dwEnum, dwIndex, pdwZone);
1600
1601 /* make sure, that dwEnum and dwIndex are in the valid range */
1602 if (dwEnum < This->zonemap_count) {
1603 if ((data = This->zonemaps[dwEnum])) {
1604 if (dwIndex < data[0]) {
1605 *pdwZone = data[dwIndex + 1];
1606 return S_OK;
1607 }
1608 }
1609 }
1610 return E_INVALIDARG;
1611}

◆ ZoneMgrImpl_GetZoneAttributes()

static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributes ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
ZONEATTRIBUTES *  pZoneAttributes 
)
static

Definition at line 1371 of file sec_mgr.c.

1374{
1376 HRESULT hr;
1377 HKEY hcu;
1378 HKEY hklm = NULL;
1379
1380 TRACE("(%p)->(%ld %p)\n", This, dwZone, pZoneAttributes);
1381
1382 if (!pZoneAttributes)
1383 return E_INVALIDARG;
1384
1385 hr = open_zone_key(HKEY_CURRENT_USER, dwZone, &hcu);
1386 if (FAILED(hr))
1387 return S_OK; /* IE6 and older returned E_FAIL here */
1388
1389 hr = open_zone_key(HKEY_LOCAL_MACHINE, dwZone, &hklm);
1390 if (FAILED(hr))
1391 TRACE("Zone %ld not in HKLM\n", dwZone);
1392
1393 get_string_from_reg(hcu, hklm, L"DisplayName", pZoneAttributes->szDisplayName, MAX_ZONE_PATH);
1394 get_string_from_reg(hcu, hklm, L"Description", pZoneAttributes->szDescription, MAX_ZONE_DESCRIPTION);
1395 get_string_from_reg(hcu, hklm, L"Icon", pZoneAttributes->szIconPath, MAX_ZONE_PATH);
1396 get_dword_from_reg(hcu, hklm, L"MinLevel", &pZoneAttributes->dwTemplateMinLevel);
1397 get_dword_from_reg(hcu, hklm, L"CurrentLevel", &pZoneAttributes->dwTemplateCurrentLevel);
1398 get_dword_from_reg(hcu, hklm, L"RecommendedLevel", &pZoneAttributes->dwTemplateRecommended);
1399 get_dword_from_reg(hcu, hklm, L"Flags", &pZoneAttributes->dwFlags);
1400
1401 RegCloseKey(hklm);
1402 RegCloseKey(hcu);
1403 return S_OK;
1404}
HRESULT hr
Definition: delayimp.cpp:582
static void get_dword_from_reg(HKEY hcu, HKEY hklm, LPCWSTR name, LPDWORD out)
Definition: sec_mgr.c:89
static void get_string_from_reg(HKEY hcu, HKEY hklm, LPCWSTR name, LPWSTR out, DWORD maxlen)
Definition: sec_mgr.c:63

◆ ZoneMgrImpl_GetZoneAttributesEx()

static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributesEx ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
ZONEATTRIBUTES *  pZoneAttributes,
DWORD  dwFlags 
)
static

Definition at line 1688 of file sec_mgr.c.

1692{
1693 TRACE("(%p)->(%ld, %p, 0x%lx)\n", iface, dwZone, pZoneAttributes, dwFlags);
1694
1695 if (dwFlags)
1696 FIXME("dwFlags 0x%lx ignored\n", dwFlags);
1697
1698 return IInternetZoneManagerEx2_GetZoneAttributes(iface, dwZone, pZoneAttributes);
1699}

◆ ZoneMgrImpl_GetZoneCustomPolicy()

static HRESULT WINAPI ZoneMgrImpl_GetZoneCustomPolicy ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
REFGUID  guidKey,
BYTE **  ppPolicy,
DWORD pcbPolicy,
URLZONEREG  ulrZoneReg 
)
static

Definition at line 1454 of file sec_mgr.c.

1460{
1461 FIXME("(%p)->(%08lx %s %p %p %08x) stub\n", iface, dwZone, debugstr_guid(guidKey),
1462 ppPolicy, pcbPolicy, ulrZoneReg);
1463 return E_NOTIMPL;
1464}

◆ ZoneMgrImpl_GetZoneSecurityState()

static HRESULT WINAPI ZoneMgrImpl_GetZoneSecurityState ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZoneIndex,
BOOL  fRespectPolicy,
LPDWORD  pdwState,
BOOL pfPolicyEncountered 
)
static

Definition at line 1705 of file sec_mgr.c.

1710{
1711 FIXME("(%p)->(%ld, %d, %p, %p) stub\n", iface, dwZoneIndex, fRespectPolicy,
1712 pdwState, pfPolicyEncountered);
1713
1714 *pdwState = SECURITY_IE_STATE_GREEN;
1715
1716 if (pfPolicyEncountered)
1717 *pfPolicyEncountered = FALSE;
1718
1719 return S_OK;
1720}

◆ ZoneMgrImpl_LogAction()

static HRESULT WINAPI ZoneMgrImpl_LogAction ( IInternetZoneManagerEx2 *  iface,
DWORD  dwAction,
LPCWSTR  pwszUrl,
LPCWSTR  pwszText,
DWORD  dwLogFlags 
)
static

Definition at line 1529 of file sec_mgr.c.

1534{
1535 FIXME("(%p)->(%08lx %s %s %08lx) stub\n", iface, dwAction, debugstr_w(pwszUrl),
1536 debugstr_w(pwszText), dwLogFlags);
1537 return E_NOTIMPL;
1538}

◆ ZoneMgrImpl_PromptAction()

static HRESULT WINAPI ZoneMgrImpl_PromptAction ( IInternetZoneManagerEx2 *  iface,
DWORD  dwAction,
HWND  hwndParent,
LPCWSTR  pwszUrl,
LPCWSTR  pwszText,
DWORD  dwPromptFlags 
)
static

Definition at line 1514 of file sec_mgr.c.

1520{
1521 FIXME("%p %08lx %p %s %s %08lx\n", iface, dwAction, hwndParent,
1522 debugstr_w(pwszUrl), debugstr_w(pwszText), dwPromptFlags );
1523 return E_NOTIMPL;
1524}
static HWND hwndParent
Definition: cryptui.c:299

◆ ZoneMgrImpl_QueryInterface()

static HRESULT WINAPI ZoneMgrImpl_QueryInterface ( IInternetZoneManagerEx2 *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1305 of file sec_mgr.c.

1306{
1308
1309 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObject);
1310
1311 if(!This || !ppvObject)
1312 return E_INVALIDARG;
1313
1315 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppvObject);
1316 }else if(IsEqualIID(&IID_IInternetZoneManager, riid)) {
1317 TRACE("(%p)->(IID_InternetZoneManager %p)\n", This, ppvObject);
1318 }else if(IsEqualIID(&IID_IInternetZoneManagerEx, riid)) {
1319 TRACE("(%p)->(IID_InternetZoneManagerEx %p)\n", This, ppvObject);
1320 }else if(IsEqualIID(&IID_IInternetZoneManagerEx2, riid)) {
1321 TRACE("(%p)->(IID_InternetZoneManagerEx2 %p)\n", This, ppvObject);
1322 }
1323 else
1324 {
1325 FIXME("Unknown interface: %s\n", debugstr_guid(riid));
1326 *ppvObject = NULL;
1327 return E_NOINTERFACE;
1328 }
1329
1330 *ppvObject = iface;
1331 IInternetZoneManagerEx2_AddRef(iface);
1332 return S_OK;
1333}

◆ ZoneMgrImpl_Release()

static ULONG WINAPI ZoneMgrImpl_Release ( IInternetZoneManagerEx2 *  iface)
static

Definition at line 1351 of file sec_mgr.c.

1352{
1354 ULONG refCount = InterlockedDecrement(&This->ref);
1355
1356 TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
1357
1358 if(!refCount) {
1359 while (This->zonemap_count) free(This->zonemaps[--This->zonemap_count]);
1360 free(This->zonemaps);
1361 free(This);
1363 }
1364
1365 return refCount;
1366}

◆ ZoneMgrImpl_SetZoneActionPolicy()

static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicy ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
URLZONEREG  urlZoneReg 
)
static

Definition at line 1499 of file sec_mgr.c.

1505{
1506 FIXME("(%p)->(%08lx %08lx %p %08lx %08x) stub\n", iface, dwZone, dwAction, pPolicy,
1507 cbPolicy, urlZoneReg);
1508 return E_NOTIMPL;
1509}

◆ ZoneMgrImpl_SetZoneActionPolicyEx()

static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicyEx ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
URLZONEREG  urlZoneReg,
DWORD  dwFlags 
)
static

Definition at line 1672 of file sec_mgr.c.

1679{
1680 FIXME("(%p)->(%ld, 0x%lx, %p, %ld, %d, 0x%lx) stub\n", iface, dwZone, dwAction, pPolicy,
1681 cbPolicy, urlZoneReg, dwFlags);
1682 return E_NOTIMPL;
1683}

◆ ZoneMgrImpl_SetZoneAttributes()

static HRESULT WINAPI ZoneMgrImpl_SetZoneAttributes ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
ZONEATTRIBUTES *  pZoneAttributes 
)
static

Definition at line 1409 of file sec_mgr.c.

1412{
1414 HRESULT hr;
1415 HKEY hcu;
1416
1417 TRACE("(%p)->(%ld %p)\n", This, dwZone, pZoneAttributes);
1418
1419 if (!pZoneAttributes)
1420 return E_INVALIDARG;
1421
1422 hr = open_zone_key(HKEY_CURRENT_USER, dwZone, &hcu);
1423 if (FAILED(hr))
1424 return S_OK; /* IE6 returned E_FAIL here */
1425
1426 /* cbSize is ignored */
1427 RegSetValueExW(hcu, L"DisplayName", 0, REG_SZ, (BYTE*)pZoneAttributes->szDisplayName,
1428 (lstrlenW(pZoneAttributes->szDisplayName)+1)* sizeof(WCHAR));
1429
1430 RegSetValueExW(hcu, L"Description", 0, REG_SZ, (BYTE*)pZoneAttributes->szDescription,
1431 (lstrlenW(pZoneAttributes->szDescription)+1)* sizeof(WCHAR));
1432
1433 RegSetValueExW(hcu, L"Icon", 0, REG_SZ, (BYTE*)pZoneAttributes->szIconPath,
1434 (lstrlenW(pZoneAttributes->szIconPath)+1)* sizeof(WCHAR));
1435
1436 RegSetValueExW(hcu, L"MinLevel", 0, REG_DWORD,
1437 (const BYTE*) &pZoneAttributes->dwTemplateMinLevel, sizeof(DWORD));
1438
1439 RegSetValueExW(hcu, L"CurrentLevel", 0, REG_DWORD,
1440 (const BYTE*) &pZoneAttributes->dwTemplateCurrentLevel, sizeof(DWORD));
1441
1442 RegSetValueExW(hcu, L"RecommendedLevel", 0, REG_DWORD,
1443 (const BYTE*) &pZoneAttributes->dwTemplateRecommended, sizeof(DWORD));
1444
1445 RegSetValueExW(hcu, L"Flags", 0, REG_DWORD, (const BYTE*) &pZoneAttributes->dwFlags, sizeof(DWORD));
1446 RegCloseKey(hcu);
1447 return S_OK;
1448
1449}
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882

◆ ZoneMgrImpl_SetZoneCustomPolicy()

static HRESULT WINAPI ZoneMgrImpl_SetZoneCustomPolicy ( IInternetZoneManagerEx2 *  iface,
DWORD  dwZone,
REFGUID  guidKey,
BYTE ppPolicy,
DWORD  cbPolicy,
URLZONEREG  ulrZoneReg 
)
static

Definition at line 1469 of file sec_mgr.c.

1475{
1476 FIXME("(%p)->(%08lx %s %p %08lx %08x) stub\n", iface, dwZone, debugstr_guid(guidKey),
1477 ppPolicy, cbPolicy, ulrZoneReg);
1478 return E_NOTIMPL;
1479}

Variable Documentation

◆ VT_SecManagerImpl

const IInternetSecurityManagerEx2Vtbl VT_SecManagerImpl
static
Initial value:
=
{
}
static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManagerEx2 *iface)
Definition: sec_mgr.c:842
static HRESULT WINAPI SecManagerImpl_GetSecurityIdEx2(IInternetSecurityManagerEx2 *iface, IUri *pUri, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: sec_mgr.c:1161
static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManagerEx2 *iface, DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags)
Definition: sec_mgr.c:1058
static HRESULT WINAPI SecManagerImpl_GetSecuritySite(IInternetSecurityManagerEx2 *iface, IInternetSecurityMgrSite **ppSite)
Definition: sec_mgr.c:909
static HRESULT WINAPI SecManagerImpl_ProcessUrlActionEx2(IInternetSecurityManagerEx2 *iface, IUri *pUri, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD_PTR dwReserved, DWORD *pdwOutFlags)
Definition: sec_mgr.c:1151
static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
Definition: sec_mgr.c:980
static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManagerEx2 *iface, REFIID riid, void **ppvObject)
Definition: sec_mgr.c:818
static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, DWORD *pdwZone, DWORD dwFlags)
Definition: sec_mgr.c:926
static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManagerEx2 *iface, IInternetSecurityMgrSite *pSite)
Definition: sec_mgr.c:874
static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy(IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
Definition: sec_mgr.c:1035
static HRESULT WINAPI SecManagerImpl_QueryCustomPolicyEx2(IInternetSecurityManagerEx2 *iface, IUri *pUri, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD_PTR dwReserved)
Definition: sec_mgr.c:1176
static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: sec_mgr.c:953
static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManagerEx2 *iface)
Definition: sec_mgr.c:852
static HRESULT WINAPI SecManagerImpl_GetZoneMappings(IInternetSecurityManagerEx2 *iface, DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
Definition: sec_mgr.c:1077
static HRESULT WINAPI SecManagerImpl_ProcessUrlActionEx(IInternetSecurityManagerEx2 *iface, LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved, DWORD *pdwOutFlags)
Definition: sec_mgr.c:1096
static HRESULT WINAPI SecManagerImpl_MapUrlToZoneEx2(IInternetSecurityManagerEx2 *iface, IUri *pUri, DWORD *pdwZone, DWORD dwFlags, LPWSTR *ppwszMappedUrl, DWORD *pdwOutFlags)
Definition: sec_mgr.c:1106

Definition at line 1186 of file sec_mgr.c.

Referenced by SecManagerImpl_Construct().

◆ wszZoneMapDomainsKey

const WCHAR wszZoneMapDomainsKey[]
static
Initial value:
=
L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap\\Domains"

Definition at line 40 of file sec_mgr.c.

Referenced by get_zone_from_domains().

◆ wszZonesKey

const WCHAR wszZonesKey[]
static
Initial value:
=
L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\"

Definition at line 36 of file sec_mgr.c.

Referenced by build_zonemap_from_reg(), and open_zone_key().

◆ zone_map_keyW

const WCHAR zone_map_keyW[]
static
Initial value:
=
L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap"

Definition at line 38 of file sec_mgr.c.

Referenced by IsInternetESCEnabledLocal().

◆ ZoneMgrImplVtbl

const IInternetZoneManagerEx2Vtbl ZoneMgrImplVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ZoneMgrImpl_GetIESecurityState(IInternetZoneManagerEx2 *iface, BOOL fRespectPolicy, LPDWORD pdwState, BOOL *pfPolicyEncountered, BOOL fNoCache)
Definition: sec_mgr.c:1725
static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManagerEx2 *iface)
Definition: sec_mgr.c:1351
static HRESULT WINAPI ZoneMgrImpl_CopyTemplatePoliciesToZone(IInternetZoneManagerEx2 *iface, DWORD dwTemplate, DWORD dwZone, DWORD dwReserved)
Definition: sec_mgr.c:1637
static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManagerEx2 *iface, DWORD dwEnum)
Definition: sec_mgr.c:1616
static ULONG WINAPI ZoneMgrImpl_AddRef(IInternetZoneManagerEx2 *iface)
Definition: sec_mgr.c:1338
static HRESULT WINAPI ZoneMgrImpl_GetZoneCustomPolicy(IInternetZoneManagerEx2 *iface, DWORD dwZone, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, URLZONEREG ulrZoneReg)
Definition: sec_mgr.c:1454
static HRESULT WINAPI ZoneMgrImpl_FixInsecureSettings(IInternetZoneManagerEx2 *iface)
Definition: sec_mgr.c:1745
static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributes(IInternetZoneManagerEx2 *iface, DWORD dwZone, ZONEATTRIBUTES *pZoneAttributes)
Definition: sec_mgr.c:1371
static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributesEx(IInternetZoneManagerEx2 *iface, DWORD dwZone, ZONEATTRIBUTES *pZoneAttributes, DWORD dwFlags)
Definition: sec_mgr.c:1688
static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2 *iface, DWORD *pdwEnum, DWORD *pdwCount, DWORD dwFlags)
Definition: sec_mgr.c:1543
static HRESULT WINAPI ZoneMgrImpl_PromptAction(IInternetZoneManagerEx2 *iface, DWORD dwAction, HWND hwndParent, LPCWSTR pwszUrl, LPCWSTR pwszText, DWORD dwPromptFlags)
Definition: sec_mgr.c:1514
static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicyEx(IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg, DWORD dwFlags)
Definition: sec_mgr.c:1672
static HRESULT WINAPI ZoneMgrImpl_LogAction(IInternetZoneManagerEx2 *iface, DWORD dwAction, LPCWSTR pwszUrl, LPCWSTR pwszText, DWORD dwLogFlags)
Definition: sec_mgr.c:1529
static HRESULT WINAPI ZoneMgrImpl_GetZoneSecurityState(IInternetZoneManagerEx2 *iface, DWORD dwZoneIndex, BOOL fRespectPolicy, LPDWORD pdwState, BOOL *pfPolicyEncountered)
Definition: sec_mgr.c:1705
static HRESULT WINAPI ZoneMgrImpl_QueryInterface(IInternetZoneManagerEx2 *iface, REFIID riid, void **ppvObject)
Definition: sec_mgr.c:1305
static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicy(IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg)
Definition: sec_mgr.c:1484
static HRESULT WINAPI ZoneMgrImpl_SetZoneAttributes(IInternetZoneManagerEx2 *iface, DWORD dwZone, ZONEATTRIBUTES *pZoneAttributes)
Definition: sec_mgr.c:1409
static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicyEx(IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg, DWORD dwFlags)
Definition: sec_mgr.c:1649
static HRESULT WINAPI ZoneMgrImpl_SetZoneCustomPolicy(IInternetZoneManagerEx2 *iface, DWORD dwZone, REFGUID guidKey, BYTE *ppPolicy, DWORD cbPolicy, URLZONEREG ulrZoneReg)
Definition: sec_mgr.c:1469
static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicy(IInternetZoneManagerEx2 *iface, DWORD dwZone, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg)
Definition: sec_mgr.c:1499
static HRESULT WINAPI ZoneMgrImpl_GetZoneAt(IInternetZoneManagerEx2 *iface, DWORD dwEnum, DWORD dwIndex, DWORD *pdwZone)
Definition: sec_mgr.c:1591

Definition at line 1754 of file sec_mgr.c.

Referenced by ZoneMgrImpl_Construct().