<commit_before>P/Invoke
=======

[![Build status](https://ci.appveyor.com/api/projects/status/idu56hy4jwytxd3x?svg=true)](https://ci.appveyor.com/project/AArnott/pinvoke)
[![Join the chat at https://gitter.im/AArnott/pinvoke](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/AArnott/pinvoke?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A library intended to contain all P/Invoke method signatures for popular operating systems.
Think of it as http://pinvoke.net, but proven to compile and work properly, and often
with sample usage in the form of unit tests.

## Usage

Install the NuGet package(s) for the DLLs you want to P/Invoke into.
For example, if you want to P/Invoke into Win32's BCrypt.dll, install this package:

    Install-Package PInvoke.BCrypt

Then import the following namespaces, as demonstrated below (if using C# 6):

    using PInvoke;
    using static PInvoke.BCrypt; // Supported in C# 6 (VS2015) and later.

This will allow you to conveniently call these methods directly by method name:

    var error = BCryptOpenAlgorithm(AlgorithmIdentifiers.BCRYPT_SHA256_ALGORITHM); // C# 6 syntax
    var error = BCrypt.BCryptOpenAlgorithm(BCrypt.AlgorithmIdentifiers.BCRYPT_SHA256_ALGORITHM); // C# 5 syntax

## Design goals

Provide a slightly higher than lowest level API for P/Invoke signatures.
For example, instead of `IntPtr` parameters and `uint` flags, you'll see `SafeHandle`-derived
types as parameters and flags `enum` types. API documentation will be provided via XML doc comments
for easy reading with Intellisense, along with links to the describing pages on MSDN
or elsewhere as applicable.

This is a portable library so you can use it anywhere.

## Distribution

This library should be available on NuGet for easy consumption by your projects.
You may also copy and paste the P/Invoke signatures you need directly into your projects if desired. 

Packages:

Library      | Package name     | NuGet       | Description
-------------|------------------|-------------|-------------
kernel32.dll |`PInvoke.Kernel32`| [![NuGet](https://img.shields.io/nuget/v/PInvoke.Kernel32.svg)](https://www.nuget.org/packages/PInvoke.Kernel32)|Windows Kernel API
user32.dll   |`PInvoke.User32`  | [![NuGet](https://img.shields.io/nuget/v/PInvoke.User32.svg)](https://www.nuget.org/packages/PInvoke.User32)|Windows User Interface
gdi32.dll    |`PInvoke.Gdi32`   | [![NuGet](https://img.shields.io/nuget/v/PInvoke.Gdi32.svg)](https://www.nuget.org/packages/PInvoke.Gdi32)|[Windows Graphics Device Interface][Gdi]
setupapi.dll |`PInvoke.SetupApi`| [![NuGet](https://img.shields.io/nuget/v/PInvoke.SetupApi.svg)](https://www.nuget.org/packages/PInvoke.SetupApi)|[Windows application programming interface][SetupApi]
hid.dll      |`PInvoke.Hid`     | [![NuGet](https://img.shields.io/nuget/v/PInvoke.Hid.svg)](https://www.nuget.org/packages/PInvoke.Hid)|[Windows Human Interface Devices][Hid]
bcrypt.dll   |`PInvoke.BCrypt`  | [![NuGet](https://img.shields.io/nuget/v/PInvoke.BCrypt.svg)](https://www.nuget.org/packages/PInvoke.BCrypt)|[Windows CNG Cryptographic Configuration Functions][BCrypt]
ncrypt.dll   |`PInvoke.NCrypt`  | [![NuGet](https://img.shields.io/nuget/v/PInvoke.NCrypt.svg)](https://www.nuget.org/packages/PInvoke.NCrypt)|[Windows CNG Cryptographic Primitive Functions][NCrypt]



## Contribution

Please consider [contributing](CONTRIB.md) more P/Invoke method signatures to this project.
Once you contribute, you can immediately consume your additions without waiting for another
public release of the library.

[BCrypt]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb204774
[NCrypt]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa833130
[Hid]: https://msdn.microsoft.com/en-us/library/windows/hardware/ff538865
[SetupApi]: https://msdn.microsoft.com/en-us/library/windows/hardware/ff550855
[Gdi]: https://msdn.microsoft.com/en-us/library/dd145203<commit_msg>Readme: Update links to CNG dlls, add advapi and reorder links<commit_after>P/Invoke
=======

[![Build status](https://ci.appveyor.com/api/projects/status/idu56hy4jwytxd3x?svg=true)](https://ci.appveyor.com/project/AArnott/pinvoke)
[![Join the chat at https://gitter.im/AArnott/pinvoke](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/AArnott/pinvoke?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A library intended to contain all P/Invoke method signatures for popular operating systems.
Think of it as http://pinvoke.net, but proven to compile and work properly, and often
with sample usage in the form of unit tests.

## Usage

Install the NuGet package(s) for the DLLs you want to P/Invoke into.
For example, if you want to P/Invoke into Win32's BCrypt.dll, install this package:

    Install-Package PInvoke.BCrypt

Then import the following namespaces, as demonstrated below (if using C# 6):

    using PInvoke;
    using static PInvoke.BCrypt; // Supported in C# 6 (VS2015) and later.

This will allow you to conveniently call these methods directly by method name:

    var error = BCryptOpenAlgorithm(AlgorithmIdentifiers.BCRYPT_SHA256_ALGORITHM); // C# 6 syntax
    var error = BCrypt.BCryptOpenAlgorithm(BCrypt.AlgorithmIdentifiers.BCRYPT_SHA256_ALGORITHM); // C# 5 syntax

## Design goals

Provide a slightly higher than lowest level API for P/Invoke signatures.
For example, instead of `IntPtr` parameters and `uint` flags, you'll see `SafeHandle`-derived
types as parameters and flags `enum` types. API documentation will be provided via XML doc comments
for easy reading with Intellisense, along with links to the describing pages on MSDN
or elsewhere as applicable.

This is a portable library so you can use it anywhere.

## Distribution

This library should be available on NuGet for easy consumption by your projects.
You may also copy and paste the P/Invoke signatures you need directly into your projects if desired. 

Packages:

Library      | Package name     | NuGet       | Description
-------------|------------------|-------------|-------------
advapi32.dll |`PInvoke.AdvApi32`| [![NuGet](https://img.shields.io/nuget/v/PInvoke.AdvApi32.svg)](https://www.nuget.org/packages/PInvoke.AdvApi32)|Windows Advanced Services
bcrypt.dll   |`PInvoke.BCrypt`  | [![NuGet](https://img.shields.io/nuget/v/PInvoke.BCrypt.svg)](https://www.nuget.org/packages/PInvoke.BCrypt)|[Windows Cryptography API: Next Generation][CNG]
gdi32.dll    |`PInvoke.Gdi32`   | [![NuGet](https://img.shields.io/nuget/v/PInvoke.Gdi32.svg)](https://www.nuget.org/packages/PInvoke.Gdi32)|[Windows Graphics Device Interface][Gdi]
hid.dll      |`PInvoke.Hid`     | [![NuGet](https://img.shields.io/nuget/v/PInvoke.Hid.svg)](https://www.nuget.org/packages/PInvoke.Hid)|[Windows Human Interface Devices][Hid]
kernel32.dll |`PInvoke.Kernel32`| [![NuGet](https://img.shields.io/nuget/v/PInvoke.Kernel32.svg)](https://www.nuget.org/packages/PInvoke.Kernel32)|Windows Kernel API
ncrypt.dll   |`PInvoke.NCrypt`  | [![NuGet](https://img.shields.io/nuget/v/PInvoke.NCrypt.svg)](https://www.nuget.org/packages/PInvoke.NCrypt)|[Windows Cryptography API: Next Generation][CNG]
setupapi.dll |`PInvoke.SetupApi`| [![NuGet](https://img.shields.io/nuget/v/PInvoke.SetupApi.svg)](https://www.nuget.org/packages/PInvoke.SetupApi)|[Windows application programming interface][SetupApi]
user32.dll   |`PInvoke.User32`  | [![NuGet](https://img.shields.io/nuget/v/PInvoke.User32.svg)](https://www.nuget.org/packages/PInvoke.User32)|Windows User Interface

## Contribution

Please consider [contributing](CONTRIB.md) more P/Invoke method signatures to this project.
Once you contribute, you can immediately consume your additions without waiting for another
public release of the library.

[CNG]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376210
[Hid]: https://msdn.microsoft.com/en-us/library/windows/hardware/ff538865
[SetupApi]: https://msdn.microsoft.com/en-us/library/windows/hardware/ff550855
[Gdi]: https://msdn.microsoft.com/en-us/library/dd145203
{'fraction_non_alphanumeric': 0.14212818917237088, 'fraction_numerical': 0.019166148102053516, 'mean_word_length': 4.596100278551532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 49, 'lorem ipsum': 0, 'www.': 15, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2509910', 'n_tokens_mistral': 2780, 'n_tokens_neox': 2542, 'n_words': 630}