Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cWinFirewall.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cWinFirewall_H
7 #define _INC_cWinFirewall_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
13 
14 #if defined(USE_WIN_SDK) && defined(_WIN32) && ( _MSC_VER >= 1400 ) && ! defined(UNDER_CE)
18 
19 interface INetFwProfile;
20 enum NET_FW_SCOPE_;
21 enum NET_FW_IP_PROTOCOL_;
22 enum NET_FW_PROFILE_TYPE_;
23 
24 namespace GrayLib
25 {
26  UNITTEST2_PREDEF(cWinFirewall);
27 
28  class GRAYLIB_LINK cWinFirewall
29  {
34 
35  private:
36  cIUnkPtr<INetFwProfile> m_pFwProfile;
37 
38  public:
39  cWinFirewall();
40  ~cWinFirewall();
41 
42  HRESULT InitFirewallProfile(NET_FW_PROFILE_TYPE_ eProfile);
43  void UnInitFirewall();
44 
45  bool isFirewallPresent() const
46  {
47  return m_pFwProfile != nullptr;
48  }
49 
50  bool isFirewallEnabled() const;
51  bool isExceptionsAllowed() const;
52  bool isNotificationsEnabled() const;
53 
54  bool IsAppEnabled(const wchar_t* psFwProcessImageFileName) const;
55 
56  HRESULT AddAuthorizedApp(const wchar_t* psFwProcessImageFileName, const wchar_t* pszFwFriendlyName = nullptr, NET_FW_SCOPE_ eScope = (NET_FW_SCOPE_)0);
57  HRESULT RemoveAuthorizedApp(const wchar_t* psFwProcessImageFileName);
58 
59  HRESULT AddOpenPort(WORD wPort, NET_FW_IP_PROTOCOL_ dwProtool, const wchar_t* pszName);
60  HRESULT RemoveOpenPort(WORD wPort, NET_FW_IP_PROTOCOL_ dwProtool);
61 
62  UNITTEST2_PREDEF(cWinFirewall);
63  };
64 };
65 #endif
66 #endif // _INC_cWinFirewall_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)