SOL9 Sample: NetFwProfile
|
1 Screenshot
2 Source code
/*
* NetFwProfile.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
//2012/08/29
#include <sol\Locale.h>
#include <sol\com\ApartmentThreadedModel.h>
#include <sol\netfw\NetFwMgr.h>
#include <sol\netfw\NetFwPolicy.h>
#include <sol\netfw\NetFwProfile.h>
void _tmain(int argc, const TCHAR* argv[])
{
Locale locale;
const TCHAR* encoding = _T("ISO-8859-1");
if (argc == 2) {
encoding = argv[1];
}
try {
ApartmentThreadedModel model;
_tprintf(_T("<?xml version='1.0' encoding='%s' ?>\n"), encoding);
_tprintf(_T("<NetFwApplication name='%s'>\n"), argv[0]);
SOL::NetFwMgr mgr;
NetFwPolicy policy = mgr.getLocalPolicy();
NetFwProfile currentProfile = policy.getProfileByType(NET_FW_PROFILE_CURRENT);
_tprintf(_T("<CurrentProfile>\n"));
currentProfile.display();
_tprintf(_T("</CurrentProfile>\n"));
NetFwProfile domainProfile = policy.getProfileByType(NET_FW_PROFILE_DOMAIN);
_tprintf(_T("<DomainProfile>\n"));
domainProfile.display();
_tprintf(_T("</DomainProfile>\n"));
NetFwProfile standardProfile = policy.getProfileByType(NET_FW_PROFILE_STANDARD);
_tprintf(_T("<StandardProfile>\n"));
standardProfile.display();
_tprintf(_T("</StandardProfile>\n"));
_tprintf(_T("</NetFwApplication>\n"));
} catch (Exception& ex) {
ex.printf();
} catch (HRESULT hr) {
_tprintf(_T("Exception: HRESULT=%x\n"), hr);
}
}
Last modified: 2 May 2016
Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.