Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 12 additions & 25 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
142 changes: 54 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
```

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
<PropertyGroup>
<EnableAuthenticodeSigning>true</EnableAuthenticodeSigning>
<CodeSigningCertificatePath>path\to\your\certificate.pfx</CodeSigningCertificatePath>
<CodeSigningCertificatePassword>your-password</CodeSigningCertificatePassword>
</PropertyGroup>
```

To fix it, create an application manifest and un-comment the following block section:
**Certificate store:**

```xml
<PropertyGroup>
<EnableAuthenticodeSigning>true</EnableAuthenticodeSigning>
<CodeSigningCertificateThumbprint>your-certificate-thumbprint</CodeSigningCertificateThumbprint>
</PropertyGroup>
```
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!-- <dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>-->
```

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
<PropertyGroup>
<EnableAuthenticodeSigning>true</EnableAuthenticodeSigning>
<CodeSigningCertificatePath>path\to\your\certificate.pfx</CodeSigningCertificatePath>
<CodeSigningCertificatePassword>your-password</CodeSigningCertificatePassword> <!-- Optional -->
</PropertyGroup>
```

2. **Using a Certificate from Certificate Store:**
```xml
<PropertyGroup>
<EnableAuthenticodeSigning>true</EnableAuthenticodeSigning>
<CodeSigningCertificateThumbprint>your-certificate-thumbprint</CodeSigningCertificateThumbprint>
</PropertyGroup>
```

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.
See [CONTRIBUTING.md](CONTRIBUTING.md). Bug reports should include Windows version, TFM, and package version ([template](.github/ISSUE_TEMPLATE/bug_report.md)).
20 changes: 9 additions & 11 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -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.
Loading
Loading