This data is stored in an alternative NTFS stream with the executable file. The stream is called Zone.Identifier :
Windows® Internet Explorer® uses the stream name Zone.Identifier to store URL security zones.
Full form sample.txt:Zone.Identifier:$DATA
Stream is a simple text stream of the form:
[ZoneTransfer]
ZoneId=3
MSDN-SECZONES provides an explanation of security zones.
(NB The original has a space between the colon and the "zone", but I think this is wrong.)
ZoneIds UrlMon.h SDK; ,
enum URLZONE {
URLZONE_LOCAL_MACHINE = 0,
URLZONE_INTRANET = 1,
URLZONE_TRUSTED = 2,
URLZONE_INTERNET = 3,
URLZONE_RESTRICTED = 4
};
( + 1, .)
, API- Win32 CreateFile WriteFile.
Firefox , 3 - Firefox ( MPL/LGPL/GPL):
bool SetInternetZoneIdentifier(const FilePath& full_path) {
const DWORD kShare = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
std::wstring path = full_path.value() + L":Zone.Identifier";
HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, kShare, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE == file)
return false;
const char kIdentifier[] = "[ZoneTransfer]\nZoneId=3";
DWORD written = 0;
BOOL result = WriteFile(file, kIdentifier, arraysize(kIdentifier), &written,
NULL);
CloseHandle(file);
if (!result || written != arraysize(kIdentifier)) {
DCHECK(FALSE);
return false;
}
return true;
}
IE COM API CLSID_PersistentZoneIdentifier, .