From 19d12b22452ead76e57dd1a0490a08fad16690ae Mon Sep 17 00:00:00 2001 From: Peter Wagner Date: Tue, 8 Sep 2026 14:54:07 +0100 Subject: [PATCH] Bump to 8.0.16; add tests, docs, and CI fixes Bump library/package versions to 8.0.16 and update assembly/file versions. Add CONTRIBUTING.md and a detailed Source/Current/ROADMAP.md. Add a Tests project (xUnit) with multiple unit tests and global usings, include it in the solution, and add test project settings (not packable). Update several component READMEs and package metadata (descriptions, authors, repository/url, tags). Remove hard-coded .NET Framework HintPaths and enable UseWindowsForms where appropriate. Stop building the DirectX stub in CI and document it as not shipped. Adjust GitHub Actions: simplify test/pack steps, improve package packing/validation and PR zip handling. Misc: refine bug report template, tighten SECURITY.md, small code fixes (TabbedThumbnail events/OnTabbedThumbnailClosed), mark scratch/bugtest projects as non-packable, and add component Directory.Build props. Coherent set of maintainer, packaging, CI, docs, and test improvements. --- .github/ISSUE_TEMPLATE/bug_report.md | 37 +-- .github/workflows/README.md | 2 +- .github/workflows/ci.yml | 12 +- .github/workflows/pr-validation.yml | 9 +- .github/workflows/release.yml | 5 - CONTRIBUTING.md | 22 ++ Directory.Build.props | 4 +- README.md | 142 ++++----- SECURITY.md | 20 +- Source/Current/ROADMAP.md | 300 ++++++++++++++++++ .../BugTest/BugTest.csproj | 2 + .../Components/Core/Core.csproj | 12 +- .../Components/Core/Readme.md | 74 +---- .../Components/DirectX/README.md | 9 + .../Components/Directory.Build.props | 6 + .../ExtendedLinguisticServices.csproj | 14 +- .../ExtendedLinguisticServices/Readme.md | 74 +---- .../Components/Sensors/Readme.md | 74 +---- .../Components/Sensors/Sensors.csproj | 12 +- .../Components/Shell/Readme.md | 74 +---- .../Components/Shell/Shell.csproj | 18 +- .../Shell/Taskbar/TabbedThumbnail.cs | 9 + .../TabbedThumbnailClosingEventArgs.cs | 2 +- .../Components/ShellExtensions/Readme.md | 74 +---- .../ShellExtensions/ShellExtensions.csproj | 16 +- .../Components/WindowsAPICodePack/Readme.md | 1 + .../WindowsAPICodePack.csproj | 6 - .../Directory.Build.targets | 6 +- .../ScratchProject/ScratchProject.csproj | 2 + .../Tests/GlobalUsings.cs | 1 + .../Tests/KnownFoldersTests.cs | 32 ++ .../Tests/PropVariantTests.cs | 88 +++++ .../Tests/PropertyKeyTests.cs | 51 +++ .../Tests/SensorDescriptionAttributeTests.cs | 15 + .../Tests/SystemPropertiesTests.cs | 16 + .../Windows API CodePack/Tests/Tests.csproj | 32 ++ .../Windows API CodePack.sln | 16 + .../Windows API CodePack.slnx | 3 + 38 files changed, 720 insertions(+), 572 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 Source/Current/ROADMAP.md create mode 100644 Source/Current/Windows API CodePack/Components/DirectX/README.md create mode 100644 Source/Current/Windows API CodePack/Tests/GlobalUsings.cs create mode 100644 Source/Current/Windows API CodePack/Tests/KnownFoldersTests.cs create mode 100644 Source/Current/Windows API CodePack/Tests/PropVariantTests.cs create mode 100644 Source/Current/Windows API CodePack/Tests/PropertyKeyTests.cs create mode 100644 Source/Current/Windows API CodePack/Tests/SensorDescriptionAttributeTests.cs create mode 100644 Source/Current/Windows API CodePack/Tests/SystemPropertiesTests.cs create mode 100644 Source/Current/Windows API CodePack/Tests/Tests.csproj diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea78..9a5fa7b3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,38 +1,25 @@ --- name: Bug report -about: Create a report to help us improve +about: Report a problem in the Windows API Code Pack title: '' -labels: '' +labels: bug assignees: '' - --- **Describe the bug** -A clear and concise description of what the bug is. +A clear description of what went wrong. -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error +**To reproduce** +Minimal code or steps. **Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] +What you expected to happen. -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] +**Environment** +- Windows version / build: +- .NET TFM (e.g. net48, net10.0-windows): +- NuGet package ID and version (e.g. WindowsAPICodePackShell 8.0.15.2): +- App type: WinForms / WPF / other: **Additional context** -Add any other context about the problem here. +Exception text, screenshots, or a link to a small repro project. diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 6309c347..5ad14ce9 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -9,7 +9,7 @@ This repository includes comprehensive GitHub Actions workflows for building, te **Features:** - Builds all .NET projects (.NET Framework 4.6.2-4.8.1, .NET 8-10) -- Builds C++ DirectX project (x64, x86 platforms) +- DirectX stub is not built or packaged - Runs tests and uploads results - Validates NuGet package generation - Performs security scans diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21db4577..39fe4d87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,16 +89,10 @@ jobs: /p:InformationalVersion=${{ steps.set-version.outputs.full-version }}+${{ github.sha }} working-directory: . - - name: Build C++ DirectX project - run: | - msbuild "Source/Current/Windows API CodePack/Components/DirectX/DirectX.vcxproj" /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /p:PlatformToolset=v143 /verbosity:normal - working-directory: . - - - name: Run tests (if any) + - name: Run tests run: | dotnet test "${{ env.SOLUTION_PATH }}" --configuration ${{ matrix.configuration }} --platform ${{ matrix.platform }} --no-build --verbosity normal --logger trx --results-directory TestResults working-directory: . - continue-on-error: true - name: Upload test results uses: actions/upload-artifact@v4 @@ -149,9 +143,9 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Validate NuGet packages + - name: Restore and pack NuGet packages run: | - dotnet pack "${{ env.SOLUTION_PATH }}" --configuration Release --no-build --verbosity normal --output ./packages + dotnet pack "${{ env.SOLUTION_PATH }}" --configuration Release --verbosity normal --output ./packages working-directory: . - name: Validate package contents diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 753c0b05..bc1ed8b9 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -38,11 +38,6 @@ jobs: dotnet build "${{ env.SOLUTION_PATH }}" --configuration Release --no-restore --verbosity normal working-directory: . - - name: Build C++ DirectX project - run: | - msbuild "Source/Current/Windows API CodePack/Components/DirectX/DirectX.vcxproj" /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /verbosity:normal - working-directory: . - - name: Run code analysis run: | dotnet build "${{ env.SOLUTION_PATH }}" --configuration Release --no-restore --verbosity normal --property:RunAnalyzersDuringBuild=true @@ -135,7 +130,9 @@ jobs: New-Item -ItemType Directory -Path $extractPath -Force | Out-Null # Extract package - Expand-Archive -Path $package.FullName -DestinationPath $extractPath -Force + $zipPath = [System.IO.Path]::ChangeExtension($package.FullName, ".zip") + Copy-Item $package.FullName $zipPath -Force + Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force # Check for required files $nuspecFile = Get-ChildItem -Path $extractPath -Filter "*.nuspec" -Recurse diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bb8c2c2..83edf5a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -152,11 +152,6 @@ jobs: dotnet build "${{ env.SOLUTION_PATH }}" $buildProps working-directory: . - - name: Build C++ DirectX project - run: | - msbuild "Source/Current/Windows API CodePack/Components/DirectX/DirectX.vcxproj" /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:PlatformToolset=v143 /verbosity:normal - working-directory: . - - name: Pack NuGet packages run: | dotnet pack "${{ env.SOLUTION_PATH }}" --configuration Release --platform ${{ matrix.platform }} --no-build --verbosity normal --output ./packages diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..7b6d3c5e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,22 @@ +# Contributing + +Active development is under `Source/Current/Windows API CodePack`. `Source/Original` is an archive (legacy tests, full DirectX, original samples). + +## Build + +```powershell +dotnet restore "Source/Current/Windows API CodePack/Windows API CodePack.sln" +dotnet build "Source/Current/Windows API CodePack/Windows API CodePack.sln" -c Release +dotnet test "Source/Current/Windows API CodePack/Windows API CodePack.sln" -c Release +``` + +Requires a Windows machine (WinForms/WPF/COM Shell APIs). Supported library TFMs: `net462`–`net481` and `net8.0-windows` / `net9.0-windows` / `net10.0-windows`. + +## Pull requests + +- Prefer small, focused changes with tests when the behavior is unit-testable. +- Do not add machine-specific HintPaths or commit `bin`/`obj` outputs. +- DirectX in Current is an unshipped stub; do not expand it. See `Source/Current/Windows API CodePack/Components/DirectX/README.md`. +- Update `Changelog.md` for user-visible fixes and features. + +See [Source/Current/ROADMAP.md](Source/Current/ROADMAP.md) for planned work. diff --git a/Directory.Build.props b/Directory.Build.props index 5057db7a..878e5fb7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 8.0.15.2 - 8.0.15.2 + 8.0.16 + 8.0.16 \ No newline at end of file diff --git a/README.md b/README.md index a3570801..22b9a4cb 100644 --- a/README.md +++ b/README.md @@ -1,117 +1,83 @@ -# Microsoft Windows API Codepack +# Windows API Code Pack for .NET [![CI Build](https://github.com/Wagnerp/Windows-API-CodePack-NET/actions/workflows/ci.yml/badge.svg)](https://github.com/Wagnerp/Windows-API-CodePack-NET/actions/workflows/ci.yml) [![Release](https://github.com/Wagnerp/Windows-API-CodePack-NET/actions/workflows/release.yml/badge.svg)](https://github.com/Wagnerp/Windows-API-CodePack-NET/actions/workflows/release.yml) [![NuGet Version](https://img.shields.io/nuget/v/WindowsAPICodePackCore.svg)](https://www.nuget.org/packages/WindowsAPICodePackCore/) [![NuGet Downloads](https://img.shields.io/nuget/dt/WindowsAPICodePackCore.svg)](https://www.nuget.org/packages/WindowsAPICodePackCore/) -========================= +Managed wrappers for selected Windows Shell and desktop APIs, originally released by Microsoft as the Windows API Code Pack 1.1 and maintained here for modern .NET. -License -------- +**Active source:** [`Source/Current/Windows API CodePack`](Source/Current/Windows%20API%20CodePack) +**License:** MIT — see [LICENSE](LICENSE) +**Roadmap:** [Source/Current/ROADMAP.md](Source/Current/ROADMAP.md) · **Changes:** [Changelog.md](Changelog.md) -The library is not developed anymore by Microsoft and seems to have been left as 'free to use'. A clarification or update about the licence terms from Microsoft is welcome, however. - -Release notes -------------- +## Packages -This release has the latest bug fixes applied, including the fix for 64-bit exceptions. +| Package | Contents | +|---------|----------| +| [WindowsAPICodePack](https://www.nuget.org/packages/WindowsAPICodePack/) | Meta-package (all components) | +| [WindowsAPICodePackCore](https://www.nuget.org/packages/WindowsAPICodePackCore/) | Task Dialogs, power, network list, restart/recovery | +| [WindowsAPICodePackShell](https://www.nuget.org/packages/WindowsAPICodePackShell/) | Shell objects, Common File Dialogs, Explorer Browser, taskbar | +| [WindowsAPICodePackSensors](https://www.nuget.org/packages/WindowsAPICodePackSensors/) | Sensor platform | +| [WindowsAPICodePackExtendedLinguisticServices](https://www.nuget.org/packages/WindowsAPICodePackExtendedLinguisticServices/) | Extended Linguistic Services | +| [WindowsAPICodePackShellExtensions](https://www.nuget.org/packages/WindowsAPICodePackShellExtensions/) | Preview handlers and thumbnail providers | -Bugs ----- +**Target frameworks:** .NET Framework 4.6.2–4.8.1 and .NET 8 / 9 / 10 (`net*-windows`). Windows desktop (WinForms/WPF) only. -When you submit a bug: +DirectX from the original Code Pack is **not shipped** in 8.x. The Current tree keeps an unbuilt stub; see [`Components/DirectX/README.md`](Source/Current/Windows%20API%20CodePack/Components/DirectX/README.md). - - provide a short example code showing the bug - - describe the expected behavior/result - - if a pull request is applicable, please reference it +## Usage notes -Pull Requests -------------- +### TaskDialog and comctl32 v6 -I'll be glad to accept pull requests if they fix a bug or add a worthwhile feature. +If creating a `TaskDialog` throws `NotSupportedException` about comctl32.dll version 6, enable Common Controls v6 in the application manifest: +```xml + + + + + +``` -Usage notes ------------ +Visual Studio can cache the old DLL in-process; restart the IDE if the error persists after adding the manifest. -**TaskDialog** +### Authenticode signing -If you get the following exception when you instantiate a `TaskDialog`: +Optional during build. Disabled by default. -``` -An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.WindowsAPICodePack.dll +**Certificate file:** -Additional information: TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory. +```xml + + true + path\to\your\certificate.pfx + your-password + ``` -To fix it, create an application manifest and un-comment the following block section: +**Certificate store:** +```xml + + true + your-certificate-thumbprint + ``` - - -``` - -Note: you might have to restart Visual Studio as the DLLs seems to be cached in memory and rebuilding your project doesn't seem to be enough in some cases. - -**DirectX** - -The DirectX package will work under x86 and x64 configuration platforms but not for AnyCPU platform (because there is no such platform for C++/CLI projects). Consequently, the package will purposefully fail the build and tell you why it did. - -Note: package is here for historical reasons, it is highly recommended to use [SharpDX](http://sharpdx.org/) instead. - -**Authenticode Signing** - -The project supports Authenticode signing of DLLs to provide code integrity verification. To enable Authenticode signing during build: - -1. **Using a Certificate File (.pfx):** - ```xml - - true - path\to\your\certificate.pfx - your-password - - ``` - -2. **Using a Certificate from Certificate Store:** - ```xml - - true - your-certificate-thumbprint - - ``` - -3. **Via MSBuild Command Line:** - ```bash - dotnet build /p:EnableAuthenticodeSigning=true /p:CodeSigningCertificatePath="path\to\certificate.pfx" /p:CodeSigningCertificatePassword="password" - ``` - -**Requirements:** -- Windows SDK must be installed (SignTool.exe is required) -- A valid code signing certificate (either .pfx file or installed in certificate store) -- The certificate must be valid for code signing - -**Note:** Authenticode signing is disabled by default. You must explicitly enable it by setting `EnableAuthenticodeSigning=true`. The build will continue even if signing fails (with a warning), so you can build without a certificate for development purposes. -**GitHub Actions Workflow Support:** +Requires Windows SDK (`SignTool.exe`). The build continues with a warning if signing fails. For GitHub Actions, see [`.github/workflows/README.md`](.github/workflows/README.md) (`CODESIGN_CERTIFICATE_BASE64`, `CODESIGN_CERTIFICATE_PASSWORD`). -Authenticode signing is also supported in GitHub Actions workflows. To enable signing in release builds: +## Samples and original tree -1. Add your code signing certificate as a GitHub secret: - - `CODESIGN_CERTIFICATE_BASE64`: Base64-encoded PFX certificate file - - `CODESIGN_CERTIFICATE_PASSWORD`: Certificate password (if required) +- [`Source/Samples`](Source/Samples) — mix of modernized and legacy demos; prefer samples that reference `Source/Current`. +- [`Source/Original`](Source/Original) — archive of the Microsoft-era sources, tests, and full DirectX. -2. The release workflow will automatically sign all DLLs when these secrets are present. +## Contributing -See `.github/workflows/README.md` for detailed setup instructions. \ No newline at end of file +See [CONTRIBUTING.md](CONTRIBUTING.md). Bug reports should include Windows version, TFM, and package version ([template](.github/ISSUE_TEMPLATE/bug_report.md)). diff --git a/SECURITY.md b/SECURITY.md index bb6c3fd7..d36bfb27 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,18 +1,16 @@ # Security Policy -## Supported Versions +## Supported versions -Use this section to tell people about which versions of your project are -currently being supported with security updates. +| Version | Supported | +|---------|-----------| +| 8.0.x | Yes | +| Earlier | No | -| Version | Supported | -| ------- | ------------------ | -| 8.0.x | :white_check_mark: | +Security fixes are released on the current 8.0.x NuGet line. -## Reporting a Vulnerability +## Reporting a vulnerability -Use this section to tell people how to report a vulnerability. +Please use [GitHub Security Advisories](https://github.com/Wagnerp/Windows-API-CodePack-NET/security/advisories/new) for this repository. Do not open a public issue for unreleased vulnerabilities. -Tell them where to go, how often they can expect to get an update on a -reported vulnerability, what to expect if the vulnerability is accepted or -declined, etc. +You should receive an acknowledgement within a few days. If the report is accepted, a fix will be targeted for the next patch release when practical. If it is declined, we will explain why. diff --git a/Source/Current/ROADMAP.md b/Source/Current/ROADMAP.md new file mode 100644 index 00000000..c759cab9 --- /dev/null +++ b/Source/Current/ROADMAP.md @@ -0,0 +1,300 @@ +# Windows API Code Pack — Current Codebase Roadmap + +**Scope:** `Source/Current/Windows API CodePack` +**Audit date:** 2026-07-19 +**Library version at audit:** 8.0.15.2 + +This document is an audit-driven roadmap for improving, modernizing, and sustaining the active Code Pack. Items are prioritized **P0 → P2** and grouped by theme. Effort is approximate (S / M / L). + +--- + +## Executive summary + +`Current` is a solid multi-TFM modernization of the classic Windows API Code Pack (SDK-style projects, nullable, .NET 8–10, NuGet packaging, CI/release pipelines). The largest gaps are **no automated tests**, **legacy interop and UI coupling**, a **DirectX stub that misleads consumers**, and **ecosystem debt** (stale docs, broken samples, inconsistent package metadata). + +| Area | Health | Headline | +|------|--------|----------| +| Multi-TFM / packaging | Good | net462–481 + net8/9/10-windows; signed packages; meta-package | +| CI / release | Good− | Mature workflows; tests and some validation are no-ops/fragile | +| Code quality | Mixed | Nullable + XML docs on; heavy COM/`DllImport`/`Hashtable` legacy | +| Tests | Poor | Zero tests under Current | +| Samples / docs | Poor | Many samples broken; root README stale | +| DirectX | Deprecated | Empty native stub; not packaged | + +**Preserve:** TaskDialog, CommonFileDialogs, ExplorerBrowser (incl. search), Taskbar/JumpList/TabbedThumbnails, Shell property system, Sensors, ShellExtensions preview/thumbnail handlers, Authenticode signing support. + +--- + +## Component map + +| Component | Role | ~CS files | Notes | +|-----------|------|-----------|-------| +| **Core** | TaskDialog, power, network, AppRestartRecovery, PropVariant, SafeHandles | ~124 | `UseWindowsForms` may be broader than needed | +| **Shell** | Shell objects, dialogs, ExplorerBrowser, Taskbar, KnownFolders, DWM | ~335 | Largest surface; WPF + hard-coded WinForms refs | +| **ShellExtensions** | Preview / thumbnail COM handlers | ~69 | Same WinForms HintPath pattern as Shell | +| **Sensors** | Sensor API wrappers | ~93 | Recent NRE fix (#47) | +| **ExtendedLinguisticServices** | ELS / mapping services | ~75 | Niche; still useful | +| **WindowsAPICodePack** | Meta NuGet (all DLLs) | — | Best “one package” story | +| **DirectX** | Stub DLL | 0 CS | Not shipped; CI still builds it | +| **BugTest / ScratchProject** | Manual repro apps | — | Should not stay in shipping solution long-term | + +--- + +## P0 — Critical (trust, correctness, consumer clarity) + +### 1. Add automated tests under Current +**Effort:** L · **Why:** No regression gate; CI “Run tests” is effectively a no-op (`continue-on-error`). Recent bugs (ShellThumbnail COM lifetime, Sensors NRE, CommonFileDialog extension/name, ExplorerBrowser focus) are high-value regression cases. + +**Actions:** +- Create `Source/Current/Windows API CodePack/Tests/` (xUnit or NUnit), TFMs at least `net48` + `net10.0-windows`. +- Port viable tests from `Source/Original/source/Tests/` (PropVariant, PropertyKey, KnownFolders, Sensors metadata, ELS). +- Add focused regression tests for Changelog-fixed issues (8.0.12–8.0.15.x). +- Wire into `Windows API CodePack.slnx` and make CI fail on test failure. + +### 2. Fix Shell / ShellExtensions WinForms references +**Effort:** S · **Why:** Hard-coded HintPaths to .NET Framework 4.8.1 reference assemblies break portable/CI-clean builds and fight SDK-style TFMs: + +```xml + + + C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8.1\... + +``` + +**Actions:** +- Prefer `true` (and keep `UseWPF`) instead of absolute HintPaths. +- Verify multi-TFM build (net462–net481 and net*-windows) without machine-specific paths. + +### 3. Clarify / retire DirectX in Current +**Effort:** S · **Why:** `Components/DirectX` is an empty Win32 DLL stub (not C++/CLI). Root README still describes C++/CLI AnyCPU limits. Consumers are misled; CI spends matrix time building it; toolset mismatch (project v145 vs workflows often v143). + +**Actions:** +- Document clearly: DirectX is **not** in NuGet 8.x; recommend SharpDX / Vortice / Windows App SDK / Win2D as appropriate. +- Prefer removing stub + CI steps from Current (keep Original as archive), or stop building it in CI if retained for solution compatibility. + +### 4. Rewrite consumer-facing documentation +**Effort:** M · **Why:** Root `README.md` and component `Readme.md` files still read like the Microsoft-era pack (empty “Current Version”, 64-bit exception headline, DirectX C++/CLI notes). License on disk is MIT (Wagner modifications); README still hedges as if unclear. + +**Actions:** +- Document: active path (`Source/Current`), NuGet IDs, supported TFMs, Windows requirements, samples status. +- Point to `Changelog.md`, this roadmap, and workflow docs. +- Refresh NuGet package **Description** fields (several still say “Windows Forms Development in the 1.1 version, released by Microsoft in 2009” despite .NET 8–10 support). +- Fix package metadata inconsistencies (`RepositoryUrl` is literally `git` on Core/meta; Authors = package title). + +### 5. Fix fragile CI packaging validation +**Effort:** S · **Why:** `package-validation` packing with `--no-build` in a separate job without artifacts is unreliable; PR nupkg “zip” validation is suspect. + +**Actions:** +- Pack in the build job or pass artifacts between jobs. +- Validate packages with `dotnet nuget` / proper tooling, not ad-hoc zip assumptions. + +--- + +## P1 — High value (maintainability & modernization) + +### 6. Modernize P/Invoke surface +**Effort:** L · **Evidence:** ~127 `DllImport`, **0** `LibraryImport`; only **4** SafeHandle types; ~62 `Marshal.ReleaseComObject`. + +**Actions:** +- Migrate declarations to `[LibraryImport]` / source-generated interop where TFMs allow (net8+), with dual-path or polyfills for net462+. +- Evaluate **CsWin32** for new/changed APIs to reduce hand-written marshalling bugs. +- Expand SafeHandle usage (icons, windows, GDI objects, shell item lifetimes) beyond `SafeIconHandle` / `SafeWindowHandle` / `SafeRegionHandle`. +- Prefer `Marshal.FinalReleaseComObject` / careful RCW ownership patterns; audit sites that release COM while still referenced (ShellThumbnail parent-ref pattern is the template). + +### 7. Reduce UI-framework coupling +**Effort:** L · **Why:** Core/Sensors/ELS force `UseWindowsForms`; Shell forces WPF + WinForms. That pulls desktop UI stacks into consumers who only want TaskDialog, Jump Lists, or KnownFolders. + +**Actions (incremental):** +- Split or multi-target: e.g. `Core` APIs that don’t need WinForms vs dialog hosts. +- Consider optional packages: `WindowsAPICodePack.Shell.WinForms` / `.Wpf` vs a thinner Shell.Interop core. +- Ensure `System.Drawing` usage is intentional (`System.Drawing.Common` implications on modern .NET). + +### 8. Replace legacy collections & CAS leftovers +**Effort:** M · **Evidence:** ~38 `Hashtable` usages (notably generated `StronglyTypedProperties.cs`), ~6 `ArrayList`; `PowerManager` disables `SYSLIB0003` (CAS); obsolete `ClassInterfaceType.AutoDual` on ExplorerBrowser view events; ~982 SuppressMessage hits (many legacy FxCop/LinkDemand). + +**Actions:** +- Replace `Hashtable`/`ArrayList` with `Dictionary<,>` / `List<>` in hand-written code; regenerate property wrappers with modern collections. +- Remove CAS/`SecurityPermission` demands where obsolete on .NET Core+; keep netfx behavior documented if needed. +- Prune `GlobalSuppressions` (Shell’s file alone ~199 KB) — many CA2122/LinkDemand rules are irrelevant on modern runtimes. + +### 9. Address known incomplete / risky Shell APIs +**Effort:** M · **Examples:** +- `StronglyTypedProperties.cs` — **~14k lines**, marked `// TODO: FIX THIS!!!`, Hashtable-backed cache. +- `SystemProperties.cs` — **~10k lines** of generated property keys; keep as generated, improve generator. +- `ShellItemArrayWrapper` — most `IShellItemArray` members throw `NotImplementedException`. +- `ShellLibrary` — several `NotImplementedException` paths. +- `TaskbarWindow.WindowToTellTaskbarAbout` — open TODO: throws `InvalidOperationException` in valid construction races. +- `TabbedThumbnailManager` — TODO around `SetImage(IntPtr.Zero)`. +- `IEntity.cs` — empty `// TODO`. + +**Actions:** +- Triage: implement, obsolete, or document “partial COM surface” per type. +- Fix TaskbarWindow title/proxy logic with tests (aligns with active TabbedThumbnail work). +- Move property-system generation to an explicit tool/script in-repo so `FIX THIS` isn’t tribal knowledge. + +### 10. Migrate and catalog samples +**Effort:** L · **Why:** Mix of modernized SDK samples and broken .NET 3.5 / wrong project-reference samples. + +**Actions:** +- Add `Source/Samples/README.md` with status matrix (✅ / 🔧 / ❌). +- Fix broken ExplorerBrowser demos that reference non-existent split Shell projects. +- Prioritize migrating: TaskDialog, CommonFileDialogs, Taskbar, KnownFolders, ShellThumbnail. +- Add `net10.0-windows` to modernized samples for parity. +- Optional CI job building a curated samples solution. + +### 11. Retire BugTest / ScratchProject from the product solution +**Effort:** S · **Why:** Manual repro harnesses duplicate ShellThumbnail scenarios; not automated tests. + +**Actions:** +- Fold scenarios into Tests; move leftovers to an internal/samples folder or delete. +- Keep `IsPackable=false`; exclude from release packaging. + +### 12. Align versioning story +**Effort:** S · **Why:** Packages use 4-part versions (`8.0.15.2`); docs describe semver 3-part; version-increment workflow examples are stale. + +**Actions:** +- Pick one scheme and document it in `.github/VERSIONING.md`. +- Keep `Directory.Build.props` / targets / NuGet / assembly versions aligned (already a past pain point). + +### 13. Security & contribution hygiene +**Effort:** S +**Actions:** +- Replace boilerplate `SECURITY.md` with reporting channel + supported versions. +- Add `CONTRIBUTING.md` (build Current, TFMs, samples policy, PR expectations). +- Windows/.NET-focused issue templates (OS build, TFM, package version, minimal repro). + +### 14. Local build parity +**Effort:** S +**Actions:** +- Add root `build.ps1` (`restore` / `build` / `test` / `pack` / optional sign) matching CI. +- Document dual `.sln` vs `.slnx` or consolidate. + +### 15. Dependency cleanup +**Effort:** S +**Actions:** +- Revisit `Microsoft.NETCore.Platforms` 7.0.4 on Core/Sensors/ELS — often unnecessary on modern SDKs. +- Enable consistent analyzers (`AnalysisLevel`, nullable warnings as errors in CI for net8+ first). + +--- + +## P2 — Enhancements & future API surface + +### 16. Feature enhancements (product) +| Idea | Notes | +|------|--------| +| **Win11 taskbar / Jump List polish** | Validate against current Shell behavior; document limitations vs WinUI/WASDK | +| **IFileDialog customization** | More CommonFileDialog controls / events parity with native dialogs | +| **ExplorerBrowser** | Continue search/navigation/event work (#14, #20, #21, #40); keyboard/focus edge cases | +| **Shell property keys** | Refresh PKEY set for newer Windows properties; keep generation pipeline | +| **Async APIs** | Optional `*Async` wrappers for long Shell ops / ELS mapping where useful | +| **WinRT / Windows App SDK interop notes** | Not necessarily reimplement — document when to use WASDK vs Code Pack | +| **Dark mode / DWM** | Optional helpers for modern glass/backdrop where DWM APIs still apply | +| **AOT / trimming guidance** | Library is COM-heavy; publish trim/AOT warnings and supported scenarios rather than claiming full AOT | + +### 17. Packaging / architecture experiments +- Source-link + deterministic builds verification. +- Separate “interop-only” package without WPF/WinForms for advanced consumers. +- Public API analyzers (`Microsoft.CodeAnalysis.PublicApiAnalyzers`) to catch breaking changes intentionally (PR workflow already has heuristics). + +### 18. ELS & Sensors longevity +- Document Windows platform support (Sensors API availability varies). +- Keep Sensors enumeration defensive (post-#47). +- ELS: consider deprecation notice if usage is near-zero, or refresh samples. + +### 19. VB samples policy +- Migrate top VB demos **or** formally deprecate and link C# equivalents. + +### 20. Housekeeping +- Remove deprecated `build.yml` if unused; refresh `WORKFLOW_STATUS.md`. +- Deduplicate component NuGet readmes (component-specific content, not copy-paste root). +- Archive note at top of `Source/Original` (“read-only; tests/DirectX live here historically”). + +--- + +## Suggested phasing + +### Phase A — Stabilize (in progress) + +1. Tests + blocking CI +2. Shell WinForms HintPath fix +3. DirectX docs/removal from CI +4. README + NuGet description/metadata fix +5. CI pack validation fix + +### Phase B — Harden (2–4 releases) +6. Port Original tests + regression suite +7. TaskbarWindow / TabbedThumbnail TODOs +8. Sample migration wave 1 +9. LibraryImport pilot on Core native methods +10. Retire ScratchProject/BugTest + +### Phase C — Modernize (ongoing) +11. Property-system generator rewrite +12. UI framework package split exploration +13. Suppressions / Hashtable cleanup +14. Optional async / Win11 polish +15. Public API analyzer + samples CI + +--- + +## Metrics to track + +| Metric | Current (audit) | Target | +|--------|-----------------|--------| +| Automated tests in Current | 0 | Growing suite; CI required | +| `LibraryImport` usage | 0 | Increasing share of new/changed P/Invokes | +| Broken samples (known) | Large share of `Source/Samples` | Curated set all ✅ | +| Hard-coded Framework HintPaths | 2 projects | 0 | +| DirectX in Current CI | Built | Removed or documented-only | +| Package Description accuracy | Stale (2009-era) | Matches TFMs & features | +| Open `TODO` / incomplete COM stubs | Several known | Triaged (fixed or documented) | + +--- + +## Strengths to keep + +- Active maintenance and Changelog discipline (ExplorerBrowser search, Authenticode, .NET 10, real bugfixes). +- Broad TFM matrix for desktop apps still on .NET Framework **and** modern .NET. +- Coherent component split + unified meta-package. +- XML documentation generation enabled on library projects. +- Nullable reference types enabled across components. +- Strong-name + optional Authenticode story for enterprise consumers. + +--- + +## Out of scope / non-goals (recommended) + +- Full reimplementation of Original DirectX C++/CLI in Current. +- Competing with Windows App SDK / WinUI for new app models — **interop and desktop WinForms/WPF** remain the niche. +- Breaking public API churn without PublicApi analyzer + major version bump. + +--- + +## Quick reference paths + +``` +Source/Current/Windows API CodePack/ +├── Components/ +│ ├── Core/ +│ ├── Shell/ +│ ├── ShellExtensions/ +│ ├── Sensors/ +│ ├── ExtendedLinguisticServices/ +│ ├── WindowsAPICodePack/ # meta-package +│ └── DirectX/ # stub — decide fate +├── BugTest/ # manual repro +├── ScratchProject/ # manual repro +├── Directory.Build.props|targets +└── Windows API CodePack.sln(x) + +Related (outside Current, but roadmap-relevant): +├── Source/Original/source/Tests/ # legacy tests to port +├── Source/Samples/ # mixed modern/broken +├── .github/workflows/ # CI/release +├── README.md / Changelog.md / SECURITY.md +└── Directory.Build.props # LibraryVersion +``` + +--- + +*This roadmap is a living document. Update priorities as releases ship and as DirectX / samples / test decisions are made.* diff --git a/Source/Current/Windows API CodePack/BugTest/BugTest.csproj b/Source/Current/Windows API CodePack/BugTest/BugTest.csproj index 3c867ca5..4fe8060c 100644 --- a/Source/Current/Windows API CodePack/BugTest/BugTest.csproj +++ b/Source/Current/Windows API CodePack/BugTest/BugTest.csproj @@ -8,6 +8,8 @@ enable preview preview + false + false diff --git a/Source/Current/Windows API CodePack/Components/Core/Core.csproj b/Source/Current/Windows API CodePack/Components/Core/Core.csproj index 06a4a471..3e2fdefc 100644 --- a/Source/Current/Windows API CodePack/Components/Core/Core.csproj +++ b/Source/Current/Windows API CodePack/Components/Core/Core.csproj @@ -16,7 +16,7 @@ True WindowsAPICodePackCore - This package contains the core binary for the Windows API Code Pack needed for Windows Forms Development in the 1.1 version, released by Microsoft in 2009. + Core Windows API Code Pack types: Task Dialogs, power management, network list, application restart/recovery, and property-system primitives. Targets .NET Framework 4.6.2–4.8.1 and .NET 8–10 (Windows). License.md @@ -26,12 +26,6 @@ Windows.png - https://github.com/Wagnerp/Windows-API-CodePack-NET - - git - - $(Title) - $(Title) True @@ -45,10 +39,6 @@ ..\..\..\..\..\Output\bin - - - - True diff --git a/Source/Current/Windows API CodePack/Components/Core/Readme.md b/Source/Current/Windows API CodePack/Components/Core/Readme.md index f08b1ecb..9d51a092 100644 --- a/Source/Current/Windows API CodePack/Components/Core/Readme.md +++ b/Source/Current/Windows API CodePack/Components/Core/Readme.md @@ -1,73 +1,7 @@ -Microsoft Windows API Codepack -========================= +# WindowsAPICodePackCore -README -====== +Task Dialogs, power management, network list, application restart/recovery, and property-system primitives (`PropertyKey`, `PropVariant`). -## Current Version +Install: `dotnet add package WindowsAPICodePackCore` - - -License -------- - -The library is not developed anymore by Microsoft and seems to have been left as 'free to use'. A clarification or update about the licence terms from Microsoft is welcome, however. - -Release notes -------------- - -This release has the latest bug fixes applied, including the fix for 64-bit exceptions. - -Bugs ----- - -When you submit a bug: - - - provide a short example code showing the bug - - describe the expected behavior/result - - if a pull request is applicable, please reference it - -Pull Requests -------------- - -I'll be glad to accept pull requests if they fix a bug or add a worthwhile feature. - - -Usage notes ------------ - -**TaskDialog** - -If you get the following exception when you instantiate a `TaskDialog`: - -``` -An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.WindowsAPICodePack.dll - -Additional information: TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory. -``` - -To fix it, create an application manifest and un-comment the following block section: - -``` - - -``` - -Note: you might have to restart Visual Studio as the DLLs seems to be cached in memory and rebuilding your project doesn't seem to be enough in some cases. - -**DirectX** - -The DirectX package will work under x86 and x64 configuration platforms but not for AnyCPU platform (because there is no such platform for C++/CLI projects). Consequently, the package will purposefully fail the build and tell you why it did. - -Note: package is here for historical reasons, it is highly recommended to use [SharpDX](http://sharpdx.org/) instead. \ No newline at end of file +See the [repository README](https://github.com/Wagnerp/Windows-API-CodePack-NET) for TFMs, TaskDialog (comctl32 v6) notes, and license. diff --git a/Source/Current/Windows API CodePack/Components/DirectX/README.md b/Source/Current/Windows API CodePack/Components/DirectX/README.md new file mode 100644 index 00000000..ac9fb6df --- /dev/null +++ b/Source/Current/Windows API CodePack/Components/DirectX/README.md @@ -0,0 +1,9 @@ +# DirectX component (not shipped) + +This folder is a **Win32 stub DLL**, not the original C++/CLI DirectX wrappers from the 2009 Code Pack. + +- It is **not** included in any NuGet package (`WindowsAPICodePack*` 8.x). +- CI does **not** build this project. +- The full historical implementation lives under `Source/Original`. + +For new work, use [Vortice](https://github.com/amerkoleci/Vortice.Windows), Windows App SDK / Win2D, or another maintained DirectX/.NET stack. SharpDX is unmaintained. diff --git a/Source/Current/Windows API CodePack/Components/Directory.Build.props b/Source/Current/Windows API CodePack/Components/Directory.Build.props index 73e59502..baba39cb 100644 --- a/Source/Current/Windows API CodePack/Components/Directory.Build.props +++ b/Source/Current/Windows API CodePack/Components/Directory.Build.props @@ -12,6 +12,12 @@ $(LibraryVersion) + Peter William Wagner + Copyright (c) Microsoft Corporation. Modifications copyright (c) Peter William Wagner. + https://github.com/Wagnerp/Windows-API-CodePack-NET + https://github.com/Wagnerp/Windows-API-CodePack-NET + git + windows;api;shell;taskdialog;winforms;wpf;win10;win11;sensors;explorer diff --git a/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/ExtendedLinguisticServices.csproj b/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/ExtendedLinguisticServices.csproj index 99132f1a..8fa2c64a 100644 --- a/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/ExtendedLinguisticServices.csproj +++ b/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/ExtendedLinguisticServices.csproj @@ -16,24 +16,16 @@ True WindowsAPICodePackExtendedLinguisticServices - - This package contains the extended linguistic services binary for the Windows API Code Pack needed for Windows Forms Development in the 1.1 version, released by Microsoft in 2009. - + Windows Extended Linguistic Services (language detection, transliteration, and related mapping services) for desktop apps. Targets .NET Framework 4.6.2–4.8.1 and .NET 8–10 (Windows). Windows.png - git - - https://github.com/Wagnerp/Windows-API-CodePack-NET - License.md True Readme.md - $(Title) - $(Title) True @@ -53,10 +45,6 @@ - - - - True diff --git a/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/Readme.md b/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/Readme.md index f08b1ecb..622ba027 100644 --- a/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/Readme.md +++ b/Source/Current/Windows API CodePack/Components/ExtendedLinguisticServices/Readme.md @@ -1,73 +1,7 @@ -Microsoft Windows API Codepack -========================= +# WindowsAPICodePackExtendedLinguisticServices -README -====== +Windows Extended Linguistic Services: language detection, transliteration, and mapping services. -## Current Version +Install: `dotnet add package WindowsAPICodePackExtendedLinguisticServices` - - -License -------- - -The library is not developed anymore by Microsoft and seems to have been left as 'free to use'. A clarification or update about the licence terms from Microsoft is welcome, however. - -Release notes -------------- - -This release has the latest bug fixes applied, including the fix for 64-bit exceptions. - -Bugs ----- - -When you submit a bug: - - - provide a short example code showing the bug - - describe the expected behavior/result - - if a pull request is applicable, please reference it - -Pull Requests -------------- - -I'll be glad to accept pull requests if they fix a bug or add a worthwhile feature. - - -Usage notes ------------ - -**TaskDialog** - -If you get the following exception when you instantiate a `TaskDialog`: - -``` -An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.WindowsAPICodePack.dll - -Additional information: TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory. -``` - -To fix it, create an application manifest and un-comment the following block section: - -``` - - -``` - -Note: you might have to restart Visual Studio as the DLLs seems to be cached in memory and rebuilding your project doesn't seem to be enough in some cases. - -**DirectX** - -The DirectX package will work under x86 and x64 configuration platforms but not for AnyCPU platform (because there is no such platform for C++/CLI projects). Consequently, the package will purposefully fail the build and tell you why it did. - -Note: package is here for historical reasons, it is highly recommended to use [SharpDX](http://sharpdx.org/) instead. \ No newline at end of file +See the [repository README](https://github.com/Wagnerp/Windows-API-CodePack-NET). diff --git a/Source/Current/Windows API CodePack/Components/Sensors/Readme.md b/Source/Current/Windows API CodePack/Components/Sensors/Readme.md index f08b1ecb..7a6e01e1 100644 --- a/Source/Current/Windows API CodePack/Components/Sensors/Readme.md +++ b/Source/Current/Windows API CodePack/Components/Sensors/Readme.md @@ -1,73 +1,7 @@ -Microsoft Windows API Codepack -========================= +# WindowsAPICodePackSensors -README -====== +Wrappers for the Windows Sensor Platform (ambient light, motion, and related types). -## Current Version +Install: `dotnet add package WindowsAPICodePackSensors` - - -License -------- - -The library is not developed anymore by Microsoft and seems to have been left as 'free to use'. A clarification or update about the licence terms from Microsoft is welcome, however. - -Release notes -------------- - -This release has the latest bug fixes applied, including the fix for 64-bit exceptions. - -Bugs ----- - -When you submit a bug: - - - provide a short example code showing the bug - - describe the expected behavior/result - - if a pull request is applicable, please reference it - -Pull Requests -------------- - -I'll be glad to accept pull requests if they fix a bug or add a worthwhile feature. - - -Usage notes ------------ - -**TaskDialog** - -If you get the following exception when you instantiate a `TaskDialog`: - -``` -An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.WindowsAPICodePack.dll - -Additional information: TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory. -``` - -To fix it, create an application manifest and un-comment the following block section: - -``` - - -``` - -Note: you might have to restart Visual Studio as the DLLs seems to be cached in memory and rebuilding your project doesn't seem to be enough in some cases. - -**DirectX** - -The DirectX package will work under x86 and x64 configuration platforms but not for AnyCPU platform (because there is no such platform for C++/CLI projects). Consequently, the package will purposefully fail the build and tell you why it did. - -Note: package is here for historical reasons, it is highly recommended to use [SharpDX](http://sharpdx.org/) instead. \ No newline at end of file +See the [repository README](https://github.com/Wagnerp/Windows-API-CodePack-NET). diff --git a/Source/Current/Windows API CodePack/Components/Sensors/Sensors.csproj b/Source/Current/Windows API CodePack/Components/Sensors/Sensors.csproj index 561d470f..07bbeca0 100644 --- a/Source/Current/Windows API CodePack/Components/Sensors/Sensors.csproj +++ b/Source/Current/Windows API CodePack/Components/Sensors/Sensors.csproj @@ -16,16 +16,10 @@ True WindowsAPICodePackSensors - - This package contains the sensors binary for the Windows API Code Pack needed for Windows Forms Development in the 1.1 version, released by Microsoft in 2009. - - - https://github.com/Wagnerp/Windows-API-CodePack-NET + Windows Sensor Platform wrappers (ambient light, motion, and related sensor types) for desktop apps. Targets .NET Framework 4.6.2–4.8.1 and .NET 8–10 (Windows). Windows.png - git - True License.md @@ -45,10 +39,6 @@ ..\..\..\..\..\Output\bin - - - - diff --git a/Source/Current/Windows API CodePack/Components/Shell/Readme.md b/Source/Current/Windows API CodePack/Components/Shell/Readme.md index f08b1ecb..7359ffd6 100644 --- a/Source/Current/Windows API CodePack/Components/Shell/Readme.md +++ b/Source/Current/Windows API CodePack/Components/Shell/Readme.md @@ -1,73 +1,7 @@ -Microsoft Windows API Codepack -========================= +# WindowsAPICodePackShell -README -====== +Windows Shell integration: Common File Dialogs, Explorer Browser, Known Folders, the property system, Jump Lists, and tabbed thumbnails. -## Current Version +Install: `dotnet add package WindowsAPICodePackShell` - - -License -------- - -The library is not developed anymore by Microsoft and seems to have been left as 'free to use'. A clarification or update about the licence terms from Microsoft is welcome, however. - -Release notes -------------- - -This release has the latest bug fixes applied, including the fix for 64-bit exceptions. - -Bugs ----- - -When you submit a bug: - - - provide a short example code showing the bug - - describe the expected behavior/result - - if a pull request is applicable, please reference it - -Pull Requests -------------- - -I'll be glad to accept pull requests if they fix a bug or add a worthwhile feature. - - -Usage notes ------------ - -**TaskDialog** - -If you get the following exception when you instantiate a `TaskDialog`: - -``` -An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.WindowsAPICodePack.dll - -Additional information: TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory. -``` - -To fix it, create an application manifest and un-comment the following block section: - -``` - - -``` - -Note: you might have to restart Visual Studio as the DLLs seems to be cached in memory and rebuilding your project doesn't seem to be enough in some cases. - -**DirectX** - -The DirectX package will work under x86 and x64 configuration platforms but not for AnyCPU platform (because there is no such platform for C++/CLI projects). Consequently, the package will purposefully fail the build and tell you why it did. - -Note: package is here for historical reasons, it is highly recommended to use [SharpDX](http://sharpdx.org/) instead. \ No newline at end of file +Requires Core. See the [repository README](https://github.com/Wagnerp/Windows-API-CodePack-NET). diff --git a/Source/Current/Windows API CodePack/Components/Shell/Shell.csproj b/Source/Current/Windows API CodePack/Components/Shell/Shell.csproj index ef956308..d688faf3 100644 --- a/Source/Current/Windows API CodePack/Components/Shell/Shell.csproj +++ b/Source/Current/Windows API CodePack/Components/Shell/Shell.csproj @@ -10,18 +10,14 @@ enable true + true WindowsAPICodePackShell - - This package contains the shell binary for the Windows API Code Pack needed for Windows Forms Development in the 1.1 version, released by Microsoft in 2009. - - https://github.com/Wagnerp/Windows-API-CodePack-NET + Windows Shell integration for WinForms and WPF: Common File Dialogs, Explorer Browser, Known Folders, Taskbar, Jump Lists, tabbed thumbnails, and the Shell property system. Targets .NET Framework 4.6.2–4.8.1 and .NET 8–10 (Windows). Windows.png - git True License.md Readme.md $(Title) - $(Authors) True WindowsAPICodePack.snk True @@ -34,16 +30,6 @@ - - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8.1\System.Windows.Forms.dll - - - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8.1\WindowsFormsIntegration.dll - - - True diff --git a/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnail.cs b/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnail.cs index 83b651be..0009fec6 100644 --- a/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnail.cs +++ b/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnail.cs @@ -360,6 +360,9 @@ public void InvalidatePreview() /// public event EventHandler? TabbedThumbnailClosed; + /// + /// The event that occurs when a tab is closing on the taskbar thumbnail preview. + /// public event EventHandler? TabbedThumbnailClosing; /// @@ -550,4 +553,10 @@ protected virtual void Dispose(bool disposing) } #endregion + + /// + /// Raises the event. + /// + /// The event arguments. + protected virtual void OnTabbedThumbnailClosed(TabbedThumbnailClosedEventArgs e) => TabbedThumbnailClosed?.Invoke(this, e); } \ No newline at end of file diff --git a/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnailClosingEventArgs.cs b/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnailClosingEventArgs.cs index caabc8aa..9dae9f89 100644 --- a/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnailClosingEventArgs.cs +++ b/Source/Current/Windows API CodePack/Components/Shell/Taskbar/TabbedThumbnailClosingEventArgs.cs @@ -1,7 +1,7 @@  namespace Microsoft.WindowsAPICodePack.Taskbar; -// +/// /// Event args for the TabbedThumbnailClosing event. The application should set /// the Cancel property to true if the thumbnail should not be removed. /// diff --git a/Source/Current/Windows API CodePack/Components/ShellExtensions/Readme.md b/Source/Current/Windows API CodePack/Components/ShellExtensions/Readme.md index f08b1ecb..bc2ddcf5 100644 --- a/Source/Current/Windows API CodePack/Components/ShellExtensions/Readme.md +++ b/Source/Current/Windows API CodePack/Components/ShellExtensions/Readme.md @@ -1,73 +1,7 @@ -Microsoft Windows API Codepack -========================= +# WindowsAPICodePackShellExtensions -README -====== +Helpers for implementing Windows preview handlers and thumbnail providers (WinForms and WPF). -## Current Version +Install: `dotnet add package WindowsAPICodePackShellExtensions` - - -License -------- - -The library is not developed anymore by Microsoft and seems to have been left as 'free to use'. A clarification or update about the licence terms from Microsoft is welcome, however. - -Release notes -------------- - -This release has the latest bug fixes applied, including the fix for 64-bit exceptions. - -Bugs ----- - -When you submit a bug: - - - provide a short example code showing the bug - - describe the expected behavior/result - - if a pull request is applicable, please reference it - -Pull Requests -------------- - -I'll be glad to accept pull requests if they fix a bug or add a worthwhile feature. - - -Usage notes ------------ - -**TaskDialog** - -If you get the following exception when you instantiate a `TaskDialog`: - -``` -An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.WindowsAPICodePack.dll - -Additional information: TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory. -``` - -To fix it, create an application manifest and un-comment the following block section: - -``` - - -``` - -Note: you might have to restart Visual Studio as the DLLs seems to be cached in memory and rebuilding your project doesn't seem to be enough in some cases. - -**DirectX** - -The DirectX package will work under x86 and x64 configuration platforms but not for AnyCPU platform (because there is no such platform for C++/CLI projects). Consequently, the package will purposefully fail the build and tell you why it did. - -Note: package is here for historical reasons, it is highly recommended to use [SharpDX](http://sharpdx.org/) instead. \ No newline at end of file +See the [repository README](https://github.com/Wagnerp/Windows-API-CodePack-NET). diff --git a/Source/Current/Windows API CodePack/Components/ShellExtensions/ShellExtensions.csproj b/Source/Current/Windows API CodePack/Components/ShellExtensions/ShellExtensions.csproj index 0ba7ff99..6e0ab079 100644 --- a/Source/Current/Windows API CodePack/Components/ShellExtensions/ShellExtensions.csproj +++ b/Source/Current/Windows API CodePack/Components/ShellExtensions/ShellExtensions.csproj @@ -10,15 +10,13 @@ enable true + true WindowsAPICodePackShellExtensions - - This package contains extensions to the shell binary for the Windows API Code Pack needed for Windows Forms Development in the 1.1 version, released by Microsoft in 2009. - + Shell extension helpers for Windows preview handlers and thumbnail providers (WinForms and WPF). Targets .NET Framework 4.6.2–4.8.1 and .NET 8–10 (Windows). Windows.png License.md True Readme.md - $(Title) $(Title) True WindowsAPICodePack.snk @@ -33,16 +31,6 @@ - - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8.1\System.Windows.Forms.dll - - - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8.1\WindowsFormsIntegration.dll - - - True diff --git a/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/Readme.md b/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/Readme.md index 64c99775..96ddf931 100644 --- a/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/Readme.md +++ b/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/Readme.md @@ -37,6 +37,7 @@ using Microsoft.WindowsAPICodePack.ShellExtensions; - .NET Framework 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 - .NET 8.0 (Windows) - .NET 9.0 (Windows) +- .NET 10.0 (Windows) ## Individual Packages diff --git a/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/WindowsAPICodePack.csproj b/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/WindowsAPICodePack.csproj index 97441188..77c4411a 100644 --- a/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/WindowsAPICodePack.csproj +++ b/Source/Current/Windows API CodePack/Components/WindowsAPICodePack/WindowsAPICodePack.csproj @@ -25,12 +25,6 @@ Windows.png - https://github.com/Wagnerp/Windows-API-CodePack-NET - - git - - $(Title) - $(Title) True diff --git a/Source/Current/Windows API CodePack/Directory.Build.targets b/Source/Current/Windows API CodePack/Directory.Build.targets index 996327fe..2cdd05d8 100644 --- a/Source/Current/Windows API CodePack/Directory.Build.targets +++ b/Source/Current/Windows API CodePack/Directory.Build.targets @@ -1,10 +1,10 @@ - 8.0.15.2 + 8.0.16 - 8.0.15.2 + 8.0.16 - 8.0.15.2 + 8.0.16 preview diff --git a/Source/Current/Windows API CodePack/ScratchProject/ScratchProject.csproj b/Source/Current/Windows API CodePack/ScratchProject/ScratchProject.csproj index 23d5fcab..8c69e5b7 100644 --- a/Source/Current/Windows API CodePack/ScratchProject/ScratchProject.csproj +++ b/Source/Current/Windows API CodePack/ScratchProject/ScratchProject.csproj @@ -6,6 +6,8 @@ enable true enable + false + false diff --git a/Source/Current/Windows API CodePack/Tests/GlobalUsings.cs b/Source/Current/Windows API CodePack/Tests/GlobalUsings.cs new file mode 100644 index 00000000..c802f448 --- /dev/null +++ b/Source/Current/Windows API CodePack/Tests/GlobalUsings.cs @@ -0,0 +1 @@ +global using Xunit; diff --git a/Source/Current/Windows API CodePack/Tests/KnownFoldersTests.cs b/Source/Current/Windows API CodePack/Tests/KnownFoldersTests.cs new file mode 100644 index 00000000..24b32f85 --- /dev/null +++ b/Source/Current/Windows API CodePack/Tests/KnownFoldersTests.cs @@ -0,0 +1,32 @@ +using System.Reflection; +using Microsoft.WindowsAPICodePack.Shell; + +namespace WindowsAPICodePack.Tests; + +public class KnownFoldersTests +{ + [Fact] + public void DesktopKnownFolderIsAvailable() + { + IKnownFolder? desktop = KnownFolders.Desktop; + + Assert.NotNull(desktop); + Assert.False(string.IsNullOrWhiteSpace(desktop.CanonicalName)); + Assert.NotEqual(Guid.Empty, desktop.FolderId); + } + + [Fact] + public void AllContainsDesktopWhenPresent() + { + IKnownFolder? desktop = KnownFolders.Desktop; + Assert.NotNull(desktop); + Assert.Contains(KnownFolders.All, folder => folder.FolderId == desktop.FolderId); + } + + [Fact] + public void StaticKnownFolderPropertiesAreIKnownFolder() + { + PropertyInfo[] properties = typeof(KnownFolders).GetProperties(BindingFlags.Static | BindingFlags.Public); + Assert.Contains(properties, info => info.PropertyType == typeof(IKnownFolder) && info.Name == nameof(KnownFolders.Desktop)); + } +} diff --git a/Source/Current/Windows API CodePack/Tests/PropVariantTests.cs b/Source/Current/Windows API CodePack/Tests/PropVariantTests.cs new file mode 100644 index 00000000..c5d6a844 --- /dev/null +++ b/Source/Current/Windows API CodePack/Tests/PropVariantTests.cs @@ -0,0 +1,88 @@ +using System.Runtime.InteropServices; +using MS.WindowsAPICodePack.Internal; + +namespace WindowsAPICodePack.Tests; + +public class PropVariantTests +{ + [Theory] + [MemberData(nameof(FromObjectTestValues))] + public void StaticFromObjectTest(object inputObject, VarEnum expectedVarType) + { + using PropVariant pv = PropVariant.FromObject(inputObject); + + Assert.Equal(inputObject, pv.Value); + Assert.Equal(expectedVarType, pv.VarType); + Assert.False(pv.IsNullOrEmpty); + } + + [Theory] + [MemberData(nameof(InputObjectValues))] + public void DisposeClearsValue(object inputObject) + { + using PropVariant pv = PropVariant.FromObject(inputObject); + + Assert.NotNull(pv.Value); + Assert.NotEqual(VarEnum.VT_EMPTY, pv.VarType); + Assert.False(pv.IsNullOrEmpty); + + pv.Dispose(); + + Assert.Null(pv.Value); + Assert.Equal(VarEnum.VT_EMPTY, pv.VarType); + Assert.True(pv.IsNullOrEmpty); + } + + [Fact] + public void DefaultConstructorIsEmpty() + { + using PropVariant pv = new(); + + Assert.True(pv.IsNullOrEmpty); + Assert.Equal(VarEnum.VT_EMPTY, pv.VarType); + Assert.Null(pv.Value); + } + + [Fact] + public void FromObjectNullIsEmpty() + { + using PropVariant pv = PropVariant.FromObject(null); + + Assert.True(pv.IsNullOrEmpty); + Assert.Equal(VarEnum.VT_EMPTY, pv.VarType); + Assert.Null(pv.Value); + } + + public static IEnumerable FromObjectTestValues + { + get + { + yield return new object[] { "hello", VarEnum.VT_LPWSTR }; + yield return new object[] { new[] { "hello", "world" }, VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR }; + yield return new object[] { true, VarEnum.VT_BOOL }; + yield return new object[] { (byte)123, VarEnum.VT_UI1 }; + yield return new object[] { (sbyte)123, VarEnum.VT_I1 }; + yield return new object[] { (short)123, VarEnum.VT_I2 }; + yield return new object[] { (ushort)123, VarEnum.VT_UI2 }; + yield return new object[] { 123, VarEnum.VT_I4 }; + yield return new object[] { (uint)123, VarEnum.VT_UI4 }; + yield return new object[] { (long)123, VarEnum.VT_I8 }; + yield return new object[] { (ulong)123, VarEnum.VT_UI8 }; + yield return new object[] { 12.3, VarEnum.VT_R8 }; + yield return new object[] { new[] { 1, 2, 3 }, VarEnum.VT_VECTOR | VarEnum.VT_I4 }; + } + } + + public static IEnumerable InputObjectValues + { + get + { + yield return new object[] { true }; + yield return new object[] { (byte)123 }; + yield return new object[] { 123 }; + yield return new object[] { new[] { 1, 2, 3 } }; + yield return new object[] { "hello" }; + yield return new object[] { new[] { "hello", "world" } }; + } + } +} diff --git a/Source/Current/Windows API CodePack/Tests/PropertyKeyTests.cs b/Source/Current/Windows API CodePack/Tests/PropertyKeyTests.cs new file mode 100644 index 00000000..4504e3a6 --- /dev/null +++ b/Source/Current/Windows API CodePack/Tests/PropertyKeyTests.cs @@ -0,0 +1,51 @@ +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; + +namespace WindowsAPICodePack.Tests; + +public class PropertyKeyTests +{ + [Theory] + [InlineData("00000000-0000-0000-0000-000000000000", 5)] + public void ConstructorWithGuid(string formatIdString, int propertyId) + { + Guid formatId = new(formatIdString); + PropertyKey pk = new(formatId, propertyId); + + Assert.Equal(formatId, pk.FormatId); + Assert.Equal(propertyId, pk.PropertyId); + } + + [Theory] + [InlineData("00000000-0000-0000-0000-000000000000", 5)] + public void ConstructorWithString(string formatId, int propertyId) + { + PropertyKey pk = new(formatId, propertyId); + + Assert.Equal(new Guid(formatId), pk.FormatId); + Assert.Equal(propertyId, pk.PropertyId); + } + + [Fact] + public void ToStringReturnsExpectedString() + { + Guid guid = new("00000000-1111-2222-3333-000000000000"); + const int property = 1234; + PropertyKey key = new(guid, property); + + Assert.Equal("{" + guid + "}, " + property, key.ToString()); + } + + [Fact] + public void EqualityOperatorsMatchValue() + { + PropertyKey a = new(Guid.Empty, 1); + PropertyKey b = new(Guid.Empty, 1); + PropertyKey c = new(Guid.Empty, 2); + + Assert.True(a == b); + Assert.False(a != b); + Assert.True(a != c); + Assert.Equal(a, b); + Assert.NotEqual(a, c); + } +} diff --git a/Source/Current/Windows API CodePack/Tests/SensorDescriptionAttributeTests.cs b/Source/Current/Windows API CodePack/Tests/SensorDescriptionAttributeTests.cs new file mode 100644 index 00000000..4f6c85f0 --- /dev/null +++ b/Source/Current/Windows API CodePack/Tests/SensorDescriptionAttributeTests.cs @@ -0,0 +1,15 @@ +using Microsoft.WindowsAPICodePack.Sensors; + +namespace WindowsAPICodePack.Tests; + +public class SensorDescriptionAttributeTests +{ + [Theory] + [InlineData("00000000-0000-0000-0000-000000000000")] + [InlineData("11111111-2222-3333-4444-555555555555")] + public void ConstructionStoresSensorType(string sensorTypeGuid) + { + SensorDescriptionAttribute attribute = new(sensorTypeGuid); + Assert.Equal(sensorTypeGuid, attribute.SensorType); + } +} diff --git a/Source/Current/Windows API CodePack/Tests/SystemPropertiesTests.cs b/Source/Current/Windows API CodePack/Tests/SystemPropertiesTests.cs new file mode 100644 index 00000000..ac51228f --- /dev/null +++ b/Source/Current/Windows API CodePack/Tests/SystemPropertiesTests.cs @@ -0,0 +1,16 @@ +using Microsoft.WindowsAPICodePack.Shell.PropertySystem; + +namespace WindowsAPICodePack.Tests; + +public class SystemPropertiesTests +{ + [Fact] + public void SystemAuthorKeyIsStable() + { + PropertyKey key = SystemProperties.System.Author; + + Assert.NotEqual(Guid.Empty, key.FormatId); + Assert.True(key.PropertyId > 0); + Assert.Equal(key, SystemProperties.System.Author); + } +} diff --git a/Source/Current/Windows API CodePack/Tests/Tests.csproj b/Source/Current/Windows API CodePack/Tests/Tests.csproj new file mode 100644 index 00000000..c1f55c3a --- /dev/null +++ b/Source/Current/Windows API CodePack/Tests/Tests.csproj @@ -0,0 +1,32 @@ + + + + net48;net10.0-windows + enable + enable + latest + false + false + false + true + true + WindowsAPICodePack.Tests + WindowsAPICodePack.Tests + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/Source/Current/Windows API CodePack/Windows API CodePack.sln b/Source/Current/Windows API CodePack/Windows API CodePack.sln index a7ff7f9b..a015f53e 100644 --- a/Source/Current/Windows API CodePack/Windows API CodePack.sln +++ b/Source/Current/Windows API CodePack/Windows API CodePack.sln @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\..\LICENSE = ..\..\..\LICENSE ..\..\..\Assets\Documents\Licenses\License.md = ..\..\..\Assets\Documents\Licenses\License.md ..\..\..\README.md = ..\..\..\README.md + ..\ROADMAP.md = ..\ROADMAP.md + ..\..\..\CONTRIBUTING.md = ..\..\..\CONTRIBUTING.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Components", "Components", "{A47EB061-076A-4E2C-B3D5-7B06B1D707FF}" @@ -33,6 +35,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsAPICodePack", "Compo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScratchProject", "ScratchProject\ScratchProject.csproj", "{A12DB06F-15B4-41B7-BB98-505CC1EB2DD0}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -139,6 +143,18 @@ Global {A12DB06F-15B4-41B7-BB98-505CC1EB2DD0}.Release|x64.Build.0 = Release|Any CPU {A12DB06F-15B4-41B7-BB98-505CC1EB2DD0}.Release|x86.ActiveCfg = Release|Any CPU {A12DB06F-15B4-41B7-BB98-505CC1EB2DD0}.Release|x86.Build.0 = Release|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Debug|x64.ActiveCfg = Debug|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Debug|x64.Build.0 = Debug|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Debug|x86.ActiveCfg = Debug|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Debug|x86.Build.0 = Debug|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Release|Any CPU.Build.0 = Release|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Release|x64.ActiveCfg = Release|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Release|x64.Build.0 = Release|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Release|x86.ActiveCfg = Release|Any CPU + {B7C4E2A1-9D3F-4E8B-A1C2-5F6D7E8A9B0C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/Current/Windows API CodePack/Windows API CodePack.slnx b/Source/Current/Windows API CodePack/Windows API CodePack.slnx index 869a8f86..79da7635 100644 --- a/Source/Current/Windows API CodePack/Windows API CodePack.slnx +++ b/Source/Current/Windows API CodePack/Windows API CodePack.slnx @@ -19,6 +19,8 @@ + + @@ -38,4 +40,5 @@ +