Skip to content
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
30 changes: 30 additions & 0 deletions TH-NETII Windows API.sln
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "THNETII.WinApi.Constants.SC
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}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "THNETII.WinApi.Headers.InAddr", "src\THNETII.WinApi.Headers.InAddr\THNETII.WinApi.Headers.InAddr.csproj", "{5C37B204-B1DB-41B2-8081-B84870477F43}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "THNETII.WinApi.Headers.Ws2Def", "src\THNETII.WinApi.Headers.Ws2Def\THNETII.WinApi.Headers.Ws2Def.csproj", "{2ADE678A-17A4-45EF-8E2B-F95A0B612749}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -473,6 +477,30 @@ 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
{5C37B204-B1DB-41B2-8081-B84870477F43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Debug|x64.ActiveCfg = Debug|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Debug|x64.Build.0 = Debug|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Debug|x86.Build.0 = Debug|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Release|Any CPU.Build.0 = Release|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Release|x64.ActiveCfg = Release|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Release|x64.Build.0 = Release|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Release|x86.ActiveCfg = Release|Any CPU
{5C37B204-B1DB-41B2-8081-B84870477F43}.Release|x86.Build.0 = Release|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Debug|x64.ActiveCfg = Debug|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Debug|x64.Build.0 = Debug|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Debug|x86.ActiveCfg = Debug|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Debug|x86.Build.0 = Debug|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Release|Any CPU.Build.0 = Release|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Release|x64.ActiveCfg = Release|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Release|x64.Build.0 = Release|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Release|x86.ActiveCfg = Release|Any CPU
{2ADE678A-17A4-45EF-8E2B-F95A0B612749}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -510,6 +538,8 @@ 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}
{5C37B204-B1DB-41B2-8081-B84870477F43} = {9689DB3E-1ED7-478C-AC14-C734B0397619}
{2ADE678A-17A4-45EF-8E2B-F95A0B612749} = {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;
ADDRESS_FAMILY instance;
const int size = sizeof(instance);
const int value = SCARD_ABSENT;
const int value = NULL;

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

return EXIT_SUCCESS;
}
10 changes: 10 additions & 0 deletions src/THNETII.WinApi.Headers.InAddr/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// 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("Naming", "CA1707: Identifiers should not contain underscores")]
[assembly: SuppressMessage("Style", "IDE1006: Naming Styles")]
[assembly: SuppressMessage("Performance", "CA1815: Override equals and operator equals on value types")]
80 changes: 80 additions & 0 deletions src/THNETII.WinApi.Headers.InAddr/IN_ADDR.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System.Runtime.InteropServices;

namespace THNETII.WinApi.Native.InAddr
{
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\inaddr.h, line 21
//
// IPv4 Internet address
// This is an 'on-wire' format structure.
//

/// <summary>
/// The <see cref="IN_ADDR"/> structure represents an IPv4 address.
/// <para><note>The <strong>IPaddr</strong> type definition in IP Helper also represents an IPv4 address and can be cast to an interchangeable <strong>in_addr</strong> structure when needed. The <strong>in_addr</strong> structure in IP Helper has the same syntax and usage as the Windows Sockets <strong>in_addr</strong> structure, and is interchangeable with <strong>in_addr</strong> structure used in Windows sockets. Windows sockets also defines an <strong>IN_ADDR</strong> typedef for the <strong>in_addr</strong> structure.</note></para>
/// </summary>
/// <remarks>
/// <para>Microsoft Docs page: <a href="https://docs.microsoft.com/en-us/windows/win32/api/inaddr/ns-inaddr-in_addr">IN_ADDR structure</a></para>
/// </remarks>
/// <seealso cref="ARP_SEND_REPLY"/>
/// <seealso cref="AddIPAddress"/>
/// <seealso cref="GetBestInterface"/>
/// <seealso cref="GetRTTAndHopCount"/>
/// <seealso cref="ICMP_ECHO_REPLY"/>
/// <seealso cref="IP_UNIDIRECTIONAL_ADAPTER_ADDRESS"/>
/// <seealso cref="IcmpSendEcho"/>
/// <seealso cref="IcmpSendEcho2"/>
/// <seealso cref="SendARP"/>
/// <seealso cref="in_addr"/>
[StructLayout(LayoutKind.Explicit, Pack = 4)]
public unsafe struct IN_ADDR
{
[FieldOffset(0)]
internal fixed byte S_un_b[4];
[FieldOffset(0)]
internal fixed ushort S_un_w[2];
[FieldOffset(0)]
internal uint S_addr;

/// <summary>Address of the host formatted as a 32-bit integer</summary>
public uint s_addr
{
get => S_addr;
set => S_addr = value;
}

/// <summary>host on imp</summary>
public byte s_host
{
get => S_un_b[1];
set => S_un_b[1] = value;
}

/// <summary>network</summary>
public byte s_net
{
get => S_un_b[0];
set => S_un_b[0] = value;
}

/// <summary>imp</summary>
public ushort s_imp
{
get => S_un_w[1];
set => S_un_w[1] = value;
}

/// <summary>imp #</summary>
public byte s_impno
{
get => S_un_b[3];
set => S_un_b[3] = value;
}

/// <summary>logical host</summary>
public byte s_lh
{
get => S_un_b[2];
set => S_un_b[2] = value;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

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

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

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

<ItemGroup>
<ProjectReference Include="..\THNETII.WinApi.Headers.InAddr\THNETII.WinApi.Headers.InAddr.csproj" />
</ItemGroup>

</Project>