@@ -39,7 +39,7 @@ template <typename PFN>
3939class WinApiFunction
4040{
4141public:
42- WinApiFunction (const char *dllName, const char *fnName)
42+ WinApiFunction (const char *dllName, const char *fnName) noexcept
4343 {
4444 m_ptr = NULL ;
4545 const HMODULE hDll = GetModuleHandle (dllName);
@@ -50,21 +50,21 @@ class WinApiFunction
5050 ~WinApiFunction ()
5151 {}
5252
53- PFN operator * () const { return m_ptr; }
53+ PFN operator * () const noexcept { return m_ptr; }
5454
55- operator bool () const { return (m_ptr != NULL ); }
55+ operator bool () const noexcept { return (m_ptr != NULL ); }
5656
5757private:
5858 PFN m_ptr;
5959};
6060
61- const char * const KERNEL32_DLL = " kernel32.dll" ;
61+ constexpr const char * KERNEL32_DLL = " kernel32.dll" ;
6262
6363
6464class ContextActivator
6565{
6666public:
67- ContextActivator () :
67+ ContextActivator () noexcept :
6868 mFindActCtxSectionString (KERNEL32_DLL, " FindActCtxSectionStringA" ),
6969 mCreateActCtx (KERNEL32_DLL, " CreateActCtxA" ),
7070 mReleaseActCtx (KERNEL32_DLL, " ReleaseActCtx" ),
@@ -83,11 +83,7 @@ class ContextActivator
8383 if (!mCreateActCtx )
8484 return ;
8585
86- ACTCTX_SECTION_KEYED_DATA ackd;
87- memset (&ackd, 0 , sizeof (ackd));
88- ackd.cbSize = sizeof (ackd);
89-
90- const char * crtDll =
86+ constexpr const char * crtDll =
9187#if _MSC_VER == 1400
9288 " msvcr80.dll" ;
9389#elif _MSC_VER == 1500
@@ -110,6 +106,9 @@ class ContextActivator
110106// #error Specify CRT DLL name here !
111107#endif
112108
109+ ACTCTX_SECTION_KEYED_DATA ackd{};
110+ ackd.cbSize = sizeof (ackd);
111+
113112 // if CRT already present in some activation context then nothing to do
114113 if ((*mFindActCtxSectionString )
115114 (0 , NULL ,
@@ -120,8 +119,7 @@ class ContextActivator
120119 }
121120
122121 // create and use activation context from our own manifest
123- ACTCTXA actCtx;
124- memset (&actCtx, 0 , sizeof (actCtx));
122+ ACTCTXA actCtx{};
125123 actCtx.cbSize = sizeof (actCtx);
126124 actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
127125 actCtx.lpResourceName = ISOLATIONAWARE_MANIFEST_RESOURCE_ID;
@@ -157,7 +155,7 @@ class ContextActivator
157155 WinApiFunction<PFN_DAC> mDeactivateActCtx ;
158156
159157 HANDLE hActCtx;
160- ULONG_PTR mCookie ;
158+ ULONG_PTR mCookie = 0 ;
161159};
162160
163161
0 commit comments