Skip to content

Commit 8535899

Browse files
committed
Resolve warnings with code analysis
1 parent e02722a commit 8535899

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

SimpleSvmHook/Common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//
3434
// The pool tag.
3535
//
36-
static const ULONG k_PoolTag = 'MVSS';
36+
static constexpr ULONG k_PoolTag = 'MVSS';
3737

3838
//
3939
// The handy macros to specify at which section the code placed.

SimpleSvmHook/HookCommon.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
@author Satoshi Tanda
77
8-
@copyright Copyright (c) 2018, Satoshi Tanda. All rights reserved.
8+
@copyright Copyright (c) 2018-2021, Satoshi Tanda. All rights reserved.
99
*/
1010
#pragma once
1111
#include <fltKernel.h>
@@ -129,19 +129,19 @@ typedef struct _HOOK_DATA
129129

130130

131131
// Get the highest 25 bits
132-
static const ULONGLONG k_PxiShift = 39;
132+
static constexpr ULONGLONG k_PxiShift = 39;
133133

134134
// Get the highest 34 bits
135-
static const ULONGLONG k_PpiShift = 30;
135+
static constexpr ULONGLONG k_PpiShift = 30;
136136

137137
// Get the highest 43 bits
138-
static const ULONGLONG k_PdiShift = 21;
138+
static constexpr ULONGLONG k_PdiShift = 21;
139139

140140
// Get the highest 52 bits
141-
static const ULONGLONG k_PtiShift = 12;
141+
static constexpr ULONGLONG k_PtiShift = 12;
142142

143143
// Use 9 bits; 0b0000_0000_0000_0000_0000_0000_0001_1111_1111
144-
static const ULONGLONG k_PtxMask = 0x1ff;
144+
static constexpr ULONGLONG k_PtxMask = 0x1ff;
145145

146146
/*!
147147
@brief Returns the index of PML4 entry for the specified physical address.
@@ -319,7 +319,7 @@ GetVaFromPfn (
319319
return GetVaFromPa(GetPaFromPfn(PageFrameNumber));
320320
}
321321

322-
_When_(HookData == nullptr, __drv_allocatesMem(Mem) _Post_maybenull_)
322+
_When_(HookData == nullptr, _Post_maybenull_)
323323
_Post_writable_byte_size_(PAGE_SIZE)
324324
PVOID
325325
AllocateNptEntry (

SimpleSvmHook/HookKernelProcessorData.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static
2424
_IRQL_requires_max_(DISPATCH_LEVEL)
2525
VOID
2626
DestructNestedPageTablesInternal (
27-
_In_reads_(512) _Frees_ptr_ TableType* Table,
27+
_In_reads_(512) TableType* Table,
2828
_In_ ULONG TableLevel
2929
)
3030
{
@@ -79,7 +79,7 @@ static
7979
_IRQL_requires_max_(DISPATCH_LEVEL)
8080
VOID
8181
DestructNestedPageTables (
82-
_In_reads_(512) _Frees_ptr_ PPML4_ENTRY_4KB Pml4Table
82+
_In_reads_(512) PPML4_ENTRY_4KB Pml4Table
8383
)
8484
{
8585
DestructNestedPageTablesInternal(Pml4Table, 4);
@@ -115,7 +115,7 @@ BuildNestedPageTables (
115115
_Out_ PULONG MaxPpeIndex
116116
)
117117
{
118-
static const ULONG oneGigabyte = 1024 * 1024 * 1024;
118+
static constexpr ULONG oneGigabyte = 1024 * 1024 * 1024;
119119

120120
NTSTATUS status;
121121
PPML4_ENTRY_4KB pml4Table;

SimpleSvmHook/Performance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
@author Satoshi Tanda
77
8-
@copyright Copyright (c) 2018-2019, Satoshi Tanda. All rights reserved.
8+
@copyright Copyright (c) 2018-2021, Satoshi Tanda. All rights reserved.
99
*/
1010
#include "Performance.hpp"
1111
#include "Logging.hpp"
@@ -16,7 +16,7 @@
1616
//
1717
#pragma prefast(disable : __WARNING_ERROR, "This is completely bogus.")
1818

19-
static const ULONG k_PerformancePoolTag = 'freP';
19+
static constexpr ULONG k_PerformancePoolTag = 'freP';
2020

2121
/*!
2222
@brief Responsible for collecting and saving data supplied by PerfCounter.

SimpleSvmHook/Virtualization.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ BuildMsrPermissionsMap (
708708
_Inout_ PVOID MsrPermissionsMap
709709
)
710710
{
711-
static const UINT32 bitsPerMsr = 2;
712-
static const UINT32 secondMsrRangeBase = 0xc0000000;
713-
static const UINT32 secondMsrpmOffset = 0x800 * CHAR_BIT;
711+
static constexpr UINT32 bitsPerMsr = 2;
712+
static constexpr UINT32 secondMsrRangeBase = 0xc0000000;
713+
static constexpr UINT32 secondMsrpmOffset = 0x800 * CHAR_BIT;
714714

715715
RTL_BITMAP bitmapHeader;
716716
ULONG offsetFrom2ndBase, offset;

SimpleSvmHook/x86_64.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
66
@author Satoshi Tanda
77
8-
@copyright Copyright (c) 2018, Satoshi Tanda. All rights reserved.
8+
@copyright Copyright (c) 2018-2021, Satoshi Tanda. All rights reserved.
99
*/
1010
#pragma once
1111
#include <basetsd.h>
1212

13-
static const ULONG k_MaxInsturctionLength = 15;
13+
static constexpr ULONG k_MaxInsturctionLength = 15;
1414

1515
#define IA32_APIC_BASE 0x0000001b
1616
#define IA32_MSR_PAT 0x00000277

0 commit comments

Comments
 (0)