Skip to content
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

Add support for remapping short integers #1397

Merged
merged 2 commits into from
Dec 3, 2022

Conversation

riverar
Copy link
Collaborator

@riverar riverar commented Dec 3, 2022

Fixes #1389 and picks up some stragglers.

Metadata diff:

Windows.Win32.Networking.WinHttp.URL_COMPONENTS.nPort...System.UInt16 => Windows.Win32.Networking.WinHttp.INTERNET_PORT
Windows.Win32.Networking.WinHttp.WINHTTP_PROXY_RESULT_ENTRY.ProxyPort...System.UInt16 => Windows.Win32.Networking.WinHttp.INTERNET_PORT
Windows.Win32.Networking.WinInet.Apis.GopherCreateLocatorA : nServerPort...UInt16 => INTERNET_PORT
Windows.Win32.Networking.WinInet.Apis.GopherCreateLocatorW : nServerPort...UInt16 => INTERNET_PORT
Windows.Win32.Networking.WinInet.Apis.InternetConnectA : nServerPort...UInt16 => INTERNET_PORT
Windows.Win32.Networking.WinInet.Apis.InternetConnectW : nServerPort...UInt16 => INTERNET_PORT
Windows.Win32.Networking.WinInet.URL_COMPONENTSA.nPort...System.UInt16 => Windows.Win32.Networking.WinHttp.INTERNET_PORT
Windows.Win32.Networking.WinInet.URL_COMPONENTSW.nPort...System.UInt16 => Windows.Win32.Networking.WinHttp.INTERNET_PORT
Windows.Win32.Networking.WinInet.WININET_PROXY_INFO.ProxyPort...System.UInt16 => Windows.Win32.Networking.WinHttp.INTERNET_PORT
Windows.Win32.Networking.WinSock.SOCKADDR_DL.sdl_family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.Networking.WinSock.SOCKADDR_IN.sin_family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.Networking.WinSock.SOCKADDR_IN6.sin6_family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.Networking.WinSock.SOCKADDR_INET.si_family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.Networking.WinSock.SOCKADDR_STORAGE.ss_family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.Networking.WinSock.SOCKADDR_UN.sun_family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.Networking.WinSock.SOCKADDR.sa_family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.FlushIpNetTable2 : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.FlushIpPathTable : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetAnycastIpAddressTable : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetIpForwardTable2 : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetIpInterfaceTable : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetIpNetTable2 : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetIpNetworkConnectionBandwidthEstimates : AddressFamily...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetIpPathTable : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetMulticastIpAddressTable : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.GetUnicastIpAddressTable : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.NotifyIpInterfaceChange : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.NotifyRouteChange2 : AddressFamily...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.NotifyStableUnicastIpAddressTable : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.Apis.NotifyUnicastIpAddressChange : Family...UInt16 => ADDRESS_FAMILY
Windows.Win32.NetworkManagement.IpHelper.MIB_IPINTERFACE_ROW.Family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_CUSTOMER_ADDRESS_CHANGE_PARAM.CAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_CUSTOMER_ADDRESS_CHANGE_PARAM.PAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_POLICY_MISMATCH_PARAM.CAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_POLICY_MISMATCH_PARAM.PAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_PROVIDER_ADDRESS_CHANGE_PARAM.PAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_REDIRECT_PARAM.CAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_REDIRECT_PARAM.NewPAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.NetworkManagement.WindowsNetworkVirtualization.WNV_REDIRECT_PARAM.PAFamily...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY
Windows.Win32.Security.Apis.SetSecurityDescriptorControl : ControlBitsOfInterest...UInt16 => SECURITY_DESCRIPTOR_CONTROL
Windows.Win32.Security.Apis.SetSecurityDescriptorControl : ControlBitsToSet...UInt16 => SECURITY_DESCRIPTOR_CONTROL
Windows.Win32.System.Hypervisor.SOCKADDR_HV.Family...System.UInt16 => Windows.Win32.Networking.WinSock.ADDRESS_FAMILY

Interop diff sample (added an issue to resolve missing diff #1396):

// ...
public const VARIANT_BOOL VARIANT_FALSE = 0;
public const VARIANT_BOOL VARIANT_TRUE = -1;
// ...

@mikebattista mikebattista merged commit 37e2421 into microsoft:main Dec 3, 2022
@mikebattista
Copy link
Contributor

Awesome. Thanks!

@riverar riverar deleted the rafael/remap-add-short branch December 3, 2022 22:48
@mikebattista
Copy link
Contributor

I noticed a couple of bugs from this.

  1. ADDRESS_FAMILY should be typed as ushort.
  2. INTERNET_PORT is currently uint and should be ushort, but also that scenario is more open ended (the enum only contains a few known values), so I don't believe we should be applying the enum in these cases.

Do you agree?

@riverar
Copy link
Collaborator Author

riverar commented Dec 3, 2022

@mikebattista ADDRESS_FAMILY looks okay.

But INTERNET_PORT does looks like it should be a short
https://learn.microsoft.com/windows/win32/winhttp/internet-port

@mikebattista
Copy link
Contributor

ADDRESS_FAMILY is currently typed as uint but with your change we just remapped a bunch of ushort properties to a uint enum. Isn't that problematic? Given where ADDRESS_FAMILY is applied in enums.json today, there are several other APIs that expect a uint so it seems there's inconsistency in how we handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BOOL and BOOLEAN are defined as a struct whereas VARIANT_BOOL is defined as an enum
2 participants