Build and bug fixes
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
<AdditionalIncludeDirectories>$(CRT_IncludePath);$(KM_IncludePath);$(KIT_SHARED_IncludePath)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SystemInformerRoot)phnt\include\</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SystemInformerRoot)kphlib\include\</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture)\</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(ProjectDir)include\</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/kernel /utf-8 /INTEGRITYCHECK /d1nodatetime %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Platform)'=='x64'">/d2guardretpoline %(AdditionalOptions)</AdditionalOptions>
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
</Lib>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0009</Culture>
|
||||
<AdditionalOptions>/c 65001 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/8 %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<AdditionalDependencies>ksi.lib;FltMgr.lib;ksecdd.lib;kphlib_km.lib;volatileaccessk.lib;umaccess.lib%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SystemInformerRoot)kphlib\include\</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SystemInformerRoot)kphlib\include\;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture)\;</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -101,4 +101,4 @@
|
||||
<ClInclude Include="include\trace.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<ModuleDefinitionFile>ksidll.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SystemInformerRoot)kphlib\include\;</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SystemInformerRoot)kphlib\include\;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture)\;</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#pragma code_page(65001)
|
||||
|
||||
#include <windows.h>
|
||||
#include <sistatus.rc>
|
||||
|
||||
@@ -213,7 +213,7 @@ target_include_directories(SystemInformer PRIVATE
|
||||
|
||||
target_include_directories(SystemInformer INTERFACE
|
||||
"${SI_ROOT}/phnt/include"
|
||||
"${SI_ROOT}/sdk/include"
|
||||
"${SI_ROOT}/sdk/include/$<CONFIG>${SI_PLATFORM_SHORT}"
|
||||
)
|
||||
|
||||
target_compile_definitions(SystemInformer PRIVATE
|
||||
|
||||
@@ -102,17 +102,17 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_PHAPP_;_WINDOWS;WIN32;_DEBUG;DEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;cfgmgr32.lib;aclui.lib;comctl32.lib;dnsapi.lib;gdiplus.lib;ntdll.lib;phlib.lib;userenv.lib;wbemuuid.lib;windowscodecs.lib;winhttp.lib;winsta.lib;kphlib_um.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>SystemInformer.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>setupapi.dll;cfgmgr32.dll;aclui.dll;comdlg32.dll;gdiplus.dll;oleaut32.dll;winhttp.dll;winsta.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)kphlib\include;$(SolutionDir)phnt\include;$(SolutionDir)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_zdriver_sdk.cmd" "$(OutDir)$(TargetName)$(TargetExt)" "-$(Configuration)" "-$(PlatformName)"</Command>
|
||||
@@ -123,17 +123,17 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_PHAPP_;_WINDOWS;WIN64;_DEBUG;DEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;cfgmgr32.lib;aclui.lib;comctl32.lib;dnsapi.lib;gdiplus.lib;ntdll.lib;phlib.lib;userenv.lib;wbemuuid.lib;windowscodecs.lib;winhttp.lib;winsta.lib;kphlib_um.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>SystemInformer.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>setupapi.dll;cfgmgr32.dll;aclui.dll;comdlg32.dll;gdiplus.dll;oleaut32.dll;winhttp.dll;winsta.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)kphlib\include;$(SolutionDir)phnt\include;$(SolutionDir)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_zdriver_sdk.cmd" "$(OutDir)$(TargetName)$(TargetExt)" "-$(Configuration)" "-$(PlatformName)"</Command>
|
||||
@@ -144,17 +144,17 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_PHAPP_;_WINDOWS;WIN64;_DEBUG;DEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;cfgmgr32.lib;aclui.lib;comctl32.lib;dnsapi.lib;gdiplus.lib;ntdll.lib;phlib.lib;userenv.lib;wbemuuid.lib;windowscodecs.lib;winhttp.lib;winsta.lib;kphlib_um.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>SystemInformer.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>setupapi.dll;cfgmgr32.dll;aclui.dll;comdlg32.dll;gdiplus.dll;oleaut32.dll;winhttp.dll;winsta.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)kphlib\include;$(SolutionDir)phnt\include;$(SolutionDir)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_zdriver_sdk.cmd" "$(OutDir)$(TargetName)$(TargetExt)" "-$(Configuration)" "-$(PlatformName)"</Command>
|
||||
@@ -165,17 +165,17 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_PHAPP_;_WINDOWS;WIN32;NDEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;cfgmgr32.lib;aclui.lib;comctl32.lib;dnsapi.lib;gdiplus.lib;ntdll.lib;phlib.lib;userenv.lib;wbemuuid.lib;windowscodecs.lib;winhttp.lib;winsta.lib;kphlib_um.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>SystemInformer.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>setupapi.dll;cfgmgr32.dll;aclui.dll;comdlg32.dll;gdiplus.dll;oleaut32.dll;winhttp.dll;winsta.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)kphlib\include;$(SolutionDir)phnt\include;$(SolutionDir)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_zdriver_sdk.cmd" "$(OutDir)$(TargetName)$(TargetExt)" "-$(Configuration)" "-$(PlatformName)"</Command>
|
||||
@@ -186,17 +186,17 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_PHAPP_;_WINDOWS;WIN64;NDEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;cfgmgr32.lib;aclui.lib;comctl32.lib;dnsapi.lib;gdiplus.lib;ntdll.lib;phlib.lib;userenv.lib;wbemuuid.lib;windowscodecs.lib;winhttp.lib;winsta.lib;kphlib_um.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>SystemInformer.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>setupapi.dll;cfgmgr32.dll;aclui.dll;comdlg32.dll;gdiplus.dll;oleaut32.dll;winhttp.dll;winsta.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)kphlib\include;$(SolutionDir)phnt\include;$(SolutionDir)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_zdriver_sdk.cmd" "$(OutDir)$(TargetName)$(TargetExt)" "-$(Configuration)" "-$(PlatformName)"</Command>
|
||||
@@ -207,17 +207,17 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_PHAPP_;_WINDOWS;WIN64;NDEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;cfgmgr32.lib;aclui.lib;comctl32.lib;dnsapi.lib;gdiplus.lib;ntdll.lib;phlib.lib;userenv.lib;wbemuuid.lib;windowscodecs.lib;winhttp.lib;winsta.lib;kphlib_um.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>SystemInformer.def</ModuleDefinitionFile>
|
||||
<DelayLoadDLLs>setupapi.dll;cfgmgr32.dll;aclui.dll;comdlg32.dll;gdiplus.dll;oleaut32.dll;winhttp.dll;winsta.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)kphlib\include;$(SolutionDir)phnt\include;$(SolutionDir)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_zdriver_sdk.cmd" "$(OutDir)$(TargetName)$(TargetExt)" "-$(Configuration)" "-$(PlatformName)"</Command>
|
||||
@@ -410,7 +410,7 @@
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="SystemInformer.rc" />
|
||||
<ResourceCompile Include="version.rc" />
|
||||
<ResourceCompile Include="..\kphlib\include\sistatus.rc" />
|
||||
<ResourceCompile Include="$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture)\sistatus.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="SystemInformer.manifest" />
|
||||
|
||||
@@ -557,8 +557,8 @@
|
||||
</ResourceCompile>
|
||||
<ResourceCompile Include="version.rc">
|
||||
<Filter>Resources</Filter>
|
||||
</ResourceCompile>
|
||||
<ResourceCompile Include="..\kphlib\include\sistatus.rc">
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture)\sistatus.rc">
|
||||
<Filter>Resources</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -2221,7 +2221,7 @@ BOOLEAN PhUiSuspendTreeProcess(
|
||||
WindowHandle,
|
||||
L"suspend",
|
||||
PhaConcatStrings2(Process->ProcessName->Buffer, L" and its descendants")->Buffer,
|
||||
L"Suspending a process tree will cause the process and its descendants to be suspend.",
|
||||
L"Suspending a process tree will cause the process and its descendants to be suspended.",
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1585,11 +1585,10 @@ VOID PhpAppendCommandLineArgument(
|
||||
|
||||
PhAppendStringBuilder2(StringBuilder, L" -");
|
||||
PhAppendStringBuilder2(StringBuilder, Name);
|
||||
PhAppendStringBuilder2(StringBuilder, L" \"");
|
||||
temp = PhEscapeCommandLinePart(Value);
|
||||
PhAppendCharStringBuilder(StringBuilder, L' ');
|
||||
temp = PhQuoteCommandLine(Value, TRUE);
|
||||
PhAppendStringBuilder(StringBuilder, &temp->sr);
|
||||
PhDereferenceObject(temp);
|
||||
PhAppendCharStringBuilder(StringBuilder, L'\"');
|
||||
}
|
||||
|
||||
NTSTATUS PhShellProcessHackerEx(
|
||||
|
||||
+535
-151
@@ -23,8 +23,15 @@ typedef struct _COLUMNS_DIALOG_CONTEXT
|
||||
HBRUSH BrushNormal;
|
||||
HBRUSH BrushPushed;
|
||||
HBRUSH BrushHot;
|
||||
HBRUSH BrushHover;
|
||||
COLORREF TextColor;
|
||||
|
||||
WNDPROC InactiveListWindowProc;
|
||||
WNDPROC ActiveListWindowProc;
|
||||
HWND HotListHandle;
|
||||
LONG HotListIndex;
|
||||
BOOLEAN MouseTracking;
|
||||
|
||||
HWND InactiveWindowHandle;
|
||||
HWND ActiveWindowHandle;
|
||||
HWND SearchInactiveHandle;
|
||||
@@ -35,6 +42,10 @@ typedef struct _COLUMNS_DIALOG_CONTEXT
|
||||
HWND MoveDownHandle;
|
||||
PPH_LIST InactiveListArray;
|
||||
PPH_LIST ActiveListArray;
|
||||
|
||||
UINT DragListMessage;
|
||||
HWND DragSourceHandle;
|
||||
LONG DragItemIndex;
|
||||
} COLUMNS_DIALOG_CONTEXT, *PCOLUMNS_DIALOG_CONTEXT;
|
||||
|
||||
INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
@@ -44,6 +55,13 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
_In_ LPARAM lParam
|
||||
);
|
||||
|
||||
/**
|
||||
* Shows the column chooser dialog for a control.
|
||||
*
|
||||
* \param ParentWindowHandle Parent window for the dialog.
|
||||
* \param ControlHandle The handle to the control.
|
||||
* \param Type The type of the control.
|
||||
*/
|
||||
VOID PhShowChooseColumnsDialog(
|
||||
_In_ HWND ParentWindowHandle,
|
||||
_In_ HWND ControlHandle,
|
||||
@@ -72,6 +90,14 @@ VOID PhShowChooseColumnsDialog(
|
||||
PhDereferenceObject(context.Columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the display index of two columns for sorting.
|
||||
*
|
||||
* \param Context Optional callback context.
|
||||
* \param elem1 First column pointer.
|
||||
* \param elem2 Second column pointer.
|
||||
* \return Comparison result.
|
||||
*/
|
||||
static int __cdecl PhpColumnsCompareDisplayIndexTn(
|
||||
_In_ void* Context,
|
||||
_In_ void const* elem1,
|
||||
@@ -84,6 +110,14 @@ static int __cdecl PhpColumnsCompareDisplayIndexTn(
|
||||
return uintcmp(column1->DisplayIndex, column2->DisplayIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the names of two inactive columns alphabetically.
|
||||
*
|
||||
* \param Context Optional callback context.
|
||||
* \param elem1 First string pointer.
|
||||
* \param elem2 Second string pointer.
|
||||
* \return Comparison result.
|
||||
*/
|
||||
static long __cdecl PhpInactiveColumnsCompareNameTn(
|
||||
_In_ const void* Context,
|
||||
_In_ const void *elem1,
|
||||
@@ -96,6 +130,13 @@ static long __cdecl PhpInactiveColumnsCompareNameTn(
|
||||
return PhCompareStringZ(column1, column2, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the index of a string in a list.
|
||||
*
|
||||
* \param List The list to search.
|
||||
* \param String The string to find.
|
||||
* \return The index of the string, or ULONG_MAX if not found.
|
||||
*/
|
||||
_Success_(return != ULONG_MAX)
|
||||
static ULONG IndexOfStringInList(
|
||||
_In_ PPH_LIST List,
|
||||
@@ -111,6 +152,48 @@ static ULONG IndexOfStringInList(
|
||||
return ULONG_MAX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the hot (mouse-over) item, invalidating the previous and new items.
|
||||
*
|
||||
* \param Context The columns dialog context.
|
||||
* \param ListBoxHandle The list box under the mouse, or NULL for none.
|
||||
* \param ItemIndex The hot item index, or LB_ERR for none.
|
||||
*/
|
||||
static VOID PhpColumnsSetHotItem(
|
||||
_In_ PCOLUMNS_DIALOG_CONTEXT Context,
|
||||
_In_opt_ HWND ListBoxHandle,
|
||||
_In_ LONG ItemIndex
|
||||
)
|
||||
{
|
||||
RECT itemRect;
|
||||
|
||||
if (Context->HotListHandle == ListBoxHandle && Context->HotListIndex == ItemIndex)
|
||||
return;
|
||||
|
||||
if (Context->HotListHandle && Context->HotListIndex != LB_ERR)
|
||||
{
|
||||
if (ListBox_GetItemRect(Context->HotListHandle, Context->HotListIndex, &itemRect) != LB_ERR)
|
||||
InvalidateRect(Context->HotListHandle, &itemRect, FALSE);
|
||||
}
|
||||
|
||||
Context->HotListHandle = ListBoxHandle;
|
||||
Context->HotListIndex = ItemIndex;
|
||||
|
||||
if (ListBoxHandle && ItemIndex != LB_ERR)
|
||||
{
|
||||
if (ListBox_GetItemRect(ListBoxHandle, ItemIndex, &itemRect) != LB_ERR)
|
||||
InvalidateRect(ListBoxHandle, &itemRect, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets a list box and populates it with items, optionally sorting and filtering them.
|
||||
*
|
||||
* \param ListBoxHandle The handle to the list box control.
|
||||
* \param MatchHandle The search control match handle for filtering.
|
||||
* \param Array The list containing the items to display.
|
||||
* \param CompareFunction Optional comparison function for sorting.
|
||||
*/
|
||||
VOID PhpColumnsResetListBox(
|
||||
_In_ HWND ListBoxHandle,
|
||||
_In_ ULONG_PTR MatchHandle,
|
||||
@@ -153,6 +236,259 @@ VOID PhpColumnsResetListBox(
|
||||
SendMessage(ListBoxHandle, WM_SETREDRAW, TRUE, 0);
|
||||
}
|
||||
|
||||
// Moves the item at listbox row FromIndex to insert position ToIndex (the item is
|
||||
// inserted before the item currently at ToIndex; ToIndex == count appends).
|
||||
/**
|
||||
* Moves an item in the active columns list from one position to another.
|
||||
*
|
||||
* \param Context The columns dialog context.
|
||||
* \param FromIndex The index of the item to move.
|
||||
* \param ToIndex The destination index.
|
||||
*/
|
||||
static VOID PhpColumnsMoveActiveItem(
|
||||
_In_ PCOLUMNS_DIALOG_CONTEXT Context,
|
||||
_In_ LONG FromIndex,
|
||||
_In_ LONG ToIndex
|
||||
)
|
||||
{
|
||||
LONG count;
|
||||
LONG target;
|
||||
PPH_STRING string;
|
||||
ULONG arrayFrom;
|
||||
ULONG arrayTo;
|
||||
PVOID item;
|
||||
|
||||
count = ListBox_GetCount(Context->ActiveWindowHandle);
|
||||
|
||||
if (FromIndex == LB_ERR || FromIndex >= count || ToIndex < 0 || ToIndex > count)
|
||||
return;
|
||||
|
||||
PhpColumnsSetHotItem(Context, NULL, LB_ERR);
|
||||
if (ToIndex == FromIndex || ToIndex == FromIndex + 1) // no-op move
|
||||
return;
|
||||
|
||||
string = PhGetListBoxString(Context->ActiveWindowHandle, FromIndex);
|
||||
|
||||
if (PhIsNullOrEmptyString(string))
|
||||
{
|
||||
PhClearReference(&string);
|
||||
return;
|
||||
}
|
||||
|
||||
arrayFrom = IndexOfStringInList(Context->ActiveListArray, string->Buffer);
|
||||
|
||||
if (arrayFrom != ULONG_MAX)
|
||||
{
|
||||
// The listbox may be filtered, so translate the insert row to an array
|
||||
// position through the string of the item currently at that row.
|
||||
if (ToIndex >= count)
|
||||
{
|
||||
arrayTo = Context->ActiveListArray->Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
PPH_STRING targetString = PhGetListBoxString(Context->ActiveWindowHandle, ToIndex);
|
||||
|
||||
arrayTo = targetString ? IndexOfStringInList(Context->ActiveListArray, targetString->Buffer) : ULONG_MAX;
|
||||
PhClearReference(&targetString);
|
||||
|
||||
if (arrayTo == ULONG_MAX)
|
||||
arrayTo = Context->ActiveListArray->Count;
|
||||
}
|
||||
|
||||
item = Context->ActiveListArray->Items[arrayFrom];
|
||||
PhRemoveItemsList(Context->ActiveListArray, arrayFrom, 1);
|
||||
|
||||
if (arrayTo > arrayFrom)
|
||||
arrayTo--;
|
||||
|
||||
PhInsertItemList(Context->ActiveListArray, arrayTo, item);
|
||||
|
||||
target = ToIndex;
|
||||
|
||||
if (target > FromIndex)
|
||||
target--;
|
||||
|
||||
ListBox_DeleteString(Context->ActiveWindowHandle, FromIndex);
|
||||
ListBox_InsertString(Context->ActiveWindowHandle, target, item);
|
||||
ListBox_SetCurSel(Context->ActiveWindowHandle, target);
|
||||
|
||||
EnableWindow(Context->MoveUpHandle, target != 0);
|
||||
EnableWindow(Context->MoveDownHandle, target != count - 1);
|
||||
}
|
||||
|
||||
PhClearReference(&string);
|
||||
}
|
||||
|
||||
// Moves the item at inactive listbox row InactiveIndex into the active list at
|
||||
// insert position ActiveInsertIndex (INT_ERROR or count appends).
|
||||
/**
|
||||
* Moves a column from the inactive list to the active list.
|
||||
*
|
||||
* \param Context The columns dialog context.
|
||||
* \param InactiveIndex The index of the item in the inactive list.
|
||||
* \param ActiveInsertIndex The insert index in the active list.
|
||||
*/
|
||||
static VOID PhpColumnsShowItem(
|
||||
_In_ PCOLUMNS_DIALOG_CONTEXT Context,
|
||||
_In_ LONG InactiveIndex,
|
||||
_In_ LONG ActiveInsertIndex
|
||||
)
|
||||
{
|
||||
LONG count;
|
||||
PPH_STRING string;
|
||||
|
||||
count = ListBox_GetCount(Context->InactiveWindowHandle);
|
||||
|
||||
if (InactiveIndex == LB_ERR || InactiveIndex >= count)
|
||||
return;
|
||||
|
||||
PhpColumnsSetHotItem(Context, NULL, LB_ERR);
|
||||
|
||||
string = PhGetListBoxString(Context->InactiveWindowHandle, InactiveIndex);
|
||||
|
||||
if (!PhIsNullOrEmptyString(string))
|
||||
{
|
||||
ULONG index = IndexOfStringInList(Context->InactiveListArray, string->Buffer);
|
||||
|
||||
if (index != ULONG_MAX)
|
||||
{
|
||||
PVOID item = Context->InactiveListArray->Items[index];
|
||||
LONG activeCount = ListBox_GetCount(Context->ActiveWindowHandle);
|
||||
ULONG arrayTo;
|
||||
|
||||
PhRemoveItemsList(Context->InactiveListArray, index, 1);
|
||||
|
||||
if (ActiveInsertIndex < 0 || ActiveInsertIndex >= activeCount)
|
||||
{
|
||||
arrayTo = Context->ActiveListArray->Count;
|
||||
ActiveInsertIndex = activeCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
PPH_STRING targetString = PhGetListBoxString(Context->ActiveWindowHandle, ActiveInsertIndex);
|
||||
|
||||
arrayTo = targetString ? IndexOfStringInList(Context->ActiveListArray, targetString->Buffer) : ULONG_MAX;
|
||||
PhClearReference(&targetString);
|
||||
|
||||
if (arrayTo == ULONG_MAX)
|
||||
arrayTo = Context->ActiveListArray->Count;
|
||||
}
|
||||
|
||||
PhInsertItemList(Context->ActiveListArray, arrayTo, item);
|
||||
|
||||
ListBox_DeleteString(Context->InactiveWindowHandle, InactiveIndex);
|
||||
ListBox_InsertString(Context->ActiveWindowHandle, ActiveInsertIndex, item);
|
||||
}
|
||||
|
||||
count--;
|
||||
|
||||
if (InactiveIndex >= count - 1)
|
||||
InactiveIndex = count - 1;
|
||||
|
||||
if (InactiveIndex != LB_ERR)
|
||||
{
|
||||
ListBox_SetCurSel(Context->InactiveWindowHandle, InactiveIndex);
|
||||
}
|
||||
}
|
||||
|
||||
PhClearReference(&string);
|
||||
}
|
||||
|
||||
// Moves the item at active listbox row ActiveIndex back into the (sorted) inactive list.
|
||||
/**
|
||||
* Moves a column from the active list to the inactive list.
|
||||
*
|
||||
* \param Context The columns dialog context.
|
||||
* \param ActiveIndex The index of the item in the active list.
|
||||
*/
|
||||
static VOID PhpColumnsHideItem(
|
||||
_In_ PCOLUMNS_DIALOG_CONTEXT Context,
|
||||
_In_ LONG ActiveIndex
|
||||
)
|
||||
{
|
||||
LONG count;
|
||||
PPH_STRING string;
|
||||
|
||||
count = ListBox_GetCount(Context->ActiveWindowHandle);
|
||||
|
||||
if (ActiveIndex == LB_ERR || ActiveIndex >= count)
|
||||
return;
|
||||
|
||||
PhpColumnsSetHotItem(Context, NULL, LB_ERR);
|
||||
|
||||
string = PhGetListBoxString(Context->ActiveWindowHandle, ActiveIndex);
|
||||
|
||||
if (!PhIsNullOrEmptyString(string))
|
||||
{
|
||||
ULONG index = IndexOfStringInList(Context->ActiveListArray, string->Buffer);
|
||||
|
||||
if (index != ULONG_MAX)
|
||||
{
|
||||
PVOID item = Context->ActiveListArray->Items[index];
|
||||
|
||||
// Remove from active array, insert into inactive
|
||||
PhRemoveItemsList(Context->ActiveListArray, index, 1);
|
||||
PhAddItemList(Context->InactiveListArray, item);
|
||||
|
||||
// Delete from active list
|
||||
ListBox_DeleteString(Context->ActiveWindowHandle, ActiveIndex);
|
||||
// Sort the inactive list with the new entry and refresh
|
||||
PhpColumnsResetListBox(Context->InactiveWindowHandle, 0, Context->InactiveListArray, PhpInactiveColumnsCompareNameTn);
|
||||
}
|
||||
|
||||
count--;
|
||||
|
||||
if (ActiveIndex >= count - 1)
|
||||
ActiveIndex = count - 1;
|
||||
|
||||
if (ActiveIndex != LB_ERR)
|
||||
{
|
||||
ListBox_SetCurSel(Context->ActiveWindowHandle, ActiveIndex);
|
||||
}
|
||||
}
|
||||
|
||||
PhClearReference(&string);
|
||||
}
|
||||
|
||||
// Returns the insert row under the cursor for a drag list target, count when the
|
||||
// cursor is inside the listbox but below the last item, or INT_ERROR when outside.
|
||||
/**
|
||||
* Finds the drag insert index under the cursor for a list box.
|
||||
*
|
||||
* \param ListBoxHandle The handle to the list box.
|
||||
* \param Point The current cursor coordinates.
|
||||
* \param AutoScroll Whether to auto-scroll the list box.
|
||||
* \return The insert index, or INT_ERROR if the cursor is outside.
|
||||
*/
|
||||
static LONG PhpColumnsDragTargetIndex(
|
||||
_In_ HWND ListBoxHandle,
|
||||
_In_ POINT Point,
|
||||
_In_ BOOLEAN AutoScroll
|
||||
)
|
||||
{
|
||||
LONG index;
|
||||
RECT rect;
|
||||
|
||||
index = LBItemFromPt(ListBoxHandle, Point, AutoScroll);
|
||||
|
||||
if (index == INT_ERROR)
|
||||
{
|
||||
GetWindowRect(ListBoxHandle, &rect);
|
||||
|
||||
if (PtInRect(&rect, Point))
|
||||
index = ListBox_GetCount(ListBoxHandle);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for the inactive columns search control.
|
||||
*
|
||||
* \param MatchHandle The search control match handle.
|
||||
* \param Context The columns dialog context.
|
||||
*/
|
||||
_Function_class_(PH_SEARCHCONTROL_CALLBACK)
|
||||
VOID NTAPI PhpInactiveColumnsSearchControlCallback(
|
||||
_In_ ULONG_PTR MatchHandle,
|
||||
@@ -161,6 +497,8 @@ VOID NTAPI PhpInactiveColumnsSearchControlCallback(
|
||||
{
|
||||
PCOLUMNS_DIALOG_CONTEXT context = Context;
|
||||
|
||||
PhpColumnsSetHotItem(context, NULL, LB_ERR);
|
||||
|
||||
PhpColumnsResetListBox(
|
||||
context->InactiveWindowHandle,
|
||||
MatchHandle,
|
||||
@@ -169,6 +507,12 @@ VOID NTAPI PhpInactiveColumnsSearchControlCallback(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for the active columns search control.
|
||||
*
|
||||
* \param MatchHandle The search control match handle.
|
||||
* \param Context The columns dialog context.
|
||||
*/
|
||||
_Function_class_(PH_SEARCHCONTROL_CALLBACK)
|
||||
VOID NTAPI PhpActiveColumnsSearchControlCallback(
|
||||
_In_ ULONG_PTR MatchHandle,
|
||||
@@ -177,6 +521,8 @@ VOID NTAPI PhpActiveColumnsSearchControlCallback(
|
||||
{
|
||||
PCOLUMNS_DIALOG_CONTEXT context = Context;
|
||||
|
||||
PhpColumnsSetHotItem(context, NULL, LB_ERR);
|
||||
|
||||
PhpColumnsResetListBox(
|
||||
context->ActiveWindowHandle,
|
||||
MatchHandle,
|
||||
@@ -185,6 +531,76 @@ VOID NTAPI PhpActiveColumnsSearchControlCallback(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Window procedure for the column list boxes providing hot (mouse-over) tracking.
|
||||
*
|
||||
* \param WindowHandle The handle to the list box window.
|
||||
* \param WindowMessage The window message.
|
||||
* \param wParam Additional message-specific information.
|
||||
* \param lParam Additional message-specific information.
|
||||
* \return LRESULT The message result.
|
||||
*/
|
||||
static LRESULT CALLBACK PhpColumnsListBoxWndProc(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ UINT WindowMessage,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
)
|
||||
{
|
||||
PCOLUMNS_DIALOG_CONTEXT context;
|
||||
WNDPROC oldWndProc;
|
||||
|
||||
if (!(context = PhGetWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT)))
|
||||
return DefWindowProc(WindowHandle, WindowMessage, wParam, lParam);
|
||||
|
||||
if (WindowHandle == context->ActiveWindowHandle)
|
||||
oldWndProc = context->ActiveListWindowProc;
|
||||
else
|
||||
oldWndProc = context->InactiveListWindowProc;
|
||||
|
||||
switch (WindowMessage)
|
||||
{
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
|
||||
PhRemoveWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT);
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
LRESULT result = SendMessage(WindowHandle, LB_ITEMFROMPOINT, 0, lParam);
|
||||
LONG index = HIWORD(result) == 0 ? (LONG)(SHORT)LOWORD(result) : LB_ERR;
|
||||
|
||||
PhpColumnsSetHotItem(context, WindowHandle, index);
|
||||
|
||||
if (!context->MouseTracking)
|
||||
{
|
||||
TRACKMOUSEEVENT trackMouseEvent = { sizeof(TRACKMOUSEEVENT), TME_LEAVE, WindowHandle, 0 };
|
||||
|
||||
context->MouseTracking = !!TrackMouseEvent(&trackMouseEvent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_MOUSELEAVE:
|
||||
{
|
||||
context->MouseTracking = FALSE;
|
||||
PhpColumnsSetHotItem(context, NULL, LB_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProc(oldWndProc, WindowHandle, WindowMessage, wParam, lParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* The dialog procedure for the column chooser dialog.
|
||||
*
|
||||
* \param hwndDlg The handle to the dialog window.
|
||||
* \param uMsg The window message.
|
||||
* \param wParam Additional message-specific information.
|
||||
* \param lParam Additional message-specific information.
|
||||
* \return INT_PTR Dialog return value.
|
||||
*/
|
||||
INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
_In_ HWND hwndDlg,
|
||||
_In_ UINT uMsg,
|
||||
@@ -253,6 +669,18 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
ListBox_SetItemHeight(context->InactiveWindowHandle, 0, PhScaleToDisplay(16, dpiValue));
|
||||
ListBox_SetItemHeight(context->ActiveWindowHandle, 0, PhScaleToDisplay(16, dpiValue));
|
||||
|
||||
context->DragListMessage = RegisterWindowMessage(DRAGLISTMSGSTRING);
|
||||
context->DragItemIndex = LB_ERR;
|
||||
MakeDragList(context->InactiveWindowHandle);
|
||||
MakeDragList(context->ActiveWindowHandle);
|
||||
|
||||
// Subclass the list boxes (after MakeDragList) for hot tracking.
|
||||
context->HotListIndex = LB_ERR;
|
||||
PhSetWindowContext(context->InactiveWindowHandle, PH_WINDOW_CONTEXT_DEFAULT, context);
|
||||
PhSetWindowContext(context->ActiveWindowHandle, PH_WINDOW_CONTEXT_DEFAULT, context);
|
||||
context->InactiveListWindowProc = (WNDPROC)SetWindowLongPtr(context->InactiveWindowHandle, GWLP_WNDPROC, (LONG_PTR)PhpColumnsListBoxWndProc);
|
||||
context->ActiveListWindowProc = (WNDPROC)SetWindowLongPtr(context->ActiveWindowHandle, GWLP_WNDPROC, (LONG_PTR)PhpColumnsListBoxWndProc);
|
||||
|
||||
Button_Enable(context->HideWindowHandle, FALSE);
|
||||
Button_Enable(context->ShowWindowHandle, FALSE);
|
||||
Button_Enable(context->MoveUpHandle, FALSE);
|
||||
@@ -263,6 +691,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
context->BrushNormal = CreateSolidBrush(PhThemeWindowBackgroundColor);
|
||||
context->BrushHot = CreateSolidBrush(PhThemeWindowHighlightColor);
|
||||
context->BrushPushed = CreateSolidBrush(PhThemeWindowHighlight2Color);
|
||||
context->BrushHover = CreateSolidBrush(PhThemeWindowBackground2Color);
|
||||
context->TextColor = PhThemeWindowTextColor;
|
||||
}
|
||||
else
|
||||
@@ -270,6 +699,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
|
||||
context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
|
||||
context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
|
||||
context->BrushHover = CreateSolidBrush(RGB(229, 243, 255));
|
||||
context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
|
||||
}
|
||||
|
||||
@@ -358,6 +788,8 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
DeleteBrush(context->BrushHot);
|
||||
if (context->BrushPushed)
|
||||
DeleteBrush(context->BrushPushed);
|
||||
if (context->BrushHover)
|
||||
DeleteBrush(context->BrushHover);
|
||||
if (context->ControlFont)
|
||||
DeleteFont(context->ControlFont);
|
||||
if (context->InactiveListArray)
|
||||
@@ -394,7 +826,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
if (context->Type == PH_CONTROL_TYPE_TREE_NEW)
|
||||
{
|
||||
orderArraySize = (TreeNew_GetColumnCount(context->ControlHandle) + 1) * sizeof(ULONG);
|
||||
orderArray = _malloca(orderArraySize);
|
||||
orderArray = PhAllocateStack(orderArraySize);
|
||||
|
||||
memset(orderArray, 0, orderArraySize);
|
||||
maxOrder = 0;
|
||||
@@ -429,7 +861,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
|
||||
InvalidateRect(context->ControlHandle, NULL, FALSE);
|
||||
|
||||
_freea(orderArray);
|
||||
PhFreeStack(orderArray);
|
||||
}
|
||||
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
@@ -481,43 +913,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
break;
|
||||
case IDC_SHOW:
|
||||
{
|
||||
LONG sel;
|
||||
LONG count;
|
||||
PPH_STRING string;
|
||||
|
||||
sel = ListBox_GetCurSel(context->InactiveWindowHandle);
|
||||
count = ListBox_GetCount(context->InactiveWindowHandle);
|
||||
|
||||
if (sel != LB_ERR)
|
||||
{
|
||||
string = PhGetListBoxString(context->InactiveWindowHandle, sel);
|
||||
|
||||
if (!PhIsNullOrEmptyString(string))
|
||||
{
|
||||
ULONG index = IndexOfStringInList(context->InactiveListArray, string->Buffer);
|
||||
|
||||
if (index != ULONG_MAX)
|
||||
{
|
||||
PVOID item = context->InactiveListArray->Items[index];
|
||||
|
||||
PhRemoveItemsList(context->InactiveListArray, index, 1);
|
||||
PhAddItemList(context->ActiveListArray, item);
|
||||
|
||||
ListBox_DeleteString(context->InactiveWindowHandle, sel);
|
||||
ListBox_AddString(context->ActiveWindowHandle, item);
|
||||
}
|
||||
|
||||
count--;
|
||||
|
||||
if (sel >= count - 1)
|
||||
sel = count - 1;
|
||||
|
||||
if (sel != LB_ERR)
|
||||
{
|
||||
ListBox_SetCurSel(context->InactiveWindowHandle, sel);
|
||||
}
|
||||
}
|
||||
}
|
||||
PhpColumnsShowItem(context, ListBox_GetCurSel(context->InactiveWindowHandle), INT_ERROR);
|
||||
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_INACTIVE, LBN_SELCHANGE), (LPARAM)context->InactiveWindowHandle);
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_ACTIVE, LBN_SELCHANGE), (LPARAM)context->ActiveWindowHandle);
|
||||
@@ -525,55 +921,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
break;
|
||||
case IDC_HIDE:
|
||||
{
|
||||
LONG sel;
|
||||
LONG count;
|
||||
PPH_STRING string;
|
||||
|
||||
sel = ListBox_GetCurSel(context->ActiveWindowHandle);
|
||||
count = ListBox_GetCount(context->ActiveWindowHandle);
|
||||
|
||||
if (sel != LB_ERR)
|
||||
{
|
||||
string = PhGetListBoxString(context->ActiveWindowHandle, sel);
|
||||
|
||||
if (!PhIsNullOrEmptyString(string))
|
||||
{
|
||||
ULONG index = IndexOfStringInList(context->ActiveListArray, string->Buffer);
|
||||
|
||||
if (index != ULONG_MAX)
|
||||
{
|
||||
PVOID item = context->ActiveListArray->Items[index];
|
||||
|
||||
// Remove from active array, insert into inactive
|
||||
PhRemoveItemsList(context->ActiveListArray, index, 1);
|
||||
PhAddItemList(context->InactiveListArray, item);
|
||||
|
||||
// Sort inactive list with new entry
|
||||
qsort_s(context->InactiveListArray->Items, context->InactiveListArray->Count, sizeof(ULONG_PTR), PhpInactiveColumnsCompareNameTn, NULL);
|
||||
// Find index of new entry in inactive list
|
||||
ULONG lb_index = IndexOfStringInList(context->InactiveListArray, item);
|
||||
|
||||
// Delete from active list
|
||||
ListBox_DeleteString(context->ActiveWindowHandle, sel);
|
||||
// Add to list in the same position as the inactive list
|
||||
ListBox_InsertString(context->InactiveWindowHandle, lb_index, item);
|
||||
|
||||
PhpColumnsResetListBox(context->InactiveWindowHandle, 0, context->InactiveListArray, PhpInactiveColumnsCompareNameTn);
|
||||
}
|
||||
|
||||
count--;
|
||||
|
||||
if (sel >= count - 1)
|
||||
sel = count - 1;
|
||||
|
||||
if (sel != LB_ERR)
|
||||
{
|
||||
ListBox_SetCurSel(context->ActiveWindowHandle, sel);
|
||||
}
|
||||
}
|
||||
|
||||
PhClearReference(&string);
|
||||
}
|
||||
PhpColumnsHideItem(context, ListBox_GetCurSel(context->ActiveWindowHandle));
|
||||
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_INACTIVE, LBN_SELCHANGE), (LPARAM)context->InactiveWindowHandle);
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_ACTIVE, LBN_SELCHANGE), (LPARAM)context->ActiveWindowHandle);
|
||||
@@ -581,76 +929,18 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
break;
|
||||
case IDC_MOVEUP:
|
||||
{
|
||||
LONG sel;
|
||||
LONG count;
|
||||
PPH_STRING string;
|
||||
|
||||
sel = ListBox_GetCurSel(context->ActiveWindowHandle);
|
||||
count = ListBox_GetCount(context->ActiveWindowHandle);
|
||||
LONG sel = ListBox_GetCurSel(context->ActiveWindowHandle);
|
||||
|
||||
if (sel != LB_ERR)
|
||||
{
|
||||
string = PhGetListBoxString(context->ActiveWindowHandle, sel);
|
||||
|
||||
if (!PhIsNullOrEmptyString(string))
|
||||
{
|
||||
ULONG index = IndexOfStringInList(context->ActiveListArray, string->Buffer);
|
||||
|
||||
if (index != ULONG_MAX)
|
||||
{
|
||||
PVOID item = context->ActiveListArray->Items[index];
|
||||
PhRemoveItemsList(context->ActiveListArray, index, 1);
|
||||
PhInsertItemList(context->ActiveListArray, index - 1, item);
|
||||
|
||||
ListBox_DeleteString(context->ActiveWindowHandle, sel);
|
||||
sel -= 1;
|
||||
ListBox_InsertString(context->ActiveWindowHandle, sel, item);
|
||||
ListBox_SetCurSel(context->ActiveWindowHandle, sel);
|
||||
|
||||
EnableWindow(context->MoveUpHandle, sel != 0);
|
||||
EnableWindow(context->MoveDownHandle, sel != count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
PhClearReference(&string);
|
||||
}
|
||||
PhpColumnsMoveActiveItem(context, sel, sel - 1);
|
||||
}
|
||||
break;
|
||||
case IDC_MOVEDOWN:
|
||||
{
|
||||
LONG sel;
|
||||
LONG count;
|
||||
PPH_STRING string;
|
||||
LONG sel = ListBox_GetCurSel(context->ActiveWindowHandle);
|
||||
|
||||
sel = ListBox_GetCurSel(context->ActiveWindowHandle);
|
||||
count = ListBox_GetCount(context->ActiveWindowHandle);
|
||||
|
||||
if (sel != LB_ERR && sel != count - 1)
|
||||
{
|
||||
string = PhGetListBoxString(context->ActiveWindowHandle, sel);
|
||||
|
||||
if (!PhIsNullOrEmptyString(string))
|
||||
{
|
||||
ULONG index = IndexOfStringInList(context->ActiveListArray, string->Buffer);
|
||||
|
||||
if (index != ULONG_MAX)
|
||||
{
|
||||
PVOID item = context->ActiveListArray->Items[index];
|
||||
PhRemoveItemsList(context->ActiveListArray, index, 1);
|
||||
PhInsertItemList(context->ActiveListArray, index + 1, item);
|
||||
|
||||
ListBox_DeleteString(context->ActiveWindowHandle, sel);
|
||||
sel += 1;
|
||||
ListBox_InsertString(context->ActiveWindowHandle, sel, item);
|
||||
ListBox_SetCurSel(context->ActiveWindowHandle, sel);
|
||||
|
||||
EnableWindow(context->MoveUpHandle, sel != 0);
|
||||
EnableWindow(context->MoveDownHandle, sel != count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
PhClearReference(&string);
|
||||
}
|
||||
if (sel != LB_ERR)
|
||||
PhpColumnsMoveActiveItem(context, sel, sel + 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -677,6 +967,9 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
};
|
||||
BOOLEAN isSelected = (drawInfo->itemState & ODS_SELECTED) == ODS_SELECTED;
|
||||
BOOLEAN isFocused = (drawInfo->itemState & ODS_FOCUS) == ODS_FOCUS;
|
||||
BOOLEAN isHot =
|
||||
drawInfo->hwndItem == context->HotListHandle &&
|
||||
(LONG)drawInfo->itemID == context->HotListIndex;
|
||||
|
||||
if (drawInfo->itemID == LB_ERR)
|
||||
break;
|
||||
@@ -702,6 +995,11 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
//FrameRect(bufferDc, &bufferRect, PhGetStockBrush(BLACK_BRUSH));
|
||||
SetTextColor(bufferDc, context->TextColor);
|
||||
}
|
||||
else if (isHot)
|
||||
{
|
||||
FillRect(bufferDc, &bufferRect, context->BrushHover);
|
||||
SetTextColor(bufferDc, context->TextColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillRect(bufferDc, &bufferRect, context->BrushNormal);
|
||||
@@ -748,5 +1046,91 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
if (context->DragListMessage && uMsg == context->DragListMessage)
|
||||
{
|
||||
LPDRAGLISTINFO dragInfo = (LPDRAGLISTINFO)lParam;
|
||||
LRESULT result = 0;
|
||||
|
||||
switch (dragInfo->uNotification)
|
||||
{
|
||||
case DL_BEGINDRAG:
|
||||
{
|
||||
LONG index = LBItemFromPt(dragInfo->hWnd, dragInfo->ptCursor, FALSE);
|
||||
|
||||
if (index != INT_ERROR)
|
||||
{
|
||||
context->DragSourceHandle = dragInfo->hWnd;
|
||||
context->DragItemIndex = index;
|
||||
ListBox_SetCurSel(dragInfo->hWnd, index);
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DL_DRAGGING:
|
||||
{
|
||||
LONG activeIndex = PhpColumnsDragTargetIndex(context->ActiveWindowHandle, dragInfo->ptCursor, TRUE);
|
||||
LONG inactiveIndex = PhpColumnsDragTargetIndex(context->InactiveWindowHandle, dragInfo->ptCursor, FALSE);
|
||||
|
||||
if (activeIndex != INT_ERROR)
|
||||
{
|
||||
DrawInsert(hwndDlg, context->ActiveWindowHandle, activeIndex);
|
||||
result = DL_MOVECURSOR;
|
||||
}
|
||||
else if (inactiveIndex != INT_ERROR && context->DragSourceHandle == context->ActiveWindowHandle)
|
||||
{
|
||||
// The inactive list is sorted, so there's no insert position to show.
|
||||
DrawInsert(hwndDlg, context->ActiveWindowHandle, INT_ERROR);
|
||||
result = DL_MOVECURSOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawInsert(hwndDlg, context->ActiveWindowHandle, INT_ERROR);
|
||||
result = DL_STOPCURSOR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DL_DROPPED:
|
||||
{
|
||||
LONG activeIndex = PhpColumnsDragTargetIndex(context->ActiveWindowHandle, dragInfo->ptCursor, FALSE);
|
||||
LONG inactiveIndex = PhpColumnsDragTargetIndex(context->InactiveWindowHandle, dragInfo->ptCursor, FALSE);
|
||||
|
||||
DrawInsert(hwndDlg, context->ActiveWindowHandle, INT_ERROR);
|
||||
|
||||
if (context->DragItemIndex != LB_ERR)
|
||||
{
|
||||
if (context->DragSourceHandle == context->ActiveWindowHandle)
|
||||
{
|
||||
if (activeIndex != INT_ERROR)
|
||||
PhpColumnsMoveActiveItem(context, context->DragItemIndex, activeIndex);
|
||||
else if (inactiveIndex != INT_ERROR)
|
||||
PhpColumnsHideItem(context, context->DragItemIndex);
|
||||
}
|
||||
else if (context->DragSourceHandle == context->InactiveWindowHandle)
|
||||
{
|
||||
if (activeIndex != INT_ERROR)
|
||||
PhpColumnsShowItem(context, context->DragItemIndex, activeIndex);
|
||||
}
|
||||
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_INACTIVE, LBN_SELCHANGE), (LPARAM)context->InactiveWindowHandle);
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_ACTIVE, LBN_SELCHANGE), (LPARAM)context->ActiveWindowHandle);
|
||||
}
|
||||
|
||||
context->DragSourceHandle = NULL;
|
||||
context->DragItemIndex = LB_ERR;
|
||||
}
|
||||
break;
|
||||
case DL_CANCELDRAG:
|
||||
{
|
||||
DrawInsert(hwndDlg, context->ActiveWindowHandle, INT_ERROR);
|
||||
context->DragSourceHandle = NULL;
|
||||
context->DragItemIndex = LB_ERR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, result);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+220
-5
@@ -31,8 +31,156 @@ typedef struct _PH_CHOICE_DIALOG_CONTEXT
|
||||
HWND ComboBoxHandle;
|
||||
HFONT TitleFontHandle;
|
||||
HFONT FontHandle;
|
||||
|
||||
HBRUSH BrushNormal;
|
||||
HBRUSH BrushHover;
|
||||
HBRUSH BrushHot;
|
||||
COLORREF TextColor;
|
||||
} PH_CHOICE_DIALOG_CONTEXT, *PPH_CHOICE_DIALOG_CONTEXT;
|
||||
|
||||
/**
|
||||
* Creates the brushes used for owner-drawn combo box items.
|
||||
*
|
||||
* \param Context The choice dialog context.
|
||||
*/
|
||||
static VOID PhpChoiceDialogInitializeBrushes(
|
||||
_Inout_ PPH_CHOICE_DIALOG_CONTEXT Context
|
||||
)
|
||||
{
|
||||
if (PhEnableThemeSupport)
|
||||
{
|
||||
Context->BrushNormal = CreateSolidBrush(PhThemeWindowBackgroundColor);
|
||||
Context->BrushHover = CreateSolidBrush(PhThemeWindowBackground2Color);
|
||||
Context->BrushHot = CreateSolidBrush(PhThemeWindowHighlightColor);
|
||||
Context->TextColor = PhThemeWindowTextColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
Context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
|
||||
Context->BrushHover = CreateSolidBrush(RGB(229, 243, 255));
|
||||
Context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
|
||||
Context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the brushes used for owner-drawn combo box items.
|
||||
*
|
||||
* \param Context The choice dialog context.
|
||||
*/
|
||||
static VOID PhpChoiceDialogDeleteBrushes(
|
||||
_Inout_ PPH_CHOICE_DIALOG_CONTEXT Context
|
||||
)
|
||||
{
|
||||
if (Context->BrushNormal)
|
||||
DeleteBrush(Context->BrushNormal);
|
||||
if (Context->BrushHover)
|
||||
DeleteBrush(Context->BrushHover);
|
||||
if (Context->BrushHot)
|
||||
DeleteBrush(Context->BrushHot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws an owner-drawn combo box item with hot (mouse-over) and selection theming.
|
||||
*
|
||||
* \param Context The choice dialog context.
|
||||
* \param DrawInfo The owner-draw information.
|
||||
* \return TRUE if the item was drawn, FALSE to use default drawing.
|
||||
*/
|
||||
static BOOLEAN PhpChoiceDialogDrawComboBoxItem(
|
||||
_In_ PPH_CHOICE_DIALOG_CONTEXT Context,
|
||||
_In_ LPDRAWITEMSTRUCT DrawInfo
|
||||
)
|
||||
{
|
||||
HDC bufferDc;
|
||||
HBITMAP bufferBitmap;
|
||||
HBITMAP oldBufferBitmap;
|
||||
PPH_STRING string;
|
||||
RECT bufferRect =
|
||||
{
|
||||
0, 0,
|
||||
DrawInfo->rcItem.right - DrawInfo->rcItem.left,
|
||||
DrawInfo->rcItem.bottom - DrawInfo->rcItem.top
|
||||
};
|
||||
BOOLEAN isSelected = (DrawInfo->itemState & ODS_SELECTED) == ODS_SELECTED;
|
||||
BOOLEAN isEditField = (DrawInfo->itemState & ODS_COMBOBOXEDIT) == ODS_COMBOBOXEDIT;
|
||||
|
||||
if (DrawInfo->itemID == UINT_MAX)
|
||||
{
|
||||
// Empty selection field.
|
||||
FillRect(DrawInfo->hDC, &DrawInfo->rcItem, Context->BrushNormal);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
string = PhGetComboBoxString(DrawInfo->hwndItem, DrawInfo->itemID);
|
||||
|
||||
if (PhIsNullOrEmptyString(string))
|
||||
{
|
||||
PhClearReference(&string);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bufferDc = CreateCompatibleDC(DrawInfo->hDC);
|
||||
bufferBitmap = CreateCompatibleBitmap(DrawInfo->hDC, bufferRect.right, bufferRect.bottom);
|
||||
oldBufferBitmap = SelectBitmap(bufferDc, bufferBitmap);
|
||||
|
||||
SelectFont(bufferDc, GetWindowFont(DrawInfo->hwndItem));
|
||||
SetBkMode(bufferDc, TRANSPARENT);
|
||||
|
||||
if (isEditField)
|
||||
{
|
||||
// The selection field renders with the normal background.
|
||||
FillRect(bufferDc, &bufferRect, Context->BrushNormal);
|
||||
}
|
||||
else if (isSelected)
|
||||
{
|
||||
// The drop-down list highlights the item under the mouse as selected.
|
||||
FillRect(bufferDc, &bufferRect, Context->BrushHover);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillRect(bufferDc, &bufferRect, Context->BrushNormal);
|
||||
}
|
||||
|
||||
SetTextColor(bufferDc, Context->TextColor);
|
||||
|
||||
bufferRect.left += 5;
|
||||
DrawText(
|
||||
bufferDc,
|
||||
string->Buffer,
|
||||
(UINT)string->Length / sizeof(WCHAR),
|
||||
&bufferRect,
|
||||
DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOCLIP
|
||||
);
|
||||
bufferRect.left -= 5;
|
||||
|
||||
BitBlt(
|
||||
DrawInfo->hDC,
|
||||
DrawInfo->rcItem.left,
|
||||
DrawInfo->rcItem.top,
|
||||
DrawInfo->rcItem.right,
|
||||
DrawInfo->rcItem.bottom,
|
||||
bufferDc,
|
||||
0,
|
||||
0,
|
||||
SRCCOPY
|
||||
);
|
||||
|
||||
SelectBitmap(bufferDc, oldBufferBitmap);
|
||||
DeleteBitmap(bufferBitmap);
|
||||
DeleteDC(bufferDc);
|
||||
PhClearReference(&string);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the fonts used in the choice dialog based on the current DPI value.
|
||||
*
|
||||
* \param WindowHandle The handle to the dialog window.
|
||||
* \param Context The choice dialog context.
|
||||
* \param DpiValue The current DPI value.
|
||||
*/
|
||||
static VOID PhpChoiceDialogUpdateFonts(
|
||||
_In_ HWND WindowHandle,
|
||||
_Inout_ PPH_CHOICE_DIALOG_CONTEXT Context,
|
||||
@@ -48,15 +196,27 @@ static VOID PhpChoiceDialogUpdateFonts(
|
||||
metrics.lfMessageFont.lfHeight = 4 * metrics.lfMessageFont.lfHeight / 3;
|
||||
|
||||
if (fontHandle = CreateFontIndirect(&metrics.lfMessageFont))
|
||||
PhReplaceWindowFont(&Context->TitleFontHandle, GetDlgItem(WindowHandle, IDC_TITLE), fontHandle, FALSE);
|
||||
PhSwapReferenceFont(&Context->TitleFontHandle, GetDlgItem(WindowHandle, IDC_TITLE), fontHandle, FALSE);
|
||||
|
||||
metrics.lfMessageFont.lfHeight = PhScaleToDisplay(-14, DpiValue);
|
||||
|
||||
if (fontHandle = CreateFontIndirect(&metrics.lfMessageFont))
|
||||
PhReplaceWindowFont(&Context->FontHandle, Context->ComboBoxHandle, fontHandle, FALSE);
|
||||
PhSwapReferenceFont(&Context->FontHandle, Context->ComboBoxHandle, fontHandle, FALSE);
|
||||
|
||||
ComboBox_SetItemHeight(Context->ComboBoxHandle, -1, PhScaleToDisplay(22, DpiValue));
|
||||
ComboBox_SetItemHeight(Context->ComboBoxHandle, 0, PhScaleToDisplay(20, DpiValue));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The dialog procedure for the standard choice dialog.
|
||||
*
|
||||
* \param WindowHandle The handle to the dialog window.
|
||||
* \param WindowMessage The window message.
|
||||
* \param wParam Additional message-specific information.
|
||||
* \param lParam Additional message-specific information.
|
||||
* \return INT_PTR Dialog return value.
|
||||
*/
|
||||
INT_PTR CALLBACK PhChoiceDlgProc(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ UINT WindowMessage,
|
||||
@@ -122,6 +282,15 @@ INT_PTR CALLBACK PhChoiceDlgProc(
|
||||
context->ComboBoxHandle = comboBoxHandle;
|
||||
ShowWindow(context->ComboBoxHandle, SW_SHOW);
|
||||
|
||||
PhpChoiceDialogInitializeBrushes(context);
|
||||
|
||||
if (type != PH_CHOICE_DIALOG_PASSWORD)
|
||||
{
|
||||
LONG dpiValue = PhGetWindowDpi(WindowHandle);
|
||||
|
||||
ComboBox_SetItemHeight(comboBoxHandle, 0, PhScaleToDisplay(16, dpiValue));
|
||||
}
|
||||
|
||||
if (type == PH_CHOICE_DIALOG_PASSWORD)
|
||||
{
|
||||
// Nothing
|
||||
@@ -226,7 +395,7 @@ INT_PTR CALLBACK PhChoiceDlgProc(
|
||||
rect.bottom -= diff;
|
||||
SetWindowPos(GetDlgItem(WindowHandle, IDOK), NULL, rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
|
||||
// Cancel
|
||||
PhGetWindowRect(GetDlgItem(WindowHandle, IDCANCEL), &rect);
|
||||
@@ -235,14 +404,14 @@ INT_PTR CALLBACK PhChoiceDlgProc(
|
||||
rect.bottom -= diff;
|
||||
SetWindowPos(GetDlgItem(WindowHandle, IDCANCEL), NULL, rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
|
||||
// Window
|
||||
PhGetWindowRect(WindowHandle, &rect);
|
||||
rect.bottom -= diff;
|
||||
SetWindowPos(WindowHandle, NULL, rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
}
|
||||
|
||||
PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport);
|
||||
@@ -252,9 +421,19 @@ INT_PTR CALLBACK PhChoiceDlgProc(
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
{
|
||||
PhpChoiceDialogDeleteBrushes(context);
|
||||
|
||||
PhRemoveWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT);
|
||||
}
|
||||
break;
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
LPDRAWITEMSTRUCT drawInfo = (LPDRAWITEMSTRUCT)lParam;
|
||||
|
||||
if (drawInfo->hwndItem == context->ComboBoxHandle)
|
||||
return PhpChoiceDialogDrawComboBoxItem(context, drawInfo);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
||||
@@ -346,6 +525,15 @@ INT_PTR CALLBACK PhChoiceDlgProc(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* The dialog procedure for the new style choice dialog.
|
||||
*
|
||||
* \param WindowHandle The handle to the dialog window.
|
||||
* \param WindowMessage The window message.
|
||||
* \param wParam Additional message-specific information.
|
||||
* \param lParam Additional message-specific information.
|
||||
* \return INT_PTR Dialog return value.
|
||||
*/
|
||||
INT_PTR CALLBACK PhChooseNewPageDlgProc(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ UINT WindowMessage,
|
||||
@@ -374,6 +562,8 @@ INT_PTR CALLBACK PhChooseNewPageDlgProc(
|
||||
{
|
||||
context->ComboBoxHandle = GetDlgItem(WindowHandle, IDC_INPUT);
|
||||
|
||||
PhpChoiceDialogInitializeBrushes(context);
|
||||
|
||||
PhCenterWindow(WindowHandle, GetParent(WindowHandle));
|
||||
PhSetApplicationWindowIcon(WindowHandle);
|
||||
|
||||
@@ -444,6 +634,8 @@ INT_PTR CALLBACK PhChooseNewPageDlgProc(
|
||||
{
|
||||
PhRemoveWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT);
|
||||
|
||||
PhpChoiceDialogDeleteBrushes(context);
|
||||
|
||||
if (context->FontHandle)
|
||||
{
|
||||
DeleteFont(context->FontHandle);
|
||||
@@ -460,6 +652,14 @@ INT_PTR CALLBACK PhChooseNewPageDlgProc(
|
||||
PhpChoiceDialogUpdateFonts(WindowHandle, context, LOWORD(wParam));
|
||||
}
|
||||
break;
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
LPDRAWITEMSTRUCT drawInfo = (LPDRAWITEMSTRUCT)lParam;
|
||||
|
||||
if (drawInfo->hwndItem == context->ComboBoxHandle)
|
||||
return PhpChoiceDialogDrawComboBoxItem(context, drawInfo);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
||||
@@ -649,6 +849,21 @@ BOOLEAN PhaChoiceDialog(
|
||||
) == IDOK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user for input using the new dialog style.
|
||||
*
|
||||
* \param ParentWindowHandle Parent window for the dialog.
|
||||
* \param Title The title of the dialog.
|
||||
* \param Message The message displayed in the dialog.
|
||||
* \param Choices Optional list of choices to populate the combo box.
|
||||
* \param NumberOfChoices Number of choices in the Choices array.
|
||||
* \param Option Optional check box label to show.
|
||||
* \param Flags Dialog configuration flags.
|
||||
* \param SelectedChoice Receives the selected choice string.
|
||||
* \param SelectedOption Receives the state of the check box if checked.
|
||||
* \param SavedChoicesSettingName Optional setting name to save the choices list.
|
||||
* \return BOOLEAN TRUE if the user pressed OK, FALSE otherwise.
|
||||
*/
|
||||
BOOLEAN PhChoiceDialog(
|
||||
_In_ HWND ParentWindowHandle,
|
||||
_In_ PCWSTR Title,
|
||||
|
||||
@@ -321,9 +321,6 @@
|
||||
#define GUID_DISPLAY_DEVICE_ARRIVAL 0x1CA05180L, 0xA699, 0x450A, 0x9A, 0x0C, 0xDE, 0x4F, 0xBE, 0x3D, 0xDD, 0x89
|
||||
#define GUID_COMPUTE_DEVICE_ARRIVAL 0x1024e4c9L, 0x47c9, 0x48d3, 0xb4, 0xa8, 0xf9, 0xdf, 0x78, 0x52, 0x3b, 0x53
|
||||
|
||||
DEFINE_DEVPROPKEY(DEVPKEY_Gpu_Luid, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 2); // DEVPROP_TYPE_UINT64
|
||||
DEFINE_DEVPROPKEY(DEVPKEY_Gpu_PhysicalAdapterIndex, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 3); // DEVPROP_TYPE_UINT32
|
||||
|
||||
#include <SetupAPI.h>
|
||||
#include <cfgmgr32.h>
|
||||
|
||||
|
||||
@@ -601,7 +601,7 @@ BOOLEAN NTAPI PhpHandleTreeNewCallback(
|
||||
}
|
||||
else
|
||||
{
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving....");
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving...");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -668,7 +668,7 @@ BOOLEAN NTAPI PhpHandleTreeNewCallback(
|
||||
}
|
||||
else
|
||||
{
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving....");
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving...");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#ifndef PH_APPSUP_H
|
||||
#define PH_APPSUP_H
|
||||
|
||||
EXTERN_C_START
|
||||
|
||||
DEFINE_GUID(XP_CONTEXT_GUID, 0xbeb1b341, 0x6837, 0x4c83, 0x83, 0x66, 0x2b, 0x45, 0x1e, 0x7c, 0xe6, 0x9b);
|
||||
DEFINE_GUID(VISTA_CONTEXT_GUID, 0xe2011457, 0x1546, 0x43c5, 0xa5, 0xfe, 0x00, 0x8d, 0xee, 0xe3, 0xd3, 0xf0);
|
||||
DEFINE_GUID(WIN7_CONTEXT_GUID, 0x35138b9a, 0x5d96, 0x4fbd, 0x8e, 0x2d, 0xa2, 0x44, 0x02, 0x25, 0xf9, 0x3a);
|
||||
@@ -693,8 +695,10 @@ FORCEINLINE PVOID PhpGenericPropertyPageHeader(
|
||||
return context;
|
||||
}
|
||||
|
||||
#define SWP_NO_ACTIVATE_MOVE_SIZE_ZORDER (SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER)
|
||||
#define SWP_NO_ACTIVATE_MOVE_SIZE_ZORDER (SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER)
|
||||
#define SWP_SHOWWINDOW_ONLY (SWP_NO_ACTIVATE_MOVE_SIZE_ZORDER | SWP_SHOWWINDOW)
|
||||
#define SWP_HIDEWINDOW_ONLY (SWP_NO_ACTIVATE_MOVE_SIZE_ZORDER | SWP_HIDEWINDOW)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -140,6 +140,7 @@ typedef enum _PH_MIP_ADJUST_PIN_RESULT
|
||||
HideAdjustPinResult
|
||||
} PH_MIP_ADJUST_PIN_RESULT;
|
||||
|
||||
_Function_class_(PH_MESSAGE_LOOP_FILTER)
|
||||
BOOLEAN NTAPI PhMipMessageLoopFilter(
|
||||
_In_ PMSG Message,
|
||||
_In_ PVOID Context
|
||||
@@ -279,6 +280,7 @@ PPH_MINIINFO_LIST_SECTION PhMipCreateInternalListSection(
|
||||
_In_ PPH_MINIINFO_LIST_SECTION_CALLBACK Callback
|
||||
);
|
||||
|
||||
_Function_class_(PH_MINIINFO_SECTION_CALLBACK)
|
||||
BOOLEAN PhMipListSectionCallback(
|
||||
_In_ PPH_MINIINFO_SECTION Section,
|
||||
_In_ PH_MINIINFO_SECTION_MESSAGE Message,
|
||||
@@ -349,6 +351,7 @@ VOID PhMipHandleListSectionCommand(
|
||||
|
||||
// CPU section
|
||||
|
||||
_Function_class_(PH_MINIINFO_LIST_SECTION_CALLBACK)
|
||||
BOOLEAN PhMipCpuListSectionCallback(
|
||||
_In_ PPH_MINIINFO_LIST_SECTION ListSection,
|
||||
_In_ PH_MINIINFO_LIST_SECTION_MESSAGE Message,
|
||||
@@ -368,6 +371,7 @@ int __cdecl PhMipCpuListSectionNodeCompareFunction(
|
||||
|
||||
// Commit charge section
|
||||
|
||||
_Function_class_(PH_MINIINFO_LIST_SECTION_CALLBACK)
|
||||
BOOLEAN PhMipCommitListSectionCallback(
|
||||
_In_ PPH_MINIINFO_LIST_SECTION ListSection,
|
||||
_In_ PH_MINIINFO_LIST_SECTION_MESSAGE Message,
|
||||
@@ -387,6 +391,7 @@ int __cdecl PhMipCommitListSectionNodeCompareFunction(
|
||||
|
||||
// Physical memory section
|
||||
|
||||
_Function_class_(PH_MINIINFO_LIST_SECTION_CALLBACK)
|
||||
BOOLEAN PhMipPhysicalListSectionCallback(
|
||||
_In_ PPH_MINIINFO_LIST_SECTION ListSection,
|
||||
_In_ PH_MINIINFO_LIST_SECTION_MESSAGE Message,
|
||||
@@ -406,6 +411,7 @@ int __cdecl PhMipPhysicalListSectionNodeCompareFunction(
|
||||
|
||||
// I/O section
|
||||
|
||||
_Function_class_(PH_MINIINFO_LIST_SECTION_CALLBACK)
|
||||
BOOLEAN PhMipIoListSectionCallback(
|
||||
_In_ PPH_MINIINFO_LIST_SECTION ListSection,
|
||||
_In_ PH_MINIINFO_LIST_SECTION_MESSAGE Message,
|
||||
|
||||
@@ -142,39 +142,82 @@ typedef struct _PH_NF_ICON
|
||||
} PH_NF_ICON, *PPH_NF_ICON;
|
||||
// end_phapppub
|
||||
|
||||
/**
|
||||
* Performs stage 1 of the notification icon load process.
|
||||
*/
|
||||
VOID PhNfLoadStage1(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Performs stage 2 of the notification icon load process.
|
||||
*/
|
||||
VOID PhNfLoadStage2(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Saves notification icon settings.
|
||||
*/
|
||||
VOID PhNfSaveSettings(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Performs uninitialization of the notification icon system.
|
||||
*/
|
||||
VOID PhNfUninitialization(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Forwards a window message to the notification icon system.
|
||||
*
|
||||
* \param WindowHandle The window handle.
|
||||
* \param WParam The WPARAM value.
|
||||
* \param LParam The LPARAM value.
|
||||
*/
|
||||
VOID PhNfForwardMessage(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ ULONG_PTR WParam,
|
||||
_In_ ULONG_PTR LParam
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the visibility of a notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param Visible TRUE to show the icon, FALSE to hide it.
|
||||
*/
|
||||
VOID PhNfSetVisibleIcon(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
_In_ BOOLEAN Visible
|
||||
);
|
||||
|
||||
/**
|
||||
* Shows a balloon tip notification.
|
||||
*
|
||||
* \param Title The title of the notification.
|
||||
* \param Text The text of the notification.
|
||||
* \param Timeout The timeout in milliseconds.
|
||||
* \return TRUE if the notification was shown, FALSE otherwise.
|
||||
*/
|
||||
BOOLEAN PhNfShowBalloonTip(
|
||||
_In_ PCWSTR Title,
|
||||
_In_ PCWSTR Text,
|
||||
_In_ ULONG Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
* Shows a balloon tip notification with a callback.
|
||||
*
|
||||
* \param Title The title of the notification.
|
||||
* \param Text The text of the notification.
|
||||
* \param Timeout The timeout in milliseconds.
|
||||
* \param ToastCallback The callback function.
|
||||
* \param Context The user-defined context.
|
||||
* \return HRESULT.
|
||||
*/
|
||||
HRESULT PhNfShowBalloonTipEx(
|
||||
_In_ PCWSTR Title,
|
||||
_In_ PCWSTR Text,
|
||||
@@ -183,10 +226,29 @@ HRESULT PhNfShowBalloonTipEx(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Converts a bitmap to an icon.
|
||||
*
|
||||
* \param Bitmap The bitmap handle.
|
||||
* \return The icon handle.
|
||||
*/
|
||||
HICON PhNfBitmapToIcon(
|
||||
_In_ HBITMAP Bitmap
|
||||
);
|
||||
|
||||
/**
|
||||
* Registers a notification icon.
|
||||
*
|
||||
* \param Plugin The plugin registering the icon.
|
||||
* \param Id The sub-ID of the icon.
|
||||
* \param Guid The GUID of the icon.
|
||||
* \param Context The user-defined context.
|
||||
* \param Text The tooltip text.
|
||||
* \param Flags The icon flags.
|
||||
* \param UpdateCallback The icon update callback.
|
||||
* \param MessageCallback The icon message callback.
|
||||
* \return The registered icon.
|
||||
*/
|
||||
PPH_NF_ICON PhNfRegisterIcon(
|
||||
_In_opt_ PPH_PLUGIN Plugin,
|
||||
_In_ ULONG Id,
|
||||
@@ -198,19 +260,42 @@ PPH_NF_ICON PhNfRegisterIcon(
|
||||
_In_opt_ PPH_NF_ICON_MESSAGE_CALLBACK MessageCallback
|
||||
);
|
||||
|
||||
/**
|
||||
* Gets a notification icon by its sub-ID.
|
||||
*
|
||||
* \param SubId The sub-ID of the icon.
|
||||
* \return The icon, or NULL if not found.
|
||||
*/
|
||||
PPH_NF_ICON PhNfGetIconById(
|
||||
_In_ ULONG Id
|
||||
);
|
||||
|
||||
/**
|
||||
* Finds a notification icon by its plugin name and sub-ID.
|
||||
*
|
||||
* \param PluginName The plugin name.
|
||||
* \param SubId The sub-ID of the icon.
|
||||
* \return The icon, or NULL if not found.
|
||||
*/
|
||||
PPH_NF_ICON PhNfFindIcon(
|
||||
_In_ PPH_STRINGREF PluginName,
|
||||
_In_ ULONG SubId
|
||||
);
|
||||
|
||||
/**
|
||||
* Checks if notification icons are enabled.
|
||||
*
|
||||
* \return TRUE if icons are enabled, FALSE otherwise.
|
||||
*/
|
||||
BOOLEAN PhNfIconsEnabled(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Notifies the notification icon system that the mini-information window has been pinned or unpinned.
|
||||
*
|
||||
* \param Pinned TRUE if the window was pinned, FALSE if it was unpinned.
|
||||
*/
|
||||
VOID PhNfNotifyMiniInfoPinned(
|
||||
_In_ BOOLEAN Pinned
|
||||
);
|
||||
@@ -224,6 +309,14 @@ typedef struct _PH_NF_ICON_REGISTRATION_DATA
|
||||
PPH_NF_ICON_MESSAGE_CALLBACK MessageCallback;
|
||||
} PH_NF_ICON_REGISTRATION_DATA, *PPH_NF_ICON_REGISTRATION_DATA;
|
||||
|
||||
/**
|
||||
* Draws text for a tray icon.
|
||||
*
|
||||
* \param hdc The device context.
|
||||
* \param Bits The pixel bits.
|
||||
* \param DrawInfo The graph draw info.
|
||||
* \param Text The text to draw.
|
||||
*/
|
||||
VOID PhDrawTrayIconText(
|
||||
_In_ HDC hdc,
|
||||
_In_ PVOID Bits,
|
||||
@@ -231,6 +324,12 @@ VOID PhDrawTrayIconText(
|
||||
_In_ PPH_STRINGREF Text
|
||||
);
|
||||
|
||||
/**
|
||||
* Gets the font for tray icons.
|
||||
*
|
||||
* \param DpiValue The DPI value.
|
||||
* \return The font handle.
|
||||
*/
|
||||
HFONT PhNfGetTrayIconFont(
|
||||
_In_opt_ LONG DpiValue
|
||||
);
|
||||
|
||||
@@ -49,22 +49,54 @@ typedef struct _PH_NF_BITMAP
|
||||
LONG TaskbarDpi;
|
||||
} PH_NF_BITMAP, *PPH_NF_BITMAP;
|
||||
|
||||
/**
|
||||
* Gets the application icon.
|
||||
*
|
||||
* \param DpiValue The DPI value.
|
||||
* \return The icon handle.
|
||||
*/
|
||||
HICON PhNfGetApplicationIcon(
|
||||
_In_opt_ LONG DpiValue
|
||||
);
|
||||
|
||||
/**
|
||||
* Gets the black icon.
|
||||
*
|
||||
* \return The icon handle.
|
||||
*/
|
||||
HICON PhNfpGetBlackIcon(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Adds a notification icon to the tray.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \return TRUE if successful, FALSE otherwise.
|
||||
*/
|
||||
BOOLEAN PhNfpAddNotifyIcon(
|
||||
_In_ PPH_NF_ICON Icon
|
||||
);
|
||||
|
||||
/**
|
||||
* Removes a notification icon from the tray.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \return TRUE if successful, FALSE otherwise.
|
||||
*/
|
||||
BOOLEAN PhNfpRemoveNotifyIcon(
|
||||
_In_ PPH_NF_ICON Icon
|
||||
);
|
||||
|
||||
/**
|
||||
* Modifies a notification icon in the tray.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param Flags The flags.
|
||||
* \param Text The tooltip text.
|
||||
* \param IconHandle The icon handle.
|
||||
* \return TRUE if successful, FALSE otherwise.
|
||||
*/
|
||||
BOOLEAN PhNfpModifyNotifyIcon(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
_In_ ULONG Flags,
|
||||
@@ -72,21 +104,48 @@ BOOLEAN PhNfpModifyNotifyIcon(
|
||||
_In_opt_ HICON IconHandle
|
||||
);
|
||||
|
||||
/**
|
||||
* Thread routine for updating notification icons.
|
||||
*
|
||||
* \param Context The user-defined context.
|
||||
* \return NTSTATUS.
|
||||
*/
|
||||
_Function_class_(USER_THREAD_START_ROUTINE)
|
||||
NTSTATUS PhNfpTrayIconUpdateThread(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Callback function for process provider updates.
|
||||
*
|
||||
* \param Parameter The callback parameter.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_CALLBACK_FUNCTION)
|
||||
VOID PhNfpProcessesUpdatedHandler(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Updates a registered notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
*/
|
||||
VOID PhNfpUpdateRegisteredIcon(
|
||||
_In_ PPH_NF_ICON Icon
|
||||
);
|
||||
|
||||
/**
|
||||
* Begins bitmap drawing for notification icons.
|
||||
*
|
||||
* \param Width The width of the bitmap.
|
||||
* \param Height The height of the bitmap.
|
||||
* \param Bitmap The bitmap handle.
|
||||
* \param Bits The pixel bits.
|
||||
* \param Hdc The device context.
|
||||
* \param OldBitmap The old bitmap handle.
|
||||
*/
|
||||
_Function_class_(PH_NF_BEGIN_BITMAP)
|
||||
VOID PhNfpBeginBitmap(
|
||||
_Out_ PULONG Width,
|
||||
@@ -97,6 +156,17 @@ VOID PhNfpBeginBitmap(
|
||||
_Out_ HBITMAP *OldBitmap
|
||||
);
|
||||
|
||||
/**
|
||||
* Begins bitmap drawing for notification icons with a context.
|
||||
*
|
||||
* \param Context The bitmap context.
|
||||
* \param Width The width of the bitmap.
|
||||
* \param Height The height of the bitmap.
|
||||
* \param Bitmap The bitmap handle.
|
||||
* \param Bits The pixel bits.
|
||||
* \param Hdc The device context.
|
||||
* \param OldBitmap The old bitmap handle.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpBeginBitmap2(
|
||||
_Inout_ PPH_NF_BITMAP Context,
|
||||
@@ -108,6 +178,15 @@ VOID PhNfpBeginBitmap2(
|
||||
_Out_ HBITMAP *OldBitmap
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the CPU history notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpCpuHistoryIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -116,6 +195,16 @@ VOID PhNfpCpuHistoryIconUpdateCallback(
|
||||
_Out_ PPH_STRING *NewText,
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the IO history notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpIoHistoryIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -125,6 +214,15 @@ VOID PhNfpIoHistoryIconUpdateCallback(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the commit history notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpCommitHistoryIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -134,6 +232,15 @@ VOID PhNfpCommitHistoryIconUpdateCallback(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the physical history notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpPhysicalHistoryIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -143,6 +250,15 @@ VOID PhNfpPhysicalHistoryIconUpdateCallback(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the CPU usage notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpCpuUsageIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -154,6 +270,15 @@ VOID PhNfpCpuUsageIconUpdateCallback(
|
||||
|
||||
// Text icons
|
||||
|
||||
/**
|
||||
* Update callback for the CPU usage text notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpCpuUsageTextIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -163,6 +288,15 @@ VOID PhNfpCpuUsageTextIconUpdateCallback(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the IO usage text notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpIoUsageTextIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -172,6 +306,15 @@ VOID PhNfpIoUsageTextIconUpdateCallback(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the commit usage text notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpCommitTextIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -181,6 +324,15 @@ VOID PhNfpCommitTextIconUpdateCallback(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Update callback for the physical usage text notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpPhysicalUsageTextIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -191,6 +343,15 @@ VOID PhNfpPhysicalUsageTextIconUpdateCallback(
|
||||
);
|
||||
|
||||
// plain icon
|
||||
/**
|
||||
* Update callback for the plain (static) notification icon.
|
||||
*
|
||||
* \param Icon The icon.
|
||||
* \param NewIconOrBitmap The new icon or bitmap.
|
||||
* \param Flags The update flags.
|
||||
* \param NewText The new tooltip text.
|
||||
* \param Context The user-defined context.
|
||||
*/
|
||||
_Function_class_(PH_NF_ICON_UPDATE_CALLBACK)
|
||||
VOID PhNfpPlainIconUpdateCallback(
|
||||
_In_ PPH_NF_ICON Icon,
|
||||
@@ -200,6 +361,14 @@ VOID PhNfpPlainIconUpdateCallback(
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
/**
|
||||
* Gets the show mini-information section data for an icon.
|
||||
*
|
||||
* \param IconIndex The index of the icon.
|
||||
* \param RegisteredIcon The registered icon.
|
||||
* \param Data A variable which receives the section data.
|
||||
* \return TRUE if successful, FALSE otherwise.
|
||||
*/
|
||||
_Success_(return)
|
||||
BOOLEAN PhNfpGetShowMiniInfoSectionData(
|
||||
_In_ ULONG IconIndex,
|
||||
@@ -210,6 +379,14 @@ BOOLEAN PhNfpGetShowMiniInfoSectionData(
|
||||
#define NFP_ICON_CLICK_ACTIVATE_DELAY 140
|
||||
#define NFP_ICON_RESTORE_HOVER_DELAY 1000
|
||||
|
||||
/**
|
||||
* Timer procedure for activating an icon after a click.
|
||||
*
|
||||
* \param WindowHandle The window handle.
|
||||
* \param uMsg The window message.
|
||||
* \param idEvent The timer ID.
|
||||
* \param dwTime The current system time.
|
||||
*/
|
||||
VOID PhNfpIconClickActivateTimerProc(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ UINT uMsg,
|
||||
@@ -217,10 +394,21 @@ VOID PhNfpIconClickActivateTimerProc(
|
||||
_In_ ULONG dwTime
|
||||
);
|
||||
|
||||
/**
|
||||
* Disables icon hover effects.
|
||||
*/
|
||||
VOID PhNfpDisableHover(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Timer procedure for restoring icon hover effects.
|
||||
*
|
||||
* \param WindowHandle The window handle.
|
||||
* \param uMsg The window message.
|
||||
* \param idEvent The timer ID.
|
||||
* \param dwTime The current system time.
|
||||
*/
|
||||
VOID PhNfpIconRestoreHoverTimerProc(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ UINT uMsg,
|
||||
@@ -228,10 +416,21 @@ VOID PhNfpIconRestoreHoverTimerProc(
|
||||
_In_ ULONG dwTime
|
||||
);
|
||||
|
||||
/**
|
||||
* Disables the popup hover workaround for Windows 11.
|
||||
*/
|
||||
VOID PhNfpIconDisablePopupHoverWin11Workaround(
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Timer procedure for showing a popup hover on Windows 11.
|
||||
*
|
||||
* \param WindowHandle The window handle.
|
||||
* \param uMsg The window message.
|
||||
* \param idEvent The timer ID.
|
||||
* \param dwTime The current system time.
|
||||
*/
|
||||
VOID PhNfpIconShowPopupHoverTimerProc(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ UINT uMsg,
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <appsup.h>
|
||||
#include <searchbox.h>
|
||||
|
||||
EXTERN_C_START
|
||||
|
||||
// main
|
||||
|
||||
// begin_phapppub
|
||||
@@ -991,4 +993,6 @@ HPROPSHEETPAGE PhCreateTokenPage(
|
||||
_In_opt_ DLGPROC HookProc
|
||||
);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -579,6 +579,12 @@ INT_PTR CALLBACK PhpJobPageProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <sistatus.h>
|
||||
#include <informer.h>
|
||||
#include <phsvccl.h>
|
||||
#include <phutil.h>
|
||||
#include <svcsup.h>
|
||||
|
||||
#include <ksisup.h>
|
||||
@@ -140,11 +141,13 @@ PCWSTR KsiGetWindowsVersionString(
|
||||
return L"Windows 11 25H2";
|
||||
case WINDOWS_11_26H1:
|
||||
return L"Windows 11 26H1";
|
||||
case WINDOWS_11_27H2:
|
||||
return L"Windows 11 27H2";
|
||||
case WINDOWS_NEW:
|
||||
return L"Windows Insider Preview";
|
||||
}
|
||||
|
||||
static_assert(WINDOWS_MAX == WINDOWS_11_26H1, "KsiGetWindowsVersionString must include all versions");
|
||||
static_assert(WINDOWS_MAX == WINDOWS_11_27H2, "KsiGetWindowsVersionString must include all versions");
|
||||
|
||||
return L"Windows";
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ END_SORT_FUNCTION
|
||||
|
||||
BEGIN_SORT_FUNCTION(State)
|
||||
{
|
||||
// For UDP, treat "Bound" state (listening sockets) specially - always sort them last
|
||||
// For TCP, treat "Bound" state (listening sockets) specially - always sort them last
|
||||
BOOLEAN isBound1 = (networkItem1->ProtocolType == PH_PROTOCOL_TYPE_TCP && networkItem1->State == MIB_TCP_STATE_RESERVED);
|
||||
BOOLEAN isBound2 = (networkItem2->ProtocolType == PH_PROTOCOL_TYPE_TCP && networkItem2->State == MIB_TCP_STATE_RESERVED);
|
||||
|
||||
@@ -693,7 +693,7 @@ BOOLEAN NTAPI PhpNetworkTreeNewCallback(
|
||||
if (networkItem->LocalHostnameResolved)
|
||||
getCellText->Text = PhGetStringRef(networkItem->LocalHostString);
|
||||
else
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving....");
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving...");
|
||||
}
|
||||
break;
|
||||
case PHNETLC_LOCALPORT:
|
||||
@@ -711,7 +711,7 @@ BOOLEAN NTAPI PhpNetworkTreeNewCallback(
|
||||
if (networkItem->RemoteHostnameResolved)
|
||||
getCellText->Text = PhGetStringRef(networkItem->RemoteHostString);
|
||||
else
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving....");
|
||||
PhInitializeStringRef(&getCellText->Text, L"Resolving...");
|
||||
}
|
||||
break;
|
||||
case PHNETLC_REMOTEPORT:
|
||||
|
||||
@@ -1388,7 +1388,7 @@ VOID PhNetworkProviderUpdate(
|
||||
{
|
||||
if (PhIsNullOrEmptyString(networkItem->ProcessName))
|
||||
{
|
||||
PhSetReference(&networkItem->ProcessName, &networkItem->ProcessItem->ProcessName);
|
||||
PhSetReference(&networkItem->ProcessName, networkItem->ProcessItem->ProcessName);
|
||||
modified = TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -810,9 +810,9 @@ INT_PTR CALLBACK PhPluginsDlgProc(
|
||||
HFONT titleFontHandle;
|
||||
|
||||
if (normalFontHandle = PhCreateCommonFont(-10, FW_NORMAL, NULL, LOWORD(wParam)))
|
||||
PhReplaceWindowFont(&context->NormalFontHandle, NULL, normalFontHandle, FALSE);
|
||||
PhSwapReferenceFont(&context->NormalFontHandle, NULL, normalFontHandle, FALSE);
|
||||
if (titleFontHandle = PhCreateCommonFont(-14, FW_BOLD, NULL, LOWORD(wParam)))
|
||||
PhReplaceWindowFont(&context->TitleFontHandle, NULL, titleFontHandle, FALSE);
|
||||
PhSwapReferenceFont(&context->TitleFontHandle, NULL, titleFontHandle, FALSE);
|
||||
|
||||
TreeNew_SetRowHeight(context->TreeNewHandle, PhScaleToDisplay(48, LOWORD(wParam)));
|
||||
TreeNew_NodesStructured(context->TreeNewHandle);
|
||||
|
||||
@@ -186,6 +186,8 @@ INT_PTR CALLBACK PhpProcessRecordDlgProc(
|
||||
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_OPENFILENAME), BM_SETIMAGE, IMAGE_ICON,
|
||||
(LPARAM)PH_LOAD_SHARED_ICON_SMALL(PhInstanceHandle, MAKEINTRESOURCE(IDI_FOLDER), dpiValue));
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_VIEWCOMMANDLINE), BM_SETIMAGE, IMAGE_ICON,
|
||||
(LPARAM)PH_LOAD_SHARED_ICON_SMALL(PhInstanceHandle, MAKEINTRESOURCE(IDI_MAGNIFIER), dpiValue));
|
||||
|
||||
PhSetDialogItemText(hwndDlg, IDC_NAME, PhGetStringOrDefault(versionInfo.FileDescription, L"N/A"));
|
||||
PhSetDialogItemText(hwndDlg, IDC_COMPANYNAME, PhGetStringOrDefault(versionInfo.CompanyName, L"N/A"));
|
||||
@@ -200,6 +202,9 @@ INT_PTR CALLBACK PhpProcessRecordDlgProc(
|
||||
|
||||
PhSetDialogItemText(hwndDlg, IDC_CMDLINE, PhGetStringOrDefault(context->Record->CommandLine, L"N/A"));
|
||||
|
||||
if (!context->Record->CommandLine)
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_VIEWCOMMANDLINE), FALSE);
|
||||
|
||||
if (context->Record->CreateTime.QuadPart != 0)
|
||||
PhSetDialogItemText(hwndDlg, IDC_STARTED, PhpaGetRelativeTimeString(&context->Record->CreateTime)->Buffer);
|
||||
else
|
||||
@@ -250,6 +255,42 @@ INT_PTR CALLBACK PhpProcessRecordDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IDC_VIEWCOMMANDLINE:
|
||||
{
|
||||
if (context->Record->CommandLine)
|
||||
{
|
||||
PPH_STRING commandLineString;
|
||||
PPH_LIST commandLineList;
|
||||
|
||||
if (commandLineList = PhCommandLineToList(PhGetString(context->Record->CommandLine)))
|
||||
{
|
||||
PH_STRING_BUILDER sb;
|
||||
|
||||
PhInitializeStringBuilder(&sb, 260);
|
||||
|
||||
for (ULONG i = 0; i < commandLineList->Count; i++)
|
||||
{
|
||||
PhAppendFormatStringBuilder(&sb, L"[%d] %s\r\n\r\n", i, PhGetString(commandLineList->Items[i]));
|
||||
}
|
||||
|
||||
PhAppendFormatStringBuilder(&sb, L"[FULL] %s\r\n", PhGetString(context->Record->CommandLine));
|
||||
|
||||
commandLineString = PhFinalStringBuilderString(&sb);
|
||||
|
||||
PhDereferenceObjects(commandLineList->Items, commandLineList->Count);
|
||||
PhDereferenceObject(commandLineList);
|
||||
}
|
||||
else
|
||||
{
|
||||
commandLineString = PhReferenceObject(context->Record->CommandLine);
|
||||
}
|
||||
|
||||
PhShowInformationDialog(hwndDlg, PhGetString(commandLineString), 0);
|
||||
|
||||
PhDereferenceObject(commandLineString);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IDC_PROPERTIES:
|
||||
{
|
||||
PPH_PROCESS_ITEM processItem;
|
||||
|
||||
@@ -1681,7 +1681,7 @@ INT_PTR CALLBACK PhpProcessEnvironmentDlgProc(
|
||||
HFONT treeNewFont;
|
||||
|
||||
if (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg)))
|
||||
PhReplaceWindowFont(&context->TreeNewFont, context->TreeNewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&context->TreeNewFont, context->TreeNewHandle, treeNewFont, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1931,6 +1931,12 @@ INT_PTR CALLBACK PhpProcessEnvironmentDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -993,6 +993,12 @@ INT_PTR CALLBACK PhpProcessGeneralDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -604,7 +604,7 @@ INT_PTR CALLBACK PhpProcessHandlesDlgProc(
|
||||
HFONT treeNewFont;
|
||||
|
||||
if (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg)))
|
||||
PhReplaceWindowFont(&handlesContext->TreeNewFont, handlesContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&handlesContext->TreeNewFont, handlesContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -977,6 +977,12 @@ INT_PTR CALLBACK PhpProcessHandlesDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -662,7 +662,7 @@ INT_PTR CALLBACK PhpProcessMemoryDlgProc(
|
||||
HFONT treeNewFont;
|
||||
|
||||
if (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg)))
|
||||
PhReplaceWindowFont(&memoryContext->TreeNewFont, memoryContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&memoryContext->TreeNewFont, memoryContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1133,6 +1133,12 @@ INT_PTR CALLBACK PhpProcessMemoryDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -763,6 +763,7 @@ INT_PTR CALLBACK PhpProcessModulesDlgProc(
|
||||
modulesContext->ListContext.ProcessId = processItem->ProcessId;
|
||||
modulesContext->ListContext.ProcessCreateTime = processItem->CreateTime;
|
||||
modulesContext->ListContext.HasServices = processItem->ServiceList && processItem->ServiceList->Count != 0;
|
||||
modulesContext->ListContext.IsSubsystemProcess = !!processItem->IsSubsystemProcess;
|
||||
modulesContext->ListContext.BoldFont = PhDuplicateFontWithNewWeight(GetWindowFont(modulesContext->TreeNewHandle), FW_BOLD);
|
||||
|
||||
// Initialize the search box. (dmex)
|
||||
@@ -877,7 +878,7 @@ INT_PTR CALLBACK PhpProcessModulesDlgProc(
|
||||
HFONT treeNewFont;
|
||||
|
||||
if (PhTreeWindowFont && (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg))))
|
||||
PhReplaceWindowFont(&modulesContext->TreeNewFont, modulesContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&modulesContext->TreeNewFont, modulesContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
|
||||
modulesContext->ListContext.BoldFont = PhDuplicateFontWithNewWeight(GetWindowFont(modulesContext->TreeNewHandle), FW_BOLD);
|
||||
if (fontHandle) DeleteFont(fontHandle);
|
||||
@@ -1210,6 +1211,12 @@ INT_PTR CALLBACK PhpProcessModulesDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -566,6 +566,12 @@ INT_PTR CALLBACK PhpProcessPerformanceDlgProc(
|
||||
performanceContext->WindowDpi = PhGetWindowDpi(hwndDlg);
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -111,6 +111,12 @@ INT_PTR CALLBACK PhpProcessServicesDlgProc(
|
||||
PhpLayoutServiceListControl(hwndDlg, (HWND)propPageContext->Context);
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -2418,7 +2418,7 @@ INT_PTR CALLBACK PhpProcessStatisticsDlgProc(
|
||||
|
||||
if (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg)))
|
||||
{
|
||||
PhReplaceWindowFont(&statisticsContext->TreeNewFont, statisticsContext->ListViewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&statisticsContext->TreeNewFont, statisticsContext->ListViewHandle, treeNewFont, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1201,7 +1201,7 @@ INT_PTR CALLBACK PhpProcessThreadsDlgProc(
|
||||
HFONT treeNewFont;
|
||||
|
||||
if (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg)))
|
||||
PhReplaceWindowFont(&threadsContext->TreeNewFont, threadsContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&threadsContext->TreeNewFont, threadsContext->TreeNewHandle, treeNewFont, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1813,6 +1813,12 @@ INT_PTR CALLBACK PhpProcessThreadsDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -441,6 +441,12 @@ INT_PTR CALLBACK PhpProcessVdmHostProcessDlgProc(
|
||||
PhpRefreshVdmHostProcess(hwndDlg, context, processItem);
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -2675,7 +2675,7 @@ INT_PTR CALLBACK PhpProcessWmiProvidersDlgProc(
|
||||
HFONT treeNewFont;
|
||||
|
||||
if (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg)))
|
||||
PhReplaceWindowFont(&context->TreeNewFont, context->TreeNewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&context->TreeNewFont, context->TreeNewHandle, treeNewFont, TRUE);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2784,6 +2784,12 @@ INT_PTR CALLBACK PhpProcessWmiProvidersDlgProc(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
return HANDLE_WM_CTLCOLORBTN(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORDLG:
|
||||
return HANDLE_WM_CTLCOLORDLG(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
case WM_CTLCOLORSTATIC:
|
||||
return HANDLE_WM_CTLCOLORSTATIC(hwndDlg, wParam, lParam, PhWindowThemeControlColor);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
+10
-27
@@ -836,16 +836,14 @@ ULONG PhRunAsGetLogonId(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
WINSTATIONINFORMATION stationInfo;
|
||||
TOKEN_STATISTICS statistics;
|
||||
|
||||
// LsaGetLogonSessionData or TokenLogonSid
|
||||
|
||||
if (NT_SUCCESS(PhGetWindowStationSessionInformation(
|
||||
WINSTATION_CURRENT_SESSION,
|
||||
&stationInfo
|
||||
if (NT_SUCCESS(PhGetTokenStatistics(
|
||||
PhGetOwnTokenAttributes().TokenHandle,
|
||||
&statistics
|
||||
)))
|
||||
{
|
||||
return stationInfo.LogonId;
|
||||
return statistics.AuthenticationId.LowPart;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1104,16 +1102,11 @@ NTSTATUS PhRunAsExecuteParentCommand(
|
||||
|
||||
if (PhRunAsGetLogonSid(newProcessHandle, &userSid, &logonSid))
|
||||
{
|
||||
status = PhRunAsUpdateDesktop(userSid);
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
status = PhRunAsUpdateWindowStation(userSid, logonSid);
|
||||
PhRunAsUpdateDesktop(userSid);
|
||||
PhRunAsUpdateWindowStation(userSid, logonSid);
|
||||
|
||||
PhFree(userSid);
|
||||
PhFree(logonSid);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
goto CleanupExit;
|
||||
}
|
||||
|
||||
if (PhGetOwnTokenAttributes().Elevated)
|
||||
@@ -1378,21 +1371,11 @@ VOID PhRunAsExecuteCommmand(
|
||||
|
||||
if (PhRunAsGetLogonSid(newProcessHandle, &userSid, &logonSid))
|
||||
{
|
||||
status = PhRunAsUpdateDesktop(userSid);
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
status = PhRunAsUpdateWindowStation(userSid, logonSid);
|
||||
PhRunAsUpdateDesktop(userSid);
|
||||
PhRunAsUpdateWindowStation(userSid, logonSid);
|
||||
|
||||
PhFree(userSid);
|
||||
PhFree(logonSid);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
NtClose(newProcessHandle);
|
||||
PhClearReference(&domainPart);
|
||||
PhClearReference(&userPart);
|
||||
goto CleanupExit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!createSuspended)
|
||||
@@ -3287,7 +3270,7 @@ INT_PTR CALLBACK PhpRunFileWndProc(
|
||||
{
|
||||
ULONG buttonStyle = PhGetWindowStyle(customDraw->hdr.hwndFrom);
|
||||
|
||||
if (FlagOn(buttonStyle, BS_CHECKBOX) == BS_CHECKBOX)
|
||||
if ((buttonStyle & BS_TYPEMASK) == BS_CHECKBOX || (buttonStyle & BS_TYPEMASK) == BS_AUTOCHECKBOX)
|
||||
{
|
||||
switch (customDraw->dwDrawStage)
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ PPH_RUNASPACKAGE_TREE_ROOT_NODE PhRunAsPackageAddNode(
|
||||
|
||||
if (bitmap = PhLoadImageFromFile(Package->SmallLogoPath->Buffer, width, height))
|
||||
{
|
||||
iconHandle = PhGdiplusConvertBitmapToIcon(bitmap, width, height, RGB(0, 0, 0));
|
||||
iconHandle = PhConvertBitmapToIcon(bitmap, width, height, RGB(0, 0, 0));
|
||||
DeleteBitmap(bitmap);
|
||||
}
|
||||
|
||||
@@ -856,9 +856,18 @@ INT_PTR CALLBACK PhRunAsPackageWndProc(
|
||||
break;
|
||||
case WM_SIZE:
|
||||
{
|
||||
// Suspend redraw across the resize so the stale-row-height scrollbar update from
|
||||
// PhLayoutManagerLayout (which sends the TreeNew a synchronous WM_SIZE before the
|
||||
// fill row height is recomputed) is coalesced with the corrected update below.
|
||||
// Without this the vertical scrollbar visibly flashes on/off during each resize tick.
|
||||
|
||||
TreeNew_SetRedraw(context->TreeNewHandle, FALSE);
|
||||
|
||||
PhLayoutManagerLayout(&context->LayoutManager);
|
||||
|
||||
TreeNew_AutoSizeColumn(context->TreeNewHandle, PH_RUNASPACKAGE_TREE_COLUMN_ITEM_NAME, TN_AUTOSIZE_REMAINING_SPACE);
|
||||
|
||||
TreeNew_SetRedraw(context->TreeNewHandle, TRUE);
|
||||
}
|
||||
break;
|
||||
case WM_DPICHANGED:
|
||||
@@ -869,9 +878,9 @@ INT_PTR CALLBACK PhRunAsPackageWndProc(
|
||||
context->WindowDpi = LOWORD(wParam);
|
||||
|
||||
if (normalFontHandle = PhCreateCommonFont(-10, FW_NORMAL, NULL, context->WindowDpi))
|
||||
PhReplaceWindowFont(&context->NormalFontHandle, NULL, normalFontHandle, FALSE);
|
||||
PhSwapReferenceFont(&context->NormalFontHandle, NULL, normalFontHandle, FALSE);
|
||||
if (titleFontHandle = PhCreateCommonFont(-14, FW_BOLD, NULL, context->WindowDpi))
|
||||
PhReplaceWindowFont(&context->TitleFontHandle, NULL, titleFontHandle, FALSE);
|
||||
PhSwapReferenceFont(&context->TitleFontHandle, NULL, titleFontHandle, FALSE);
|
||||
|
||||
TreeNew_SetRowHeight(context->TreeNewHandle, PhScaleToDisplay(48, context->WindowDpi));
|
||||
TreeNew_NodesStructured(context->TreeNewHandle);
|
||||
|
||||
@@ -521,7 +521,7 @@ INT_PTR CALLBACK PhpServicesPageProc(
|
||||
HFONT treeNewFont;
|
||||
|
||||
if (treeNewFont = PhCreateTreeWindowFont(PhGetWindowDpi(hwndDlg)))
|
||||
PhReplaceWindowFont(&context->TreeNewFont, context->ListViewHandle, treeNewFont, TRUE);
|
||||
PhSwapReferenceFont(&context->TreeNewFont, context->ListViewHandle, treeNewFont, TRUE);
|
||||
}
|
||||
|
||||
PhLayoutManagerUpdate(&context->LayoutManager, LOWORD(wParam));
|
||||
|
||||
@@ -2179,7 +2179,7 @@ VOID PhSipLayoutSummaryView(
|
||||
y,
|
||||
availableWidth,
|
||||
graphHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
y += graphHeight + CurrentParameters.GraphPadding;
|
||||
|
||||
@@ -2236,7 +2236,7 @@ VOID PhSipLayoutSectionView(
|
||||
y,
|
||||
CurrentParameters.SmallGraphWidth,
|
||||
graphHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
|
||||
deferHandle = DeferWindowPos(
|
||||
@@ -2247,7 +2247,7 @@ VOID PhSipLayoutSectionView(
|
||||
y,
|
||||
CurrentParameters.SmallGraphPadding + CurrentParameters.PanelWidth,
|
||||
graphHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
InvalidateRect(section->PanelHandle, NULL, TRUE);
|
||||
|
||||
@@ -2264,7 +2264,7 @@ VOID PhSipLayoutSectionView(
|
||||
y,
|
||||
CurrentParameters.SmallGraphWidth + CurrentParameters.SmallGraphPadding + CurrentParameters.PanelWidth,
|
||||
graphHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
InvalidateRect(RestoreSummaryControl, NULL, TRUE);
|
||||
|
||||
@@ -2276,7 +2276,7 @@ VOID PhSipLayoutSectionView(
|
||||
0,
|
||||
CurrentParameters.SeparatorWidth,
|
||||
CurrentParameters.WindowPadding + availableHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
|
||||
containerLeft = CurrentParameters.WindowPadding + CurrentParameters.SmallGraphWidth + CurrentParameters.SmallGraphPadding + CurrentParameters.PanelWidth + CurrentParameters.WindowPadding - 7 + CurrentParameters.SeparatorWidth;
|
||||
@@ -2288,7 +2288,7 @@ VOID PhSipLayoutSectionView(
|
||||
0,
|
||||
clientRect.right - containerLeft,
|
||||
CurrentParameters.WindowPadding + availableHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
|
||||
EndDeferWindowPos(deferHandle);
|
||||
@@ -2302,7 +2302,7 @@ VOID PhSipLayoutSectionView(
|
||||
CurrentParameters.WindowPadding,
|
||||
clientRect.right - containerLeft - CurrentParameters.WindowPadding - CurrentParameters.WindowPadding,
|
||||
availableHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+45
-7
@@ -13,8 +13,11 @@ set "IsCI=false"
|
||||
set "SuppressPause=false"
|
||||
set "TLG=auto"
|
||||
set "VSINSTALLPATH="
|
||||
set "VS_ARM64_SUPPORT=false"
|
||||
set "VCVARS_ARCH=amd64"
|
||||
set "CustomBuildTool=tools\CustomBuildTool\bin\Release\%PROCESSOR_ARCHITECTURE%\CustomBuildTool.exe"
|
||||
set "BUILD_CONFIGURATION=Debug"
|
||||
set "BUILD_CONFIGURATION=Debug;Release"
|
||||
set "BUILD_PLATFORMS=x64;ARM64"
|
||||
set "BUILD_TARGET=Build"
|
||||
set "PREFAST_ANALYSIS="
|
||||
|
||||
@@ -46,20 +49,39 @@ if errorlevel 1 exit /b %errorlevel%
|
||||
call :FindVisualStudio
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
call :SetupVcVars "amd64_arm64"
|
||||
REM Detect if ARM64 toolchain is available in the current Visual Studio installation.
|
||||
call :DetectArm64Support
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
echo [+] Building... [WIN64] %BUILD_CONFIGURATION% %BUILD_TARGET% %PREFAST_ANALYSIS%
|
||||
msbuild KSystemInformer\KSystemInformer.sln -t:%BUILD_TARGET% -p:Configuration=%BUILD_CONFIGURATION%;Platform=x64 -maxCpuCount -terminalLogger:%TLG% -consoleLoggerParameters:Summary;Verbosity=minimal %PREFAST_ANALYSIS%
|
||||
REM If ARM64 support is available, set up cross-compiling (amd64_arm64).
|
||||
if /i "%VS_ARM64_SUPPORT%"=="true" set "VCVARS_ARCH=amd64_arm64"
|
||||
|
||||
REM Set up the Visual C++ compiler environment for the target architecture.
|
||||
REM Configures PATH, INCLUDE, and LIB variables needed by the compiler and MSBuild.
|
||||
call :SetupVcVars "%VCVARS_ARCH%"
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
echo [+] Building... [ARM64] %BUILD_CONFIGURATION% %BUILD_TARGET% %PREFAST_ANALYSIS%
|
||||
msbuild KSystemInformer\KSystemInformer.sln -t:%BUILD_TARGET% -p:Configuration=%BUILD_CONFIGURATION%;Platform=ARM64 -maxCpuCount -terminalLogger:%TLG% -consoleLoggerParameters:Summary;Verbosity=minimal %PREFAST_ANALYSIS%
|
||||
REM Execute the kernel driver build across all configured platforms and configurations.
|
||||
REM Logs build parameters, invokes MSBuild with multiprocessor support, and validates success.
|
||||
echo [+] Building... [%BUILD_PLATFORMS%] (%BUILD_CONFIGURATION%) %BUILD_TARGET% %PREFAST_ANALYSIS%
|
||||
call :RunDriverBuild "%BUILD_PLATFORMS%" %BUILD_TARGET%
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
REM Report successful completion and return success code.
|
||||
echo [+] Build Complete! %BUILD_CONFIGURATION% %BUILD_TARGET% %PREFAST_ANALYSIS%
|
||||
exit /b 0
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
REM Function: RunDriverBuild
|
||||
REM Description: Builds KSystemInformer across the selected configuration/platform matrix.
|
||||
REM Parameters:
|
||||
REM %~1 - Semicolon-separated platform list (e.g. "x64" or "x64;ARM64").
|
||||
REM %~2 - BuildAll target such as Clean, Build, or Rebuild.
|
||||
REM -----------------------------------------------------------------------------
|
||||
:RunDriverBuild
|
||||
msbuild /m /graph KSystemInformer\KSystemInformer.sln -t:All -p:BuildAllTarget=%~2 -p:TargetConfigurations="%BUILD_CONFIGURATION%" -p:TargetPlatforms="%~1" -p:RestoreUseStaticGraphEvaluation=true -p:ContinueOnError=False -p:CopyRetryCount=10 -p:CopyRetryDelayMilliseconds=500 -terminalLogger:%TLG% -consoleLoggerParameters:Summary;Verbosity=minimal %PREFAST_ANALYSIS%
|
||||
exit /b %errorlevel%
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
REM Function: ParseArgs
|
||||
REM Description: Parses optional build mode arguments and updates script state.
|
||||
@@ -95,7 +117,7 @@ REM ----------------------------------------------------------------------------
|
||||
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
if not exist "%VSWHERE%" set "VSWHERE=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
if exist "%VSWHERE%" (
|
||||
for /f "usebackq tokens=*" %%A in (`call "%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
|
||||
for /f "usebackq tokens=*" %%A in (`call "%VSWHERE%" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
|
||||
set "VSINSTALLPATH=%%A"
|
||||
)
|
||||
)
|
||||
@@ -139,6 +161,22 @@ if /i "%GITHUB_ACTIONS%"=="true" set "IsCI=true"
|
||||
if /i "%TF_BUILD%"=="true" set "IsCI=true"
|
||||
exit /b 0
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
REM Function: DetectArm64Support
|
||||
REM Description: Checks whether the detected Visual Studio install has ARM64 VC tools.
|
||||
REM -----------------------------------------------------------------------------
|
||||
:DetectArm64Support
|
||||
if /i "%EnterpriseWDK%"=="true" (
|
||||
REM EWDK shells are single-arch; the launched arch is exposed via Platform.
|
||||
if /i "%Platform%"=="arm64" set "VS_ARM64_SUPPORT=true"
|
||||
exit /b 0
|
||||
)
|
||||
if not exist "%VSWHERE%" exit /b 0
|
||||
for /f "usebackq tokens=*" %%a in (`call "%VSWHERE%" -latest -prerelease -products * -requires "Microsoft.VisualStudio.Component.VC.Tools.ARM64" -property installationPath`) do (
|
||||
set "VS_ARM64_SUPPORT=true"
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
REM Function: ConfigureTerminalLogger
|
||||
REM Description: Disables the terminal logger when running under CI.
|
||||
|
||||
@@ -137,11 +137,11 @@ function(_si_set_target_defaults target)
|
||||
target_include_directories(${target} PRIVATE
|
||||
"${SI_ROOT}/plugins/include"
|
||||
"${SI_ROOT}/phnt/include"
|
||||
"${SI_ROOT}/sdk/include"
|
||||
"${SI_ROOT}/sdk/include/$<CONFIG>${SI_PLATFORM_SHORT}"
|
||||
"${SI_ROOT}/kphlib/include"
|
||||
)
|
||||
target_link_directories(${target} PRIVATE
|
||||
"${SI_ROOT}/sdk/lib/${SI_PLATFORM_SDK_LIB}"
|
||||
"${SI_ROOT}/sdk/lib/$<CONFIG>${SI_PLATFORM_SHORT}"
|
||||
"${SI_OUTPUT_DIR}/$<CONFIG>${SI_PLATFORM_SHORT}"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -14,12 +14,10 @@ set(HEADERS
|
||||
"include/kphmsg.h"
|
||||
"include/kphmsgdefs.h"
|
||||
"include/kphmsgdyn.h"
|
||||
"include/sistatus.h"
|
||||
)
|
||||
source_group("Header Files" FILES ${HEADERS})
|
||||
|
||||
set(RESOURCES
|
||||
"include/sistatus_MSG00001.bin"
|
||||
"kphdyn.xml"
|
||||
"sistatus.mc"
|
||||
)
|
||||
@@ -44,6 +42,7 @@ si_add_library(kphlib_um STATIC ${ALL_FILES})
|
||||
|
||||
target_include_directories(kphlib_um PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/$<CONFIG>${SI_PLATFORM_SHORT}"
|
||||
)
|
||||
|
||||
target_link_libraries(kphlib_um PRIVATE
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of System Informer.
|
||||
*
|
||||
* sistatus.h IS AN AUTOGENERATED FILE, DO NOT MODIFY
|
||||
*
|
||||
* Changes should be made in sistatus.mc
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SI_STATUS_H
|
||||
#define SI_STATUS_H
|
||||
//
|
||||
// Values are 32 bit values laid out as follows:
|
||||
//
|
||||
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
// +---+-+-+-----------------------+-------------------------------+
|
||||
// |Sev|C|R| Facility | Code |
|
||||
// +---+-+-+-----------------------+-------------------------------+
|
||||
//
|
||||
// where
|
||||
//
|
||||
// Sev - is the severity code
|
||||
//
|
||||
// 00 - Success
|
||||
// 01 - Informational
|
||||
// 10 - Warning
|
||||
// 11 - Error
|
||||
//
|
||||
// C - is the Customer code flag
|
||||
//
|
||||
// R - is a reserved bit
|
||||
//
|
||||
// Facility - is the facility code
|
||||
//
|
||||
// Code - is the facility's status code
|
||||
//
|
||||
//
|
||||
// Define the facility codes
|
||||
//
|
||||
#define FACILITY_SI 0x1
|
||||
#define FACILITY_SI_DYNDATA 0x2
|
||||
#define FACILITY_KSI 0x3
|
||||
|
||||
|
||||
//
|
||||
// Define the severity codes
|
||||
//
|
||||
#define STATUS_SEVERITY_SUCCESS 0x0
|
||||
#define STATUS_SEVERITY_INFORMATIONAL 0x1
|
||||
#define STATUS_SEVERITY_WARNING 0x2
|
||||
#define STATUS_SEVERITY_ERROR 0x3
|
||||
|
||||
|
||||
//
|
||||
// MessageId: STATUS_SI_DYNDATA_UNSUPPORTED_KERNEL
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// System Informer dynamic data is not yet supported on this kernel version.
|
||||
//
|
||||
#define STATUS_SI_DYNDATA_UNSUPPORTED_KERNEL ((NTSTATUS)0xE0020001L)
|
||||
|
||||
//
|
||||
// MessageId: STATUS_SI_DYNDATA_VERSION_MISMATCH
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// System Informer dynamic data version is incompatible.
|
||||
//
|
||||
#define STATUS_SI_DYNDATA_VERSION_MISMATCH ((NTSTATUS)0xE0020002L)
|
||||
|
||||
//
|
||||
// MessageId: STATUS_SI_DYNDATA_INVALID_LENGTH
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// System Informer dynamic data is an invalid length.
|
||||
//
|
||||
#define STATUS_SI_DYNDATA_INVALID_LENGTH ((NTSTATUS)0xE0020003L)
|
||||
|
||||
//
|
||||
// MessageId: STATUS_SI_DYNDATA_INVALID_SIGNATURE
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// System Informer dynamic data signature is invalid.
|
||||
//
|
||||
#define STATUS_SI_DYNDATA_INVALID_SIGNATURE ((NTSTATUS)0xE0020004L)
|
||||
|
||||
//
|
||||
// MessageId: STATUS_SI_KSIDLL_VERSION_MISMATCH
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// System Informer kernel library version is incompatible.
|
||||
//
|
||||
#define STATUS_SI_KSIDLL_VERSION_MISMATCH ((NTSTATUS)0xE0030001L)
|
||||
|
||||
#endif
|
||||
@@ -1,2 +0,0 @@
|
||||
LANGUAGE 0x9,0x1
|
||||
1 11 "sistatus_MSG00001.bin"
|
||||
Binary file not shown.
+14
-11
@@ -44,31 +44,34 @@
|
||||
<AdditionalDependencies>ksecdd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)..\tools\CustomBuildTool\bin\Release\$(PROCESSOR_ARCHITECTURE)\CustomBuildTool.exe" -dyndata "$(SolutionDir)..\bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
<Command>"$(SystemInformerRoot)tools\CustomBuildTool\bin\Release\$(PROCESSOR_ARCHITECTURE)\CustomBuildTool.exe" -dyndata "$(SystemInformerRoot)bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- sistatus
|
||||
Compiling of the message file is only done in the kernelmode side of KPHLIB
|
||||
so that the WDK is not a requirement only building the usermode parts. If
|
||||
changes are made to sistatus.mc, you must build the kernel parts for the
|
||||
header and resources to be regenerated.
|
||||
The kernelmode side compiles the message file with the WDK MessageCompile task into
|
||||
a per-configuration directory bin\$(Configuration)$(PlatformArchitecture)\ so the
|
||||
parallel matrix build does not race on a single shared output. The usermode side is
|
||||
generated separately by CustomBuildTool via the Windows SDK mc.exe (no WDK required).
|
||||
-->
|
||||
<Target Name="KsiMakeSistatusDir" BeforeTargets="MessageCompile">
|
||||
<MakeDir Directories="$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<MessageCompile Include="sistatus.mc">
|
||||
<GeneratedHeaderPath>true</GeneratedHeaderPath>
|
||||
<HeaderFilePath>$(ProjectDir)include</HeaderFilePath>
|
||||
<HeaderFilePath>$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)</HeaderFilePath>
|
||||
<GeneratedRcAndMessagesPath>true</GeneratedRcAndMessagesPath>
|
||||
<RCFilePath>$(ProjectDir)include</RCFilePath>
|
||||
<RCFilePath>$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)</RCFilePath>
|
||||
<SetCustomerbit>true</SetCustomerbit>
|
||||
<TerminateMessageWithNull>true</TerminateMessageWithNull>
|
||||
<UnicodeMessageInBinFile>true</UnicodeMessageInBinFile>
|
||||
<UnicodeInputFile>true</UnicodeInputFile>
|
||||
<Verbose>true</Verbose>
|
||||
</MessageCompile>
|
||||
<None Include="include\sistatus_MSG00001.bin" />
|
||||
<ResourceCompile Include="include\sistatus.rc" />
|
||||
<None Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus_MSG00001.bin" />
|
||||
<ResourceCompile Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.rc" />
|
||||
<ClInclude Include="include\kphringbuff.h" />
|
||||
<ClInclude Include="include\sistatus.h" />
|
||||
<ClInclude Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.h" />
|
||||
</ItemGroup>
|
||||
<!-- sistatus -->
|
||||
<ItemGroup>
|
||||
@@ -91,4 +94,4 @@
|
||||
<Xml Include="kphdyn.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<ClInclude Include="include\kphdyndata.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\sistatus.h">
|
||||
<ClInclude Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\kphringbuff.h">
|
||||
@@ -64,13 +64,13 @@
|
||||
<MessageCompile Include="sistatus.mc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="include\sistatus_MSG00001.bin">
|
||||
<None Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus_MSG00001.bin">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="include\sistatus.rc">
|
||||
<ResourceCompile Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
+27
-14
@@ -127,7 +127,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
@@ -140,10 +140,11 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_dyndata.cmd" "$(SolutionDir)bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
@@ -156,10 +157,11 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_dyndata.cmd" "$(SolutionDir)bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
@@ -172,10 +174,11 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_dyndata.cmd" "$(SolutionDir)bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>/utf-8 /d1nodatetime /guard:xfg %(AdditionalOptions)</AdditionalOptions>
|
||||
@@ -188,10 +191,11 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_dyndata.cmd" "$(SolutionDir)bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>/utf-8 /d1nodatetime /guard:xfg %(AdditionalOptions)</AdditionalOptions>
|
||||
@@ -204,10 +208,11 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_dyndata.cmd" "$(SolutionDir)bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phnt\include;include;bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>/utf-8 /d1nodatetime %(AdditionalOptions)</AdditionalOptions>
|
||||
@@ -220,22 +225,30 @@
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)build\build_dyndata.cmd" "$(SolutionDir)bin\$(Configuration)$(PlatformArchitecture)"</Command>
|
||||
</PreBuildEvent>
|
||||
<ResourceCompile />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<FilesToPackage Include="$(TargetPath)" />
|
||||
</ItemGroup>
|
||||
<!-- sistatus
|
||||
Compiling of the message file is only done in the kernelmode side of KPHLIB
|
||||
so that the WDK is not a requirement only building the usermode parts. If
|
||||
changes are made to sistatus.mc, you must build the kernel parts for the
|
||||
header and resources to be regenerated.
|
||||
The message file is compiled per-configuration into
|
||||
bin\$(Configuration)$(PlatformArchitecture)\. The kernelmode side uses the
|
||||
WDK MessageCompile task; the usermode side uses a CustomBuild item that
|
||||
invokes the Windows SDK mc.exe with equivalent flags (no WDK requirement).
|
||||
The declared Outputs make incremental builds skip mc.exe when sistatus.mc
|
||||
is unchanged.
|
||||
-->
|
||||
<ItemGroup>
|
||||
<None Include="sistatus.mc" />
|
||||
<None Include="include\sistatus_MSG00001.bin" />
|
||||
<ResourceCompile Include="include\sistatus.rc" />
|
||||
<CustomBuild Include="sistatus.mc">
|
||||
<Command>if not exist "$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)" mkdir "$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)"
|
||||
mc.exe -c -u -U -n -b -h "$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)" -r "$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)" "%(FullPath)"</Command>
|
||||
<Outputs>$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)\sistatus.h;$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)\sistatus.rc;$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)\sistatus_MSG00001.bin</Outputs>
|
||||
<Message>Compiling messages %(Filename)%(Extension)</Message>
|
||||
</CustomBuild>
|
||||
<None Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus_MSG00001.bin" />
|
||||
<ResourceCompile Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.rc" />
|
||||
<ClInclude Include="include\kphringbuff.h" />
|
||||
<ClInclude Include="include\sistatus.h" />
|
||||
<ClInclude Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.h" />
|
||||
</ItemGroup>
|
||||
<!-- sistatus -->
|
||||
<ItemGroup>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<ClInclude Include="include\kphdyndata.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\sistatus.h">
|
||||
<ClInclude Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\kphringbuff.h">
|
||||
@@ -61,14 +61,16 @@
|
||||
<Xml Include="kphdyn.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="sistatus.mc" />
|
||||
<None Include="include\sistatus_MSG00001.bin">
|
||||
<CustomBuild Include="sistatus.mc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</CustomBuild>
|
||||
<None Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus_MSG00001.bin">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="include\sistatus.rc">
|
||||
<ResourceCompile Include="bin\$(Configuration)$(PlatformArchitecture)\sistatus.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
+2
-2
@@ -1363,7 +1363,7 @@ BOOLEAN PhAppResolverGetPackageIcon(
|
||||
|
||||
if (bitmap = PhLoadImageFromFile(imagePath, width, height))
|
||||
{
|
||||
iconLarge = PhGdiplusConvertBitmapToIcon(bitmap, width, height, propertyColorValue.ulVal);
|
||||
iconLarge = PhConvertBitmapToIcon(bitmap, width, height, propertyColorValue.ulVal);
|
||||
DeleteBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
@@ -1379,7 +1379,7 @@ BOOLEAN PhAppResolverGetPackageIcon(
|
||||
|
||||
if (bitmap = PhLoadImageFromFile(imagePath, width, height))
|
||||
{
|
||||
iconSmall = PhGdiplusConvertBitmapToIcon(bitmap, width, height, propertyColorValue.ulVal);
|
||||
iconSmall = PhConvertBitmapToIcon(bitmap, width, height, propertyColorValue.ulVal);
|
||||
DeleteBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,49 @@
|
||||
*/
|
||||
|
||||
#include <phbase.h>
|
||||
#include <phintrin.h>
|
||||
#include "include\base64.h"
|
||||
|
||||
static const CHAR PhBase64EncodeTable[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
#ifndef _ARM64_
|
||||
/**
|
||||
* \brief SSSE3 base64 encode of one 12-input-byte block to 16 output chars
|
||||
* (Wojciech Muła's pshufb-based encoder). Produces the standard alphabet
|
||||
* (A-Za-z0-9+/), identical to PhBase64EncodeTable.
|
||||
*/
|
||||
static __m128i PhpBase64EncodeBlock(
|
||||
_In_ __m128i Input
|
||||
)
|
||||
{
|
||||
__m128i in;
|
||||
__m128i t0;
|
||||
__m128i t1;
|
||||
__m128i t2;
|
||||
__m128i t3;
|
||||
__m128i indices;
|
||||
__m128i mask;
|
||||
const __m128i lut = _mm_setr_epi8(65, 71, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -19, -16, 0, 0);
|
||||
|
||||
// Rearrange so each 32-bit lane holds 3 source bytes ready for 6-bit splitting.
|
||||
in = _mm_shuffle_epi8(Input, _mm_set_epi8(10, 11, 9, 10, 7, 8, 6, 7, 4, 5, 3, 4, 1, 2, 0, 1));
|
||||
|
||||
// Split each lane into four 6-bit fields (0..63).
|
||||
t0 = _mm_and_si128(in, _mm_set1_epi32(0x0fc0fc00));
|
||||
t1 = _mm_mulhi_epu16(t0, _mm_set1_epi32(0x04000040));
|
||||
t2 = _mm_and_si128(in, _mm_set1_epi32(0x003f03f0));
|
||||
t3 = _mm_mullo_epi16(t2, _mm_set1_epi32(0x01000010));
|
||||
indices = _mm_or_si128(t1, t3);
|
||||
|
||||
// Translate 6-bit indices to ASCII via range-offset LUT.
|
||||
mask = _mm_cmpgt_epi8(indices, _mm_set1_epi8(25));
|
||||
t0 = _mm_subs_epu8(indices, _mm_set1_epi8(51));
|
||||
t0 = _mm_sub_epi8(t0, mask);
|
||||
return _mm_add_epi8(indices, _mm_shuffle_epi8(lut, t0));
|
||||
}
|
||||
#endif
|
||||
|
||||
static const UCHAR PhBase64DecodeTable[256] =
|
||||
{
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
@@ -55,6 +93,22 @@ BOOLEAN PhBase64Encode(
|
||||
if (OutputLength < requiredLength)
|
||||
return FALSE;
|
||||
|
||||
#ifndef _ARM64_
|
||||
// SSSE3: encode 12 input bytes -> 16 output chars per iteration. The 16-byte
|
||||
// load overshoots the 12 consumed bytes by 4, so require 16 readable bytes;
|
||||
// the trailing groups (and any padding) fall through to the scalar loop.
|
||||
if (PhHasSSSE3)
|
||||
{
|
||||
while (inputIndex + 16 <= InputLength)
|
||||
{
|
||||
__m128i block = _mm_loadu_si128((__m128i const*)&Input[inputIndex]);
|
||||
_mm_storeu_si128((__m128i*)&Output[outputIndex], PhpBase64EncodeBlock(block));
|
||||
inputIndex += 12;
|
||||
outputIndex += 16;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (inputIndex + 3 <= InputLength)
|
||||
{
|
||||
ULONG value = ((ULONG)Input[inputIndex] << 16) | ((ULONG)Input[inputIndex + 1] << 8) | Input[inputIndex + 2];
|
||||
|
||||
+29
-6
@@ -550,6 +550,7 @@ DOUBLE PhReadTimeStampFrequency(
|
||||
LARGE_INTEGER startTime;
|
||||
LARGE_INTEGER endTime;
|
||||
ULONG_PTR affinityMask = 0;
|
||||
ULONG64 yieldCount = 0;
|
||||
ULONG64 startTsc;
|
||||
ULONG64 endTsc;
|
||||
|
||||
@@ -559,8 +560,7 @@ DOUBLE PhReadTimeStampFrequency(
|
||||
|
||||
// Calculate wait interval in QPC ticks (100ms measurement window)
|
||||
|
||||
const LONGLONG calibrationIntervalMs = 100;
|
||||
const LONGLONG calibrationIntervalTicks = PhMultiplyDivide((ULONG)performanceFrequency.QuadPart, (ULONG)calibrationIntervalMs, 1000);
|
||||
const LONGLONG calibrationIntervalTicks = PhMultiplyDivide((ULONG)performanceFrequency.QuadPart, 100, 1000);
|
||||
|
||||
// Warm up CPU caches and branch predictors.
|
||||
|
||||
@@ -578,11 +578,13 @@ DOUBLE PhReadTimeStampFrequency(
|
||||
startTsc = ReadTimeStampCounter();
|
||||
SpeculationFence();
|
||||
|
||||
// Busy-wait for calibration interval.
|
||||
// Busy-wait for calibration interval, unrolled to dilute QPC overhead.
|
||||
|
||||
do
|
||||
{
|
||||
YieldProcessor();
|
||||
yieldCount += 8;
|
||||
|
||||
PhQueryPerformanceCounter(&endTime);
|
||||
} while ((endTime.QuadPart - startTime.QuadPart) < calibrationIntervalTicks);
|
||||
|
||||
@@ -599,12 +601,18 @@ DOUBLE PhReadTimeStampFrequency(
|
||||
PhSetThreadAffinityMask(NtCurrentThread(), affinityMask);
|
||||
}
|
||||
|
||||
const ULONG64 elapsedTscTicks = endTsc - startTsc;
|
||||
const DOUBLE elapsedSeconds = (DOUBLE)(endTime.QuadPart - startTime.QuadPart) / performanceFrequency.QuadPart;
|
||||
|
||||
// Calculate cycles per yield: elapsed_tsc_ticks / yield_count.
|
||||
|
||||
const DOUBLE CyclesPerYield = (DOUBLE)elapsedTscTicks / (DOUBLE)yieldCount;
|
||||
|
||||
// Calculate TSC frequency: tsc_delta / elapsed_seconds.
|
||||
|
||||
const DOUBLE elapsedSeconds = (DOUBLE)(endTime.QuadPart - startTime.QuadPart) / performanceFrequency.QuadPart;
|
||||
const ULONG64 elapsedTscTicks = endTsc - startTsc;
|
||||
const DOUBLE TscFrequency = (DOUBLE)elapsedTscTicks / elapsedSeconds;
|
||||
|
||||
return (DOUBLE)elapsedTscTicks / elapsedSeconds;
|
||||
return TscFrequency;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3144,6 +3152,21 @@ BOOLEAN PhCalculateEntropy(
|
||||
ULONG64 bufferSumValue = 0;
|
||||
ULONG64 counts[UCHAR_MAX + 1];
|
||||
|
||||
// Guard against division by zero: an empty buffer has no distribution, so
|
||||
// entropy/mean/variance are all zero. Without this the entropy and mean
|
||||
// computations below would divide by (FLOAT)BufferLength == 0 and yield NaN.
|
||||
if (BufferLength == 0)
|
||||
{
|
||||
if (Entropy)
|
||||
*Entropy = 0.f;
|
||||
if (Mean)
|
||||
*Mean = 0.f;
|
||||
if (Variance)
|
||||
*Variance = 0.f;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
memset(counts, 0, sizeof(counts));
|
||||
|
||||
while (bufferOffset < BufferLength)
|
||||
|
||||
@@ -103,6 +103,7 @@ NTSTATUS PhDosErrorToNtStatus(
|
||||
case ERROR_STACK_OVERFLOW: return STATUS_STACK_OVERFLOW;
|
||||
case ERROR_NO_TOKEN: return STATUS_NO_TOKEN;
|
||||
case ERROR_DEPENDENT_SERVICES_RUNNING: return STATUS_UNSATISFIED_DEPENDENCIES;
|
||||
case ERROR_SERVICE_REQUEST_TIMEOUT: return STATUS_TIMEOUT;
|
||||
case ERROR_SERVICE_ALREADY_RUNNING: return STATUS_IMAGE_ALREADY_LOADED;
|
||||
case ERROR_SERVICE_DISABLED: return STATUS_ILL_FORMED_SERVICE_ENTRY; // STATUS_INVALID_CONFIG_VALUE
|
||||
case ERROR_SERVICE_DOES_NOT_EXIST: return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
|
||||
+1
-1
@@ -160,8 +160,8 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
|
||||
{
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
PhRemoveWindowContext(WindowHandle, MAXCHAR);
|
||||
PhSetWindowProcedure(WindowHandle, oldWndProc);
|
||||
PhRemoveWindowContext(WindowHandle, MAXCHAR);
|
||||
|
||||
PhListView_Destroy(context->ListViewContext);
|
||||
|
||||
|
||||
+5
-1
@@ -181,10 +181,14 @@ NTSTATUS PhInitializeWindowsInformation(
|
||||
// Windows 10, Windows Server 2016
|
||||
else if (majorVersion == 10 && minorVersion == 0)
|
||||
{
|
||||
if (buildVersion > 28000)
|
||||
if (buildVersion > 29500)
|
||||
{
|
||||
WindowsVersion = WINDOWS_NEW;
|
||||
}
|
||||
else if (buildVersion >= 29500)
|
||||
{
|
||||
WindowsVersion = WINDOWS_11_27H2;
|
||||
}
|
||||
else if (buildVersion >= 28000)
|
||||
{
|
||||
WindowsVersion = WINDOWS_11_26H1;
|
||||
|
||||
+171
@@ -17,6 +17,11 @@ static PH_INITONCE PhHandleTableInitOnce = PH_INITONCE_INIT;
|
||||
static PH_FREE_LIST PhHandleTableLevel0FreeList;
|
||||
static PH_FREE_LIST PhHandleTableLevel1FreeList;
|
||||
|
||||
/**
|
||||
* Creates a handle table.
|
||||
*
|
||||
* \return A pointer to the newly created handle table.
|
||||
*/
|
||||
PPH_HANDLE_TABLE PhCreateHandleTable(
|
||||
VOID
|
||||
)
|
||||
@@ -81,6 +86,11 @@ PPH_HANDLE_TABLE PhCreateHandleTable(
|
||||
return handleTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table to destroy.
|
||||
*/
|
||||
VOID PhDestroyHandleTable(
|
||||
_In_ _Post_invalid_ PPH_HANDLE_TABLE HandleTable
|
||||
)
|
||||
@@ -151,6 +161,12 @@ VOID PhDestroyHandleTable(
|
||||
PhFree(HandleTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks the current thread until a handle table entry is unlocked.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param HandleTableEntry A pointer to the handle table entry to wait on.
|
||||
*/
|
||||
VOID PhpBlockOnLockedHandleTableEntry(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ PPH_HANDLE_TABLE_ENTRY HandleTableEntry
|
||||
@@ -177,6 +193,14 @@ VOID PhpBlockOnLockedHandleTableEntry(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Locks a handle table entry.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param HandleTableEntry A pointer to the handle table entry to lock.
|
||||
*
|
||||
* \return TRUE if the entry was locked successfully, otherwise FALSE.
|
||||
*/
|
||||
BOOLEAN PhLockHandleTableEntry(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_Inout_ PPH_HANDLE_TABLE_ENTRY HandleTableEntry
|
||||
@@ -207,6 +231,12 @@ BOOLEAN PhLockHandleTableEntry(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlocks a handle table entry.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param HandleTableEntry A pointer to the handle table entry to unlock.
|
||||
*/
|
||||
VOID PhUnlockHandleTableEntry(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_Inout_ PPH_HANDLE_TABLE_ENTRY HandleTableEntry
|
||||
@@ -219,6 +249,14 @@ VOID PhUnlockHandleTableEntry(
|
||||
PhSetWakeEvent(&HandleTable->HandleWakeEvent, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a handle in a handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param HandleTableEntry A pointer to the handle table entry to copy into the new handle.
|
||||
*
|
||||
* \return The newly created handle, or NULL if the handle could not be created.
|
||||
*/
|
||||
HANDLE PhCreateHandle(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ PPH_HANDLE_TABLE_ENTRY HandleTableEntry
|
||||
@@ -247,6 +285,16 @@ HANDLE PhCreateHandle(
|
||||
return PhpEncodeHandle(handleValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys a handle in a handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param Handle The handle to destroy.
|
||||
* \param HandleTableEntry An optional pointer to the handle table entry. If this is NULL, the
|
||||
* entry is looked up using the handle.
|
||||
*
|
||||
* \return TRUE if the handle was destroyed, otherwise FALSE.
|
||||
*/
|
||||
BOOLEAN PhDestroyHandle(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ HANDLE Handle,
|
||||
@@ -282,6 +330,14 @@ BOOLEAN PhDestroyHandle(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up a handle table entry in a handle table and locks it.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param Handle The handle to look up.
|
||||
*
|
||||
* \return A pointer to the locked handle table entry, or NULL if the handle was not found.
|
||||
*/
|
||||
PPH_HANDLE_TABLE_ENTRY PhLookupHandleTableEntry(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ HANDLE Handle
|
||||
@@ -300,6 +356,13 @@ PPH_HANDLE_TABLE_ENTRY PhLookupHandleTableEntry(
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates all handles in a handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param Callback A callback function called for each handle.
|
||||
* \param Context A user-defined context passed to the callback function.
|
||||
*/
|
||||
VOID PhEnumHandleTable(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ PPH_ENUM_HANDLE_TABLE_CALLBACK Callback,
|
||||
@@ -332,6 +395,13 @@ VOID PhEnumHandleTable(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates all handles in a handle table without locking them.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param Callback A callback function called for each handle.
|
||||
* \param Context A user-defined context passed to the callback function.
|
||||
*/
|
||||
VOID PhSweepHandleTable(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ PPH_ENUM_HANDLE_TABLE_CALLBACK Callback,
|
||||
@@ -363,6 +433,17 @@ VOID PhSweepHandleTable(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries information about a handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param InformationClass The information class to query.
|
||||
* \param Buffer A buffer which receives the information.
|
||||
* \param BufferLength The length of the buffer.
|
||||
* \param ReturnLength A pointer to a variable which receives the number of bytes returned.
|
||||
*
|
||||
* \return Successful NTSTATUS, or an error code.
|
||||
*/
|
||||
NTSTATUS PhQueryInformationHandleTable(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ PH_HANDLE_TABLE_INFORMATION_CLASS InformationClass,
|
||||
@@ -422,6 +503,16 @@ NTSTATUS PhQueryInformationHandleTable(
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets information for a handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param InformationClass The information class to set.
|
||||
* \param Buffer A buffer which contains the information.
|
||||
* \param BufferLength The length of the buffer.
|
||||
*
|
||||
* \return Successful NTSTATUS, or an error code.
|
||||
*/
|
||||
NTSTATUS PhSetInformationHandleTable(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ PH_HANDLE_TABLE_INFORMATION_CLASS InformationClass,
|
||||
@@ -460,6 +551,15 @@ NTSTATUS PhSetInformationHandleTable(
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a handle table entry.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param HandleValue A pointer to a variable which receives the handle value.
|
||||
*
|
||||
* \return A pointer to the newly allocated handle table entry, or NULL if the entry could not be
|
||||
* allocated.
|
||||
*/
|
||||
PPH_HANDLE_TABLE_ENTRY PhpAllocateHandleTableEntry(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_Out_ PULONG HandleValue
|
||||
@@ -571,6 +671,13 @@ PPH_HANDLE_TABLE_ENTRY PhpAllocateHandleTableEntry(
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees a handle table entry.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param HandleValue The handle value of the entry.
|
||||
* \param HandleTableEntry A pointer to the handle table entry to free.
|
||||
*/
|
||||
VOID PhpFreeHandleTableEntry(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ ULONG HandleValue,
|
||||
@@ -615,6 +722,14 @@ VOID PhpFreeHandleTableEntry(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates more handle table entries.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param Initialize Whether to initialize the new entries and add them to the free list.
|
||||
*
|
||||
* \return TRUE if more entries were allocated, otherwise FALSE.
|
||||
*/
|
||||
BOOLEAN PhpAllocateMoreHandleTableEntries(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ BOOLEAN Initialize
|
||||
@@ -828,6 +943,14 @@ BOOLEAN PhpAllocateMoreHandleTableEntries(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up a handle table entry in a handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param HandleValue The handle value to look up.
|
||||
*
|
||||
* \return A pointer to the handle table entry, or NULL if the handle was not found.
|
||||
*/
|
||||
PPH_HANDLE_TABLE_ENTRY PhpLookupHandleTableEntry(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ ULONG HandleValue
|
||||
@@ -881,6 +1004,14 @@ PPH_HANDLE_TABLE_ENTRY PhpLookupHandleTableEntry(
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves all entries from the alternative free list to the main free list.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
*
|
||||
* \return The handle value of the first entry moved, or PH_HANDLE_VALUE_INVALID if no entries were
|
||||
* moved.
|
||||
*/
|
||||
ULONG PhpMoveFreeHandleTableEntries(
|
||||
_Inout_ PPH_HANDLE_TABLE HandleTable
|
||||
)
|
||||
@@ -978,6 +1109,15 @@ ULONG PhpMoveFreeHandleTableEntries(
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a level 0 handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
* \param Initialize Whether to initialize the table.
|
||||
*
|
||||
* \return A pointer to the newly created level 0 table, or NULL if the table could not be
|
||||
* allocated.
|
||||
*/
|
||||
PPH_HANDLE_TABLE_ENTRY PhpCreateHandleTableLevel0(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable,
|
||||
_In_ BOOLEAN Initialize
|
||||
@@ -1020,6 +1160,11 @@ PPH_HANDLE_TABLE_ENTRY PhpCreateHandleTableLevel0(
|
||||
return table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees a level 0 handle table.
|
||||
*
|
||||
* \param Table A pointer to the level 0 table to free.
|
||||
*/
|
||||
VOID PhpFreeHandleTableLevel0(
|
||||
_In_ PPH_HANDLE_TABLE_ENTRY Table
|
||||
)
|
||||
@@ -1027,6 +1172,14 @@ VOID PhpFreeHandleTableLevel0(
|
||||
PhFreeToFreeList(&PhHandleTableLevel0FreeList, Table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a level 1 handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
*
|
||||
* \return A pointer to the newly created level 1 table, or NULL if the table could not be
|
||||
* allocated.
|
||||
*/
|
||||
PPH_HANDLE_TABLE_ENTRY *PhpCreateHandleTableLevel1(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable
|
||||
)
|
||||
@@ -1051,6 +1204,11 @@ PPH_HANDLE_TABLE_ENTRY *PhpCreateHandleTableLevel1(
|
||||
return table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees a level 1 handle table.
|
||||
*
|
||||
* \param Table A pointer to the level 1 table to free.
|
||||
*/
|
||||
VOID PhpFreeHandleTableLevel1(
|
||||
_In_ PPH_HANDLE_TABLE_ENTRY *Table
|
||||
)
|
||||
@@ -1058,6 +1216,14 @@ VOID PhpFreeHandleTableLevel1(
|
||||
PhFreeToFreeList(&PhHandleTableLevel1FreeList, Table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a level 2 handle table.
|
||||
*
|
||||
* \param HandleTable A pointer to the handle table.
|
||||
*
|
||||
* \return A pointer to the newly created level 2 table, or NULL if the table could not be
|
||||
* allocated.
|
||||
*/
|
||||
PPH_HANDLE_TABLE_ENTRY **PhpCreateHandleTableLevel2(
|
||||
_In_ PPH_HANDLE_TABLE HandleTable
|
||||
)
|
||||
@@ -1078,6 +1244,11 @@ PPH_HANDLE_TABLE_ENTRY **PhpCreateHandleTableLevel2(
|
||||
return table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees a level 2 handle table.
|
||||
*
|
||||
* \param Table A pointer to the level 2 table to free.
|
||||
*/
|
||||
VOID PhpFreeHandleTableLevel2(
|
||||
_In_ PPH_HANDLE_TABLE_ENTRY **Table
|
||||
)
|
||||
|
||||
+2
-1
@@ -1088,12 +1088,13 @@ NTSTATUS PhHttpDownloadToFile(
|
||||
break;
|
||||
}
|
||||
|
||||
numberOfBytesReadTotal += isb.Information;
|
||||
|
||||
if (Callback)
|
||||
{
|
||||
PhQuerySystemTime(&timeNow);
|
||||
timeTicks = (timeNow.QuadPart - timeStart.QuadPart) / PH_TICKS_PER_SEC;
|
||||
|
||||
numberOfBytesReadTotal += isb.Information;
|
||||
context.ReadLength = numberOfBytesReadTotal;
|
||||
context.TotalLength = numberOfBytesTotal;
|
||||
context.BitsPerSecond = numberOfBytesReadTotal / __max(timeTicks, 1);
|
||||
|
||||
@@ -640,6 +640,18 @@ PhGetMappedImageResource(
|
||||
_Out_opt_ PVOID* ResourceBuffer
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhGetMappedImageResourceBinarySearch(
|
||||
_In_ PPH_MAPPED_IMAGE MappedImage,
|
||||
_In_ PCWSTR Name,
|
||||
_In_ PCWSTR Type,
|
||||
_In_opt_ USHORT Language,
|
||||
_Out_opt_ PULONG ResourceLength,
|
||||
_Out_opt_ PVOID* ResourceBuffer
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
@@ -986,6 +998,38 @@ PhFreeMappedImageRelocations(
|
||||
_In_opt_ PPH_MAPPED_IMAGE_RELOC Relocations
|
||||
);
|
||||
|
||||
typedef struct _PH_IMAGE_SECURITY_ENTRY
|
||||
{
|
||||
USHORT Revision; // WIN_CERTIFICATE.wRevision
|
||||
USHORT CertificateType; // WIN_CERTIFICATE.wCertificateType (WIN_CERT_TYPE_*)
|
||||
ULONG CertificateLength; // payload length = dwLength - UFIELD_OFFSET(WIN_CERTIFICATE, bCertificate)
|
||||
PBYTE Certificate; // pointer into the mapped view (bCertificate); zero-copy
|
||||
} PH_IMAGE_SECURITY_ENTRY, *PPH_IMAGE_SECURITY_ENTRY;
|
||||
|
||||
typedef struct _PH_MAPPED_IMAGE_SECURITY
|
||||
{
|
||||
PPH_MAPPED_IMAGE MappedImage;
|
||||
PIMAGE_DATA_DIRECTORY DataDirectory;
|
||||
|
||||
ULONG NumberOfEntries;
|
||||
PPH_IMAGE_SECURITY_ENTRY Entries;
|
||||
} PH_MAPPED_IMAGE_SECURITY, *PPH_MAPPED_IMAGE_SECURITY;
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhGetMappedImageSecurity(
|
||||
_In_ PPH_MAPPED_IMAGE MappedImage,
|
||||
_Out_ PPH_MAPPED_IMAGE_SECURITY Security
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
VOID
|
||||
NTAPI
|
||||
PhFreeMappedImageSecurity(
|
||||
_In_opt_ PPH_MAPPED_IMAGE_SECURITY Security
|
||||
);
|
||||
|
||||
typedef struct _PH_IMAGE_DYNAMIC_RELOC_ENTRY
|
||||
{
|
||||
ULONGLONG Symbol;
|
||||
@@ -1289,6 +1333,67 @@ PhGetRemoteMappedImageCHPEVersion(
|
||||
_Out_ PULONG CHPEVersion
|
||||
);
|
||||
|
||||
typedef struct _PH_MAPPED_IMAGE_LOCK_PREFIX
|
||||
{
|
||||
PPH_MAPPED_IMAGE MappedImage;
|
||||
|
||||
ULONG NumberOfEntries;
|
||||
PULONGLONG Entries; // heap-allocated, free with PhFree
|
||||
} PH_MAPPED_IMAGE_LOCK_PREFIX, *PPH_MAPPED_IMAGE_LOCK_PREFIX;
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhGetMappedImageLockPrefixTable(
|
||||
_In_ PPH_MAPPED_IMAGE MappedImage,
|
||||
_Out_ PPH_MAPPED_IMAGE_LOCK_PREFIX LockPrefix
|
||||
);
|
||||
|
||||
typedef struct _PH_MAPPED_IMAGE_ENCLAVE_CONFIG
|
||||
{
|
||||
PPH_MAPPED_IMAGE MappedImage;
|
||||
PVOID EnclaveConfig; // PIMAGE_ENCLAVE_CONFIG32/64 (points into the mapped view)
|
||||
|
||||
ULONG NumberOfImports;
|
||||
PIMAGE_ENCLAVE_IMPORT Imports; // points into the mapped view (NULL when none)
|
||||
} PH_MAPPED_IMAGE_ENCLAVE_CONFIG, *PPH_MAPPED_IMAGE_ENCLAVE_CONFIG;
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhGetMappedImageEnclaveConfig(
|
||||
_In_ PPH_MAPPED_IMAGE MappedImage,
|
||||
_Out_ PPH_MAPPED_IMAGE_ENCLAVE_CONFIG EnclaveConfig
|
||||
);
|
||||
|
||||
typedef struct _PH_MAPPED_IMAGE_CHPE
|
||||
{
|
||||
PPH_MAPPED_IMAGE MappedImage;
|
||||
PVOID Metadata; // PIMAGE_CHPE_METADATA_X86 / PIMAGE_ARM64EC_METADATA (points into the mapped view)
|
||||
ULONG Version;
|
||||
BOOLEAN IsArm64ec;
|
||||
|
||||
// ARM64EC tables (valid when IsArm64ec; point into the mapped view)
|
||||
ULONG NumberOfCodeMapEntries;
|
||||
PIMAGE_ARM64EC_CODE_MAP_ENTRY CodeMap;
|
||||
ULONG NumberOfCodeRangeEntryPoints;
|
||||
PIMAGE_ARM64EC_CODE_RANGE_ENTRY_POINT CodeRangesToEntryPoints;
|
||||
ULONG NumberOfRedirectionEntries;
|
||||
PIMAGE_ARM64EC_REDIRECTION_ENTRY RedirectionMetadata;
|
||||
|
||||
// x86 CHPE table (valid when !IsArm64ec; points into the mapped view)
|
||||
ULONG NumberOfCodeRangeEntries;
|
||||
PIMAGE_CHPE_RANGE_ENTRY CodeRanges;
|
||||
} PH_MAPPED_IMAGE_CHPE, *PPH_MAPPED_IMAGE_CHPE;
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhGetMappedImageCHPE(
|
||||
_In_ PPH_MAPPED_IMAGE MappedImage,
|
||||
_Out_ PPH_MAPPED_IMAGE_CHPE Chpe
|
||||
);
|
||||
|
||||
// ELF binary support
|
||||
|
||||
NTSTATUS PhInitializeMappedWslImage(
|
||||
|
||||
+14
-10
@@ -635,7 +635,11 @@ PhInitializeEvent(
|
||||
)
|
||||
{
|
||||
WriteULongPtrRelease(&Event->Value, PH_EVENT_REFCOUNT_INC);
|
||||
WritePointerRelease(&Event->EventHandle, UlongToPtr(0));
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
WritePointerRelease(&Event->EventHandle, NULL);
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4646,6 +4650,15 @@ PhConvertCopyMemoryUlong64(
|
||||
_In_ SIZE_T Count
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
VOID
|
||||
NTAPI
|
||||
PhAddMemoryUlong(
|
||||
_Inout_ PULONG A,
|
||||
_In_ PULONG B,
|
||||
_In_ ULONG Count
|
||||
);
|
||||
|
||||
DECLSPEC_NOALIAS
|
||||
PHLIBAPI
|
||||
VOID
|
||||
@@ -4656,15 +4669,6 @@ PhConvertCopyMemorySizeT(
|
||||
_In_ SIZE_T Count
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
VOID
|
||||
NTAPI
|
||||
PhAddMemoryUlong(
|
||||
_Inout_ PULONG A,
|
||||
_In_ PULONG B,
|
||||
_In_ ULONG Count
|
||||
);
|
||||
|
||||
DECLSPEC_NOALIAS
|
||||
PHLIBAPI
|
||||
VOID
|
||||
|
||||
@@ -51,7 +51,8 @@ EXTERN_C ULONG WindowsVersion;
|
||||
#define WINDOWS_11_24H2 117 // October, 2024 // Build 26100
|
||||
#define WINDOWS_11_25H2 118 // October, 2025 // Build 26200
|
||||
#define WINDOWS_11_26H1 119 // Build 28000
|
||||
#define WINDOWS_MAX WINDOWS_11_26H1
|
||||
#define WINDOWS_11_27H2 120 // Build 29500
|
||||
#define WINDOWS_MAX WINDOWS_11_27H2
|
||||
#define WINDOWS_NEW ULONG_MAX
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
+858
-2
@@ -32,17 +32,27 @@ PhSymCryptInitialize(
|
||||
|
||||
#define PH_SYMCRYPT_MD5_RESULT_SIZE 16
|
||||
#define PH_SYMCRYPT_SHA1_RESULT_SIZE 20
|
||||
#define PH_SYMCRYPT_SHA224_RESULT_SIZE 28
|
||||
#define PH_SYMCRYPT_SHA256_RESULT_SIZE 32
|
||||
#define PH_SYMCRYPT_SHA384_RESULT_SIZE 48
|
||||
#define PH_SYMCRYPT_SHA512_RESULT_SIZE 64
|
||||
#define PH_SYMCRYPT_SHA512_224_RESULT_SIZE 28
|
||||
#define PH_SYMCRYPT_SHA512_256_RESULT_SIZE 32
|
||||
#define PH_SYMCRYPT_SHA3_224_RESULT_SIZE 28
|
||||
#define PH_SYMCRYPT_SHA3_256_RESULT_SIZE 32
|
||||
#define PH_SYMCRYPT_SHA3_384_RESULT_SIZE 48
|
||||
#define PH_SYMCRYPT_SHA3_512_RESULT_SIZE 64
|
||||
#define PH_SYMCRYPT_SHAKE128_DEFAULT_RESULT_SIZE 32
|
||||
#define PH_SYMCRYPT_SHAKE256_DEFAULT_RESULT_SIZE 64
|
||||
|
||||
#define PH_SYMCRYPT_HMAC_MD5_RESULT_SIZE PH_SYMCRYPT_MD5_RESULT_SIZE
|
||||
#define PH_SYMCRYPT_HMAC_SHA1_RESULT_SIZE PH_SYMCRYPT_SHA1_RESULT_SIZE
|
||||
#define PH_SYMCRYPT_HMAC_SHA224_RESULT_SIZE PH_SYMCRYPT_SHA224_RESULT_SIZE
|
||||
#define PH_SYMCRYPT_HMAC_SHA256_RESULT_SIZE PH_SYMCRYPT_SHA256_RESULT_SIZE
|
||||
#define PH_SYMCRYPT_HMAC_SHA384_RESULT_SIZE PH_SYMCRYPT_SHA384_RESULT_SIZE
|
||||
#define PH_SYMCRYPT_HMAC_SHA512_RESULT_SIZE PH_SYMCRYPT_SHA512_RESULT_SIZE
|
||||
#define PH_SYMCRYPT_AES_CMAC_RESULT_SIZE 16
|
||||
#define PH_SYMCRYPT_AES_GMAC_RESULT_SIZE 16
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Algorithm/blob identifier strings for BCrypt-compatible call sites
|
||||
@@ -75,6 +85,14 @@ typedef ULONG PH_SYMCRYPT_HASH_ALGORITHM, *PPH_SYMCRYPT_HASH_ALGORITHM;
|
||||
#define PH_SYMCRYPT_SHA3_256_ALGORITHM 5ul
|
||||
#define PH_SYMCRYPT_SHA3_384_ALGORITHM 6ul
|
||||
#define PH_SYMCRYPT_SHA3_512_ALGORITHM 7ul
|
||||
#define PH_SYMCRYPT_SHA224_ALGORITHM 8ul
|
||||
#define PH_SYMCRYPT_SHA512_224_ALGORITHM 9ul
|
||||
#define PH_SYMCRYPT_SHA512_256_ALGORITHM 10ul
|
||||
#define PH_SYMCRYPT_SHA3_224_ALGORITHM 11ul
|
||||
#define PH_SYMCRYPT_SHAKE128_ALGORITHM 12ul
|
||||
#define PH_SYMCRYPT_SHAKE256_ALGORITHM 13ul
|
||||
|
||||
typedef PVOID PH_SYMCRYPT_KEY_HANDLE, *PPH_SYMCRYPT_KEY_HANDLE;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Generic incremental hash context (caller-owned, SymCrypt-private internals)
|
||||
@@ -191,6 +209,30 @@ PhSymCryptRdrandGetBytes(
|
||||
_In_ SIZE_T Length
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRdseedStatus(
|
||||
VOID
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRdseedGetBytes(
|
||||
_Out_writes_bytes_(Length) PVOID Buffer,
|
||||
_In_ SIZE_T Length
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGenRandom(
|
||||
_Out_writes_bytes_(Length) PVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Constant-time / wipe utilities
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -244,6 +286,15 @@ PhSymCryptSha1(
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_SHA1_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptSha224(
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_SHA224_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
@@ -271,6 +322,33 @@ PhSymCryptSha512(
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_SHA512_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptSha512_224(
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_SHA512_224_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptSha512_256(
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_SHA512_256_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptSha3_224(
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_SHA3_224_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
@@ -298,6 +376,54 @@ PhSymCryptSha3_512(
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_SHA3_512_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptShake128(
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptShake256(
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptCShake128(
|
||||
_In_reads_bytes_opt_(FunctionNameLength) PCVOID FunctionName,
|
||||
_In_ SIZE_T FunctionNameLength,
|
||||
_In_reads_bytes_opt_(CustomizationLength) PCVOID Customization,
|
||||
_In_ SIZE_T CustomizationLength,
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptCShake256(
|
||||
_In_reads_bytes_opt_(FunctionNameLength) PCVOID FunctionName,
|
||||
_In_ SIZE_T FunctionNameLength,
|
||||
_In_reads_bytes_opt_(CustomizationLength) PCVOID Customization,
|
||||
_In_ SIZE_T CustomizationLength,
|
||||
_In_reads_bytes_(Length) PCVOID Buffer,
|
||||
_In_ SIZE_T Length,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Parallel multi-hash API
|
||||
//
|
||||
@@ -646,10 +772,46 @@ PhSymCryptFinishHash(
|
||||
_Out_writes_bytes_(HashSize) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGetProperty(
|
||||
_In_ PCWSTR AlgorithmId,
|
||||
_In_ PCWSTR Property,
|
||||
_Out_writes_bytes_to_opt_(OutputLength, *ResultLength) PVOID Output,
|
||||
_In_ ULONG OutputLength,
|
||||
_Out_opt_ PULONG ResultLength
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// HMAC (single-shot)
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptHmac(
|
||||
_In_ PCWSTR AlgorithmId,
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Data,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_to_(ResultLength, *BytesWritten) PVOID Result,
|
||||
_In_ SIZE_T ResultLength,
|
||||
_Out_opt_ PSIZE_T BytesWritten
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptHmacMd5(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Data,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_HMAC_MD5_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
@@ -661,6 +823,17 @@ PhSymCryptHmacSha1(
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_HMAC_SHA1_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptHmacSha224(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Data,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_HMAC_SHA224_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
@@ -694,10 +867,77 @@ PhSymCryptHmacSha512(
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_HMAC_SHA512_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesCmac(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Data,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_(PH_SYMCRYPT_AES_CMAC_RESULT_SIZE) PVOID Result
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesGmac(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(NonceLength) PCVOID Nonce,
|
||||
_In_ SIZE_T NonceLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Data,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_(TagLength) PVOID Tag,
|
||||
_In_ SIZE_T TagLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptKmac128(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_opt_(CustomizationLength) PCVOID Customization,
|
||||
_In_ SIZE_T CustomizationLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Data,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptKmac256(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_opt_(CustomizationLength) PCVOID Customization,
|
||||
_In_ SIZE_T CustomizationLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Data,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// KDFs — return NTSTATUS, mapped from SYMCRYPT_ERROR
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptPbkdf2(
|
||||
_In_ PCWSTR MacAlgorithmId,
|
||||
_In_reads_bytes_(PasswordLength) PCVOID Password,
|
||||
_In_ SIZE_T PasswordLength,
|
||||
_In_reads_bytes_opt_(SaltLength) PCVOID Salt,
|
||||
_In_ SIZE_T SaltLength,
|
||||
_In_ ULONG64 IterationCount,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
@@ -752,6 +992,97 @@ PhSymCryptHkdfSha512(
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptHkdf(
|
||||
_In_ PCWSTR MacAlgorithmId,
|
||||
_In_reads_bytes_(IkmLength) PCVOID Ikm,
|
||||
_In_ SIZE_T IkmLength,
|
||||
_In_reads_bytes_opt_(SaltLength) PCVOID Salt,
|
||||
_In_ SIZE_T SaltLength,
|
||||
_In_reads_bytes_opt_(InfoLength) PCVOID Info,
|
||||
_In_ SIZE_T InfoLength,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptSp800_108(
|
||||
_In_ PCWSTR MacAlgorithmId,
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_opt_(LabelLength) PCVOID Label,
|
||||
_In_ SIZE_T LabelLength,
|
||||
_In_reads_bytes_opt_(ContextLength) PCVOID Context,
|
||||
_In_ SIZE_T ContextLength,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptTlsPrf1_1(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_opt_(LabelLength) PCVOID Label,
|
||||
_In_ SIZE_T LabelLength,
|
||||
_In_reads_bytes_(SeedLength) PCVOID Seed,
|
||||
_In_ SIZE_T SeedLength,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptTlsPrf1_2(
|
||||
_In_ PCWSTR MacAlgorithmId,
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_opt_(LabelLength) PCVOID Label,
|
||||
_In_ SIZE_T LabelLength,
|
||||
_In_reads_bytes_(SeedLength) PCVOID Seed,
|
||||
_In_ SIZE_T SeedLength,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptSshKdf(
|
||||
_In_ PH_SYMCRYPT_HASH_ALGORITHM HashAlgorithm,
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(HashValueLength) PCVOID HashValue,
|
||||
_In_ SIZE_T HashValueLength,
|
||||
_In_ BYTE Label,
|
||||
_In_reads_bytes_(SessionIdLength) PCVOID SessionId,
|
||||
_In_ SIZE_T SessionIdLength,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptSrtpKdf(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(SaltLength) PCVOID Salt,
|
||||
_In_ SIZE_T SaltLength,
|
||||
_In_ ULONG KeyDerivationRate,
|
||||
_In_ ULONG64 Index,
|
||||
_In_ ULONG IndexWidth,
|
||||
_In_ BYTE Label,
|
||||
_Out_writes_bytes_(ResultLength) PVOID Result,
|
||||
_In_ SIZE_T ResultLength
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// AEAD
|
||||
//
|
||||
@@ -794,6 +1125,107 @@ PhSymCryptAesGcmDecrypt(
|
||||
_In_ SIZE_T TagLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesCcmEncrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(NonceLength) PCVOID Nonce,
|
||||
_In_ SIZE_T NonceLength,
|
||||
_In_reads_bytes_opt_(AuthDataLength) PCVOID AuthData,
|
||||
_In_ SIZE_T AuthDataLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Plaintext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T DataLength,
|
||||
_Out_writes_bytes_(TagLength) PVOID Tag,
|
||||
_In_ SIZE_T TagLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesCcmDecrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(NonceLength) PCVOID Nonce,
|
||||
_In_ SIZE_T NonceLength,
|
||||
_In_reads_bytes_opt_(AuthDataLength) PCVOID AuthData,
|
||||
_In_ SIZE_T AuthDataLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Ciphertext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Plaintext,
|
||||
_In_ SIZE_T DataLength,
|
||||
_In_reads_bytes_(TagLength) PCVOID Tag,
|
||||
_In_ SIZE_T TagLength
|
||||
);
|
||||
|
||||
typedef PVOID PH_SYMCRYPT_AUTH_STATE_HANDLE, *PPH_SYMCRYPT_AUTH_STATE_HANDLE;
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGcmInit(
|
||||
_Out_ PPH_SYMCRYPT_AUTH_STATE_HANDLE StateHandle,
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(NonceLength) PCVOID Nonce,
|
||||
_In_ SIZE_T NonceLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGcmAuthPart(
|
||||
_In_ PH_SYMCRYPT_AUTH_STATE_HANDLE StateHandle,
|
||||
_In_reads_bytes_opt_(AuthDataLength) PCVOID AuthData,
|
||||
_In_ SIZE_T AuthDataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGcmEncryptPart(
|
||||
_In_ PH_SYMCRYPT_AUTH_STATE_HANDLE StateHandle,
|
||||
_In_reads_bytes_(DataLength) PCVOID Plaintext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGcmDecryptPart(
|
||||
_In_ PH_SYMCRYPT_AUTH_STATE_HANDLE StateHandle,
|
||||
_In_reads_bytes_(DataLength) PCVOID Ciphertext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Plaintext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGcmEncryptFinal(
|
||||
_In_ PH_SYMCRYPT_AUTH_STATE_HANDLE StateHandle,
|
||||
_Out_writes_bytes_(TagLength) PVOID Tag,
|
||||
_In_ SIZE_T TagLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGcmDecryptFinal(
|
||||
_In_ PH_SYMCRYPT_AUTH_STATE_HANDLE StateHandle,
|
||||
_In_reads_bytes_(TagLength) PCVOID Tag,
|
||||
_In_ SIZE_T TagLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptDestroyAuthState(
|
||||
_In_opt_ PH_SYMCRYPT_AUTH_STATE_HANDLE StateHandle
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
@@ -882,6 +1314,196 @@ PhSymCryptAesCbcDecryptPkcs7(
|
||||
_Out_ PSIZE_T PlaintextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesEcbEncrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Plaintext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesEcbDecrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Ciphertext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Plaintext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesCtr(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_Inout_updates_bytes_(16) PVOID Counter,
|
||||
_In_reads_bytes_(DataLength) PCVOID Input,
|
||||
_Out_writes_bytes_(DataLength) PVOID Output,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesCfbEncrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(16) PCVOID Iv,
|
||||
_In_ SIZE_T ShiftLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Plaintext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesCfbDecrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(16) PCVOID Iv,
|
||||
_In_ SIZE_T ShiftLength,
|
||||
_In_reads_bytes_(DataLength) PCVOID Ciphertext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Plaintext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptXtsAesEncrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_ SIZE_T DataUnitLength,
|
||||
_In_reads_bytes_(16) PCVOID Tweak,
|
||||
_In_reads_bytes_(DataLength) PCVOID Plaintext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptXtsAesDecrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_ SIZE_T DataUnitLength,
|
||||
_In_reads_bytes_(16) PCVOID Tweak,
|
||||
_In_reads_bytes_(DataLength) PCVOID Ciphertext,
|
||||
_Out_writes_bytes_(DataLength) PVOID Plaintext,
|
||||
_In_ SIZE_T DataLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesKwEncrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(PlaintextLength) PCVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextLength,
|
||||
_Out_writes_bytes_to_(CiphertextCapacity, *CiphertextLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextCapacity,
|
||||
_Out_ PSIZE_T CiphertextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesKwDecrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(CiphertextLength) PCVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextLength,
|
||||
_Out_writes_bytes_to_(PlaintextCapacity, *PlaintextLength) PVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextCapacity,
|
||||
_Out_ PSIZE_T PlaintextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesKwpEncrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(PlaintextLength) PCVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextLength,
|
||||
_Out_writes_bytes_to_(CiphertextCapacity, *CiphertextLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextCapacity,
|
||||
_Out_ PSIZE_T CiphertextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptAesKwpDecrypt(
|
||||
_In_reads_bytes_(KeyLength) PCVOID Key,
|
||||
_In_ SIZE_T KeyLength,
|
||||
_In_reads_bytes_(CiphertextLength) PCVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextLength,
|
||||
_Out_writes_bytes_to_(PlaintextCapacity, *PlaintextLength) PVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextCapacity,
|
||||
_Out_ PSIZE_T PlaintextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptGenerateSymmetricKey(
|
||||
_In_ PCWSTR Algorithm,
|
||||
_Out_ PPH_SYMCRYPT_KEY_HANDLE KeyHandle,
|
||||
_In_reads_bytes_(SecretLength) PCVOID Secret,
|
||||
_In_ ULONG SecretLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptSetProperty(
|
||||
_In_ PH_SYMCRYPT_KEY_HANDLE KeyHandle,
|
||||
_In_ PCWSTR Property,
|
||||
_In_reads_bytes_opt_(InputLength) PCVOID Input,
|
||||
_In_ ULONG InputLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptEncrypt(
|
||||
_In_ PH_SYMCRYPT_KEY_HANDLE KeyHandle,
|
||||
_In_reads_bytes_opt_(InputLength) PCVOID Input,
|
||||
_In_ ULONG InputLength,
|
||||
_In_opt_ PVOID PaddingInfo,
|
||||
_Inout_updates_bytes_opt_(IvLength) PVOID Iv,
|
||||
_In_ ULONG IvLength,
|
||||
_Out_writes_bytes_to_opt_(OutputLength, *ResultLength) PVOID Output,
|
||||
_In_ ULONG OutputLength,
|
||||
_Out_ PULONG ResultLength,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptDecrypt(
|
||||
_In_ PH_SYMCRYPT_KEY_HANDLE KeyHandle,
|
||||
_In_reads_bytes_opt_(InputLength) PCVOID Input,
|
||||
_In_ ULONG InputLength,
|
||||
_In_opt_ PVOID PaddingInfo,
|
||||
_Inout_updates_bytes_opt_(IvLength) PVOID Iv,
|
||||
_In_ ULONG IvLength,
|
||||
_Out_writes_bytes_to_opt_(OutputLength, *ResultLength) PVOID Output,
|
||||
_In_ ULONG OutputLength,
|
||||
_Out_ PULONG ResultLength,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Asymmetric verification (raw big-endian buffers)
|
||||
//
|
||||
@@ -948,6 +1570,90 @@ PhSymCryptEcDsaVerifyP384(
|
||||
_In_ SIZE_T SignatureLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRsaRawEncrypt(
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_In_reads_bytes_(PlaintextLength) PCVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextLength,
|
||||
_Out_writes_bytes_to_(CiphertextCapacity, *CiphertextLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextCapacity,
|
||||
_Out_ PSIZE_T CiphertextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRsaRawDecrypt(
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_In_reads_bytes_(CiphertextLength) PCVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextLength,
|
||||
_Out_writes_bytes_to_(PlaintextCapacity, *PlaintextLength) PVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextCapacity,
|
||||
_Out_ PSIZE_T PlaintextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRsaPkcs1Encrypt(
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_In_reads_bytes_(PlaintextLength) PCVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextLength,
|
||||
_Out_writes_bytes_to_(CiphertextCapacity, *CiphertextLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextCapacity,
|
||||
_Out_ PSIZE_T CiphertextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRsaPkcs1Decrypt(
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_In_reads_bytes_(CiphertextLength) PCVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextLength,
|
||||
_Out_writes_bytes_to_(PlaintextCapacity, *PlaintextLength) PVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextCapacity,
|
||||
_Out_ PSIZE_T PlaintextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRsaOaepEncrypt(
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_In_ PH_SYMCRYPT_HASH_ALGORITHM HashAlgorithm,
|
||||
_In_reads_bytes_opt_(LabelLength) PCVOID Label,
|
||||
_In_ SIZE_T LabelLength,
|
||||
_In_reads_bytes_(PlaintextLength) PCVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextLength,
|
||||
_Out_writes_bytes_to_(CiphertextCapacity, *CiphertextLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextCapacity,
|
||||
_Out_ PSIZE_T CiphertextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptRsaOaepDecrypt(
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_In_ PH_SYMCRYPT_HASH_ALGORITHM HashAlgorithm,
|
||||
_In_reads_bytes_opt_(LabelLength) PCVOID Label,
|
||||
_In_ SIZE_T LabelLength,
|
||||
_In_reads_bytes_(CiphertextLength) PCVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextLength,
|
||||
_Out_writes_bytes_to_(PlaintextCapacity, *PlaintextLength) PVOID Plaintext,
|
||||
_In_ SIZE_T PlaintextCapacity,
|
||||
_Out_ PSIZE_T PlaintextLength
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Asymmetric verification (BCrypt blob compatibility)
|
||||
//
|
||||
@@ -1063,8 +1769,6 @@ PhSymCryptEcDsaSignP256Blob(
|
||||
// Handle-based Asymmetric Key Abstraction (BCrypt Emulation)
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
typedef PVOID PH_SYMCRYPT_KEY_HANDLE, *PPH_SYMCRYPT_KEY_HANDLE;
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
@@ -1154,6 +1858,158 @@ PhSymCryptGenerateRsaKeyBlobs(
|
||||
_Out_opt_ PSIZE_T PublicKeyBlobLength
|
||||
);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Post-quantum in-memory keys
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
typedef ULONG PH_SYMCRYPT_MLKEM_PARAMETER_SET, *PPH_SYMCRYPT_MLKEM_PARAMETER_SET;
|
||||
#define PH_SYMCRYPT_MLKEM_512 1ul
|
||||
#define PH_SYMCRYPT_MLKEM_768 2ul
|
||||
#define PH_SYMCRYPT_MLKEM_1024 3ul
|
||||
|
||||
typedef ULONG PH_SYMCRYPT_MLKEM_KEY_FORMAT, *PPH_SYMCRYPT_MLKEM_KEY_FORMAT;
|
||||
#define PH_SYMCRYPT_MLKEM_PRIVATE_SEED 1ul
|
||||
#define PH_SYMCRYPT_MLKEM_DECAPSULATION_KEY 2ul
|
||||
#define PH_SYMCRYPT_MLKEM_ENCAPSULATION_KEY 3ul
|
||||
|
||||
typedef PVOID PH_SYMCRYPT_MLKEM_KEY_HANDLE, *PPH_SYMCRYPT_MLKEM_KEY_HANDLE;
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlKemGenerateKey(
|
||||
_In_ PH_SYMCRYPT_MLKEM_PARAMETER_SET ParameterSet,
|
||||
_Out_ PPH_SYMCRYPT_MLKEM_KEY_HANDLE KeyHandle
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlKemImportKey(
|
||||
_In_ PH_SYMCRYPT_MLKEM_PARAMETER_SET ParameterSet,
|
||||
_In_ PH_SYMCRYPT_MLKEM_KEY_FORMAT Format,
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_Out_ PPH_SYMCRYPT_MLKEM_KEY_HANDLE KeyHandle
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlKemExportKey(
|
||||
_In_ PH_SYMCRYPT_MLKEM_KEY_HANDLE KeyHandle,
|
||||
_In_ PH_SYMCRYPT_MLKEM_KEY_FORMAT Format,
|
||||
_Out_writes_bytes_to_opt_(KeyBlobCapacity, *KeyBlobLength) PVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobCapacity,
|
||||
_Out_ PSIZE_T KeyBlobLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlKemEncapsulate(
|
||||
_In_ PH_SYMCRYPT_MLKEM_KEY_HANDLE KeyHandle,
|
||||
_Out_writes_bytes_(SecretLength) PVOID Secret,
|
||||
_In_ SIZE_T SecretLength,
|
||||
_Out_writes_bytes_to_(CiphertextCapacity, *CiphertextLength) PVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextCapacity,
|
||||
_Out_ PSIZE_T CiphertextLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlKemDecapsulate(
|
||||
_In_ PH_SYMCRYPT_MLKEM_KEY_HANDLE KeyHandle,
|
||||
_In_reads_bytes_(CiphertextLength) PCVOID Ciphertext,
|
||||
_In_ SIZE_T CiphertextLength,
|
||||
_Out_writes_bytes_(SecretLength) PVOID Secret,
|
||||
_In_ SIZE_T SecretLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptMlKemDestroyKey(
|
||||
_In_opt_ PH_SYMCRYPT_MLKEM_KEY_HANDLE KeyHandle
|
||||
);
|
||||
|
||||
typedef ULONG PH_SYMCRYPT_MLDSA_PARAMETER_SET, *PPH_SYMCRYPT_MLDSA_PARAMETER_SET;
|
||||
#define PH_SYMCRYPT_MLDSA_44 1ul
|
||||
#define PH_SYMCRYPT_MLDSA_65 2ul
|
||||
#define PH_SYMCRYPT_MLDSA_87 3ul
|
||||
|
||||
typedef ULONG PH_SYMCRYPT_MLDSA_KEY_FORMAT, *PPH_SYMCRYPT_MLDSA_KEY_FORMAT;
|
||||
#define PH_SYMCRYPT_MLDSA_PRIVATE_SEED 1ul
|
||||
#define PH_SYMCRYPT_MLDSA_PRIVATE_KEY 2ul
|
||||
#define PH_SYMCRYPT_MLDSA_PUBLIC_KEY 3ul
|
||||
|
||||
typedef PVOID PH_SYMCRYPT_MLDSA_KEY_HANDLE, *PPH_SYMCRYPT_MLDSA_KEY_HANDLE;
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlDsaGenerateKey(
|
||||
_In_ PH_SYMCRYPT_MLDSA_PARAMETER_SET ParameterSet,
|
||||
_Out_ PPH_SYMCRYPT_MLDSA_KEY_HANDLE KeyHandle
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlDsaImportKey(
|
||||
_In_ PH_SYMCRYPT_MLDSA_PARAMETER_SET ParameterSet,
|
||||
_In_ PH_SYMCRYPT_MLDSA_KEY_FORMAT Format,
|
||||
_In_reads_bytes_(KeyBlobLength) PCVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobLength,
|
||||
_Out_ PPH_SYMCRYPT_MLDSA_KEY_HANDLE KeyHandle
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlDsaExportKey(
|
||||
_In_ PH_SYMCRYPT_MLDSA_KEY_HANDLE KeyHandle,
|
||||
_In_ PH_SYMCRYPT_MLDSA_KEY_FORMAT Format,
|
||||
_Out_writes_bytes_to_opt_(KeyBlobCapacity, *KeyBlobLength) PVOID KeyBlob,
|
||||
_In_ SIZE_T KeyBlobCapacity,
|
||||
_Out_ PSIZE_T KeyBlobLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlDsaSign(
|
||||
_In_ PH_SYMCRYPT_MLDSA_KEY_HANDLE KeyHandle,
|
||||
_In_reads_bytes_(MessageLength) PCVOID Message,
|
||||
_In_ SIZE_T MessageLength,
|
||||
_In_reads_bytes_opt_(ContextLength) PCVOID Context,
|
||||
_In_ SIZE_T ContextLength,
|
||||
_Out_writes_bytes_to_(SignatureCapacity, *SignatureLength) PVOID Signature,
|
||||
_In_ SIZE_T SignatureCapacity,
|
||||
_Out_ PSIZE_T SignatureLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhSymCryptMlDsaVerify(
|
||||
_In_ PH_SYMCRYPT_MLDSA_KEY_HANDLE KeyHandle,
|
||||
_In_reads_bytes_(MessageLength) PCVOID Message,
|
||||
_In_ SIZE_T MessageLength,
|
||||
_In_reads_bytes_opt_(ContextLength) PCVOID Context,
|
||||
_In_ SIZE_T ContextLength,
|
||||
_In_reads_bytes_(SignatureLength) PCVOID Signature,
|
||||
_In_ SIZE_T SignatureLength
|
||||
);
|
||||
|
||||
EXTERN_C
|
||||
VOID
|
||||
NTAPI
|
||||
PhSymCryptMlDsaDestroyKey(
|
||||
_In_opt_ PH_SYMCRYPT_MLDSA_KEY_HANDLE KeyHandle
|
||||
);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif // PHLIB_SYMCRYPT_H
|
||||
|
||||
+63
-2
@@ -1037,6 +1037,27 @@ PhStringToGuid(
|
||||
_Out_ PGUID Guid
|
||||
);
|
||||
|
||||
/**
|
||||
* Converts a string representation of a GUID to a GUID structure.
|
||||
*
|
||||
* \param[in] GuidString The string representation of the GUID.
|
||||
* \param[out] Guid A pointer to the GUID structure to receive the converted GUID.
|
||||
* \return Standard NTSTATUS status code.
|
||||
*/
|
||||
FORCEINLINE
|
||||
NTSTATUS
|
||||
PhGuidFromStringZ(
|
||||
_In_ PCWSTR GuidString,
|
||||
_Out_ PGUID Guid
|
||||
)
|
||||
{
|
||||
PH_STRINGREF string;
|
||||
|
||||
PhInitializeStringRef(&string, GuidString);
|
||||
|
||||
return PhStringToGuid(&string, Guid);
|
||||
}
|
||||
|
||||
typedef struct _VS_VERSION_INFO_STRUCT16
|
||||
{
|
||||
USHORT Length;
|
||||
@@ -1541,6 +1562,7 @@ PhGetKnownLocationZ(
|
||||
DEFINE_GUID(FOLDERID_LocalAppData, 0xF1B32785, 0x6FBA, 0x4FCF, 0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91);
|
||||
DEFINE_GUID(FOLDERID_RoamingAppData, 0x3EB685DB, 0x65F9, 0x4CF6, 0xA0, 0x3A, 0xE3, 0xEF, 0x65, 0x72, 0x9F, 0x3D);
|
||||
DEFINE_GUID(FOLDERID_ProgramFiles, 0x905e63b6, 0xc1bf, 0x494e, 0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a);
|
||||
DEFINE_GUID(FOLDERID_ProgramFilesX86, 0x7C5A40EF, 0xA0FB, 0x4BFC, 0x87, 0x4A, 0xC0, 0xF2, 0xE0, 0xB9, 0xFA, 0x8E);
|
||||
DEFINE_GUID(FOLDERID_ProgramData, 0x62AB5D82, 0xFDC1, 0x4DC3, 0xA9, 0xDD, 0x07, 0x0D, 0x1D, 0x49, 0x5D, 0x97);
|
||||
|
||||
#define PH_KF_FLAG_FORCE_PACKAGE_REDIRECTION 0x1
|
||||
@@ -2151,7 +2173,15 @@ typedef enum _PH_HASH_ALGORITHM
|
||||
typedef struct _PH_HASH_CONTEXT
|
||||
{
|
||||
PH_HASH_ALGORITHM Algorithm;
|
||||
#ifndef PH_NATIVE_CRYPT
|
||||
union
|
||||
{
|
||||
PH_SYMCRYPT_HASH_CONTEXT HashContext;
|
||||
ULONG Context[64];
|
||||
};
|
||||
#else
|
||||
ULONG Context[64];
|
||||
#endif
|
||||
} PH_HASH_CONTEXT, *PPH_HASH_CONTEXT;
|
||||
|
||||
PHLIBAPI
|
||||
@@ -2261,8 +2291,16 @@ PhParseCommandLine(
|
||||
PHLIBAPI
|
||||
PPH_STRING
|
||||
NTAPI
|
||||
PhEscapeCommandLinePart(
|
||||
_In_ PCPH_STRINGREF String
|
||||
PhQuoteCommandLine(
|
||||
_In_ PCPH_STRINGREF Argument,
|
||||
_In_ BOOLEAN Force
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
PPH_STRING
|
||||
NTAPI
|
||||
PhEscapeCommandLineConsole(
|
||||
_In_ PCPH_STRINGREF CommandLine
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
@@ -2328,6 +2366,13 @@ PhGetNamespaceHandle(
|
||||
VOID
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
HANDLE
|
||||
NTAPI
|
||||
PhGetNamespaceHandle2(
|
||||
VOID
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
HWND
|
||||
NTAPI
|
||||
@@ -2978,6 +3023,22 @@ NTSTATUS PhQueryDirectXExclusiveOwnership(
|
||||
_Inout_ PD3DKMT_QUERYVIDPNEXCLUSIVEOWNERSHIP QueryExclusiveOwnership
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhD3DKMTGetProcessSchedulingPriorityClass(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_Out_ D3DKMT_SCHEDULINGPRIORITYCLASS* SchedulingPriorityClass
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhD3DKMTSetProcessSchedulingPriorityClass(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ D3DKMT_SCHEDULINGPRIORITYCLASS SchedulingPriorityClass
|
||||
);
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
|
||||
@@ -90,6 +90,8 @@ NTSTATUS PhCreateJsonParserEx(
|
||||
PPH_STRING jsonStringUtf16 = JsonString;
|
||||
PPH_BYTES jsonStringUtf8;
|
||||
|
||||
if (!jsonStringUtf16)
|
||||
return STATUS_FAIL_CHECK;
|
||||
if (jsonStringUtf16->Length / sizeof(WCHAR) >= INT32_MAX)
|
||||
return STATUS_INVALID_BUFFER_SIZE;
|
||||
if (!(tokenerObject = json_tokener_new()))
|
||||
@@ -104,17 +106,33 @@ NTSTATUS PhCreateJsonParserEx(
|
||||
jsonStringUtf16->Buffer,
|
||||
jsonStringUtf16->Length
|
||||
);
|
||||
|
||||
if (!jsonStringUtf8)
|
||||
{
|
||||
json_tokener_free(tokenerObject);
|
||||
return STATUS_FAIL_CHECK;
|
||||
}
|
||||
|
||||
jsonObject = json_tokener_parse_ex(
|
||||
tokenerObject,
|
||||
jsonStringUtf8->Buffer,
|
||||
(LONG)jsonStringUtf8->Length
|
||||
);
|
||||
|
||||
PhDereferenceObject(jsonStringUtf8);
|
||||
|
||||
if (!jsonObject)
|
||||
{
|
||||
json_tokener_free(tokenerObject);
|
||||
return STATUS_FAIL_CHECK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PPH_BYTES jsonStringUtf8 = JsonString;
|
||||
|
||||
if (!jsonStringUtf8)
|
||||
return STATUS_FAIL_CHECK;
|
||||
if (jsonStringUtf8->Length >= INT32_MAX)
|
||||
return STATUS_INVALID_BUFFER_SIZE;
|
||||
if (!(tokenerObject = json_tokener_new()))
|
||||
@@ -130,6 +148,12 @@ NTSTATUS PhCreateJsonParserEx(
|
||||
jsonStringUtf8->Buffer,
|
||||
(LONG)jsonStringUtf8->Length
|
||||
);
|
||||
|
||||
if (!jsonObject)
|
||||
{
|
||||
json_tokener_free(tokenerObject);
|
||||
return STATUS_FAIL_CHECK;
|
||||
}
|
||||
}
|
||||
|
||||
jsonStatus = json_tokener_get_error(tokenerObject);
|
||||
@@ -332,6 +356,15 @@ VOID PhAddJsonObjectUtf8(
|
||||
json_object_object_add_ex(Object, Key, string, JSON_C_OBJECT_ADD_KEY_IS_NEW | JSON_C_OBJECT_ADD_CONSTANT_KEY);
|
||||
}
|
||||
|
||||
VOID PhAddJsonObjectBoolean(
|
||||
_In_ PVOID Object,
|
||||
_In_ PCSTR Key,
|
||||
_In_ BOOLEAN Value
|
||||
)
|
||||
{
|
||||
json_object_object_add_ex(Object, Key, json_object_new_boolean(Value), JSON_C_OBJECT_ADD_KEY_IS_NEW | JSON_C_OBJECT_ADD_CONSTANT_KEY);
|
||||
}
|
||||
|
||||
VOID PhAddJsonObjectInt64(
|
||||
_In_ PVOID Object,
|
||||
_In_ PCSTR Key,
|
||||
|
||||
@@ -225,3 +225,76 @@ NTSTATUS PhGetJobBasicUiRestrictions(
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a job object pre-configured for hosting System Informer's own child processes.
|
||||
*
|
||||
* Sets JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE so all processes in the job terminate when
|
||||
* the last handle to the job is closed, JOB_OBJECT_UILIMIT_INJECTION to prevent DLL
|
||||
* injection from outside the job, and JOB_OBJECT_POST_AT_END_OF_JOB as the end-of-job
|
||||
* time action.
|
||||
*
|
||||
* \param JobHandle Receives the handle to the created job object on success.
|
||||
* \return NTSTATUS Successful or errant status.
|
||||
*/
|
||||
NTSTATUS PhCreateConfiguredJobObject(
|
||||
_Out_ PHANDLE JobHandle
|
||||
)
|
||||
{
|
||||
NTSTATUS status;
|
||||
HANDLE jobHandle;
|
||||
JOBOBJECT_BASIC_LIMIT_INFORMATION basicLimits;
|
||||
JOBOBJECT_BASIC_UI_RESTRICTIONS uiRestrictions;
|
||||
JOBOBJECT_END_OF_JOB_TIME_INFORMATION endOfJobInfo;
|
||||
|
||||
status = PhCreateJobObject(&jobHandle, JOB_OBJECT_ALL_ACCESS, NULL, NULL);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
return status;
|
||||
|
||||
memset(&basicLimits, 0, sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION));
|
||||
basicLimits.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||
|
||||
status = NtSetInformationJobObject(
|
||||
jobHandle,
|
||||
JobObjectBasicLimitInformation,
|
||||
&basicLimits,
|
||||
sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION)
|
||||
);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
goto CleanupExit;
|
||||
|
||||
memset(&uiRestrictions, 0, sizeof(JOBOBJECT_BASIC_UI_RESTRICTIONS));
|
||||
uiRestrictions.UIRestrictionsClass = JOB_OBJECT_UILIMIT_INJECTION;
|
||||
|
||||
status = NtSetInformationJobObject(
|
||||
jobHandle,
|
||||
JobObjectBasicUIRestrictions,
|
||||
&uiRestrictions,
|
||||
sizeof(JOBOBJECT_BASIC_UI_RESTRICTIONS)
|
||||
);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
goto CleanupExit;
|
||||
|
||||
memset(&endOfJobInfo, 0, sizeof(JOBOBJECT_END_OF_JOB_TIME_INFORMATION));
|
||||
endOfJobInfo.EndOfJobTimeAction = JOB_OBJECT_POST_AT_END_OF_JOB;
|
||||
|
||||
status = NtSetInformationJobObject(
|
||||
jobHandle,
|
||||
JobObjectEndOfJobTimeInformation,
|
||||
&endOfJobInfo,
|
||||
sizeof(JOBOBJECT_END_OF_JOB_TIME_INFORMATION)
|
||||
);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
goto CleanupExit;
|
||||
|
||||
*JobHandle = jobHandle;
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
CleanupExit:
|
||||
NtClose(jobHandle);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -499,6 +499,12 @@ NTSTATUS PhGetKernelFileNameEx(
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file name of the secure kernel image.
|
||||
*
|
||||
* \return A pointer to a string containing the secure kernel image file name. You must free the string
|
||||
* using PhDereferenceObject() when you no longer need it.
|
||||
*/
|
||||
PPH_STRING PhGetSecureKernelFileName(
|
||||
VOID
|
||||
)
|
||||
@@ -543,6 +549,15 @@ PPH_STRING PhGetSecureKernelFileName(
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function for enumerating the modules loaded by a process.
|
||||
*
|
||||
* \param ProcessHandle Handle to the process to enumerate.
|
||||
* \param Callback A callback function which is executed for each process module.
|
||||
* \param Context1 A user-defined value to pass to the callback function.
|
||||
* \param Context2 A user-defined value to pass to the callback function.
|
||||
* \return NTSTATUS Successful or errant status.
|
||||
*/
|
||||
NTSTATUS PhpEnumProcessModules(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ PPH_ENUM_MODULES_CALLBACK Callback,
|
||||
@@ -651,6 +666,17 @@ NTSTATUS PhpEnumProcessModules(
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal callback function for process module enumeration.
|
||||
*
|
||||
* \param ProcessHandle Handle to the process being enumerated.
|
||||
* \param Entry Pointer to the loader data table entry for the module.
|
||||
* \param AddressOfEntry Virtual address of the entry in the process.
|
||||
* \param SizeOfEntry Size of the loader data table entry.
|
||||
* \param Context1 Pointer to enumeration parameters.
|
||||
* \param Context2 Unused.
|
||||
* \return BOOLEAN TRUE to continue enumeration, FALSE to stop.
|
||||
*/
|
||||
_Function_class_(PH_ENUM_MODULES_CALLBACK)
|
||||
static BOOLEAN NTAPI PhpEnumProcessModulesCallback(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
@@ -845,6 +871,17 @@ typedef struct _SET_PROCESS_MODULE_LOAD_COUNT_CONTEXT
|
||||
ULONG LoadCount;
|
||||
} SET_PROCESS_MODULE_LOAD_COUNT_CONTEXT, *PSET_PROCESS_MODULE_LOAD_COUNT_CONTEXT;
|
||||
|
||||
/**
|
||||
* Internal callback function for setting module load counts.
|
||||
*
|
||||
* \param ProcessHandle Handle to the process.
|
||||
* \param Entry Pointer to the loader data table entry for the module.
|
||||
* \param AddressOfEntry Virtual address of the entry in the process.
|
||||
* \param SizeOfEntry Size of the loader data table entry.
|
||||
* \param Context1 Pointer to the context structure containing search and update information.
|
||||
* \param Context2 Unused.
|
||||
* \return BOOLEAN FALSE if the module was found and updated (stops enumeration), TRUE otherwise.
|
||||
*/
|
||||
_Function_class_(PH_ENUM_MODULES_CALLBACK)
|
||||
BOOLEAN NTAPI PhpSetProcessModuleLoadCountCallback(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
@@ -909,6 +946,15 @@ NTSTATUS PhSetProcessModuleLoadCount(
|
||||
return context.Status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function for enumerating the 32-bit modules loaded by a process.
|
||||
*
|
||||
* \param ProcessHandle Handle to the process to enumerate.
|
||||
* \param Callback A callback function which is executed for each process module.
|
||||
* \param Context1 A user-defined value to pass to the callback function.
|
||||
* \param Context2 A user-defined value to pass to the callback function.
|
||||
* \return NTSTATUS Successful or errant status.
|
||||
*/
|
||||
NTSTATUS PhpEnumProcessModules32(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ PPH_ENUM_MODULES_CALLBACK Callback,
|
||||
@@ -1017,6 +1063,17 @@ NTSTATUS PhpEnumProcessModules32(
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal callback function for 32-bit process module enumeration.
|
||||
*
|
||||
* \param ProcessHandle Handle to the process being enumerated.
|
||||
* \param Entry Pointer to the 32-bit loader data table entry for the module.
|
||||
* \param AddressOfEntry Virtual address of the entry in the process.
|
||||
* \param SizeOfEntry Size of the loader data table entry.
|
||||
* \param Context1 Pointer to enumeration parameters.
|
||||
* \param Context2 Unused.
|
||||
* \return BOOLEAN TRUE to continue enumeration, FALSE to stop.
|
||||
*/
|
||||
_Function_class_(PH_ENUM_MODULES_CALLBACK)
|
||||
BOOLEAN NTAPI PhpEnumProcessModules32Callback(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
@@ -1271,6 +1328,17 @@ NTSTATUS PhEnumProcessModules32Ex(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal callback function for setting 32-bit module load counts.
|
||||
*
|
||||
* \param ProcessHandle Handle to the process.
|
||||
* \param Entry Pointer to the 32-bit loader data table entry for the module.
|
||||
* \param AddressOfEntry Virtual address of the entry in the process.
|
||||
* \param SizeOfEntry Size of the loader data table entry.
|
||||
* \param Context1 Pointer to the context structure containing search and update information.
|
||||
* \param Context2 Unused.
|
||||
* \return BOOLEAN FALSE if the module was found and updated (stops enumeration), TRUE otherwise.
|
||||
*/
|
||||
_Function_class_(PH_ENUM_MODULES_CALLBACK)
|
||||
static BOOLEAN NTAPI PhSetProcessModuleLoadCount32Callback(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
|
||||
+2411
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -96,61 +96,61 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);..\tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kphlib_um.lib;thirdparty.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);..\tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kphlib_um.lib;thirdparty.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);..\tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kphlib_um.lib;thirdparty.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);..\tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kphlib_um.lib;thirdparty.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);..\tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kphlib_um.lib;thirdparty.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)phlib\include;$(SolutionDir)kphlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phlib\include;$(SystemInformerRoot)kphlib\include;$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)kphlib\bin\$(Configuration)$(PlatformArchitecture);..\tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)kphlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)tools\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>kphlib_um.lib;thirdparty.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -315,4 +315,4 @@
|
||||
<ClInclude Include="include\workqueuep.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
+34
-1
@@ -67,6 +67,34 @@ PH_CHAR_TYPE PhpClassifyByte(
|
||||
}
|
||||
}
|
||||
|
||||
// Combined per-byte classification LUT, indexed [ExtendedCharSet][byte]. Each
|
||||
// entry is PhpClassifyByte(byte, Ext, Ext) i.e. the classification assuming the
|
||||
// UTF-16-high check is enabled (the maximal result). The runtime gate only ever
|
||||
// downgrades a PhCharTypeUTF16High result to PhCharTypeNone, so a single LUT load
|
||||
// plus the cheap inline gate is exactly equivalent to PhpClassifyByte while
|
||||
// replacing its 4-5 boolean table loads per byte.
|
||||
static PH_INITONCE PhpCharTypeTableInitOnce = PH_INITONCE_INIT;
|
||||
static BYTE PhpCharTypeTable[2][256];
|
||||
|
||||
static VOID PhpInitializeCharTypeTable(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
if (PhBeginInitOnce(&PhpCharTypeTableInitOnce))
|
||||
{
|
||||
ULONG ext;
|
||||
ULONG value;
|
||||
|
||||
for (ext = 0; ext < 2; ext++)
|
||||
{
|
||||
for (value = 0; value < 256; value++)
|
||||
PhpCharTypeTable[ext][value] = (BYTE)PhpClassifyByte((BYTE)value, (BOOLEAN)ext, (BOOLEAN)ext);
|
||||
}
|
||||
|
||||
PhEndInitOnce(&PhpCharTypeTableInitOnce);
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN PhpSearchStrings(
|
||||
_In_ PPH_STRING_SEARCH_CONEXT Context,
|
||||
_In_reads_bytes_(Length) PBYTE Buffer,
|
||||
@@ -102,7 +130,10 @@ BOOLEAN PhpSearchStrings(
|
||||
checkUTF8High = TRUE;
|
||||
}
|
||||
|
||||
charType = PhpClassifyByte(byte, Context->ExtendedCharSet, checkUTF8High);
|
||||
charType = (PH_CHAR_TYPE)PhpCharTypeTable[Context->ExtendedCharSet ? 1 : 0][byte];
|
||||
|
||||
if (charType == PhCharTypeUTF16High && !checkUTF8High)
|
||||
charType = PhCharTypeNone;
|
||||
|
||||
// Pattern: [Printable][Printable][Printable] - ANSI string detection
|
||||
if (charType2 == PhCharTypePrintable &&
|
||||
@@ -299,6 +330,8 @@ NTSTATUS PhSearchStrings(
|
||||
if (!MinimumLength)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
PhpInitializeCharTypeTable();
|
||||
|
||||
context = PhAllocateZero(sizeof(PH_STRING_SEARCH_CONEXT));
|
||||
context->MinimumLength = MinimumLength;
|
||||
context->ExtendedCharSet = ExtendedCharSet;
|
||||
|
||||
+29
-1
@@ -183,17 +183,45 @@ BOOLEAN FASTCALL PhfWaitForEvent(
|
||||
* \param Event A pointer to an event object.
|
||||
* \remarks This function is not thread-safe. Make sure no other threads are using the event when
|
||||
* you call this function.
|
||||
* \remarks Safe to call concurrently with PhWaitForEvent. The PH_EVENT_SET bit is cleared
|
||||
* atomically while preserving the refcount field, so waiters that have already incremented
|
||||
* the refcount are not stomped. A waiter currently inside RtlWaitOnAddress has captured a
|
||||
* value with PH_EVENT_SET clear (otherwise it would have broken out of the loop), so
|
||||
* clearing the bit does not invalidate its undesired value — no spurious wake is needed.
|
||||
*/
|
||||
VOID FASTCALL PhfResetEvent(
|
||||
_Inout_ PPH_EVENT Event
|
||||
)
|
||||
{
|
||||
//assert(!Event->EventHandle);
|
||||
#if defined(PH_EVENT_UNSAFE_RESET)
|
||||
|
||||
assert(!Event->EventHandle);
|
||||
|
||||
if (PhTestEvent(Event))
|
||||
{
|
||||
WriteULongPtrRelease(&Event->Value, PH_EVENT_REFCOUNT_INC);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
ULONG_PTR oldValue;
|
||||
ULONG_PTR newValue;
|
||||
|
||||
do
|
||||
{
|
||||
oldValue = ReadULongPtrAcquire(&Event->Value);
|
||||
|
||||
if (!(oldValue & PH_EVENT_SET))
|
||||
return;
|
||||
|
||||
newValue = oldValue & ~(ULONG_PTR)PH_EVENT_SET;
|
||||
} while ((ULONG_PTR)_InterlockedCompareExchangePointer(
|
||||
(PVOID *)&Event->Value,
|
||||
(PVOID)newValue,
|
||||
(PVOID)oldValue
|
||||
) != oldValue);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1487
-402
File diff suppressed because it is too large
Load Diff
+263
-48
@@ -11,8 +11,8 @@
|
||||
*/
|
||||
|
||||
#include <ph.h>
|
||||
|
||||
#include <commdlg.h>
|
||||
#include <cfgmgr32.h>
|
||||
#include <d3dkmthk.h>
|
||||
#include <ntintsafe.h>
|
||||
#include <processsnapshot.h>
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <phintrin.h>
|
||||
#include <wslsup.h>
|
||||
#include <thirdparty.h>
|
||||
#include <phcrypt.h>
|
||||
|
||||
#if defined(PH_BUILD_MSIX)
|
||||
#include <roapi.h>
|
||||
@@ -2975,8 +2974,6 @@ NTSTATUS PhFormatGuidToBuffer(
|
||||
_Out_opt_ PSIZE_T ReturnLength
|
||||
)
|
||||
{
|
||||
static PH_INITONCE initOnce = PH_INITONCE_INIT;
|
||||
static typeof(&RtlStringFromGUIDEx) RtlStringFromGUIDEx_I = NULL;
|
||||
NTSTATUS status;
|
||||
UNICODE_STRING unicodeString;
|
||||
|
||||
@@ -3000,22 +2997,12 @@ NTSTATUS PhFormatGuidToBuffer(
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (PhBeginInitOnce(&initOnce))
|
||||
{
|
||||
if (WindowsVersion >= WINDOWS_10)
|
||||
{
|
||||
RtlStringFromGUIDEx_I = PhGetDllProcedureAddressZ(RtlNtdllName, "RtlStringFromGUIDEx", 0);
|
||||
}
|
||||
|
||||
PhEndInitOnce(&initOnce);
|
||||
}
|
||||
|
||||
if (!RtlStringFromGUIDEx_I)
|
||||
if (!RtlStringFromGUIDEx_Import())
|
||||
return STATUS_PROCEDURE_NOT_FOUND;
|
||||
|
||||
RtlInitEmptyUnicodeString(&unicodeString, Buffer, BufferLength);
|
||||
|
||||
status = RtlStringFromGUIDEx_I(
|
||||
status = RtlStringFromGUIDEx_Import()(
|
||||
Guid,
|
||||
&unicodeString,
|
||||
FALSE
|
||||
@@ -8029,7 +8016,6 @@ NTSTATUS PhInitializeHash(
|
||||
case Sha1HashAlgorithm:
|
||||
case Sha256HashAlgorithm:
|
||||
{
|
||||
PPH_SYMCRYPT_HASH_CONTEXT symCryptContext;
|
||||
PH_SYMCRYPT_HASH_ALGORITHM algorithm;
|
||||
|
||||
if (Algorithm == Md5HashAlgorithm)
|
||||
@@ -8039,18 +8025,10 @@ NTSTATUS PhInitializeHash(
|
||||
else
|
||||
algorithm = PH_SYMCRYPT_SHA256_ALGORITHM;
|
||||
|
||||
symCryptContext = PhAllocateSafe(sizeof(PH_SYMCRYPT_HASH_CONTEXT));
|
||||
if (!symCryptContext)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
if (!NT_SUCCESS(PhSymCryptHashInit(algorithm, symCryptContext)))
|
||||
if (NT_SUCCESS(PhSymCryptHashInit(algorithm, &Context->HashContext)))
|
||||
{
|
||||
PhFree(symCryptContext);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
*(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context = symCryptContext;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
@@ -8092,11 +8070,11 @@ NTSTATUS PhUpdateHash(
|
||||
return STATUS_SUCCESS;
|
||||
#else
|
||||
case Md5HashAlgorithm:
|
||||
return PhSymCryptHashData(*(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context, Buffer, Length);
|
||||
return PhSymCryptHashData(&Context->HashContext, Buffer, Length);
|
||||
case Sha1HashAlgorithm:
|
||||
return PhSymCryptHashData(*(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context, Buffer, Length);
|
||||
return PhSymCryptHashData(&Context->HashContext, Buffer, Length);
|
||||
case Sha256HashAlgorithm:
|
||||
return PhSymCryptHashData(*(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context, Buffer, Length);
|
||||
return PhSymCryptHashData(&Context->HashContext, Buffer, Length);
|
||||
#endif
|
||||
default:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
@@ -8198,60 +8176,48 @@ NTSTATUS PhFinalHash(
|
||||
#else
|
||||
case Md5HashAlgorithm:
|
||||
{
|
||||
UCHAR digest[PH_HASH_MD5_LENGTH];
|
||||
PPH_SYMCRYPT_HASH_CONTEXT symCryptContext = *(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context;
|
||||
PhSymCryptHashFinal(symCryptContext, digest, sizeof(digest));
|
||||
PhFree(symCryptContext);
|
||||
*(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context = NULL;
|
||||
if (HashLength >= PH_HASH_MD5_LENGTH)
|
||||
{
|
||||
memcpy(Hash, digest, PH_HASH_MD5_LENGTH);
|
||||
PhSymCryptHashFinal(&Context->HashContext, Hash, PH_HASH_MD5_LENGTH);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
if (ReturnLength)
|
||||
*ReturnLength = PH_HASH_MD5_LENGTH;
|
||||
}
|
||||
break;
|
||||
case Sha1HashAlgorithm:
|
||||
{
|
||||
UCHAR digest[PH_HASH_SHA1_LENGTH];
|
||||
PPH_SYMCRYPT_HASH_CONTEXT symCryptContext = *(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context;
|
||||
PhSymCryptHashFinal(symCryptContext, digest, sizeof(digest));
|
||||
PhFree(symCryptContext);
|
||||
*(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context = NULL;
|
||||
if (HashLength >= PH_HASH_SHA1_LENGTH)
|
||||
{
|
||||
memcpy(Hash, digest, PH_HASH_SHA1_LENGTH);
|
||||
PhSymCryptHashFinal(&Context->HashContext, Hash, PH_HASH_SHA1_LENGTH);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
if (ReturnLength)
|
||||
*ReturnLength = PH_HASH_SHA1_LENGTH;
|
||||
}
|
||||
break;
|
||||
case Sha256HashAlgorithm:
|
||||
{
|
||||
UCHAR digest[PH_HASH_SHA256_LENGTH];
|
||||
PPH_SYMCRYPT_HASH_CONTEXT symCryptContext = *(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context;
|
||||
PhSymCryptHashFinal(symCryptContext, digest, sizeof(digest));
|
||||
PhFree(symCryptContext);
|
||||
*(PPH_SYMCRYPT_HASH_CONTEXT*)Context->Context = NULL;
|
||||
if (HashLength >= PH_HASH_SHA256_LENGTH)
|
||||
{
|
||||
memcpy(Hash, digest, PH_HASH_SHA256_LENGTH);
|
||||
PhSymCryptHashFinal(&Context->HashContext, Hash, PH_HASH_SHA256_LENGTH);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
if (ReturnLength)
|
||||
*ReturnLength = PH_HASH_SHA256_LENGTH;
|
||||
}
|
||||
@@ -8537,6 +8503,7 @@ BOOLEAN PhParseCommandLine(
|
||||
* \return The escaped string.
|
||||
* \remarks Only the double quotation mark is escaped.
|
||||
*/
|
||||
#ifdef PH_KEEP_LEGACY_ESCAPE
|
||||
PPH_STRING PhEscapeCommandLinePart(
|
||||
_In_ PCPH_STRINGREF String
|
||||
)
|
||||
@@ -8585,6 +8552,133 @@ PPH_STRING PhEscapeCommandLinePart(
|
||||
|
||||
return PhFinalStringBuilderString(&stringBuilder);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Quotes and escapes an argument for use in a command line.
|
||||
*
|
||||
* ┌──────────────────┬──────────────────────────┬──────────────────────────────────────────────────────────────┐
|
||||
* │ Execution Method │ Caret Escaping Required? │ Reason │
|
||||
* ├──────────────────┼──────────────────────────┼──────────────────────────────────────────────────────────────┤
|
||||
* │ CreateProcess │ No │ Target app uses CommandLineToArgvW; carets are seen as data. │
|
||||
* │ ShellExecute │ Usually No │ Unless specifically calling cmd.exe. │
|
||||
* │ cmd.exe /c │ YES │ cmd is a text preprocessor; it will misinterpret &, \ │
|
||||
* │ .bat / .cmd │ YES │ Same as cmd.exe /c. │
|
||||
* └──────────────────┴──────────────────────────┴──────────────────────────────────────────────────────────────┘
|
||||
*
|
||||
* \param Argument The argument string to quote.
|
||||
* \param Force If TRUE, always wrap the argument in quotes.
|
||||
* \return A string containing the quoted and escaped argument.
|
||||
* \remarks Follows the escaping rules for CommandLineToArgvW.
|
||||
* \sa https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way
|
||||
*/
|
||||
PHLIBAPI
|
||||
PPH_STRING
|
||||
NTAPI
|
||||
PhQuoteCommandLine(
|
||||
_In_ PCPH_STRINGREF Argument,
|
||||
_In_ BOOLEAN Force
|
||||
)
|
||||
{
|
||||
PH_STRING_BUILDER stringBuilder;
|
||||
SIZE_T i;
|
||||
ULONG numBackslashes = 0;
|
||||
BOOLEAN quoteNeeded = Force;
|
||||
|
||||
if (!Force && Argument->Length > 0)
|
||||
{
|
||||
// Quote if we have spaces, tabs, or quotes
|
||||
if (
|
||||
PhFindCharInStringRef(Argument, L' ', FALSE) != SIZE_MAX ||
|
||||
PhFindCharInStringRef(Argument, L'\t', FALSE) != SIZE_MAX ||
|
||||
PhFindCharInStringRef(Argument, L'\"', FALSE) != SIZE_MAX
|
||||
)
|
||||
{
|
||||
quoteNeeded = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!quoteNeeded)
|
||||
return PhCreateString2(Argument);
|
||||
|
||||
PhInitializeStringBuilder(&stringBuilder, Argument->Length / sizeof(WCHAR) + 16);
|
||||
PhAppendCharStringBuilder(&stringBuilder, L'\"');
|
||||
|
||||
for (i = 0; i < Argument->Length / sizeof(WCHAR); i++)
|
||||
{
|
||||
WCHAR c = Argument->Buffer[i];
|
||||
|
||||
if (c == L'\\')
|
||||
{
|
||||
numBackslashes++;
|
||||
}
|
||||
else if (c == L'\"')
|
||||
{
|
||||
// Rule: 2n + 1 backslashes before a quote
|
||||
PhAppendCharStringBuilder2(&stringBuilder, L'\\', (ULONG64)numBackslashes * 2 + 1);
|
||||
PhAppendCharStringBuilder(&stringBuilder, L'\"');
|
||||
numBackslashes = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rule: Backslashes are literal here
|
||||
PhAppendCharStringBuilder2(&stringBuilder, L'\\', numBackslashes);
|
||||
PhAppendCharStringBuilder(&stringBuilder, c);
|
||||
numBackslashes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Rule: 2n backslashes at the very end of the argument before the closing quote
|
||||
PhAppendCharStringBuilder2(&stringBuilder, L'\\', (ULONG64)numBackslashes * 2);
|
||||
PhAppendCharStringBuilder(&stringBuilder, L'\"');
|
||||
|
||||
return PhFinalStringBuilderString(&stringBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a command line for interpretation by cmd.exe.
|
||||
*
|
||||
* ┌──────────────────┬──────────────────────────┬──────────────────────────────────────────────────────────────┐
|
||||
* │ Execution Method │ Caret Escaping Required? │ Reason │
|
||||
* ├──────────────────┼──────────────────────────┼──────────────────────────────────────────────────────────────┤
|
||||
* │ CreateProcess │ No │ Target app uses CommandLineToArgvW; carets are seen as data. │
|
||||
* │ ShellExecute │ Usually No │ Unless specifically calling cmd.exe. │
|
||||
* │ cmd.exe /c │ YES │ cmd is a text preprocessor; it will misinterpret &, \ │
|
||||
* │ .bat / .cmd │ YES │ Same as cmd.exe /c. │
|
||||
* └──────────────────┴──────────────────────────┴──────────────────────────────────────────────────────────────┘
|
||||
*
|
||||
* \param CommandLine The command line string to escape.
|
||||
* \return The escaped command line string.
|
||||
* \sa https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way
|
||||
*/
|
||||
PHLIBAPI
|
||||
PPH_STRING
|
||||
NTAPI
|
||||
PhEscapeCommandLineConsole(
|
||||
_In_ PCPH_STRINGREF CommandLine
|
||||
)
|
||||
{
|
||||
static CONST PH_STRINGREF metachars = PH_STRINGREF_INIT(L"()%!^\"<>&|");
|
||||
PH_STRING_BUILDER stringBuilder;
|
||||
SIZE_T i;
|
||||
|
||||
PhInitializeStringBuilder(&stringBuilder, CommandLine->Length / sizeof(WCHAR) + 16);
|
||||
|
||||
for (i = 0; i < CommandLine->Length / sizeof(WCHAR); i++)
|
||||
{
|
||||
WCHAR c = CommandLine->Buffer[i];
|
||||
|
||||
// If the character is a cmd metacharacter, prefix it with a caret
|
||||
if (PhFindCharInStringRef(&metachars, c, FALSE) != SIZE_MAX)
|
||||
{
|
||||
PhAppendCharStringBuilder(&stringBuilder, L'^');
|
||||
}
|
||||
|
||||
PhAppendCharStringBuilder(&stringBuilder, c);
|
||||
}
|
||||
|
||||
return PhFinalStringBuilderString(&stringBuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a command line string. If the string does not contain quotation marks around the file name
|
||||
@@ -9169,6 +9263,69 @@ HANDLE PhGetNamespaceHandle(
|
||||
return directoryHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates the private namespace handle for System Informer objects.
|
||||
*
|
||||
* \return The private namespace handle, or NULL on failure.
|
||||
*/
|
||||
HANDLE PhGetNamespaceHandle2(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
static PH_INITONCE initOnce = PH_INITONCE_INIT;
|
||||
static HANDLE namespaceHandle = NULL;
|
||||
|
||||
if (PhBeginInitOnce(&initOnce))
|
||||
{
|
||||
static CONST PH_STRINGREF namespaceName = PH_STRINGREF_INIT(L"\\SystemInformer");
|
||||
POBJECT_BOUNDARY_DESCRIPTOR boundaryDescriptor;
|
||||
NTSTATUS status;
|
||||
|
||||
if (boundaryDescriptor = PhCreateBoundaryDescriptor(&namespaceName, BOUNDARY_DESCRIPTOR_ADD_APPCONTAINER_SID))
|
||||
{
|
||||
//if (!NT_SUCCESS(status = PhAddSIDToBoundaryDescriptor(&boundaryDescriptor, &PhSeLocalSid)))
|
||||
// goto CleanupExit;
|
||||
//if (!NT_SUCCESS(status = PhAddSIDToBoundaryDescriptor(&boundaryDescriptor, PhSeAdministratorsSid())))
|
||||
// goto CleanupExit;
|
||||
//if (!NT_SUCCESS(status = PhAddSIDToBoundaryDescriptor(&boundaryDescriptor, &PhSeInteractiveSid)))
|
||||
// goto CleanupExit;
|
||||
if (!NT_SUCCESS(status = PhAddSIDToBoundaryDescriptor(&boundaryDescriptor, &PhSeEveryoneSid)))
|
||||
goto CleanupExit;
|
||||
|
||||
status = PhOpenPrivateNamespace(
|
||||
&namespaceHandle,
|
||||
MAXIMUM_ALLOWED,
|
||||
NULL,
|
||||
&namespaceName,
|
||||
boundaryDescriptor
|
||||
);
|
||||
|
||||
if (status == STATUS_OBJECT_PATH_NOT_FOUND)
|
||||
{
|
||||
status = PhCreatePrivateNamespace(
|
||||
&namespaceHandle,
|
||||
MAXIMUM_ALLOWED,
|
||||
NULL,
|
||||
&namespaceName,
|
||||
boundaryDescriptor
|
||||
);
|
||||
}
|
||||
|
||||
CleanupExit:
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
namespaceHandle = NULL;
|
||||
}
|
||||
|
||||
PhDeleteBoundaryDescriptor(boundaryDescriptor);
|
||||
}
|
||||
|
||||
PhEndInitOnce(&initOnce);
|
||||
}
|
||||
|
||||
return namespaceHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the hung window represented by a ghost window.
|
||||
* If the specified window is not a ghost window, the function returns NULL.
|
||||
@@ -11722,6 +11879,64 @@ NTSTATUS PhQueryDirectXExclusiveOwnership(
|
||||
return D3DKMTQueryVidPnExclusiveOwnership_I(QueryExclusiveOwnership);
|
||||
}
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhD3DKMTGetProcessSchedulingPriorityClass(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_Out_ D3DKMT_SCHEDULINGPRIORITYCLASS* SchedulingPriorityClass
|
||||
)
|
||||
{
|
||||
static typeof(&D3DKMTGetProcessSchedulingPriorityClass) D3DKMTGetProcessSchedulingPriorityClass_I = NULL;
|
||||
static PH_INITONCE initOnce = PH_INITONCE_INIT;
|
||||
|
||||
if (PhBeginInitOnce(&initOnce))
|
||||
{
|
||||
PVOID baseAddress;
|
||||
|
||||
if (baseAddress = PhLoadLibrary(L"gdi32.dll")) // win32u.dll
|
||||
{
|
||||
D3DKMTGetProcessSchedulingPriorityClass_I = PhGetProcedureAddress(baseAddress, "D3DKMTGetProcessSchedulingPriorityClass", 0);
|
||||
}
|
||||
|
||||
PhEndInitOnce(&initOnce);
|
||||
}
|
||||
|
||||
if (!D3DKMTGetProcessSchedulingPriorityClass_I)
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
|
||||
return D3DKMTGetProcessSchedulingPriorityClass_I(ProcessHandle, SchedulingPriorityClass);
|
||||
}
|
||||
|
||||
PHLIBAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PhD3DKMTSetProcessSchedulingPriorityClass(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ D3DKMT_SCHEDULINGPRIORITYCLASS SchedulingPriorityClass
|
||||
)
|
||||
{
|
||||
static typeof(&D3DKMTSetProcessSchedulingPriorityClass) D3DKMTSetProcessSchedulingPriorityClass_I = NULL;
|
||||
static PH_INITONCE initOnce = PH_INITONCE_INIT;
|
||||
|
||||
if (PhBeginInitOnce(&initOnce))
|
||||
{
|
||||
PVOID baseAddress;
|
||||
|
||||
if (baseAddress = PhLoadLibrary(L"gdi32.dll")) // win32u.dll
|
||||
{
|
||||
D3DKMTSetProcessSchedulingPriorityClass_I = PhGetProcedureAddress(baseAddress, "D3DKMTSetProcessSchedulingPriorityClass", 0);
|
||||
}
|
||||
|
||||
PhEndInitOnce(&initOnce);
|
||||
}
|
||||
|
||||
if (!D3DKMTSetProcessSchedulingPriorityClass_I)
|
||||
return STATUS_NOINTERFACE;
|
||||
|
||||
return D3DKMTSetProcessSchedulingPriorityClass_I(ProcessHandle, SchedulingPriorityClass);
|
||||
}
|
||||
|
||||
typedef struct _PH_ENDSESSION_CONTEXT
|
||||
{
|
||||
CLIENT_ID ClientId;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
.vs
|
||||
.vscode
|
||||
bin
|
||||
obj
|
||||
*.user
|
||||
*.suo
|
||||
*.vsidx
|
||||
*.log
|
||||
*.cache
|
||||
@@ -109,7 +109,7 @@ namespace CustomBuildTool
|
||||
{
|
||||
string tenantId = Environment.GetEnvironmentVariable("AZURE_TENANT_ID");
|
||||
string clientId = Environment.GetEnvironmentVariable("AZURE_CLIENT_ID");
|
||||
string clientSecret = Environment.GetEnvironmentVariable("AZURE_CLIENT_SECRET");
|
||||
Win32.GetEnvironmentVariableSecure("AZURE_CLIENT_SECRET", out SecureBuffer clientSecret);
|
||||
string clientCertPath = Environment.GetEnvironmentVariable("AZURE_CLIENT_CERTIFICATE_PATH");
|
||||
string vaultName = Environment.GetEnvironmentVariable("KEYVAULT_NAME");
|
||||
string certName = Environment.GetEnvironmentVariable("CERT_NAME");
|
||||
@@ -118,22 +118,25 @@ namespace CustomBuildTool
|
||||
|
||||
if (AzureClientCertificateCache.TryGetValue(cacheKey, out var cachedCertificate) && cachedCertificate != null)
|
||||
{
|
||||
clientSecret?.Dispose();
|
||||
Program.PrintColorMessage($"Loaded certificate from cache: {cachedCertificate.Subject} | Thumbprint: {cachedCertificate.Thumbprint} | HasPrivateKey: {cachedCertificate.HasPrivateKey}", ConsoleColor.Green);
|
||||
return true;
|
||||
}
|
||||
|
||||
using var httpClient = BuildHttpClient.CreateHttpClient();
|
||||
using (clientSecret)
|
||||
{
|
||||
using var httpClient = BuildHttpClient.CreateHttpClient();
|
||||
|
||||
var accessToken = await GetAccessTokenWithRetry(
|
||||
httpClient,
|
||||
tenantId,
|
||||
clientId,
|
||||
clientSecret,
|
||||
clientCertPath,
|
||||
MaxRetries: 5,
|
||||
InitialDelayMs: 500,
|
||||
CancellationToken: CancellationToken
|
||||
);
|
||||
var accessToken = GetAccessTokenWithRetry(
|
||||
httpClient,
|
||||
tenantId,
|
||||
clientId,
|
||||
clientSecret != null ? clientSecret.Span : ReadOnlySpan<char>.Empty,
|
||||
clientCertPath,
|
||||
MaxRetries: 5,
|
||||
InitialDelayMs: 500,
|
||||
CancellationToken: CancellationToken
|
||||
);
|
||||
|
||||
if (string.IsNullOrEmpty(accessToken))
|
||||
{
|
||||
@@ -213,6 +216,7 @@ namespace CustomBuildTool
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signs files using Azure Key Vault certificates with Authenticode signatures.
|
||||
@@ -233,14 +237,14 @@ namespace CustomBuildTool
|
||||
/// Uses SHA256 hash algorithm and RSA signatures.
|
||||
/// Requires a valid cached certificate from StartAzureClient().
|
||||
/// </remarks>
|
||||
public static async Task<bool> SignFiles(
|
||||
public static bool SignFiles(
|
||||
string TargetPath,
|
||||
string TimeStampServer,
|
||||
string AzureCertName,
|
||||
string AzureVaultName,
|
||||
string TenantGuid,
|
||||
string ClientGuid,
|
||||
string ClientSecret,
|
||||
ReadOnlySpan<char> ClientSecret,
|
||||
string SignatureDescription = null,
|
||||
string SignatureDescriptionUrl = null,
|
||||
CancellationToken CancellationToken = default
|
||||
@@ -262,7 +266,7 @@ namespace CustomBuildTool
|
||||
X509Certificate2 vaultPublicCert;
|
||||
Uri keyIdUri;
|
||||
|
||||
string vaultAccessToken = await GetAccessTokenWithRetry(
|
||||
string vaultAccessToken = GetAccessTokenWithRetry(
|
||||
httpClientForKeyVault,
|
||||
TenantGuid,
|
||||
ClientGuid,
|
||||
@@ -279,13 +283,13 @@ namespace CustomBuildTool
|
||||
return false;
|
||||
}
|
||||
|
||||
var keyVaultCertificateResponse = await GetKeyVaultCertificate(
|
||||
var keyVaultCertificateResponse = GetKeyVaultCertificate(
|
||||
httpClientForKeyVault,
|
||||
AzureVaultName,
|
||||
AzureCertName,
|
||||
vaultAccessToken,
|
||||
CancellationToken
|
||||
);
|
||||
).GetAwaiter().GetResult();
|
||||
|
||||
if (keyVaultCertificateResponse?.CertificateBuffer != null && keyVaultCertificateResponse.CertificateBuffer.Length > 0)
|
||||
{
|
||||
@@ -426,11 +430,11 @@ namespace CustomBuildTool
|
||||
/// Certificate-based authentication takes priority if both ClientSecret and ClientCertificatePath are provided.
|
||||
/// At least one authentication method must be specified.
|
||||
/// </remarks>
|
||||
private static async Task<string> GetAccessTokenWithRetry(
|
||||
private static string GetAccessTokenWithRetry(
|
||||
HttpClient HttpClient,
|
||||
string TenantId,
|
||||
string ClientId,
|
||||
string ClientSecret,
|
||||
ReadOnlySpan<char> ClientSecret,
|
||||
string ClientCertificatePath,
|
||||
int MaxRetries = 5,
|
||||
int InitialDelayMs = 500,
|
||||
@@ -438,7 +442,7 @@ namespace CustomBuildTool
|
||||
{
|
||||
// Determine authentication method
|
||||
bool useCertificate = !string.IsNullOrWhiteSpace(ClientCertificatePath);
|
||||
bool useSecret = !string.IsNullOrWhiteSpace(ClientSecret);
|
||||
bool useSecret = !ClientSecret.IsEmpty;
|
||||
|
||||
if (!useCertificate && !useSecret)
|
||||
{
|
||||
@@ -453,7 +457,7 @@ namespace CustomBuildTool
|
||||
|
||||
if (useCertificate)
|
||||
{
|
||||
return await GetAccessTokenWithCertificate(
|
||||
return GetAccessTokenWithCertificate(
|
||||
HttpClient,
|
||||
TenantId,
|
||||
ClientId,
|
||||
@@ -461,11 +465,11 @@ namespace CustomBuildTool
|
||||
MaxRetries,
|
||||
InitialDelayMs,
|
||||
CancellationToken
|
||||
);
|
||||
).GetAwaiter().GetResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
return await GetAccessTokenWithSecret(
|
||||
return GetAccessTokenWithSecret(
|
||||
HttpClient,
|
||||
TenantId,
|
||||
ClientId,
|
||||
@@ -493,11 +497,11 @@ namespace CustomBuildTool
|
||||
/// Implements exponential backoff with jitter for retries.
|
||||
/// Securely handles the client secret by zeroing memory after use.
|
||||
/// </remarks>
|
||||
private static async Task<string> GetAccessTokenWithSecret(
|
||||
private static string GetAccessTokenWithSecret(
|
||||
HttpClient HttpClient,
|
||||
string TenantId,
|
||||
string ClientId,
|
||||
string ClientSecret,
|
||||
ReadOnlySpan<char> ClientSecret,
|
||||
int MaxRetries = 5,
|
||||
int InitialDelayMs = 500,
|
||||
CancellationToken CancellationToken = default)
|
||||
@@ -522,7 +526,7 @@ namespace CustomBuildTool
|
||||
ReadOnlySpan<byte> scopePrefix = "scope=https%3A%2F%2Fvault.azure.net%2F.default&client_secret="u8;
|
||||
scopePrefix.CopyTo(span[written..]);
|
||||
written += scopePrefix.Length;
|
||||
written += Encoding.UTF8.GetBytes(Uri.EscapeDataString(ClientSecret), span[written..]);
|
||||
written += Encoding.UTF8.GetBytes(Uri.EscapeDataString(new string(ClientSecret)), span[written..]);
|
||||
span[written++] = (byte)'&';
|
||||
|
||||
ReadOnlySpan<byte> grantPrefix = "grant_type=client_credentials"u8;
|
||||
@@ -548,16 +552,16 @@ namespace CustomBuildTool
|
||||
using var tokenBody = new ByteArrayContent(bodyBytes);
|
||||
tokenBody.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
|
||||
|
||||
using HttpResponseMessage responseMessage = await HttpClient.PostAsync(
|
||||
using HttpResponseMessage responseMessage = HttpClient.PostAsync(
|
||||
$"https://login.microsoftonline.com/{TenantId}/oauth2/v2.0/token",
|
||||
tokenBody,
|
||||
CancellationToken
|
||||
);
|
||||
).GetAwaiter().GetResult();
|
||||
|
||||
if (responseMessage.IsSuccessStatusCode)
|
||||
{
|
||||
var jsonResponseStream = await responseMessage.Content.ReadAsStreamAsync(CancellationToken);
|
||||
var tokenResponse = await JsonSerializer.DeserializeAsync(jsonResponseStream, AzureJsonContext.Default.TokenResponse, CancellationToken);
|
||||
var jsonResponseStream = responseMessage.Content.ReadAsStreamAsync(CancellationToken).GetAwaiter().GetResult();
|
||||
var tokenResponse = JsonSerializer.DeserializeAsync(jsonResponseStream, AzureJsonContext.Default.TokenResponse, CancellationToken).GetAwaiter().GetResult();
|
||||
|
||||
if (tokenResponse.AccessToken == null)
|
||||
{
|
||||
@@ -582,12 +586,12 @@ namespace CustomBuildTool
|
||||
|
||||
var retryAfterDelay = GetRetryAfterMs(responseMessage);
|
||||
delayMs = retryAfterDelay ?? ApplyJitter(delayMs);
|
||||
await Task.Delay(delayMs, CancellationToken);
|
||||
Task.Delay(delayMs, CancellationToken).GetAwaiter().GetResult();
|
||||
delayMs = Math.Min(delayMs * 2, 15000);
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorBodyText = await responseMessage.Content.ReadAsStringAsync(CancellationToken);
|
||||
var errorBodyText = responseMessage.Content.ReadAsStringAsync(CancellationToken).GetAwaiter().GetResult();
|
||||
Program.PrintColorMessage($"Non-retryable token error: {(int)responseMessage.StatusCode} {responseMessage.ReasonPhrase}", ConsoleColor.Red);
|
||||
Program.PrintColorMessage(errorBodyText, ConsoleColor.DarkGray);
|
||||
return string.Empty;
|
||||
@@ -597,14 +601,14 @@ namespace CustomBuildTool
|
||||
{
|
||||
int waitDelay = ApplyJitter(delayMs);
|
||||
Program.PrintColorMessage($"Network error on token fetch (attempt {currentAttempt}/{MaxRetries}): {httpRequestException.Message}. Retrying in {waitDelay} ms...", ConsoleColor.Yellow);
|
||||
await Task.Delay(waitDelay, CancellationToken);
|
||||
Task.Delay(waitDelay, CancellationToken).GetAwaiter().GetResult();
|
||||
delayMs = Math.Min(delayMs * 2, 15000);
|
||||
}
|
||||
catch (TaskCanceledException) when (!CancellationToken.IsCancellationRequested && currentAttempt <= MaxRetries)
|
||||
{
|
||||
int waitDelay = ApplyJitter(delayMs);
|
||||
Program.PrintColorMessage($"Timeout on token fetch (attempt {currentAttempt}/{MaxRetries}). Retrying in {waitDelay} ms...", ConsoleColor.Yellow);
|
||||
await Task.Delay(waitDelay, CancellationToken);
|
||||
Task.Delay(waitDelay, CancellationToken).GetAwaiter().GetResult();
|
||||
delayMs = Math.Min(delayMs * 2, 15000);
|
||||
}
|
||||
}
|
||||
@@ -671,16 +675,19 @@ namespace CustomBuildTool
|
||||
)
|
||||
{
|
||||
// For PFX, you may need a password. Check environment variable.
|
||||
string certPassword = Environment.GetEnvironmentVariable("AZURE_CLIENT_CERTIFICATE_PASSWORD");
|
||||
Win32.GetEnvironmentVariableSecure("AZURE_CLIENT_CERTIFICATE_PASSWORD", out SecureBuffer certPassword);
|
||||
byte[] certBytes = await File.ReadAllBytesAsync(ClientCertificatePath, CancellationToken);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(certPassword))
|
||||
using (certPassword)
|
||||
{
|
||||
clientCertificate = X509CertificateLoader.LoadPkcs12(certBytes, certPassword);
|
||||
}
|
||||
else
|
||||
{
|
||||
clientCertificate = X509CertificateLoader.LoadPkcs12(certBytes, null);
|
||||
if (certPassword != null)
|
||||
{
|
||||
clientCertificate = X509CertificateLoader.LoadPkcs12(certBytes, certPassword.Span);
|
||||
}
|
||||
else
|
||||
{
|
||||
clientCertificate = X509CertificateLoader.LoadPkcs12(certBytes, (string)null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+167
-61
@@ -878,30 +878,63 @@ namespace CustomBuildTool
|
||||
}
|
||||
|
||||
//
|
||||
// Copy headers
|
||||
// Determine active build flavors (one per matching config x arch in Flags).
|
||||
// Each flavor gets its own sdk\include\<flavor>\ and sdk\lib\<flavor>\ tree
|
||||
// so concurrent post-builds across configs/platforms cannot race.
|
||||
//
|
||||
// N.B. The flavor token must match the MSBuild $(Configuration)$(PlatformArchitecture)
|
||||
// value used by the SDK consumers (e.g. plugins\Plugins.props), which resolves to
|
||||
// "Debug64" / "Release64" / "DebugARM64" / etc. - i.e. the sourceDirectory field.
|
||||
// It is NOT the CustomBuildTool architecture token (amd64/i386/arm64).
|
||||
//
|
||||
|
||||
var activeFlavors = new List<(string flavorToken, string sourceDirectory, string targetArchitecture)>();
|
||||
|
||||
foreach (var configurationEntry in configurationsMap)
|
||||
{
|
||||
if (Flags.HasFlag(configurationEntry.Key.configuration) && Flags.HasFlag(configurationEntry.Key.architecture))
|
||||
{
|
||||
activeFlavors.Add((configurationEntry.Value.sourceDirectory, configurationEntry.Value.sourceDirectory, configurationEntry.Value.targetArchitecture));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var flavor in activeFlavors)
|
||||
{
|
||||
Win32.CreateDirectory(Path.Join(["sdk\\include", flavor.flavorToken]));
|
||||
Win32.CreateDirectory(Path.Join(["sdk\\lib", flavor.flavorToken]));
|
||||
}
|
||||
|
||||
//
|
||||
// Copy headers (per-flavor, so concurrent post-builds don't share destinations).
|
||||
//
|
||||
|
||||
//foreach (string headerFileName in BuildConfig.Build_Phnt_Headers)
|
||||
//{
|
||||
// Win32.CopyIfNewer(
|
||||
// Path.Join([Build.BuildWorkingFolder, "\\phnt\\include\\", headerFileName]),
|
||||
// Path.Join([Build.BuildWorkingFolder, "\\sdk\\include\\", headerFileName]),
|
||||
// Flags, true);
|
||||
// foreach (var flavor in activeFlavors)
|
||||
// {
|
||||
// Win32.CopyIfNewer(
|
||||
// Path.Join([Build.BuildWorkingFolder, "\\phnt\\include\\", headerFileName]),
|
||||
// Path.Join([Build.BuildWorkingFolder, "sdk\\include", flavor.flavorToken, headerFileName]),
|
||||
// Flags, true);
|
||||
// }
|
||||
//}
|
||||
|
||||
foreach (string headerFileName in BuildConfig.Build_Phlib_Headers)
|
||||
foreach (var flavor in activeFlavors)
|
||||
{
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "phlib\\include", headerFileName]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include", headerFileName]),
|
||||
Flags, true);
|
||||
}
|
||||
foreach (string headerFileName in BuildConfig.Build_Kphlib_Headers)
|
||||
{
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "kphlib\\include", headerFileName]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include", headerFileName]),
|
||||
Flags, true);
|
||||
foreach (string headerFileName in BuildConfig.Build_Phlib_Headers)
|
||||
{
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "phlib\\include", headerFileName]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include", flavor.flavorToken, headerFileName]),
|
||||
Flags, true);
|
||||
}
|
||||
foreach (string headerFileName in BuildConfig.Build_Kphlib_Headers)
|
||||
{
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "kphlib\\include", headerFileName]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include", flavor.flavorToken, headerFileName]),
|
||||
Flags, true);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -914,22 +947,19 @@ namespace CustomBuildTool
|
||||
Flags, true);
|
||||
|
||||
//
|
||||
// Copy files
|
||||
// Copy libs (per-flavor)
|
||||
//
|
||||
|
||||
foreach (string fileName in buildSdkFiles)
|
||||
{
|
||||
foreach (var configurationEntry in configurationsMap)
|
||||
foreach (var flavor in activeFlavors)
|
||||
{
|
||||
if (Flags.HasFlag(configurationEntry.Key.configuration) && Flags.HasFlag(configurationEntry.Key.architecture))
|
||||
{
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([baseDirectory, configurationEntry.Value.sourceDirectory, fileName]),
|
||||
Path.Join([Build.BuildWorkingFolder, $"sdk\\lib\\{configurationEntry.Value.targetArchitecture}\\", fileName]),
|
||||
Flags,
|
||||
true
|
||||
);
|
||||
}
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([baseDirectory, flavor.sourceDirectory, fileName]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\lib", flavor.flavorToken, fileName]),
|
||||
Flags,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,26 +970,29 @@ namespace CustomBuildTool
|
||||
HeaderGen.Execute();
|
||||
|
||||
//
|
||||
// Copy the SDK headers
|
||||
// Copy the SDK headers (per-flavor)
|
||||
//
|
||||
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "SystemInformer\\include\\phappres.h"]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include\\phappres.h"]),
|
||||
Flags, true);
|
||||
foreach (var flavor in activeFlavors)
|
||||
{
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "SystemInformer\\include\\phappres.h"]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include", flavor.flavorToken, "phappres.h"]),
|
||||
Flags, true);
|
||||
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "SystemInformer\\sdk\\phapppub.h"]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include\\phapppub.h"]),
|
||||
Flags, true);
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "SystemInformer\\sdk\\phapppub.h"]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include", flavor.flavorToken, "phapppub.h"]),
|
||||
Flags, true);
|
||||
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "SystemInformer\\sdk\\phdk.h"]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include\\phdk.h"]),
|
||||
Flags, true);
|
||||
Win32.CopyIfNewer(
|
||||
Path.Join([Build.BuildWorkingFolder, "SystemInformer\\sdk\\phdk.h"]),
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include", flavor.flavorToken, "phdk.h"]),
|
||||
Flags, true);
|
||||
}
|
||||
|
||||
//
|
||||
// Copy the resource header and prefix types with PHAPP for the SDK
|
||||
// Copy the resource header and prefix types with PHAPP for the SDK (per-flavor)
|
||||
//
|
||||
|
||||
Win32.GetFileBasicInfo(
|
||||
@@ -969,27 +1002,31 @@ namespace CustomBuildTool
|
||||
out _
|
||||
);
|
||||
|
||||
Win32.GetFileBasicInfo(
|
||||
Path.Join([Build.BuildWorkingFolder, "sdk\\include\\phappresource.h"]),
|
||||
out var targetCreationTime,
|
||||
out var targetWriteTime,
|
||||
out var targetAttributes
|
||||
);
|
||||
|
||||
if (sourceCreationTime != targetCreationTime || sourceWriteTime != targetWriteTime)
|
||||
foreach (var flavor in activeFlavors)
|
||||
{
|
||||
string resourceContent = Utils.ReadAllText(Path.Join([Build.BuildWorkingFolder, "\\SystemInformer\\resource.h"]));
|
||||
string targetContent = resourceContent.Replace("#define ID", "#define PHAPP_ID", StringComparison.OrdinalIgnoreCase);
|
||||
string phappresourcePath = Path.Join([Build.BuildWorkingFolder, "sdk\\include", flavor.flavorToken, "phappresource.h"]);
|
||||
|
||||
if (!resourceContent.Equals(targetContent, StringComparison.OrdinalIgnoreCase))
|
||||
Win32.GetFileBasicInfo(
|
||||
phappresourcePath,
|
||||
out var targetCreationTime,
|
||||
out var targetWriteTime,
|
||||
out var targetAttributes
|
||||
);
|
||||
|
||||
if (sourceCreationTime != targetCreationTime || sourceWriteTime != targetWriteTime)
|
||||
{
|
||||
if ((targetAttributes & FileAttributes.ReadOnly) != 0)
|
||||
File.SetAttributes(Path.Join([Build.BuildWorkingFolder, "sdk\\include\\phappresource.h"]), FileAttributes.Normal);
|
||||
Utils.WriteAllText(Path.Join([Build.BuildWorkingFolder, "sdk\\include\\phappresource.h"]), targetContent);
|
||||
}
|
||||
string resourceContent = Utils.ReadAllText(Path.Join([Build.BuildWorkingFolder, "\\SystemInformer\\resource.h"]));
|
||||
string targetContent = resourceContent.Replace("#define ID", "#define PHAPP_ID", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
Win32.SetFileBasicInfo(Path.Join([Build.BuildWorkingFolder, "sdk\\include\\phappresource.h"]), sourceCreationTime, sourceWriteTime, true);
|
||||
//Win32.CopyIfNewer("SystemInformer\\resource.h", "sdk\\include\\phappresource.h", Flags);
|
||||
if (!resourceContent.Equals(targetContent, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if ((targetAttributes & FileAttributes.ReadOnly) != 0)
|
||||
File.SetAttributes(phappresourcePath, FileAttributes.Normal);
|
||||
Utils.WriteAllText(phappresourcePath, targetContent);
|
||||
}
|
||||
|
||||
Win32.SetFileBasicInfo(phappresourcePath, sourceCreationTime, sourceWriteTime, true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1483,8 +1520,8 @@ namespace CustomBuildTool
|
||||
if (!string.IsNullOrWhiteSpace(Build.BuildVersionRevision()))
|
||||
preprocessorOptionsList.Add($"PHAPP_VERSION_REVISION={Build.BuildVersionRevision()}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Build.BuildSourceLink))
|
||||
linkerOptionsList.Add($"/SOURCELINK:\"{Build.BuildSourceLink}\"");
|
||||
if (!string.IsNullOrWhiteSpace(Build.BuildSourceLink)) linkerOptionsList.Add($"/SOURCELINK:\"{Build.BuildSourceLink}\"");
|
||||
if (Build.BuildToolsDebug) linkerOptionsList.Add("/VERBOSE");
|
||||
|
||||
preprocessorOptionsBuilder.AppendJoin(";", preprocessorOptionsList);
|
||||
compilerOptionsBuilder.AppendJoin(" ", compilerOptionsList);
|
||||
@@ -1649,6 +1686,67 @@ namespace CustomBuildTool
|
||||
return commandLineBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compiles kphlib\sistatus.mc into per-configuration headers and resources using the
|
||||
/// Windows SDK Message Compiler (mc.exe). The kernelmode build uses the WDK MessageCompile
|
||||
/// task; this provides the equivalent output for the usermode build (which has no WDK) and
|
||||
/// writes each flavor into kphlib\bin\<Configuration><Architecture>\ so the
|
||||
/// parallel matrix build does not race on a shared output file.
|
||||
/// </summary>
|
||||
public static bool BuildMessageHeaders(BuildFlags Flags)
|
||||
{
|
||||
string messageCompiler = Utils.GetMessageCompilerPath();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(messageCompiler))
|
||||
{
|
||||
Program.PrintColorMessage("[ERROR] mc.exe (Windows SDK Message Compiler) was not found.", ConsoleColor.Red, true, Flags | BuildFlags.BuildVerbose);
|
||||
return false;
|
||||
}
|
||||
|
||||
string sourceFile = Path.GetFullPath(Path.Join([Build.BuildWorkingFolder, "kphlib\\sistatus.mc"]));
|
||||
|
||||
List<(string Configuration, string Architecture)> flavors = new List<(string, string)>();
|
||||
|
||||
foreach (string configuration in new[] { "Debug", "Release" })
|
||||
{
|
||||
if (configuration == "Debug" && !Flags.HasFlag(BuildFlags.BuildDebug))
|
||||
continue;
|
||||
if (configuration == "Release" && !Flags.HasFlag(BuildFlags.BuildRelease))
|
||||
continue;
|
||||
|
||||
if (Flags.HasFlag(BuildFlags.Build32bit))
|
||||
flavors.Add((configuration, "32"));
|
||||
if (Flags.HasFlag(BuildFlags.Build64bit))
|
||||
flavors.Add((configuration, "64"));
|
||||
if (Flags.HasFlag(BuildFlags.BuildArm64bit))
|
||||
flavors.Add((configuration, "ARM64"));
|
||||
}
|
||||
|
||||
foreach ((string Configuration, string Architecture) flavor in flavors)
|
||||
{
|
||||
string outputDirectory = Path.GetFullPath(Path.Join([Build.BuildWorkingFolder, "kphlib\\bin", $"{flavor.Configuration}{flavor.Architecture}"]));
|
||||
|
||||
Win32.CreateDirectory(outputDirectory);
|
||||
|
||||
// Mirror the <MessageCompile> metadata in kphlib_km.vcxproj:
|
||||
// -c SetCustomerbit, -u UnicodeInputFile, -U UnicodeMessageInBinFile,
|
||||
// -n TerminateMessageWithNull, -b basename prefix (sistatus_MSG00001.bin).
|
||||
int exitcode = Win32.CreateProcess(
|
||||
messageCompiler,
|
||||
$"-c -u -U -n -b -h \"{outputDirectory}\" -r \"{outputDirectory}\" \"{sourceFile}\"",
|
||||
out string outputString
|
||||
);
|
||||
|
||||
if (exitcode != 0)
|
||||
{
|
||||
Program.PrintColorMessage($"[ERROR] mc.exe ({exitcode}) {outputString}", ConsoleColor.Red, true, Flags | BuildFlags.BuildVerbose);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool BuildSolutionParallel(string Solution, BuildFlags Flags, string Channel = null, bool SkipArm64 = false)
|
||||
{
|
||||
if (SkipArm64)
|
||||
@@ -1823,6 +1921,14 @@ namespace CustomBuildTool
|
||||
if (toolchainList.Count == 0)
|
||||
return true;
|
||||
|
||||
//
|
||||
// Generate the per-configuration sistatus.* headers up front (sequentially)
|
||||
// so the parallel CMake toolchain builds do not race to produce them. The
|
||||
// CMake build has no WDK MessageCompile task, so this uses the SDK mc.exe.
|
||||
//
|
||||
if (!BuildMessageHeaders(Flags))
|
||||
return false;
|
||||
|
||||
bool allOk = true;
|
||||
Parallel.ForEach(toolchainList, new ParallelOptions { MaxDegreeOfParallelism = toolchainList.Count }, tc =>
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace CustomBuildTool
|
||||
/// required configuration is missing, the method returns false and displays an error message.</remarks>
|
||||
/// <param name="Path">The path to the file or directory containing the files to be signed. Must not be null, empty, or whitespace.</param>
|
||||
/// <returns>true if the files are successfully signed; otherwise, false.</returns>
|
||||
public static async Task<bool> SignFiles(string Path)
|
||||
public static bool SignFiles(string Path)
|
||||
{
|
||||
//if (string.IsNullOrWhiteSpace(ENTRA_TIMESTAMP_ALGORITHM))
|
||||
// return false;
|
||||
@@ -91,29 +91,24 @@ namespace CustomBuildTool
|
||||
return false;
|
||||
}
|
||||
// Read the client secret from environment at time of use to reduce lifetime in memory.
|
||||
string entraClientSecret = Win32.GetEnvironmentVariable("BUILD_ENTRA_SECRET_ID");
|
||||
if (string.IsNullOrWhiteSpace(entraClientSecret))
|
||||
if (!Win32.GetEnvironmentVariableSecure("BUILD_ENTRA_SECRET_ID", out SecureBuffer entraClientSecret))
|
||||
{
|
||||
Console.WriteLine($"{VT.RED}ENTRA CLIENT SECRET{VT.RESET}");
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
using (entraClientSecret)
|
||||
{
|
||||
return await SignFiles(
|
||||
return SignFiles(
|
||||
Path,
|
||||
ENTRA_TIMESTAMP_SERVER,
|
||||
ENTRA_CERIFICATE_NAME,
|
||||
ENTRA_CERIFICATE_VAULT,
|
||||
ENTRA_TENANT_GUID,
|
||||
ENTRA_CLIENT_GUID,
|
||||
entraClientSecret
|
||||
entraClientSecret.Buffer
|
||||
);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { Environment.SetEnvironmentVariable("BUILD_ENTRA_SECRET_ID", null, EnvironmentVariableTarget.Process); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -130,21 +125,21 @@ namespace CustomBuildTool
|
||||
/// True if the files are successfully signed; otherwise, false.
|
||||
/// The method retries up to three times in case of transient Azure connectivity issues.
|
||||
/// </returns>
|
||||
public static async Task<bool> SignFiles(
|
||||
public static bool SignFiles(
|
||||
string Path,
|
||||
string TimeStampServer,
|
||||
string AzureCertName,
|
||||
string AzureVaultName,
|
||||
string TenantGuid,
|
||||
string ClientGuid,
|
||||
string ClientSecret
|
||||
ReadOnlySpan<char> ClientSecret
|
||||
)
|
||||
{
|
||||
// Try a few times in case of transient Azure connectivity (dmex)
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (await KeyVaultDigestSignFiles(Path, TimeStampServer, AzureCertName, AzureVaultName, TenantGuid, ClientGuid, ClientSecret))
|
||||
if (KeyVaultDigestSignFiles(Path, TimeStampServer, AzureCertName, AzureVaultName, TenantGuid, ClientGuid, ClientSecret))
|
||||
return true;
|
||||
|
||||
Program.PrintColorMessage("Retrying....", ConsoleColor.Yellow);
|
||||
@@ -168,14 +163,14 @@ namespace CustomBuildTool
|
||||
/// True if all files are successfully signed; otherwise, false.
|
||||
/// Displays error messages for missing certificates, unsupported file types, or signing failures.
|
||||
/// </returns>
|
||||
public static async Task<bool> KeyVaultDigestSignFiles(
|
||||
public static bool KeyVaultDigestSignFiles(
|
||||
string Path,
|
||||
string TimeStampServer,
|
||||
string AzureCertName,
|
||||
string AzureVaultName,
|
||||
string TenantGuid,
|
||||
string ClientGuid,
|
||||
string ClientSecret
|
||||
ReadOnlySpan<char> ClientSecret
|
||||
)
|
||||
{
|
||||
try
|
||||
@@ -183,7 +178,7 @@ namespace CustomBuildTool
|
||||
var certificateTimeStampServer = new TimeStampConfiguration(TimeStampServer, TimeStampType.RFC3161);
|
||||
|
||||
// Get access token via REST
|
||||
string accessToken = await GetAzureAdToken(TenantGuid, ClientGuid, ClientSecret);
|
||||
string accessToken = GetAzureAdToken(TenantGuid, ClientGuid, ClientSecret);
|
||||
if (string.IsNullOrWhiteSpace(accessToken))
|
||||
{
|
||||
Program.PrintColorMessage("Failed to obtain Azure AD token.", ConsoleColor.Red);
|
||||
@@ -191,7 +186,7 @@ namespace CustomBuildTool
|
||||
}
|
||||
|
||||
// Download certificate (public-key only) and key ID via REST
|
||||
var (azureCertificatePublic, keyId) = await DownloadCertificateAndKeyId(AzureVaultName, AzureCertName, accessToken);
|
||||
var (azureCertificatePublic, keyId) = DownloadCertificateAndKeyId(AzureVaultName, AzureCertName, accessToken).GetAwaiter().GetResult();
|
||||
if (azureCertificatePublic == null)
|
||||
{
|
||||
Program.PrintColorMessage("Azure Certificate Failed.", ConsoleColor.Red);
|
||||
@@ -278,7 +273,7 @@ namespace CustomBuildTool
|
||||
/// <param name="ClientId">The client application identifier registered in Azure Active Directory. Cannot be null or empty.</param>
|
||||
/// <param name="ClientSecret">The client application's secret used for authentication. Cannot be null or empty.</param>
|
||||
/// <returns>A string containing the access token if authentication is successful; otherwise, null.</returns>
|
||||
public static async Task<string> GetAzureAdToken(string TenantId, string ClientId, string ClientSecret)
|
||||
public static string GetAzureAdToken(string TenantId, string ClientId, ReadOnlySpan<char> ClientSecret)
|
||||
{
|
||||
//using var request = new HttpRequestMessage(HttpMethod.Post, $"https://login.microsoftonline.com/{TenantId}/oauth2/v2.0/token")
|
||||
//{
|
||||
@@ -318,7 +313,10 @@ namespace CustomBuildTool
|
||||
ReadOnlySpan<byte> scopePrefix = "scope=https%3A%2F%2Fvault.azure.net%2F.default&client_secret="u8;
|
||||
scopePrefix.CopyTo(span[written..]);
|
||||
written += scopePrefix.Length;
|
||||
written += Encoding.UTF8.GetBytes(Uri.EscapeDataString(ClientSecret), span[written..]);
|
||||
|
||||
// We still use Uri.EscapeDataString which creates a string, but it's temporary.
|
||||
// Better would be a span-based escaper.
|
||||
written += Encoding.UTF8.GetBytes(Uri.EscapeDataString(new string(ClientSecret)), span[written..]);
|
||||
span[written++] = (byte)'&';
|
||||
|
||||
ReadOnlySpan<byte> grantPrefix = "grant_type=client_credentials"u8;
|
||||
@@ -338,7 +336,7 @@ namespace CustomBuildTool
|
||||
using var request = new HttpRequestMessage(HttpMethod.Post, $"https://login.microsoftonline.com/{TenantId}/oauth2/v2.0/token");
|
||||
request.Content = tokenBody;
|
||||
|
||||
var tokenResponse = await BuildHttpClient.SendMessage(EntraHttpClient, request, AzureJsonContext.Default.TokenResponse);
|
||||
var tokenResponse = BuildHttpClient.SendMessage(EntraHttpClient, request, AzureJsonContext.Default.TokenResponse).GetAwaiter().GetResult();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(tokenResponse.AccessToken))
|
||||
return null;
|
||||
|
||||
@@ -50,13 +50,9 @@ namespace CustomBuildTool
|
||||
public static readonly ImmutableArray<string> Build_Sdk_Directories =
|
||||
[
|
||||
"sdk",
|
||||
"sdk\\include",
|
||||
"sdk\\dbg\\amd64",
|
||||
"sdk\\dbg\\i386",
|
||||
"sdk\\dbg\\arm64",
|
||||
"sdk\\lib\\amd64",
|
||||
"sdk\\lib\\i386",
|
||||
"sdk\\lib\\arm64",
|
||||
//"sdk\\samples\\SamplePlugin",
|
||||
//"sdk\\samples\\SamplePlugin\\bin\\Release32"
|
||||
];
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace CustomBuildTool
|
||||
/// <param name="Salt">The salt value or key name for encryption.</param>
|
||||
/// <param name="Iterations">The iterations value or key name for encryption.</param>
|
||||
/// <returns>True if encryption succeeds; otherwise, false.</returns>
|
||||
public static bool EncryptFile(string FileName, string OutFileName, string Secret, string Salt, string Iterations)
|
||||
public static bool EncryptFile(string FileName, string OutFileName, ReadOnlySpan<char> Secret, string Salt, string Iterations)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(FileName) || string.IsNullOrWhiteSpace(OutFileName) || string.IsNullOrWhiteSpace(Secret) || string.IsNullOrWhiteSpace(Salt))
|
||||
if (string.IsNullOrWhiteSpace(FileName) || string.IsNullOrWhiteSpace(OutFileName) || Secret.IsEmpty || string.IsNullOrWhiteSpace(Salt))
|
||||
{
|
||||
Program.PrintColorMessage($"Unable to encrypt file: Invalid arguments.", ConsoleColor.Yellow);
|
||||
return false;
|
||||
@@ -73,9 +73,9 @@ namespace CustomBuildTool
|
||||
/// <param name="Salt">The salt value or key name for decryption.</param>
|
||||
/// <param name="Iterations">The iterations value or key name for encryption.</param>
|
||||
/// <returns>True if decryption succeeds; otherwise, false.</returns>
|
||||
public static bool DecryptFile(string FileName, string OutFileName, string Secret, string Salt, string Iterations)
|
||||
public static bool DecryptFile(string FileName, string OutFileName, ReadOnlySpan<char> Secret, string Salt, string Iterations)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(FileName) || string.IsNullOrWhiteSpace(OutFileName) || string.IsNullOrWhiteSpace(Secret) || string.IsNullOrWhiteSpace(Salt))
|
||||
if (string.IsNullOrWhiteSpace(FileName) || string.IsNullOrWhiteSpace(OutFileName) || Secret.IsEmpty || string.IsNullOrWhiteSpace(Salt))
|
||||
{
|
||||
Program.PrintColorMessage($"Unable to decrypt file: Invalid arguments.", ConsoleColor.Yellow);
|
||||
return false;
|
||||
@@ -183,18 +183,25 @@ namespace CustomBuildTool
|
||||
return true;
|
||||
}
|
||||
|
||||
if (StrictChecks)
|
||||
try
|
||||
{
|
||||
if (File.Exists(sigFileName) && Win32.GetFileSize(sigFileName) != 0)
|
||||
if (StrictChecks)
|
||||
{
|
||||
Program.PrintColorMessage($"[Signature File Exists] ({sigFileName})", ConsoleColor.Red);
|
||||
return false;
|
||||
if (File.Exists(sigFileName) && Win32.GetFileSize(sigFileName) != 0)
|
||||
{
|
||||
Program.PrintColorMessage($"[Signature File Exists] ({sigFileName})", ConsoleColor.Red);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
byte[] signature = SignFile(keyMaterial, FileName);
|
||||
|
||||
Utils.WriteAllBytes(sigFileName, signature);
|
||||
}
|
||||
finally
|
||||
{
|
||||
CryptographicOperations.ZeroMemory(keyMaterial);
|
||||
}
|
||||
|
||||
byte[] signature = SignFile(keyMaterial, FileName);
|
||||
|
||||
Utils.WriteAllBytes(sigFileName, signature);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -220,11 +227,18 @@ namespace CustomBuildTool
|
||||
{
|
||||
if (GetKeyMaterial(KeyName, out byte[] keyMaterial))
|
||||
{
|
||||
byte[] signature = SignFile(keyMaterial, FileName);
|
||||
|
||||
if (signature.Length != 0)
|
||||
try
|
||||
{
|
||||
return Convert.ToHexString(signature);
|
||||
byte[] signature = SignFile(keyMaterial, FileName);
|
||||
|
||||
if (signature.Length != 0)
|
||||
{
|
||||
return Convert.ToHexString(signature);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
CryptographicOperations.ZeroMemory(keyMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +258,7 @@ namespace CustomBuildTool
|
||||
/// <param name="Salt">The salt value for encryption.</param>
|
||||
/// <param name="Iterations">The iterations value for encryption.</param>
|
||||
/// <returns>The encrypted byte array, or null if encryption fails.</returns>
|
||||
private static byte[] Encrypt(Stream Stream, string Secret, string Salt, int Iterations)
|
||||
private static byte[] Encrypt(Stream Stream, ReadOnlySpan<char> Secret, string Salt, int Iterations)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -280,7 +294,7 @@ namespace CustomBuildTool
|
||||
/// <param name="Salt">The salt used in key derivation.</param>
|
||||
/// <param name="Iterations">The number of iterations for the key derivation function.</param>
|
||||
/// <returns>A byte array containing the decrypted data, or null if decryption fails.</returns>
|
||||
private static byte[] Decrypt(Stream Stream, string Secret, string Salt, int Iterations)
|
||||
private static byte[] Decrypt(Stream Stream, ReadOnlySpan<char> Secret, string Salt, int Iterations)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -316,7 +330,7 @@ namespace CustomBuildTool
|
||||
/// <param name="Salt">The salt used in key derivation.</param>
|
||||
/// <param name="Iterations">The number of iterations for the key derivation function.</param>
|
||||
/// <returns>The decrypted byte array, or null if decryption fails.</returns>
|
||||
private static byte[] Decrypt(byte[] Bytes, string Secret, string Salt, int Iterations)
|
||||
private static byte[] Decrypt(byte[] Bytes, ReadOnlySpan<char> Secret, string Salt, int Iterations)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -333,7 +347,7 @@ namespace CustomBuildTool
|
||||
return null;
|
||||
}
|
||||
|
||||
private static byte[] Encrypt(byte[] Bytes, string Secret, string Salt, int Iterations)
|
||||
private static byte[] Encrypt(byte[] Bytes, ReadOnlySpan<char> Secret, string Salt, int Iterations)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -350,13 +364,13 @@ namespace CustomBuildTool
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Aes GetRijndael(string Secret, string Salt, int Iterations)
|
||||
private static Aes GetRijndael(ReadOnlySpan<char> Secret, string Salt, int Iterations)
|
||||
{
|
||||
ReadOnlySpan<byte> saltBytes = Convert.FromBase64String(Salt);
|
||||
Span<byte> keyMaterial = stackalloc byte[48];
|
||||
|
||||
Rfc2898DeriveBytes.Pbkdf2(
|
||||
Secret.AsSpan(),
|
||||
Secret,
|
||||
saltBytes,
|
||||
keyMaterial,
|
||||
Iterations,
|
||||
@@ -616,9 +630,11 @@ namespace CustomBuildTool
|
||||
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
string secret = File.ReadAllText(fileName);
|
||||
byte[] bytes = Utils.ReadAllBytes(GetPath($"{KeyName}.s"));
|
||||
KeyMaterial = Decrypt(bytes, secret, GetSalt(KeyName), GetIterations(KeyName));
|
||||
using (var secret = Utils.ReadAllTextSecure(fileName))
|
||||
{
|
||||
byte[] bytes = Utils.ReadAllBytes(GetPath($"{KeyName}.s"));
|
||||
KeyMaterial = Decrypt(bytes, secret.Span, GetSalt(KeyName), GetIterations(KeyName));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (File.Exists(GetPath($"{KeyName}.key")))
|
||||
@@ -626,10 +642,13 @@ namespace CustomBuildTool
|
||||
KeyMaterial = Utils.ReadAllBytes(GetPath($"{KeyName}.key"));
|
||||
return true;
|
||||
}
|
||||
else if (Win32.GetEnvironmentVariable(KeyName_Vars[KeyName].Key, out string secret))
|
||||
else if (Win32.GetEnvironmentVariableSecure(KeyName_Vars[KeyName].Key, out SecureBuffer secret))
|
||||
{
|
||||
byte[] bytes = Utils.ReadAllBytes(GetPath($"{KeyName}.s"));
|
||||
KeyMaterial = Decrypt(bytes, secret, GetSalt(KeyName), GetIterations(KeyName));
|
||||
using (secret)
|
||||
{
|
||||
byte[] bytes = Utils.ReadAllBytes(GetPath($"{KeyName}.s"));
|
||||
KeyMaterial = Decrypt(bytes, secret.Span, GetSalt(KeyName), GetIterations(KeyName));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<DirectPInvokeList Include="NativeImports.txt" />
|
||||
<NativeLibrary Include="dbghelp.lib" />
|
||||
<NativeLibrary Include="Advapi32.lib" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.manifest" />
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# escape=`
|
||||
|
||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0-windowsservercore-ltsc2025 AS base
|
||||
USER ContainerUser
|
||||
WORKDIR /app
|
||||
|
||||
# This stage is used to build the project
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0-windowsservercore-ltsc2025 AS build
|
||||
# Install Visual Studio Build Tools, they are required for aot publish
|
||||
RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe
|
||||
RUN vs_buildtools.exe --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.28000 --quiet --wait --norestart --nocache
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["CustomBuildTool.csproj", "."]
|
||||
RUN dotnet restore "./CustomBuildTool.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/."
|
||||
RUN dotnet build "./CustomBuildTool.csproj" -c %BUILD_CONFIGURATION% -o /app/build
|
||||
|
||||
# This stage is used to publish the service project to be copied to the final stage
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./CustomBuildTool.csproj" -c %BUILD_CONFIGURATION% -o /app/publish
|
||||
|
||||
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0-windowsservercore-ltsc2025 AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["CustomBuildTool.exe"]
|
||||
@@ -14,6 +14,7 @@ SafeArrayGetUBound
|
||||
SafeArrayGetElement
|
||||
SafeArrayDestroy
|
||||
GetFileAttributesEx
|
||||
GetEnvironmentVariable
|
||||
GetCurrentProcess
|
||||
GetErrorMode
|
||||
SetErrorMode
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace CustomBuildTool
|
||||
{
|
||||
string path = parseResult.GetValue(pathArg);
|
||||
BuildToolsId.CheckForOutOfDateTools();
|
||||
if (!await BuildAzure.SignFiles(path)) Environment.Exit(1);
|
||||
if (!BuildAzure.SignFiles(path)) Environment.Exit(1);
|
||||
});
|
||||
return cmd;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CustomBuildTool
|
||||
/// handling Windows SDK paths. Many methods assume Windows environments and may rely on environment variables or
|
||||
/// registry keys. Thread safety is not guaranteed for all static members; use caution when accessing shared
|
||||
/// resources concurrently.</remarks>
|
||||
public static unsafe class Utils
|
||||
public static unsafe partial class Utils
|
||||
{
|
||||
private static readonly Dictionary<string, string> EnvironmentBlock = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
public static readonly Encoding UTF8NoBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
|
||||
@@ -842,6 +842,37 @@ namespace CustomBuildTool
|
||||
return makeAppxPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the full path to the Message Compiler (mc.exe) tool from the Windows SDK installation.
|
||||
/// </summary>
|
||||
/// <remarks>mc.exe ships with the Windows SDK (not the WDK), so it can be used to compile message
|
||||
/// files for the usermode build without requiring the WDK build customizations.</remarks>
|
||||
/// <returns>The full path to mc.exe if found; otherwise, null.</returns>
|
||||
public static string GetMessageCompilerPath()
|
||||
{
|
||||
string windowsSdkPath = Utils.GetWindowsSdkPath();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(windowsSdkPath))
|
||||
return null;
|
||||
|
||||
string messageCompilerPath = Path.Join([windowsSdkPath, "\\x64\\mc.exe"]);
|
||||
|
||||
if (!File.Exists(messageCompilerPath))
|
||||
{
|
||||
string sdkRootPath = Win32.GetKeyValue(true, "Software\\Microsoft\\Windows Kits\\Installed Roots", "WdkBinRootVersioned", null);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(sdkRootPath))
|
||||
return null;
|
||||
|
||||
messageCompilerPath = Utils.ExpandFullPath(Path.Join([sdkRootPath, "\\x64\\mc.exe"]));
|
||||
|
||||
if (!File.Exists(messageCompilerPath))
|
||||
return null;
|
||||
}
|
||||
|
||||
return messageCompilerPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locates the full file path to the CMake executable (cmake.exe) available on the system.
|
||||
/// </summary>
|
||||
@@ -2790,4 +2821,50 @@ namespace CustomBuildTool
|
||||
public const string PINK = "\u001b[38;5;213m";
|
||||
public const string LIME = "\u001b[38;5;118m";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a buffer of characters that can be securely zeroed out after use.
|
||||
/// </summary>
|
||||
public sealed class SecureBuffer : IDisposable
|
||||
{
|
||||
public char[] Buffer { get; }
|
||||
public int Length { get; }
|
||||
public ReadOnlySpan<char> Span => Buffer.AsSpan(0, Length);
|
||||
|
||||
public SecureBuffer(int length)
|
||||
{
|
||||
Buffer = new char[length];
|
||||
Length = length;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
CryptographicOperations.ZeroMemory(MemoryMarshal.AsBytes(Buffer.AsSpan()));
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class Utils
|
||||
{
|
||||
public static SecureBuffer ReadAllTextSecure(string FileName)
|
||||
{
|
||||
if (!File.Exists(FileName))
|
||||
return null;
|
||||
|
||||
using (var fs = new FileStream(FileName, FileMode.Open, FileAccess.Read))
|
||||
using (var sr = new StreamReader(fs, Utils.UTF8NoBOM))
|
||||
{
|
||||
int length = (int)fs.Length;
|
||||
var buffer = new SecureBuffer(length);
|
||||
int read = sr.Read(buffer.Buffer, 0, length);
|
||||
if (read < length)
|
||||
{
|
||||
var newBuffer = new SecureBuffer(read);
|
||||
buffer.Span.Slice(0, read).CopyTo(newBuffer.Buffer);
|
||||
buffer.Dispose();
|
||||
return newBuffer;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,57 +279,6 @@ namespace CustomBuildTool
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// Number of times, and delay between, retries for a transiently-locked file operation.
|
||||
//
|
||||
private const int FileRetryAttempts = 10;
|
||||
private const int FileRetryDelay = 200;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the exception represents a transient file lock (a sharing or lock
|
||||
/// violation) that is expected to clear once another process releases the file.
|
||||
/// </summary>
|
||||
/// <param name="Exception">The IO exception to inspect.</param>
|
||||
/// <returns>True if the failure is a transient sharing/lock violation; otherwise false.</returns>
|
||||
private static bool IsTransientFileLock(IOException Exception)
|
||||
{
|
||||
int code = Exception.HResult & 0xffff;
|
||||
return code == 32 /* ERROR_SHARING_VIOLATION */ || code == 33 /* ERROR_LOCK_VIOLATION */;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a file operation, retrying briefly when the file is transiently locked by another
|
||||
/// process. During parallel multi-platform builds the linker for one architecture can still
|
||||
/// hold a binary that another architecture's post-build step needs to read (for example the
|
||||
/// WOW64 payload copied into the x64/ARM64 output); the lock clears once the linker finishes.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The return type of the operation.</typeparam>
|
||||
/// <param name="Operation">The file operation to invoke.</param>
|
||||
/// <returns>The result of the operation.</returns>
|
||||
private static T InvokeWithFileRetry<T>(Func<T> Operation)
|
||||
{
|
||||
for (int attempt = 1; ; attempt++)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Operation();
|
||||
}
|
||||
catch (IOException exception) when (attempt < FileRetryAttempts && IsTransientFileLock(exception))
|
||||
{
|
||||
Thread.Sleep(FileRetryDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a file operation, retrying briefly when the file is transiently locked by another process.
|
||||
/// </summary>
|
||||
/// <param name="Operation">The file operation to invoke.</param>
|
||||
private static void InvokeWithFileRetry(Action Operation)
|
||||
{
|
||||
InvokeWithFileRetry<object>(() => { Operation(); return null; });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the source file to the destination file if the source is newer or the destination does not exist.
|
||||
/// Preserves creation and last write times, and optionally sets the read-only attribute.
|
||||
@@ -381,7 +330,7 @@ namespace CustomBuildTool
|
||||
try { File.SetAttributes(DestinationFile, FileAttributes.Normal); } catch { }
|
||||
}
|
||||
|
||||
InvokeWithFileRetry(() => File.Copy(SourceFile, DestinationFile, true));
|
||||
File.Copy(SourceFile, DestinationFile, true);
|
||||
Win32.SetFileBasicInfo(DestinationFile, sourceCreationTime, sourceWriteTime, ReadOnly);
|
||||
updated = true;
|
||||
}
|
||||
@@ -389,7 +338,7 @@ namespace CustomBuildTool
|
||||
else
|
||||
{
|
||||
Win32.GetFileBasicInfo(SourceFile, out var sourceCreationTime, out var sourceWriteTime, out _);
|
||||
InvokeWithFileRetry(() => File.Copy(SourceFile, DestinationFile, true));
|
||||
File.Copy(SourceFile, DestinationFile, true);
|
||||
Win32.SetFileBasicInfo(DestinationFile, sourceCreationTime, sourceWriteTime, ReadOnly);
|
||||
updated = true;
|
||||
}
|
||||
@@ -443,7 +392,7 @@ namespace CustomBuildTool
|
||||
try { File.SetAttributes(DestinationFile, FileAttributes.Normal); } catch { }
|
||||
}
|
||||
|
||||
InvokeWithFileRetry(() => File.Copy(SourceFile, DestinationFile, true));
|
||||
File.Copy(SourceFile, DestinationFile, true);
|
||||
SetFileBasicInfo(DestinationFile, sourceCreationTime, sourceWriteTime, false);
|
||||
updated = true;
|
||||
}
|
||||
@@ -451,7 +400,7 @@ namespace CustomBuildTool
|
||||
else
|
||||
{
|
||||
GetFileBasicInfo(SourceFile, out var sourceCreationTime, out var sourceWriteTime, out _);
|
||||
InvokeWithFileRetry(() => File.Copy(SourceFile, DestinationFile, true));
|
||||
File.Copy(SourceFile, DestinationFile, true);
|
||||
SetFileBasicInfo(DestinationFile, sourceCreationTime, sourceWriteTime, false);
|
||||
updated = true;
|
||||
}
|
||||
@@ -494,6 +443,39 @@ namespace CustomBuildTool
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the value of an environment variable from the current process securely.
|
||||
/// </summary>
|
||||
/// <param name="Name">The name of the environment variable.</param>
|
||||
/// <param name="Value">The value of the environment variable as a SecureBuffer.</param>
|
||||
/// <returns>True if the environment variable was found.</returns>
|
||||
public static bool GetEnvironmentVariableSecure(string Name, out SecureBuffer Value)
|
||||
{
|
||||
Value = null;
|
||||
|
||||
fixed (char* pName = Name)
|
||||
{
|
||||
uint size = PInvoke.GetEnvironmentVariable(pName, null, 0);
|
||||
if (size == 0)
|
||||
return false;
|
||||
|
||||
using (var buffer = new SecureBuffer((int)size))
|
||||
{
|
||||
fixed (char* pBuffer = buffer.Buffer)
|
||||
{
|
||||
uint length = PInvoke.GetEnvironmentVariable(pName, pBuffer, size);
|
||||
if (length == 0 || length >= size)
|
||||
return false;
|
||||
|
||||
Value = new SecureBuffer((int)length);
|
||||
buffer.Span.Slice(0, (int)length).CopyTo(Value.Buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the value of an environment variable from the current process.
|
||||
/// </summary>
|
||||
@@ -846,7 +828,7 @@ namespace CustomBuildTool
|
||||
return false;
|
||||
}
|
||||
|
||||
using (var fs = InvokeWithFileRetry(() => File.OpenRead(FileName)))
|
||||
using (var fs = File.OpenRead(FileName))
|
||||
{
|
||||
var handle = new HANDLE(fs.SafeFileHandle!.DangerousGetHandle());
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace CustomBuildTool
|
||||
|
||||
private static ZipWriterOptions CreateWriterOptions(CompressionProgressReporter ProgressReporter)
|
||||
{
|
||||
return new ZipWriterOptions(CompressionType.Deflate)
|
||||
return new ZipWriterOptions(CompressionType.LZMA2)
|
||||
{
|
||||
LeaveStreamOpen = true,
|
||||
ArchiveEncoding = new ArchiveEncoding { Default = Utils.UTF8NoBOM },
|
||||
|
||||
@@ -63,45 +63,45 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>thirdparty.lib;phlib.lib;ntdll.lib;bcrypt.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)..\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN64;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>thirdparty.lib;phlib.lib;ntdll.lib;bcrypt.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)..\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>thirdparty.lib;phlib.lib;ntdll.lib;bcrypt.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)..\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN64;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>thirdparty.lib;phlib.lib;ntdll.lib;bcrypt.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)..\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -114,4 +114,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<Solution>
|
||||
<Configurations>
|
||||
<Platform Name="ARM64" />
|
||||
<Platform Name="Win32" />
|
||||
<Platform Name="x64" />
|
||||
</Configurations>
|
||||
<Project Path="CustomSetupTool.vcxproj" Id="5c00734f-f50a-49fc-9d2a-f6ee51ecb00f" />
|
||||
</Solution>
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{5C00734F-F50A-49FC-9D2A-F6EE51ECB00F}</ProjectGuid>
|
||||
@@ -21,41 +37,107 @@
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)bin\$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;DEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>thirdparty.lib;comctl32.lib;crypt32.lib;winhttp.lib;ntdll.lib;phlib.lib;shlwapi.lib;userenv.lib;windowscodecs.lib;winsta.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)..\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;ole32.dll;shell32.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>app.manifest</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;DEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>thirdparty.lib;comctl32.lib;crypt32.lib;winhttp.lib;ntdll.lib;phlib.lib;shlwapi.lib;userenv.lib;windowscodecs.lib;winsta.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;ole32.dll;shell32.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>app.manifest</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;DEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>thirdparty.lib;comctl32.lib;crypt32.lib;winhttp.lib;ntdll.lib;phlib.lib;shlwapi.lib;userenv.lib;windowscodecs.lib;winsta.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;ole32.dll;shell32.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>app.manifest</AdditionalManifestFiles>
|
||||
@@ -63,17 +145,53 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;NDEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>comctl32.lib;crypt32.lib;winhttp.lib;ntdll.lib;phlib.lib;shlwapi.lib;userenv.lib;windowscodecs.lib;winsta.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);$(SolutionDir)..\thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;ole32.dll;shell32.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\phnt\include;$(SolutionDir)..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>app.manifest</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;NDEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>comctl32.lib;crypt32.lib;winhttp.lib;ntdll.lib;phlib.lib;shlwapi.lib;userenv.lib;windowscodecs.lib;winsta.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;ole32.dll;shell32.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>app.manifest</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;NDEBUG;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>comctl32.lib;crypt32.lib;winhttp.lib;ntdll.lib;phlib.lib;shlwapi.lib;userenv.lib;windowscodecs.lib;winsta.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);$(SystemInformerRoot)thirdparty\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;ole32.dll;shell32.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);$(ExternalPreprocessorOptions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>app.manifest</AdditionalManifestFiles>
|
||||
@@ -81,8 +199,8 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="extract.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="install.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="startpage.c" />
|
||||
<ClCompile Include="util.c" />
|
||||
<ClCompile Include="uninstall.c" />
|
||||
@@ -101,8 +219,8 @@
|
||||
<Manifest Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\..\SystemInformer\resources\systeminformer.png" />
|
||||
<Image Include="..\..\SystemInformer\SystemInformer.ico" />
|
||||
<Image Include="$(SystemInformerRoot)SystemInformer\resources\systeminformer.png" />
|
||||
<Image Include="$(SystemInformerRoot)SystemInformer\SystemInformer.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
@@ -18,9 +18,6 @@
|
||||
<ClCompile Include="extract.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="install.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -39,6 +36,9 @@
|
||||
<ClCompile Include="wizard.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="setup.h">
|
||||
@@ -57,10 +57,10 @@
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\..\SystemInformer\SystemInformer.ico">
|
||||
<Image Include="$(SystemInformerRoot)SystemInformer\SystemInformer.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="..\..\SystemInformer\resources\systeminformer.png">
|
||||
<Image Include="$(SystemInformerRoot)SystemInformer\resources\systeminformer.png">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -463,11 +463,11 @@ static NTSTATUS SetupExtractBuildStageFiles(
|
||||
|
||||
do
|
||||
{
|
||||
if (NT_SUCCESS(status = SetupUseExistingKsi(extractPath, buffer, zipFileBufferLength)))
|
||||
if (NT_SUCCESS(status = SetupUseExistingKsi(extractPath, buffer, (ULONG)zipFileBufferLength)))
|
||||
break;
|
||||
if (NT_SUCCESS(status = SetupOverwriteFile(extractPath, buffer, zipFileBufferLength)))
|
||||
if (NT_SUCCESS(status = SetupOverwriteFile(extractPath, buffer, (ULONG)zipFileBufferLength)))
|
||||
break;
|
||||
if (NT_SUCCESS(status = SetupUpdateKsi(Context, extractPath, buffer, zipFileBufferLength)))
|
||||
if (NT_SUCCESS(status = SetupUpdateKsi(Context, extractPath, buffer, (ULONG)zipFileBufferLength)))
|
||||
break;
|
||||
|
||||
PhDelayExecution(1000);
|
||||
@@ -475,7 +475,7 @@ static NTSTATUS SetupExtractBuildStageFiles(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NT_SUCCESS(status = SetupWriteFileAtomic(Context, extractPath, buffer, zipFileBufferLength)))
|
||||
if (NT_SUCCESS(status = SetupWriteFileAtomic(Context, extractPath, buffer, (ULONG)zipFileBufferLength)))
|
||||
{
|
||||
PhAddItemList(StagedFiles, PhReferenceObject(extractPath));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ LRESULT CALLBACK SetupTaskDialogSubclassProc(
|
||||
{
|
||||
case WM_DESTROY:
|
||||
{
|
||||
SetWindowLongPtr(hwndDlg, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
|
||||
PhSetWindowContext(hwndDlg, UCHAR_MAX, oldWndProc);
|
||||
PhRemoveWindowContext(hwndDlg, UCHAR_MAX);
|
||||
}
|
||||
break;
|
||||
@@ -605,14 +605,14 @@ INT WINAPI wWinMain(
|
||||
}
|
||||
|
||||
SetupParseCommandLine(context);
|
||||
|
||||
|
||||
if (context->Silent)
|
||||
{
|
||||
SetupSilent(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupShowDialog(context);
|
||||
SetupShowWizard(context);
|
||||
}
|
||||
|
||||
if (context->SubProcessHandle)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#pragma code_page(65001)
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ typedef enum _SETUP_COMMAND_TYPE
|
||||
typedef struct _PH_SETUP_CONTEXT
|
||||
{
|
||||
HWND DialogHandle;
|
||||
HWND ParentWindowHandle;
|
||||
HICON IconSmallHandle;
|
||||
HICON IconLargeHandle;
|
||||
WNDPROC TaskDialogWndProc;
|
||||
|
||||
@@ -121,7 +121,8 @@ NTSTATUS SetupCreateUninstallKey(
|
||||
PhSetValueKeyStringZ(keyHandle, L"InstallLocation", &string->sr);
|
||||
|
||||
string = SetupCreateFullPath(Context->SetupInstallPath, L"\\systeminformer-setup.exe");
|
||||
PhMoveReference(&string, PhFormatString(L"\"%s\" -uninstall", PhGetString(string)));
|
||||
PhMoveReference(&string, PhQuoteCommandLine(&string->sr, TRUE));
|
||||
PhMoveReference(&string, PhConcatStrings2(PhGetString(string), L" -uninstall"));
|
||||
PhSetValueKeyStringZ(keyHandle, L"UninstallString", &string->sr);
|
||||
|
||||
PhSetValueKeyUlong(keyHandle, L"NoModify", TRUE);
|
||||
@@ -155,7 +156,7 @@ PPH_STRING SetupFindInstallDirectory(
|
||||
if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
||||
setupInstallPath = PhExpandEnvironmentStrings(&programW6432);
|
||||
else
|
||||
setupInstallPath = PhExpandEnvironmentStrings(&programFiles);
|
||||
setupInstallPath = PhGetKnownFolderPathZ(&FOLDERID_ProgramFiles, NULL);
|
||||
}
|
||||
|
||||
if (PhIsNullOrEmptyString(setupInstallPath))
|
||||
@@ -721,7 +722,7 @@ NTSTATUS SetupCreateTaskMgrDebuggerIfeo(
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
value = PhFormatString(L"\"%s\"", PhGetString(clientPathString));
|
||||
value = PhQuoteCommandLine(&clientPathString->sr, TRUE);
|
||||
if (!value)
|
||||
{
|
||||
PhDereferenceObject(clientPathString);
|
||||
@@ -1972,7 +1973,9 @@ NTSTATUS SetupWriteFileAtomic(
|
||||
{
|
||||
NTSTATUS status;
|
||||
PPH_STRING sessionId;
|
||||
PPH_STRING stagingName;
|
||||
PPH_STRING stagingName = NULL;
|
||||
PCWSTR writeName;
|
||||
BOOLEAN finalExists;
|
||||
HANDLE fileHandle = NULL;
|
||||
LARGE_INTEGER allocationSize;
|
||||
IO_STATUS_BLOCK isb;
|
||||
@@ -1980,12 +1983,25 @@ NTSTATUS SetupWriteFileAtomic(
|
||||
if (!(sessionId = SetupGetSessionId(Context)))
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
stagingName = PhFormatString(L"%s.%s.new", PhGetString(FinalName), PhGetString(sessionId));
|
||||
finalExists = PhDoesFileExistWin32(PhGetString(FinalName));
|
||||
|
||||
if (finalExists)
|
||||
{
|
||||
stagingName = PhFormatString(L"%s.%s.new", PhGetString(FinalName), PhGetString(sessionId));
|
||||
|
||||
if (!stagingName)
|
||||
{
|
||||
status = STATUS_NO_MEMORY;
|
||||
goto CleanupExit;
|
||||
}
|
||||
}
|
||||
|
||||
writeName = finalExists ? PhGetString(stagingName) : PhGetString(FinalName);
|
||||
allocationSize.QuadPart = BufferLength;
|
||||
|
||||
status = PhCreateFileWin32Ex(
|
||||
&fileHandle,
|
||||
PhGetString(stagingName),
|
||||
writeName,
|
||||
FILE_GENERIC_WRITE | DELETE,
|
||||
&allocationSize,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
@@ -2057,6 +2073,16 @@ NTSTATUS SetupCommitFile(
|
||||
stagingName = PhFormatString(L"%s.%s.new", PhGetString(FinalName), PhGetString(sessionId));
|
||||
backupName = PhFormatString(L"%s.%s.bak", PhGetString(FinalName), PhGetString(sessionId));
|
||||
|
||||
if (!PhDoesFileExistWin32(PhGetString(stagingName)))
|
||||
{
|
||||
if (PhDoesFileExistWin32(PhGetString(FinalName)) &&
|
||||
!PhDoesFileExistWin32(PhGetString(backupName)))
|
||||
{
|
||||
status = STATUS_SUCCESS;
|
||||
goto CleanupExit;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any stale .bak left by a previous failed install. An explicit delete
|
||||
// is more reliable than relying solely on ReplaceIfExists: it clears read-only
|
||||
// attributes and avoids STATUS_INVALID_PARAMETER on some filesystem configurations.
|
||||
@@ -2192,6 +2218,12 @@ NTSTATUS SetupRollbackFile(
|
||||
NtClose(backupHandle);
|
||||
}
|
||||
}
|
||||
else if (!PhDoesFileExistWin32(PhGetString(stagingName)) &&
|
||||
PhDoesFileExistWin32(PhGetString(FinalName)))
|
||||
{
|
||||
// No staged file or backup means this file was newly created directly.
|
||||
PhDeleteFileWin32(PhGetString(FinalName));
|
||||
}
|
||||
|
||||
if (backupName)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#pragma code_page(65001)
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
@@ -851,7 +851,7 @@ static BOOL CALLBACK SetupSetWizardChildFont(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK SetupInvalidateWizardChildWindow(
|
||||
BOOL CALLBACK SetupInvalidateWizardChildWindow(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ LPARAM lParam
|
||||
)
|
||||
@@ -868,7 +868,8 @@ static BOOL CALLBACK SetupInvalidateWizardChildWindow(
|
||||
* \param WindowHandle The wizard page window handle.
|
||||
* \param LargeTitle TRUE to use the welcome/completed page title font.
|
||||
*/
|
||||
static VOID SetupInitializeWizardTitleFont(
|
||||
VOID SetupInitializeWizardTitleFont(
|
||||
_In_ PPH_SETUP_CONTEXT Context,
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ BOOLEAN LargeTitle
|
||||
)
|
||||
@@ -877,11 +878,13 @@ static VOID SetupInitializeWizardTitleFont(
|
||||
|
||||
PhSetWindowContext(WindowHandle, SETUP_WINDOW_CONTEXT_LARGE_TITLE, (PVOID)(ULONG_PTR)LargeTitle);
|
||||
|
||||
if (propSheetContext = PhGetWindowContext(GetParent(WindowHandle), UCHAR_MAX))
|
||||
if (propSheetContext = PhGetWindowContext(Context->ParentWindowHandle, UCHAR_MAX))
|
||||
{
|
||||
SetupApplyWizardPageFonts(WindowHandle, propSheetContext, LargeTitle);
|
||||
}
|
||||
}
|
||||
|
||||
static VOID SetupDestroyWizardPage(
|
||||
VOID SetupDestroyWizardPage(
|
||||
_In_ HWND WindowHandle
|
||||
)
|
||||
{
|
||||
@@ -895,7 +898,7 @@ static VOID SetupDestroyWizardPage(
|
||||
* \param PropSheetContext The property sheet context.
|
||||
* \param ParentWindowHandle The property sheet window handle.
|
||||
*/
|
||||
static VOID SetupSetPropSheetButtonFonts(
|
||||
VOID SetupSetPropSheetButtonFonts(
|
||||
_In_ PPV_PROPSHEETCONTEXT PropSheetContext,
|
||||
_In_ HWND ParentWindowHandle
|
||||
)
|
||||
@@ -934,7 +937,7 @@ static VOID SetupSetPropSheetButtonFonts(
|
||||
}
|
||||
}
|
||||
|
||||
static VOID SetupApplyWizardFonts(
|
||||
VOID SetupApplyWizardFonts(
|
||||
_In_ HWND ParentWindowHandle,
|
||||
_In_ PPV_PROPSHEETCONTEXT PropSheetContext
|
||||
)
|
||||
@@ -958,7 +961,7 @@ static VOID SetupApplyWizardFonts(
|
||||
}
|
||||
}
|
||||
|
||||
static VOID SetupUpdateWizardFonts(
|
||||
VOID SetupUpdateWizardFonts(
|
||||
_In_ HWND ParentWindowHandle,
|
||||
_Inout_ PPV_PROPSHEETCONTEXT PropSheetContext,
|
||||
_In_ LONG WindowDpi
|
||||
@@ -987,7 +990,7 @@ static VOID SetupUpdateWizardFonts(
|
||||
*
|
||||
* \param WindowHandle The wizard page window handle.
|
||||
*/
|
||||
static VOID SetupLoadWelcomeBitmap(
|
||||
VOID SetupLoadWelcomeBitmap(
|
||||
_In_ HWND WindowHandle
|
||||
)
|
||||
{
|
||||
@@ -1020,7 +1023,7 @@ static VOID SetupLoadWelcomeBitmap(
|
||||
* \param ControlId The property sheet button control identifier.
|
||||
* \param ShowButton TRUE to show the button, FALSE to hide the button.
|
||||
*/
|
||||
static VOID SetupShowWizardButton(
|
||||
VOID SetupShowWizardButton(
|
||||
_In_ HWND ParentWindowHandle,
|
||||
_In_ INT ControlId,
|
||||
_In_ BOOLEAN ShowButton
|
||||
@@ -1034,7 +1037,7 @@ static VOID SetupShowWizardButton(
|
||||
}
|
||||
}
|
||||
|
||||
static VOID SetupEnableWizardButton(
|
||||
VOID SetupEnableWizardButton(
|
||||
_In_ HWND ParentWindowHandle,
|
||||
_In_ INT ControlId,
|
||||
_In_ BOOLEAN ShowButton
|
||||
@@ -1048,7 +1051,7 @@ static VOID SetupEnableWizardButton(
|
||||
}
|
||||
}
|
||||
|
||||
static VOID SetupSetWizardButtonText(
|
||||
VOID SetupSetWizardButtonText(
|
||||
_In_ HWND ParentWindowHandle,
|
||||
_In_ INT ControlId,
|
||||
_In_ PCWSTR Text
|
||||
@@ -1057,10 +1060,12 @@ static VOID SetupSetWizardButtonText(
|
||||
HWND buttonHandle;
|
||||
|
||||
if (buttonHandle = GetDlgItem(ParentWindowHandle, ControlId))
|
||||
{
|
||||
SetWindowText(buttonHandle, Text);
|
||||
}
|
||||
}
|
||||
|
||||
static BOOLEAN SetupCancelWizard(
|
||||
BOOLEAN SetupCancelWizard(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ PPH_SETUP_CONTEXT Context
|
||||
)
|
||||
@@ -1069,7 +1074,7 @@ static BOOLEAN SetupCancelWizard(
|
||||
return TRUE;
|
||||
|
||||
if (PhShowMessage2(
|
||||
GetParent(WindowHandle),
|
||||
Context->ParentWindowHandle,
|
||||
TD_YES_BUTTON | TD_NO_BUTTON,
|
||||
TD_WARNING_ICON,
|
||||
L"Cancel Setup?",
|
||||
@@ -1093,7 +1098,7 @@ static BOOLEAN SetupCancelWizard(
|
||||
* \param ShowFinish TRUE to show the Finish button.
|
||||
* \param ShowCancel TRUE to show the Cancel button.
|
||||
*/
|
||||
static VOID SetupSetWizardButtons(
|
||||
VOID SetupSetWizardButtons(
|
||||
_In_ HWND WindowHandle,
|
||||
_In_ DWORD Buttons,
|
||||
_In_ BOOLEAN ShowBack,
|
||||
@@ -1157,8 +1162,11 @@ INT_PTR CALLBACK SetupWelcomePageDlgProc(
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
PhCenterWindow(GetParent(WindowHandle), NULL);
|
||||
SetupInitializeWizardTitleFont(WindowHandle, TRUE);
|
||||
context->DialogHandle = WindowHandle;
|
||||
context->ParentWindowHandle = GetParent(WindowHandle);
|
||||
|
||||
PhCenterWindow(context->ParentWindowHandle, NULL);
|
||||
SetupInitializeWizardTitleFont(context, WindowHandle, TRUE);
|
||||
SetupLoadWelcomeBitmap(WindowHandle);
|
||||
SetupApplyDarkModeToPage(WindowHandle);
|
||||
|
||||
@@ -1166,7 +1174,7 @@ INT_PTR CALLBACK SetupWelcomePageDlgProc(
|
||||
|
||||
if (!PhGetOwnTokenAttributes().Elevated)
|
||||
{
|
||||
Button_SetElevationRequiredState(GetDlgItem(GetParent(WindowHandle), IDC_PROPSHEET_NEXT), TRUE);
|
||||
Button_SetElevationRequiredState(GetDlgItem(context->ParentWindowHandle, IDC_PROPSHEET_NEXT), TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1197,7 +1205,7 @@ INT_PTR CALLBACK SetupWelcomePageDlgProc(
|
||||
{
|
||||
if (!context->SetupIsLegacyUpdate && NT_SUCCESS(SetupLegacySetupInstalled()))
|
||||
{
|
||||
SetupShowMessagePromptForLegacyVersion();
|
||||
//SetupShowMessagePromptForLegacyVersion();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1247,18 +1255,22 @@ INT_PTR CALLBACK SetupWelcomePageDlgProc(
|
||||
SetupRedrawEditBorder(WindowHandle);
|
||||
break;
|
||||
case WM_ERASEBKGND:
|
||||
if (SetupWizardDarkMode)
|
||||
{
|
||||
SetupPaintDarkBackground(WindowHandle, (HDC)wParam);
|
||||
return TRUE;
|
||||
if (SetupWizardDarkMode)
|
||||
{
|
||||
SetupPaintDarkBackground(WindowHandle, (HDC)wParam);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
case WM_CTLCOLOREDIT:
|
||||
if (SetupWizardDarkMode)
|
||||
return SetupHandleDarkControlColor(wParam, lParam);
|
||||
{
|
||||
if (SetupWizardDarkMode)
|
||||
return SetupHandleDarkControlColor(wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_NCDESTROY:
|
||||
SetupDestroyWizardPage(WindowHandle);
|
||||
@@ -1292,7 +1304,7 @@ INT_PTR CALLBACK SetupConfigPageDlgProc(
|
||||
context = (PPH_SETUP_CONTEXT)page->lParam;
|
||||
PhSetWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT, context);
|
||||
|
||||
SetupInitializeWizardTitleFont(WindowHandle, FALSE);
|
||||
SetupInitializeWizardTitleFont(context, WindowHandle, FALSE);
|
||||
SetupApplyDarkModeToPage(WindowHandle);
|
||||
SetDlgItemText(WindowHandle, IDC_PATH, PhGetStringOrEmpty(context->SetupInstallPath));
|
||||
}
|
||||
@@ -1421,9 +1433,10 @@ INT_PTR CALLBACK SetupInstallPageDlgProc(
|
||||
{
|
||||
LPPROPSHEETPAGE page = (LPPROPSHEETPAGE)lParam;
|
||||
context = (PPH_SETUP_CONTEXT)page->lParam;
|
||||
|
||||
PhSetWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT, context);
|
||||
|
||||
SetupInitializeWizardTitleFont(WindowHandle, FALSE);
|
||||
SetupInitializeWizardTitleFont(context, WindowHandle, FALSE);
|
||||
SetupApplyDarkModeToPage(WindowHandle);
|
||||
SendMessage(GetDlgItem(WindowHandle, IDC_PROGRESS), PBM_SETMARQUEE, TRUE, 0);
|
||||
}
|
||||
@@ -1471,12 +1484,12 @@ INT_PTR CALLBACK SetupInstallPageDlgProc(
|
||||
break;
|
||||
case SETUP_SHOWFINAL:
|
||||
{
|
||||
PropSheet_SetCurSel(GetParent(WindowHandle), NULL, SETUP_WIZARD_COMPLETED_PAGE_INDEX);
|
||||
PropSheet_SetCurSel(context->ParentWindowHandle, NULL, SETUP_WIZARD_COMPLETED_PAGE_INDEX);
|
||||
}
|
||||
break;
|
||||
case SETUP_SHOWERROR:
|
||||
{
|
||||
PropSheet_SetCurSel(GetParent(WindowHandle), NULL, SETUP_WIZARD_ERROR_PAGE_INDEX);
|
||||
PropSheet_SetCurSel(context->ParentWindowHandle, NULL, SETUP_WIZARD_ERROR_PAGE_INDEX);
|
||||
}
|
||||
break;
|
||||
case WM_ERASEBKGND:
|
||||
@@ -1525,7 +1538,7 @@ INT_PTR CALLBACK SetupCompletedPageDlgProc(
|
||||
context = (PPH_SETUP_CONTEXT)page->lParam;
|
||||
PhSetWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT, context);
|
||||
|
||||
SetupInitializeWizardTitleFont(WindowHandle, TRUE);
|
||||
SetupInitializeWizardTitleFont(context, WindowHandle, TRUE);
|
||||
SetupApplyDarkModeToPage(WindowHandle);
|
||||
CheckDlgButton(WindowHandle, IDC_STARTAPP, BST_CHECKED);
|
||||
SetupLoadWelcomeBitmap(WindowHandle);
|
||||
@@ -1576,10 +1589,12 @@ INT_PTR CALLBACK SetupCompletedPageDlgProc(
|
||||
SetupRedrawEditBorder(WindowHandle);
|
||||
break;
|
||||
case WM_ERASEBKGND:
|
||||
if (SetupWizardDarkMode)
|
||||
{
|
||||
SetupPaintDarkBackground(WindowHandle, (HDC)wParam);
|
||||
return TRUE;
|
||||
if (SetupWizardDarkMode)
|
||||
{
|
||||
SetupPaintDarkBackground(WindowHandle, (HDC)wParam);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORDLG:
|
||||
@@ -1621,7 +1636,7 @@ INT_PTR CALLBACK SetupErrorPageDlgProc(
|
||||
context = (PPH_SETUP_CONTEXT)page->lParam;
|
||||
PhSetWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT, context);
|
||||
|
||||
SetupInitializeWizardTitleFont(WindowHandle, TRUE);
|
||||
SetupInitializeWizardTitleFont(context, WindowHandle, TRUE);
|
||||
SetupApplyDarkModeToPage(WindowHandle);
|
||||
SetupLoadWelcomeBitmap(WindowHandle);
|
||||
}
|
||||
@@ -1664,13 +1679,13 @@ INT_PTR CALLBACK SetupErrorPageDlgProc(
|
||||
}
|
||||
|
||||
SetupSetWizardButtons(WindowHandle, PSWIZB_BACK, TRUE, FALSE, FALSE, TRUE);
|
||||
SetupSetWizardButtonText(GetParent(WindowHandle), IDC_PROPSHEET_BACK, L"Retry");
|
||||
SetupSetWizardButtonText(context->ParentWindowHandle, IDC_PROPSHEET_BACK, L"Retry");
|
||||
}
|
||||
break;
|
||||
case PSN_QUERYCANCEL:
|
||||
return !SetupCancelWizard(WindowHandle, context);
|
||||
case PSN_WIZBACK:
|
||||
PropSheet_SetCurSel(GetParent(WindowHandle), NULL, 0);
|
||||
PropSheet_SetCurSel(context->ParentWindowHandle, NULL, 0);
|
||||
SetWindowLongPtr(WindowHandle, DWLP_MSGRESULT, -1);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1734,7 +1749,7 @@ LRESULT CALLBACK PvpPropSheetWndProc(
|
||||
case WM_DPICHANGED:
|
||||
{
|
||||
LRESULT result;
|
||||
RECT *suggestedRect = (RECT *)lParam;
|
||||
PRECT suggestedRect = (RECT *)lParam;
|
||||
|
||||
SetWindowPos(
|
||||
WindowHandle,
|
||||
@@ -1755,8 +1770,6 @@ LRESULT CALLBACK PvpPropSheetWndProc(
|
||||
|
||||
return result;
|
||||
}
|
||||
case WM_SETFONT:
|
||||
return 0;
|
||||
case WM_DESTROY:
|
||||
{
|
||||
SetupDeleteDarkMode();
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<Platform Name="x64" />
|
||||
<Platform Name="x86" />
|
||||
</Configurations>
|
||||
<Project Path="CustomSignTool.vcxproj" />
|
||||
<Project Path="CustomSignTool.vcxproj" Id="e8cd0a41-1537-4ea6-98ac-e80cd59c478e" />
|
||||
</Solution>
|
||||
|
||||
@@ -68,45 +68,45 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\phnt\include;..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>phlib.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\phnt\include;..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN64;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>phlib.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\phnt\include;..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>phlib.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\phnt\include;..\..\phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SystemInformerRoot)phnt\include;$(SystemInformerRoot)phlib\include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_PHLIB_;_WINDOWS;WIN64;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>phlib.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(SystemInformerRoot)phlib\bin\$(Configuration)$(PlatformArchitecture);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
+643
-239
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#pragma code_page(65001)
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user