P/Invoke各种总结(九、如何快速获取P/Invoke方法签名)
使用API函数已经好几年了,封装函数签名基本是参照MSDN上的文档,然后再做数据类型对应。
虽然有 pinvoke.net 这个网站,但基本很少使用。一方面是想多动手,另一方面是因为各种数据类型基本都用过了,都能自己在C#中 对应 起来。
最近在逛github时,发现了一个官方的项目,https://github.com/dotnet/pinvoke,这个项目是流行操作系统的所有P/Invoke方法签名的库集合。
Library | Package name | Description |
---|---|---|
advapi32.dll | PInvoke.AdvApi32 |
Windows Advanced Services |
bcrypt.dll | PInvoke.BCrypt |
Windows Cryptography API: Next Generation |
cabinet.dll | PInvoke.Cabinet |
Cabinet API Functions |
cfgmgr32.dll | PInvoke.CfgMgr32 |
Device and Driver Installation |
crypt32.dll | PInvoke.Crypt32 |
Windows Cryptography API |
DwmApi.dll | PInvoke.DwmApi |
Desktop Window Manager |
fusion.dll | PInvoke.Fusion |
.NET Framework Fusion |
gdi32.dll | PInvoke.Gdi32 |
Windows Graphics Device Interface |
hid.dll | PInvoke.Hid |
Windows Human Interface Devices |
iphlpapi.dll | PInvoke.IPHlpApi |
IP Helper |
kernel32.dll | PInvoke.Kernel32 |
Windows Kernel API |
magnification.dll | PInvoke.Magnification |
Windows Magnification API |
mscoree.dll | PInvoke.MSCorEE |
.NET Framework CLR host |
msi.dll | PInvoke.Msi |
Microsoft Installer |
ncrypt.dll | PInvoke.NCrypt |
Windows Cryptography API: Next Generation |
netapi32.dll | PInvoke.NetApi32 |
Network Management |
newdev.dll | PInvoke.NewDev |
Device and Driver Installation |
ntdll.dll | PInvoke.NTDll |
Windows NTDll |
psapi.dll | PInvoke.Psapi |
Windows Process Status API |
setupapi.dll | PInvoke.SetupApi |
Windows setup API |
SHCore.dll | PInvoke.SHCore |
Windows Shell |
shell32.dll | PInvoke.Shell32 |
Windows Shell |
user32.dll | PInvoke.User32 |
Windows User Interface |
userenv.dll | PInvoke.Userenv |
Windows User Environment |
uxtheme.dll | PInvoke.UxTheme |
Windows Visual Styles |
winusb.dll | PInvoke.WinUsb |
USB Driver |
WtsApi32.dll | PInvoke.WtsApi32 |
Windows Remote Desktop Services |
例如要使用User32中的ShowWindow函数
1、导入Nuget包(PInvoke.User32)
2、使用
赞 (0)