Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Add IPHlpApi #466

Merged
merged 5 commits into from
Jul 1, 2020
Merged

Add IPHlpApi #466

merged 5 commits into from
Jul 1, 2020

Conversation

qmfrederik
Copy link
Contributor

  • GetExtendedTcpTable

Adding netstandard1.1 support is a bit problematic, is this really required?

Copy link
Collaborator

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing. Yes, I think you can drop netstandard1.1 support as you suggest.
I have a few repo-contributing guideline conformance requests for you, and I'll be happy to merge.

src/IPHlpApi/IPHlpApi.cs Outdated Show resolved Hide resolved
bool sort,
AddressFamily ipVersion,
TcpTableType tcpTableType,
int reserved);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest uint for reserved here since we don't know what it'll be used for and the header file defines it as unsigned, and specifying 0 as an argument isn't any harder with it typed as uint than it is if it were typed with int.

src/IPHlpApi/IPHlpApi+MIB_TCPROW_OWNER_PID.cs Outdated Show resolved Hide resolved
{
try
{
tcpTable = Marshal.AllocHGlobal(tcpTableLength);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip: using pointers in C# instead of these IntPtr types actually result in less code, and is often simpler to verify correctness.

src/IPHlpApi.Tests/IPHlpApiFacts.cs Outdated Show resolved Hide resolved
src/IPHlpApi/IPHlpApi.cs Outdated Show resolved Hide resolved
src/IPHlpApi/IPHlpApi+TcpTableType.cs Outdated Show resolved Hide resolved
src/IPHlpApi/IPHlpApi+TcpTableType.cs Outdated Show resolved Hide resolved
/// <summary>
/// The number of MIB_TCPROW_OWNER_PID elements in the table.
/// </summary>
public uint Length;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called dwNumEntries

src/IPHlpApi/IPHlpApi+MIB_TCPROW_OWNER_PID.cs Outdated Show resolved Hide resolved
@qmfrederik
Copy link
Contributor Author

@AArnott Thanks for the feedback, I think I addressed all your remarks.

README.md Outdated Show resolved Hide resolved
@qmfrederik
Copy link
Contributor Author

@AArnott , apart from the other comments, I disabled netstandard1.1 support for this project because of the enum which gets pulled in. That in turn breaks the project reference from Win32 to this project.

#435 mentions dropping netstandard1.1 (& net2.0) support. Is that still on the table (makes a lot of sense to me)? If so, I could open a PR for that.

@AArnott
Copy link
Collaborator

AArnott commented Jul 1, 2020

That in turn breaks the project reference from Win32 to this project.

Feel free to make the ProjectReference in Win32 conditional on the TargetFramework to avoid the build break for now.

Yes, #435 seems reasonable to do. I'd appreciate a PR for that.

@AArnott AArnott merged commit 840c6ac into dotnet:master Jul 1, 2020
@qmfrederik qmfrederik deleted the features/iphlpapi branch July 1, 2020 21:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants