Riverside.Win32

April 8, 2026 ยท View on GitHub

Win32 P/Invoke bindings for .NET Standard.


This library offers static generations of P/Invoke for all languages using custom MSBuild tasks to build CsWin32 generations from metadata. It uses custom PowerShell scripts and MSBuild tasks to build libraries, and is attached to a CD workflow that publishes the packages on NuGet.

You can then use the packages just as you would with CsWin32, but installing the correct package (relevant to the link library) to get the correct information, or installing the 'aggregate' package that contains all the Win32 P/Invoke methods and supporting types generated from the Win32 metadata repo.


The best way to consume Win32 P/Invoke APIs via this collection of libraries is by using the built-in alias system. Since all P/Invoke APIs across all packages generate into the same Windows.Win32.PInvoke class, you must use the correct alias to reference the correct version of the PInvoke class to call the P/Invoke APIs for that API set (DLL). For example, the following extract performs the SetPixel function from gdi32.dll:

extern alias gdi32; // important: you must reference the appropriate alias for the API you are calling

gdi32::Windows.Win32.Graphics.Gdi.HDC context = new(nint.Zero); // the hdc (device context) parameter in SetPixel
int x = 1; // the x coordinate parameter in SetPixel
int y = 1; // the y coordinate parameter in SetPixel
gdi32::Windows.Win32.Foundation.COLORREF white = new(0x00FFFFFF); // the colour parameter in SetPixel

gdi32::Windows.Win32.Foundation.COLORREF pixel = gdi32::Windows.Win32.PInvoke(context, x, y, white);

In practice, you might prefer to use a nicer, using statement, rather than repeating the alias throughout the document:

extern alias gdi32;

using gdi32::Windows.Win32;

// Then you can reference the P/Invoke APIs like so:
PInvoke.SetPixel();

Or, optionally, if you need access to P/Invoke APIs from multiple Win32 API sets but want to keep your codebase clean:

extern alias gdi32;
extern alias advapi32;

using GraphicsPInvoke = gdi32::Windows.Win32.PInvoke;
using AdvancedPInvoke = advapi32::Windows.Win32.PInvoke;

GraphicsPInvoke.SetPixel();
AdvancedPInvoke.CreateService();

Package nameNuGet downloadAssociated API set
Riverside.Win32NuGet Version*
Riverside.Win32.AdvancedNuGet Versionadvapi32.dll
Riverside.Win32.CabinetNuGet Versioncabinet.dll
Riverside.Win32.CommonControlsNuGet Versioncomctl32.dll
Riverside.Win32.Cryptography.BCryptNuGet Versionbcrypt.dll
Riverside.Win32.Cryptography.LegacyNuGet Versioncrypt32.dll
Riverside.Win32.Cryptography.NCryptNuGet Versionncrypt.dll
Riverside.Win32.DebuggingNuGet Versiondbghelp.dll
Riverside.Win32.DesktopNuGet Versiondwmapi.dll
Riverside.Win32.DirectX.Direct3D.10NuGet Versiond3d10.dll
Riverside.Win32.DirectX.Direct3D.10.1NuGet Versiond3d10_1.dll
Riverside.Win32.DirectX.Direct3D.11NuGet Versiond3d11.dll
Riverside.Win32.DirectX.Direct3D.12NuGet Versiond3d12.dll
Riverside.Win32.DirectX.Direct3D.9NuGet Versiond3d9.dll
Riverside.Win32.DirectX.DirectInputNuGet Versiondinput8.dll
Riverside.Win32.DirectX.DirectSoundNuGet Versiondsound.dll
Riverside.Win32.DirectX.GraphicsInfrastructureNuGet Versiondxgi.dll
Riverside.Win32.GraphicsNuGet Versiongdi32.dll
Riverside.Win32.Graphics.OpenGLNuGet Versionopengl32.dll
Riverside.Win32.Graphics.OpenGLUtilityNuGet Versionglu32.dll
Riverside.Win32.HardwareNuGet Versioncfgmgr32.dll
Riverside.Win32.InputMethodNuGet Versionimm32.dll
Riverside.Win32.InstallerNuGet Versionmsi.dll
Riverside.Win32.KernelNuGet Versionkernel32.dll
Riverside.Win32.KernelStreamingNuGet Versionksuser.dll
Riverside.Win32.MagnificationNuGet Versionmagnification.dll
Riverside.Win32.MediaFoundationNuGet Versionmf.dll
Riverside.Win32.MediaFoundation.PlatformNuGet Versionmfplat.dll
Riverside.Win32.MediaFoundation.ReadWriteNuGet Versionmfreadwrite.dll
Riverside.Win32.MultimediaNuGet Versionwinmm.dll
Riverside.Win32.Multimedia.RealtimeNuGet Versionavrt.dll
Riverside.Win32.MultipleProviderRouterNuGet Versionmpr.dll
Riverside.Win32.NETFrameworkNuGet Versionmscoree.dll
Riverside.Win32.NetworkNuGet Versionnetapi32.dll
Riverside.Win32.Network.IPHelperNuGet Versioniphlpapi.dll
Riverside.Win32.Networking.InternetNuGet Versionwininet.dll
Riverside.Win32.Networking.SocketsNuGet Versionws2_32.dll
Riverside.Win32.NewDeviceNuGet Versionnewdev.dll
Riverside.Win32.NewTechnologyNuGet Versionntdll.dll
Riverside.Win32.ObjectLinkingNuGet Versionole32.dll
Riverside.Win32.ObjectLinking.AutomationNuGet Versionoleaut32.dll
Riverside.Win32.PEImageNuGet Versionimagehlp.dll
Riverside.Win32.ProcessNuGet Versionpsapi.dll
Riverside.Win32.RemoteDesktopNuGet Versionwtsapi32.dll
Riverside.Win32.RpcNuGet Versionrpcrt4.dll
Riverside.Win32.SecurityNuGet Versionsecur32.dll
Riverside.Win32.SetupNuGet Versionsetupapi.dll
Riverside.Win32.ShellNuGet Versionshell32.dll
Riverside.Win32.Shell.LightweightNuGet Versionshlwapi.dll
Riverside.Win32.ThemesNuGet Versionuxtheme.dll
Riverside.Win32.UsbNuGet Versionwinusb.dll
Riverside.Win32.Usb.HumanInterfaceNuGet Versionhid.dll
Riverside.Win32.UserEnvironmentNuGet Versionuserenv.dll
Riverside.Win32.UserInterfaceNuGet Versionuser32.dll
Riverside.Win32.VersionNuGet Versionversion.dll