Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DartVanya committed Aug 13, 2024
2 parents 4e34a21 + bf8ec2c commit c8299cb
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 29 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Nuget Packages
run: nuget restore .\packages.config -PackagesDirectory .\packages\
- name: Build Solution
shell: cmd
working-directory: ${{github.workspace}}
run: build\build_verbose.cmd
# temporarily disabled pending resolution of:
# https://github.com/winsiderss/systeminformer/issues/2109
# https://github.com/actions/runner-images/issues/10012
#build_driver:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build Driver
# shell: cmd
# working-directory: ${{github.workspace}}
# run: build\build_zdriver.cmd prefast
build_driver:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Nuget Packages
run: nuget restore .\packages.config -PackagesDirectory .\packages\
- name: Build Driver
shell: cmd
working-directory: ${{github.workspace}}
run: build\build_zdriver.cmd prefast
47 changes: 47 additions & 0 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "CodeQL Analysis"

on:
workflow_dispatch:
schedule:
- cron: '00 16 * * 1'

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze_driver:
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install Nuget Packages
run: nuget restore .\packages.config -PackagesDirectory .\packages\
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp
packs: microsoft/windows-drivers
- name: Build Driver
shell: cmd
working-directory: ${{github.workspace}}
run: build\build_zdriver.cmd
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:cpp"
output: sarif-results
upload: failure-only
- name: Filter CodeQL Results
uses: advanced-security/filter-sarif@v1
with:
# Exclude Microsoft and third party sources
patterns: -packages/**/*
input: sarif-results/cpp.sarif
output: sarif-results/cpp.sarif
- name: Upload CodeQL Results
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: sarif-results/cpp.sarif
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Visual C++ cache folders
ipch/
.vs/
*/packages/
**/packages/

# Visual Studio profiler
*.psess
Expand Down
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
<AdditionalOptions>/d1trimfile:"$(MSBuildThisFileDirectory)\" %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="packages\Microsoft.Windows.SDK.CPP.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.props')"/>
<Import Project="packages\Microsoft.Windows.SDK.CPP.x86.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.x86.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.x86.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.x86.props') and '$(Platform)' == 'Win32'"/>
<Import Project="packages\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.x64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.x64.props') and '$(Platform)' == 'x64'"/>
<Import Project="packages\Microsoft.Windows.SDK.CPP.arm64.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.arm64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.arm64.10.0.26100.1\build\native\Microsoft.Windows.SDK.cpp.arm64.props') and '$(Platform)' == 'ARM64'"/>
<Import Project="packages\Microsoft.Windows.WDK.x64.10.0.26100.1\build\native\Microsoft.Windows.WDK.x64.props" Condition="Exists('packages\Microsoft.Windows.WDK.x64.10.0.26100.1\build\native\Microsoft.Windows.WDK.x64.props') and '$(Platform)' == 'x64'"/>
<Import Project="packages\Microsoft.Windows.WDK.arm64.10.0.26100.1\build\native\Microsoft.Windows.WDK.arm64.props" Condition="Exists('packages\Microsoft.Windows.WDK.arm64.10.0.26100.1\build\native\Microsoft.Windows.WDK.arm64.props') and '$(Platform)' == 'ARM64'"/>
</Project>
4 changes: 4 additions & 0 deletions KSystemInformer/informer_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ VOID KphpDebugPrintFlush(
* \param SystemArgument1 Unused
* \param SystemArgument2 Unused
*/
_Function_class_(KDEFERRED_ROUTINE)
_IRQL_requires_max_(DISPATCH_LEVEL)
_IRQL_requires_min_(DISPATCH_LEVEL)
_IRQL_requires_(DISPATCH_LEVEL)
_IRQL_requires_same_
VOID KphpDebugPrintDpc(
_In_ PKDPC Dpc,
Expand Down
2 changes: 1 addition & 1 deletion SystemInformer.natvis
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
Expand All @@ -7,7 +8,6 @@ Authors:
jxy-s 2024
-->
<?xml version="1.0" encoding="utf-8"?>

<!-- Debugger Visualizers -->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
Expand Down
2 changes: 1 addition & 1 deletion SystemInformer/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -5942,7 +5942,7 @@ BOOLEAN PhUiSetAttributesHandle(

if (NT_SUCCESS(status = PhOpenProcess(
&processHandle,
PROCESS_QUERY_LIMITED_INFORMATION,
PROCESS_SET_INFORMATION,
ProcessId
)))
{
Expand Down
11 changes: 0 additions & 11 deletions SystemInformer/prpghndl.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ VOID PhpInitializeHandleMenu(
_Inout_ PPH_HANDLES_CONTEXT HandlesContext
)
{
PPH_EMENU_ITEM item;
KPH_LEVEL level;

if (NumberOfHandles == 0)
Expand All @@ -106,18 +105,8 @@ VOID PhpInitializeHandleMenu(
PhEnableEMenuItem(Menu, ID_HANDLE_COPY, TRUE);
}

// Remove irrelevant menu items.

level = KsiLevel();

if (level >= KphLevelMed)
{
if (item = PhFindEMenuItem(Menu, 0, NULL, ID_HANDLE_PROTECTED))
PhDestroyEMenuItem(item);
if (item = PhFindEMenuItem(Menu, 0, NULL, ID_HANDLE_INHERIT))
PhDestroyEMenuItem(item);
}

// Protected, Inherit
if (NumberOfHandles == 1 && (level >= KphLevelMed))
{
Expand Down
9 changes: 9 additions & 0 deletions packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.SDK.CPP" version="10.0.26100.1" targetFramework="native" />
<package id="Microsoft.Windows.SDK.CPP.x86" version="10.0.26100.1" targetFramework="native" />
<package id="Microsoft.Windows.SDK.CPP.x64" version="10.0.26100.1" targetFramework="native" />
<package id="Microsoft.Windows.SDK.CPP.arm64" version="10.0.26100.1" targetFramework="native" />
<package id="Microsoft.Windows.WDK.x64" version="10.0.26100.1" targetFramework="native" />
<package id="Microsoft.Windows.WDK.arm64" version="10.0.26100.1" targetFramework="native" />
</packages>
30 changes: 26 additions & 4 deletions phlib/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,8 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
break;
}

BOOLEAN isDropDown = !!(buttonInfo.fsStyle & BTNS_WHOLEDROPDOWN);

//if (isMouseDown)
//{
// SetTextColor(DrawInfo->nmcd.hdc, PhThemeWindowTextColor);
Expand Down Expand Up @@ -1951,9 +1953,15 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
// break;
//}

BOOLEAN isPressed = buttonInfo.fsState & TBSTATE_PRESSED;
SetTextColor(DrawInfo->nmcd.hdc, PhThemeWindowTextColor); // RGB(0x0, 0x0, 0x0));
//SetDCBrushColor(DrawInfo->nmcd.hdc, PhThemeWindowBackgroundColor); // GetSysColor(COLOR_3DFACE));// RGB(0xff, 0xff, 0xff));
FillRect(DrawInfo->nmcd.hdc, &DrawInfo->nmcd.rc, PhThemeWindowBackgroundBrush);
if (!isPressed)
FillRect(DrawInfo->nmcd.hdc, &DrawInfo->nmcd.rc, PhThemeWindowBackgroundBrush);
else {
SetDCBrushColor(DrawInfo->nmcd.hdc, RGB(0x60, 0x60, 0x60));
FillRect(DrawInfo->nmcd.hdc, &DrawInfo->nmcd.rc, GetStockBrush(DC_BRUSH));
}
}

dpiValue = PhGetWindowDpi(DrawInfo->nmcd.hdr.hwndFrom);
Expand Down Expand Up @@ -1984,7 +1992,7 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
}
else
{
x = DrawInfo->nmcd.rc.left + ((DrawInfo->nmcd.rc.right - DrawInfo->nmcd.rc.left) - bitmapWidth) / 2;
x = DrawInfo->nmcd.rc.left + ((DrawInfo->nmcd.rc.right - DrawInfo->nmcd.rc.left) - bitmapWidth) / 2 - (isDropDown * 4);
y = DrawInfo->nmcd.rc.top + ((DrawInfo->nmcd.rc.bottom - DrawInfo->nmcd.rc.top) - bitmapHeight) / 2;
}

Expand All @@ -1996,7 +2004,21 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
y,
ILD_NORMAL,
!isEnabled
);
);

if (isDropDown)
{
HDC hdc = DrawInfo->nmcd.hdc;
LPRECT rc = &DrawInfo->nmcd.rc;
int triangleLeft = rc->right - 11, triangleTop = (rc->bottom - rc->top) / 2 - 2;
POINT vertices[] = { {triangleLeft, triangleTop}, {triangleLeft + 6, triangleTop}, {triangleLeft + 3, triangleTop + 3} };
SetDCPenColor(hdc, RGB(0xDE, 0xDE, 0xDE));
SetDCBrushColor(hdc, RGB(0xDE, 0xDE, 0xDE));
SelectObject(hdc, GetStockObject(DC_PEN));
SelectObject(hdc, GetStockObject(DC_BRUSH));
Polygon(hdc, vertices, _countof(vertices));
}
//return CDRF_SKIPDEFAULT | CDRF_NOTIFYPOSTPAINT;
}
}
else
Expand All @@ -2016,7 +2038,7 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
(LPARAM)buttonText
);

textRect.left += bitmapWidth; // PhGetDpi(10, dpiValue);
textRect.left += bitmapWidth - (isDropDown * 12); // PhGetDpi(10, dpiValue);
DrawText(
DrawInfo->nmcd.hdc,
buttonText,
Expand Down
5 changes: 5 additions & 0 deletions plugins/ToolStatus/toolbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ VOID RebarCreateOrUpdateWindow(
if (StatusBarHandle && IsWindowVisible(StatusBarHandle))
ShowWindow(StatusBarHandle, SW_HIDE);
}
if (!!PhGetIntegerSetting(L"EnableThemeSupport")) {
HWND hTips = (HWND)SendMessage(ToolBarHandle, TB_GETTOOLTIPS, 0, 0);
if (hTips)
PhSetControlTheme(hTips, L"DarkMode_Explorer");
}

ToolbarInitialized = TRUE;
}
Expand Down

0 comments on commit c8299cb

Please sign in to comment.