diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index f80178a3ef11..4a8ffbfb0f5f 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -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 diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml new file mode 100644 index 000000000000..632429315fb9 --- /dev/null +++ b/.github/workflows/scan.yml @@ -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 diff --git a/.gitignore b/.gitignore index 9b792729af55..2f2b4b30498a 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,7 @@ # Visual C++ cache folders ipch/ .vs/ -*/packages/ +**/packages/ # Visual Studio profiler *.psess diff --git a/Directory.Build.props b/Directory.Build.props index f511532dc45e..48502580ddce 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,4 +4,10 @@ /d1trimfile:"$(MSBuildThisFileDirectory)\" %(AdditionalOptions) + + + + + + diff --git a/KSystemInformer/informer_debug.c b/KSystemInformer/informer_debug.c index d550ec70c13a..ea67f5bb75f3 100644 --- a/KSystemInformer/informer_debug.c +++ b/KSystemInformer/informer_debug.c @@ -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, diff --git a/SystemInformer.natvis b/SystemInformer.natvis index 3c5f79d651d8..45768dfd2de0 100644 --- a/SystemInformer.natvis +++ b/SystemInformer.natvis @@ -1,3 +1,4 @@ + - diff --git a/SystemInformer/actions.c b/SystemInformer/actions.c index fa8cadf8b621..9316d4a19de3 100644 --- a/SystemInformer/actions.c +++ b/SystemInformer/actions.c @@ -5942,7 +5942,7 @@ BOOLEAN PhUiSetAttributesHandle( if (NT_SUCCESS(status = PhOpenProcess( &processHandle, - PROCESS_QUERY_LIMITED_INFORMATION, + PROCESS_SET_INFORMATION, ProcessId ))) { diff --git a/SystemInformer/prpghndl.c b/SystemInformer/prpghndl.c index d1682152ae09..fd9e97fde0fb 100644 --- a/SystemInformer/prpghndl.c +++ b/SystemInformer/prpghndl.c @@ -81,7 +81,6 @@ VOID PhpInitializeHandleMenu( _Inout_ PPH_HANDLES_CONTEXT HandlesContext ) { - PPH_EMENU_ITEM item; KPH_LEVEL level; if (NumberOfHandles == 0) @@ -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)) { diff --git a/packages.config b/packages.config new file mode 100644 index 000000000000..723e19b7fb99 --- /dev/null +++ b/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/phlib/theme.c b/phlib/theme.c index e0086a9eaf99..b7e15375f05d 100644 --- a/phlib/theme.c +++ b/phlib/theme.c @@ -1884,6 +1884,8 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar( break; } + BOOLEAN isDropDown = !!(buttonInfo.fsStyle & BTNS_WHOLEDROPDOWN); + //if (isMouseDown) //{ // SetTextColor(DrawInfo->nmcd.hdc, PhThemeWindowTextColor); @@ -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); @@ -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; } @@ -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 @@ -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, diff --git a/plugins/ToolStatus/toolbar.c b/plugins/ToolStatus/toolbar.c index ceb40253b7e7..88e26d9f294d 100644 --- a/plugins/ToolStatus/toolbar.c +++ b/plugins/ToolStatus/toolbar.c @@ -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; }