Zones and Security Demo

 

 

Small demo showing how to retrieve information about security-settings using the SecurityManager and ZoneMananger.

You can use CoInternetSecurityManager and coInternetZoneManager (urlmon.pas) to create an instance of the Security- and ZoneManager:

var
SecManager : IInternetSecurityManager;
ZoneManager : IInternetZoneManager;
begin
CoInternetCreateSecuritymanager(nil, SecManager, 0);
CoInternetCreateZoneManager(nil, ZoneManager, 0);
...


The InternetZoneManager contains all functions needed to enumerate the security zones:

var
Zone, ZoneCounter, TotalZones, ZoneEnum: Dword;
begin
ZoneManager.CreateZoneEnumerator(ZoneEnum, TotalZones, 0);
for ZoneCounter := 0 to TotalZones - 1 do
begin
ZoneManager.GetZoneAt(ZoneEnum, ZoneCounter, Zone);
... 
end;

To retrieve information about the securityzone you can use GetZoneAttributes:

var
ZoneAttrib: TZoneAttributes;
begin
...
ZoneManager.GetZoneAttributes(Zone, ZoneAttrib);
...

ZoneAttributes contains following information:

DisplayName:e.g.  Local Intranet
Description:e.g. This zone contains all Web sites that are on your  organization's intranet.
Icon information:e.g. shell32.dll#0018

The demo shows how to extract and show the icon and information in a listview.

The SecurityManager can be used to retrive information of sites or url-patterns added to the selcted zone. GetZoneMappings returns a list of type IEnumString. The following code demonstrates how to add the urlpatterns to a memo-field:

var
Enum: IEnumString;
Fetched: UInt;
Zone: DWord;
Pattern: POleStr;
begin
...
SecManager.GetZoneMappings(Zone, enum, 0);
while Succeeded(Enum.Next(1, Pattern, @fetched)) and (fetched = 1) do
memo1.lines.Add(Pattern);
...

The demo shows also how to retrieve the policies for all URLACTIONS using ZoneManagers GetZoneActionPolicies.

In EmbeddedWB you can easily connect to the Securitymanager or ZoneManager using:

EmbeddedWB1.SecurityManager 
or
EmbeddedWB1.ZoneManager

See also: EmbeddedWB->Security


LINKS:

URL Security Zones Overview

URL Security Zones Reference

Download Zones & Security Demo

Zones & Security Demo for Delphi 5


Created and maintained by
Per Lindsų Larsen

Last Update: August 19, 2000