![Vanara](/docs/icons/VanaraHeading.png)
[![Version](https://img.shields.io/github/release/dahall/Vanara.svg?style=flat-square)](https://github.com/dahall/Vanara/releases) [![Downloads](https://img.shields.io/nuget/dt/Vanara.Core.svg?style=flat-square)](https://www.nuget.org/packages/Vanara.Core/) [![Build status](https://ci.appveyor.com/api/projects/status/p6jj1j3sbt95opdr?svg=true)](https://ci.appveyor.com/project/dahall/vanara)
This project contains various .NET assemblies that contain P/Invoke functions, interfaces, enums and structures from Windows libraries. Each assembly is associated with one or a few tightly related libraries. For example, Shlwapi.dll has all the exported functions from shlwapi.lib; Kernel32.dll has all for both kernel32.lib and kernelbase.lib.
All assemblies are available via NuGet and provide builds against .NET 2.0, 3.5, 4.0, 4.5, Core 3.0, Core 3.1 and **.NET 5.0** (new in v3.2.20) and support [SourceLink](https://docs.microsoft.com/en-us/dotnet/standard/library-guidance/sourcelink). In all cases where a dependency doesn't disallow it, .NET Standard 2.0, .NET Core 2.0, and 2.1 builds are also included for use with UWP and other .NET Core and Standard projects.
This project releases new versions every few weeks after sufficient testing. New releases are cataloged, along with release notes, in the [Releases](https://github.com/dahall/Vanara/releases) section and all NuGet packages are published to [nuget.org](https://www.nuget.org/packages?q=dahall+Vanara). Each GitHub push triggers an [AppVeyor](https://ci.appveyor.com/project/dahall/vanara) build. The owners thank them for the free Open-Source account! The status of that build is in the header of this page. The NuGet packages from those builds are available for test purposes on AppVeyor's project NuGet source at https://ci.appveyor.com/nuget/vanara-prerelease.
## Use
1. Look for the function you need in Microsoft documentation. Note which library or DLL the function is in.
2. Confirm the Vanara library exists and has your function by looking at the Supported Libraries table below. Clicking on the Assembly link will take you to a drill down of that assembly's coverage. Find your function and if there is a matching implementation it will appear to the right. You can also use GitHub's project search (upper left of page) to search for your function, method or constant. Make sure to select "In this repository".
3. Add the assembly to your project via NuGet.
4. To use the function, you can:
1. Call it directly `var bret = Vanara.PInvoke.Kernel32.GetComputerName(sb, ref sbSz);`
2. Under C# 6.0 and later, use a static using directive and call it:
```
using static Vanara.PInvoke.Kernel32;
var bret = GetComputerName(sb, ref sbSz);
```
5. In some cases there is a corresponding helper/wrapper class in one of the [Supporting Assemblies](#Supporting-Assemblies), especially for Security, System Services, Forms and Shell. Go to their library page (click on link in section) and look through the classes included in each library.
## Design Concepts
I have tried to follow the concepts below in laying out the libraries.
* All functions that are imported from a single DLL should be placed into a single assembly that is named after the DLL.
* (e.g. The assembly `Vanara.PInvoke.Gdi32.dll` hosts all functions and supporting enumerations, constants and structures that are exported from `gdi32.dll` in the system directory.)
* Any structure or macro or enumeration (no function) that is used by many libraries is put into either `Vanara.Core` or `Vanara.PInvoke.Shared`.
* (e.g. The macro `HIWORD` and the structure `SIZE` are both in `Vanara.PInvoke.Shared` and classes to simplify interop calls and native memory management are in `Vanara.Core`.)
* Inside a project, all constructs are contained in a file named after the header file (*.h) in which they are defined in the Windows API.
* (e.g. In the `Vanara.PInvoke.Kernel32` project directory, you'll find a FileApi.cs, a WinBase.cs and a WinNT.cs file representing fileapi.h, winbase.h and winnt.h respectively.)
* Where the direct interpretation of a structure or function leads to memory leaks or misuse, I have tried to simplify its use.
* Where a structure is always passed by reference and where that structure needs to clean up memory allocations, I have changed the structure to a class implementing `IDisposable`.
* Wherever possible, all handles have been turned into `SafeHandle` derivatives named after the Windows API handle. If those handles require a call to a function to release/close/destroy, a derived `SafeHANDLE` exists that performs that function on disposal.
* e.g. `HTOKEN` is defined. `SafeHTOKEN` builds upon that handle with an automated release calling `CloseHandle`.
* Wherever possible, all functions that allocate memory that is to be freed by the caller use a safe memory handle.
* All PInvoke calls are in assemblies prefixed by `Vanara.PInvoke`.
* If a structure is to passed into a function as a constant, that structure is marshaled using the `in` statement which will pass the structure by reference without requiring the `ref` keyword.
* Windows API: `BOOL MapDialogRect(HWND hDlg, LPRECT lpRect)`
* Vanara: `bool MapDialogRect(HWND hDlg, in RECT lpRect);`
* If there are classes or extensions that make use of the PInvoke calls, they are in wrapper assemblies prefixed by `Vanara` and then followed by a logical name for the functionality. Today, those are Core, Security, SystemServices, Windows.Forms and Windows.Shell.
## Supported Libraries
Library/DLL | Assembly | Coverage | NuGet Link
--- | --- | --- | ---
aclui.dll | [Vanara.PInvoke.AclUI](https://github.com/dahall/Vanara/blob/master/PInvoke/AclUI/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.AclUI?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.AclUI?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.AclUI)
advapi32.dll, secur32.dll, authz.dll, sspicli.dll, schannel.dll | [Vanara.PInvoke.Security](https://github.com/dahall/Vanara/blob/master/PInvoke/Security/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.Security?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.Security?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.Security)
cabinet.dll | [Vanara.PInvoke.Cabinet](https://github.com/dahall/Vanara/blob/master/PInvoke/Cabinet/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.Cabinet?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.Cabinet?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.Cabinet)
CldApi.dll | [Vanara.PInvoke.CldApi](https://github.com/dahall/Vanara/blob/master/PInvoke/CldApi/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.CldApi?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.CldApi?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.CldApi)
comctl32.dll | [Vanara.PInvoke.ComCtl32](https://github.com/dahall/Vanara/blob/master/PInvoke/ComCtl32/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.ComCtl32?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.ComCtl32?label=%20&style=flat-square)](https://www.nuget.org/pac
没有合适的资源?快使用搜索试试~ 我知道了~
Vanara:一组用于Windows的.NET库,使用支持的包装程序实现对许多本机Windows API的PInvoke调用
共1409个文件
cs:1151个
csproj:129个
md:71个
5星 · 超过95%的资源 需积分: 50 1 下载量 174 浏览量
2021-02-05
03:03:20
上传
评论
收藏 9.36MB ZIP 举报
温馨提示
该项目包含各种.NET程序集,这些程序集包含Windows库中的P / Invoke函数,接口,枚举和结构。 每个程序集都与一个或几个紧密相关的库关联。 例如,Shlwapi.dll具有从shlwapi.lib导出的所有功能。 Kernel32.dll具有kernel32.lib和kernelbase.lib的全部。 所有程序集都可以通过NuGet获得,并提供针对.NET 2.0、3.5、4.0、4.5,Core 3.0,Core 3.1和.NET 5.0 (v3.2.20中的新增功能)的构建,并支持 。 在所有不禁止依赖的情况下,都包括.NET Standard 2.0,.NET Core
资源详情
资源评论
资源推荐
收起资源包目录
Vanara:一组用于Windows的.NET库,使用支持的包装程序实现对许多本机Windows API的PInvoke调用 (1409个子文件)
Vanara.PInvoke.CoreAudio._csproj 1KB
Welcome.aml 3KB
v1.0.0.0.aml 977B
VersionHistory.aml 964B
v1.0.2.aml 713B
AccessControlEditorDialog.bmp 956B
GlassExtenderProvider.bmp 822B
ShellNamespaceTreeControl.bmp 822B
ExplorerBrowser.bmp 822B
ThemedTableLayoutPanel.bmp 822B
ThemedLabel.bmp 822B
ThemedImageButton.bmp 822B
app.config 160B
ContentLayout.content 718B
WinSock2.WSA.cs 574KB
HRESULT.Values.cs 532KB
IpHlpApi.cs 507KB
WinINet.cs 495KB
Win32Error.Values.cs 492KB
BCrypt.cs 477KB
LmAccess.cs 470KB
OCIdl.cs 464KB
WinNls.cs 456KB
WinUser.Window.cs 447KB
Evntrace.cs 428KB
NetIOApi.cs 426KB
ProcessThreadsApi.cs 419KB
Sspi.cs 406KB
ShlObj.cs 393KB
WinSpool.Funcs.cs 381KB
ShlDisp.cs 375KB
AudioClient.cs 369KB
SecurityBaseApi.cs 363KB
MsOpc.cs 352KB
SearchApi.cs 351KB
DbgHelp.Sym.cs 348KB
WTypes.PROPERTYKEY.cs 348KB
WinCrypt.cs 343KB
WinSvc.cs 343KB
OleIdl.cs 342KB
WlanApi.Funcs.cs 342KB
Msi.Installer2.cs 337KB
NTStatus.Values.cs 324KB
NTDSAPI.cs 303KB
ws2spi.cs 300KB
SetupAPI.DiFuncs2.cs 298KB
Wincrypt.DataMgmt.cs 297KB
Shlwapi.cs 297KB
FileApi.cs 295KB
WinGdi.FontText.cs 288KB
WindowsCodecs.Interfaces2.cs 281KB
SetupAPI.Funcs2.cs 279KB
Lm.Ext.cs 278KB
Dwrite.Interfaces.cs 277KB
WindowsCodecs.Interfaces.cs 273KB
Wincrypt.Msg.cs 273KB
XpsObjectModel.cs 273KB
Pdh.cs 263KB
WinBase.cs 255KB
XpsObjectModel2.cs 250KB
DevPKEY.cs 246KB
WinSock2.legacy.cs 242KB
WinUser.System.cs 241KB
WinBase.File.cs 241KB
bits.cs 240KB
MemoryApi.cs 239KB
ObjIdlBase.cs 239KB
SetupAPI.cs 237KB
PropvarUtil.cs 236KB
NTDll.cs 235KB
WinNT.cs 232KB
NCrypt.cs 231KB
ComBaseApi.cs 231KB
PowrProf.cs 222KB
Wincrypt.Store.cs 222KB
SetupAPI.DiFuncs.cs 222KB
SetupAPI.Funcs.cs 220KB
WinIOCtl.Structs.cs 218KB
Wia_xp.cs 213KB
Ole2.cs 211KB
WinReg.cs 210KB
TaskSchd.cs 207KB
ShellApi.cs 206KB
WinCon.cs 203KB
D2d1.Interfaces1.cs 200KB
WSMan.cs 200KB
IScsiDsc.cs 200KB
WTSApi32.cs 199KB
D2d1.Interfaces2.cs 196KB
Wincrypt.Cert.cs 196KB
ws2tcpip.cs 195KB
MsiQuery.cs 195KB
DeviceTopology.cs 192KB
UrlMon.cs 189KB
Wincrypt.cs 189KB
D2d1.Interfaces4.cs 187KB
LmDfs.cs 185KB
Msi.Installer.cs 185KB
OAIdl.Interfaces.cs 182KB
WinUser.Message.cs 182KB
共 1409 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
马雁飞
- 粉丝: 17
- 资源: 4520
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1