Skip to content

Commit

Permalink
kph misc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jxy-s committed Jan 24, 2025
1 parent b4e245d commit ab4c6a0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
8 changes: 4 additions & 4 deletions KSystemInformer/KSystemInformer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<AdditionalDependencies>ksi.lib;Netio.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ksi.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<AdditionalOptions>/INTEGRITYCHECK /DEPENDENTLOADFLAG:0x800 /FILEALIGN:0x1000 /guard:retpoline %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/NATVIS:$(SolutionDir)\..\SystemInformer.natvis %(AdditionalOptions)</AdditionalOptions>
Expand Down Expand Up @@ -166,7 +166,7 @@
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<AdditionalDependencies>ksi.lib;Netio.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ksi.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<AdditionalOptions>/INTEGRITYCHECK /DEPENDENTLOADFLAG:0x800 /FILEALIGN:0x1000 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/NATVIS:$(SolutionDir)\..\SystemInformer.natvis %(AdditionalOptions)</AdditionalOptions>
Expand Down Expand Up @@ -208,7 +208,7 @@
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<AdditionalDependencies>ksi.lib;Netio.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ksi.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<AdditionalOptions>/INTEGRITYCHECK /BREPRO /DEPENDENTLOADFLAG:0x800 /PDBALTPATH:%_PDB% /FILEALIGN:0x1000 /guard:retpoline /NOVCFEATURE /NOCOFFGRPINFO %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/NATVIS:$(SolutionDir)\..\SystemInformer.natvis %(AdditionalOptions)</AdditionalOptions>
Expand Down Expand Up @@ -250,7 +250,7 @@
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<AdditionalDependencies>ksi.lib;Netio.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ksi.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;%(AdditionalDependencies)</AdditionalDependencies>
<RandomizedBaseAddress>true</RandomizedBaseAddress>
<AdditionalOptions>/INTEGRITYCHECK /BREPRO /DEPENDENTLOADFLAG:0x800 /PDBALTPATH:%_PDB% /FILEALIGN:0x1000 /NOVCFEATURE /NOCOFFGRPINFO %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/NATVIS:$(SolutionDir)\..\SystemInformer.natvis %(AdditionalOptions)</AdditionalOptions>
Expand Down
27 changes: 13 additions & 14 deletions KSystemInformer/include/kph.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <fltKernel.h>
#include <ntimage.h>
#include <bcrypt.h>
#include <wsk.h>
#pragma warning(pop)
#include <pooltags.h>
#define PHNT_MODE PHNT_MODE_KERNEL
Expand Down Expand Up @@ -248,31 +247,31 @@ SIZE_T InterlockedExchangeIfGreaterSizeT(
return expected;
}

#define ProbeOutputType(pointer, type) \
_Pragma("warning(suppress : 6001)") \
#define ProbeOutputType(pointer, type) \
_Pragma("warning(suppress : 6001 4116)") \
ProbeForRead(pointer, sizeof(type), TYPE_ALIGNMENT(type))

#define ProbeInputType(pointer, type) \
_Pragma("warning(suppress : 6001)") \
#define ProbeInputType(pointer, type) \
_Pragma("warning(suppress : 6001 4116)") \
ProbeForRead(pointer, sizeof(type), TYPE_ALIGNMENT(type))

#define ProbeOutputBytes(pointer, size) \
_Pragma("warning(suppress : 6001)") \
#define ProbeOutputBytes(pointer, size) \
_Pragma("warning(suppress : 6001 4116)") \
ProbeForRead(pointer, size, TYPE_ALIGNMENT(BYTE))

#define ProbeInputBytes(pointer, size) \
_Pragma("warning(suppress : 6001)") \
#define ProbeInputBytes(pointer, size) \
_Pragma("warning(suppress : 6001 4116)") \
ProbeForRead(pointer, size, TYPE_ALIGNMENT(BYTE))

#define C_2sTo4(x) ((unsigned int)(signed short)(x))

#define RebasePtr(pointer, oldBase, newBase) \
#define RebasePtr(pointer, oldBase, newBase) \
Add2Ptr(newBase, PtrOffset(oldBase, pointer))

#define RebaseUnicodeString(string, oldBase, newBase) \
if ((string)->Buffer) \
{ \
(string)->Buffer = Add2Ptr(newBase, PtrOffset(oldBase, (string)->Buffer));\
#define RebaseUnicodeString(string, oldBase, newBase) \
if ((string)->Buffer) \
{ \
(string)->Buffer = Add2Ptr(newBase, PtrOffset(oldBase, (string)->Buffer)); \
}

#define KPH_TIMEOUT(ms) { .QuadPart = (-10000ll * (ms)) }
Expand Down
4 changes: 0 additions & 4 deletions KSystemInformer/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

#include <trace.h>

KPH_PROTECTED_DATA_SECTION_RO_PUSH();
static const UNICODE_STRING KphpLsaPortName = RTL_CONSTANT_STRING(L"\\SeLsaCommandPort");
KPH_PROTECTED_DATA_SECTION_RO_POP();

/**
* \brief Performs a binary search of a sorted array.
*
Expand Down

0 comments on commit ab4c6a0

Please sign in to comment.