Skip to content

winsock2.h #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
17 changes: 16 additions & 1 deletion TH-NETII Windows API.sln
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.WinI
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Constants.SCardErr", "src\THNETII.WinApi.Constants.SCardErr\THNETII.WinApi.Constants.SCardErr.csproj", "{25A891EB-9BF0-45D1-89EE-B24E80DE259E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "THNETII.WinApi.Headers.WinSCard", "src\THNETII.WinApi.Headers.WinSCard\THNETII.WinApi.Headers.WinSCard.csproj", "{56348771-2C99-4C0A-B63A-C7F0736621DA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.WinSCard", "src\THNETII.WinApi.Headers.WinSCard\THNETII.WinApi.Headers.WinSCard.csproj", "{56348771-2C99-4C0A-B63A-C7F0736621DA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Headers.WinSock2", "src\THNETII.WinApi.Headers.WinSock2\THNETII.WinApi.Headers.WinSock2.csproj", "{A2A98D11-DA03-410F-8440-280BFAE263CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -473,6 +475,18 @@ Global
{56348771-2C99-4C0A-B63A-C7F0736621DA}.Release|x64.Build.0 = Release|Any CPU
{56348771-2C99-4C0A-B63A-C7F0736621DA}.Release|x86.ActiveCfg = Release|Any CPU
{56348771-2C99-4C0A-B63A-C7F0736621DA}.Release|x86.Build.0 = Release|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Debug|x64.ActiveCfg = Debug|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Debug|x64.Build.0 = Debug|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Debug|x86.ActiveCfg = Debug|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Debug|x86.Build.0 = Debug|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Release|Any CPU.Build.0 = Release|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Release|x64.ActiveCfg = Release|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Release|x64.Build.0 = Release|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Release|x86.ActiveCfg = Release|Any CPU
{A2A98D11-DA03-410F-8440-280BFAE263CB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -510,6 +524,7 @@ Global
{35C252B4-AD97-4E09-8097-72FDCA04EBF7} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{25A891EB-9BF0-45D1-89EE-B24E80DE259E} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{56348771-2C99-4C0A-B63A-C7F0736621DA} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{A2A98D11-DA03-410F-8440-280BFAE263CB} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6EF7C9CF-E403-4B60-AB44-5F9FFEB668B7}
Expand Down
8 changes: 4 additions & 4 deletions src-native-c/THNETII.WinApi.Sample.Native/main.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <WinSCard.h>
#include <WinSock2.h>

int main(int argc, char* argv[])
{
SCARD_READERSTATE instance;
u_char instance;
const int size = sizeof(instance);
const int value = SCARD_ABSENT;
const int value = WINSOCK_VERSION;

const void* ptr = SCardGetReaderDeviceInstanceId;
const void* ptr = NULL;

return EXIT_SUCCESS;
}
11 changes: 11 additions & 0 deletions src/THNETII.WinApi.Headers.WinSock2/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Documentation", "CS1591: Missing XML comment for publicly visible type or member")]
[assembly: SuppressMessage("Documentation", "CA1200: Avoid using cref tags with a prefix")]
[assembly: SuppressMessage("Naming", "CA1707: Identifiers should not contain underscores")]

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>THNETII.WinApi.Native.WinSock2</RootNamespace>
</PropertyGroup>

</Project>
15 changes: 15 additions & 0 deletions src/THNETII.WinApi.Headers.WinSock2/WinSock2Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace THNETII.WinApi.Native.WinSock2
{
using static WinSock2Macros;

public static class WinSock2Constants
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
{
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\WinSock2.h, line 83
/// <summary>
/// Define the current Winsock version. To build an earlier Winsock version
/// application redefine this value prior to including Winsock2.h.
/// </summary>
public static readonly ushort WINSOCK_VERSION = MAKEWORD(2, 2);
}
}
12 changes: 12 additions & 0 deletions src/THNETII.WinApi.Headers.WinSock2/WinSock2Macros.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace THNETII.WinApi.Native.WinSock2
{
public static class WinSock2Macros
{
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\WinSock2.h, line 78
#region MAKEWORD macro
/// <inheritdoc cref="M:THNETII.WinApi.Native.MinWinDef.MinWinDefMacros.MAKEWORD(System.Byte,System.Byte)"/>
public static ushort MAKEWORD(byte low, byte high) =>
(ushort)(low | ((uint)high << 8));
#endregion
}
}