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

Bug: Win32::Foundation::HINSTANCE is not generated #1517

Closed
mominul opened this issue Apr 1, 2023 · 15 comments
Closed

Bug: Win32::Foundation::HINSTANCE is not generated #1517

mominul opened this issue Apr 1, 2023 · 15 comments
Assignees
Labels
question Further information is requested

Comments

@mominul
Copy link

mominul commented Apr 1, 2023

Which crate is this about?

windows

Crate version

0.48.0

Summary

The type Win32::Foundation::HINSTANCE is not generated in 0.48.0 of the windows crate. I have faced such an issue in the 0.47.0 version also.

Toolchain version/configuration

Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\momin.rustup

stable-x86_64-pc-windows-msvc (default)
rustc 1.67.1 (d5a82bbd2 2023-02-07)

Reproducible example

use windows::Win32::Foundation::HINSTANCE;

pub static mut DLL_INSTANCE: HINSTANCE = HINSTANCE(0);

Crate manifest

[dependencies.windows]
version = "0.48"
features = [
    "Win32_Foundation"
]

Expected behavior

The type is generated and accessible.

Actual behavior

Not generated.

Additional comments

No response

@mominul mominul added the bug Something isn't working label Apr 1, 2023
@riverar
Copy link
Collaborator

riverar commented Apr 1, 2023

Hi @mominul, use HMODULE instead. See #1508 for more background.

@riverar riverar added question Further information is requested and removed bug Something isn't working labels Apr 1, 2023
@mominul
Copy link
Author

mominul commented Apr 1, 2023

Thanks! But I think this demands a FAQ entry, many API still uses 'hinstance' as the parameter name and MSDN docs have references to HINSTANCE.

Otherwise the metadata should get rid of 'hinstance' as parameter names also.

@kennykerr
Copy link
Contributor

I'll pass this on to the Win32 metadata repo for visibility.

@kennykerr kennykerr transferred this issue from microsoft/windows-rs Apr 3, 2023
@mikebattista
Copy link
Contributor

We can't change parameter names. When everything was HINSTANCE, the "module"-based parameters were out of sync, so if we need to standardize on 1 type for interoperability as we've done so far, the inconsistency will exist.

That said, I'm curious if we define both HMODULE and HINSTANCE and set them as AlsoUsableFor each other, if that would address the parameter name <-> type inconsistencies while also enabling interoperability. Below is what that would change.

[RAIIFree("FreeLibrary")]
[AlsoUsableFor("HINSTANCE")]
[InvalidHandleValue(0L)]
[NativeTypedef]
public struct HMODULE
{
	public IntPtr Value;
}

[RAIIFree("FreeLibrary")]
[AlsoUsableFor("HMODULE")]
[InvalidHandleValue(0L)]
[NativeTypedef]
public struct HINSTANCE
{
	public IntPtr Value;
}

Windows.Win32.Data.HtmlHelp.HH_POPUP.hinst...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Devices.DeviceAndDriverInstallation.Apis.InstallHinfSectionA : ModuleHandle...HMODULE => HINSTANCE
Windows.Win32.Devices.DeviceAndDriverInstallation.Apis.InstallHinfSectionW : ModuleHandle...HMODULE => HINSTANCE
Windows.Win32.Devices.Fax.Apis.StiCreateInstanceW : hinst...HMODULE => HINSTANCE
Windows.Win32.Devices.Fax.IStiDevice.Initialize : hinst...HMODULE => HINSTANCE
Windows.Win32.Devices.Fax.IStillImageW.Initialize : hinst...HMODULE => HINSTANCE
Windows.Win32.Devices.Fax.PFAX_EXT_REGISTER_FOR_EVENTS.Invoke : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.Fax.PFAX_EXT_SET_DATA.Invoke : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.Apis.DirectInput8Create : hinst...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.DIACTIONFORMATA.hInstString...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.DIACTIONFORMATW.hInstString...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInput8A.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInput8W.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInputA.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInputDevice8A.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInputDevice8W.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInputDeviceA.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInputDeviceW.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInputEffect.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.HumanInterfaceDevice.IDirectInputW.Initialize : param0...HMODULE => HINSTANCE
Windows.Win32.Devices.Tapi.Apis.lineInitialize : hInstance...HMODULE => HINSTANCE
Windows.Win32.Devices.Tapi.Apis.lineInitializeExA : hInstance...HMODULE => HINSTANCE
Windows.Win32.Devices.Tapi.Apis.lineInitializeExW : hInstance...HMODULE => HINSTANCE
Windows.Win32.Devices.Tapi.Apis.phoneInitialize : hInstance...HMODULE => HINSTANCE
Windows.Win32.Devices.Tapi.Apis.phoneInitializeExA : hInstance...HMODULE => HINSTANCE
Windows.Win32.Devices.Tapi.Apis.phoneInitializeExW : hInstance...HMODULE => HINSTANCE
Windows.Win32.Foundation.HINSTANCE added
Windows.Win32.Foundation.HMODULE : [InvalidHandleValue(0),NativeTypedef,RAIIFree(FreeLibrary)] => [AlsoUsableFor(HINSTANCE),InvalidHandleValue(0),NativeTypedef,RAIIFree(FreeLibrary)]
Windows.Win32.Graphics.DirectDraw.DDRAWI_DIRECTDRAW_LCL.hD3DInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Graphics.Gdi.Apis.LoadBitmapA : hInstance...HMODULE => HINSTANCE
Windows.Win32.Graphics.Gdi.Apis.LoadBitmapW : hInstance...HMODULE => HINSTANCE
Windows.Win32.Graphics.Printing.COMPROPSHEETUI.hInstCaller...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Graphics.Printing.OIEXT.hInstCaller...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Graphics.Printing.PROPSHEETUI_INFO_HEADER.hInst...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Media.Audio.ACMFILTERCHOOSEA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Media.Audio.ACMFILTERCHOOSEW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Media.Audio.ACMFORMATCHOOSEA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Media.Audio.ACMFORMATCHOOSEW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Media.Audio.Apis.acmDriverAddA : hinstModule...HMODULE => HINSTANCE
Windows.Win32.Media.Audio.Apis.acmDriverAddW : hinstModule...HMODULE => HINSTANCE
Windows.Win32.Media.Multimedia.Apis.MCIWndCreateA : hInstance...HMODULE => HINSTANCE
Windows.Win32.Media.Multimedia.Apis.MCIWndCreateW : hInstance...HMODULE => HINSTANCE
Windows.Win32.Networking.ActiveDirectory.CQPAGE.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Networking.ActiveDirectory.DSQUERYPARAMS.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Networking.WinInet.Apis.DeleteIE3Cache : hinst...HMODULE => HINSTANCE
Windows.Win32.Networking.WinInet.Apis.RunOnceUrlCache : hinst...HMODULE => HINSTANCE
Windows.Win32.NetworkManagement.Rras.RasCustomDialDlgFn.Invoke : hInstDll...HMODULE => HINSTANCE
Windows.Win32.NetworkManagement.Rras.RasCustomDialFn.Invoke : hInstDll...HMODULE => HINSTANCE
Windows.Win32.NetworkManagement.Rras.RasCustomEntryDlgFn.Invoke : hInstDll...HMODULE => HINSTANCE
Windows.Win32.Security.Authorization.UI.SI_OBJECT_INFO.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Security.Cryptography.UI.CERT_SELECT_STRUCT_A.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Security.Cryptography.UI.CERT_SELECT_STRUCT_W.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Security.Cryptography.UI.CERT_VIEWPROPERTIES_STRUCT_A.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Security.Cryptography.UI.CERT_VIEWPROPERTIES_STRUCT_W.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.AddressBook.Apis.BuildDisplayTable : hInstance...HMODULE => HINSTANCE
Windows.Win32.System.ClrHosting.Apis.RunDll32ShimW : hinst...HMODULE => HINSTANCE
Windows.Win32.System.Com.Apis.CoFreeLibrary : hInst...HMODULE => HINSTANCE
Windows.Win32.System.Com.Apis.CoLoadLibrary : return...HMODULE => HINSTANCE
Windows.Win32.System.Ole.Apis.OleIconToCursor : hinstExe...HMODULE => HINSTANCE
Windows.Win32.System.Ole.OLEUIBUSYA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUIBUSYW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUICHANGEICONA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUICHANGEICONW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUICHANGESOURCEA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUICHANGESOURCEW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUICONVERTA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUICONVERTW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUIEDITLINKSA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUIEDITLINKSW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUIINSERTOBJECTA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUIINSERTOBJECTW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUIPASTESPECIALA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.Ole.OLEUIPASTESPECIALW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.System.WindowsProgramming.Apis.DelNodeRunDLL32W : hInstance...HMODULE => HINSTANCE
Windows.Win32.System.WindowsProgramming.Apis.LaunchINFSectionExW : hInstance...HMODULE => HINSTANCE
Windows.Win32.System.WindowsProgramming.Apis.LaunchINFSectionW : hInstance...HMODULE => HINSTANCE
Windows.Win32.System.WindowsProgramming.Apis.UserInstStubWrapperA : hInstance...HMODULE => HINSTANCE
Windows.Win32.System.WindowsProgramming.Apis.UserInstStubWrapperW : hInstance...HMODULE => HINSTANCE
Windows.Win32.System.WindowsProgramming.Apis.UserUnInstStubWrapperA : hInstance...HMODULE => HINSTANCE
Windows.Win32.System.WindowsProgramming.Apis.UserUnInstStubWrapperW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.CreateMappedBitmap : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.CreateToolbarEx : hBMInst...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.CreateUpDownControl : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.GetThemeStream : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.ImageList_LoadImageA : hi...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.ImageList_LoadImageW : hi...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.LoadIconMetric : hinst...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.LoadIconWithScaleDown : hinst...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.MenuHelp : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Apis.TaskDialog : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.Controls.Dialogs.CHOOSEFONTA.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.CHOOSEFONTA.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.CHOOSEFONTW.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.CHOOSEFONTW.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.FINDREPLACEA.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.FINDREPLACEA.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.FINDREPLACEW.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.FINDREPLACEW.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAME_NT4A.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAME_NT4A.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAME_NT4W.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAME_NT4W.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAMEA.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAMEA.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAMEW.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.OPENFILENAMEW.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PAGESETUPDLGA.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PAGESETUPDLGA.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PAGESETUPDLGW.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PAGESETUPDLGW.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGA.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGA.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGEXA.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGEXA.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGEXW.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGEXW.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGW.hInstance(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.Dialogs.PRINTDLGW.hInstance(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.NMTTDISPINFOA.hinst...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.NMTTDISPINFOW.hinst...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETHEADERA_V1.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETHEADERA_V2.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETHEADERW_V1.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETHEADERW_V2.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEA_V1.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEA_V2.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEA_V3.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEW_V1.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEW_V2.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEW_V3.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.PROPSHEETPAGEW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.TASKDIALOGCONFIG.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.TBADDBITMAP.hInst...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.TBREPLACEBITMAP.hInstNew...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.TBREPLACEBITMAP.hInstOld...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.TTTOOLINFOA.hinst...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Controls.TTTOOLINFOW.hinst...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Ribbon.IUIFramework.LoadUI : instance...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.DuplicateIcon : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ExtractAssociatedIconA : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ExtractAssociatedIconExA : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ExtractAssociatedIconExW : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ExtractAssociatedIconW : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ExtractIconA : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ExtractIconW : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.FindExecutableA : return...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.FindExecutableW : return...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ShellExecuteA : return...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ShellExecuteW : return...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ShellMessageBoxA : hAppInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.Apis.ShellMessageBoxW : hAppInst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.IProgressDialog.SetAnimation : hInstAnimation...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.PropertiesSystem.Apis.InitPropVariantFromResource : hinst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.PropertiesSystem.Apis.InitVariantFromResource : hinst...HMODULE => HINSTANCE
Windows.Win32.UI.Shell.SHELLEXECUTEINFOA.hInstApp(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Shell.SHELLEXECUTEINFOA.hInstApp(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Shell.SHELLEXECUTEINFOW.hInstApp(X64, Arm64)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.Shell.SHELLEXECUTEINFOW.hInstApp(X86)...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateCursor : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateDialogIndirectParamA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateDialogIndirectParamW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateDialogParamA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateDialogParamW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateIcon : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateMDIWindowA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateMDIWindowW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateWindowExA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.CreateWindowExW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.DialogBoxIndirectParamA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.DialogBoxIndirectParamW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.DialogBoxParamA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.DialogBoxParamW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.GetClassInfoA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.GetClassInfoExA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.GetClassInfoExW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.GetClassInfoW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadAcceleratorsA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadAcceleratorsW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadCursorA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadCursorW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadIconA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadIconW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadImageA : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadImageW : hInst...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadMenuA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadMenuW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadStringA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.LoadStringW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.SetWindowsHookExA : hmod...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.SetWindowsHookExW : hmod...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.UnregisterClassA : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.Apis.UnregisterClassW : hInstance...HMODULE => HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.CREATESTRUCTA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.CREATESTRUCTW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.MSGBOXPARAMSA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.MSGBOXPARAMSW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.WNDCLASSA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.WNDCLASSEXA.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.WNDCLASSEXW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.UI.WindowsAndMessaging.WNDCLASSW.hInstance...Windows.Win32.Foundation.HMODULE => Windows.Win32.Foundation.HINSTANCE
Windows.Win32.Web.InternetExplorer.Apis.RatingClickedOnPRFInternal : param1...HMODULE => HINSTANCE
Windows.Win32.Web.InternetExplorer.Apis.RatingClickedOnRATInternal : param1...HMODULE => HINSTANCE

mikebattista added a commit that referenced this issue Apr 3, 2023
@mikebattista mikebattista self-assigned this Apr 3, 2023
@mikebattista
Copy link
Contributor

Should we make this change?

@kennykerr @AArnott @timsneath @marler8997 do you support AlsoUsableFor in this way?

@timsneath
Copy link
Contributor

timsneath commented Apr 5, 2023

Dart doesn't need an attribute to differentiate between these (we treat them both as IntPtr), so no issue for us here.

@mikebattista
Copy link
Contributor

As long as examples like https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-createwindowexw#example continue to work then this would be an improvement.

The example above is passing GetModuleHandle(null), which returns an HMODULE, into CreateWindow, which expects an HINSTANCE.

@marler8997
Copy link
Contributor

My unqualified opinion is that it seems like there's a new level of complexity added when your type heirachy is more complex than a DAG. I could forsee some languages possibly having problems if AlsoUsableFor could create cycles? Not sure though, just a hunch mostly. As for Zig we can't really do much with AlsoUsableFor except using it to create convenient functions for conversions so these cycles wouldn't be an issue. I think there might be a proposal around adding implicit conversions between opaque types, but I think those are "one-way" meaning the relationship would have to be a DAG. Take this all with a big grain of salt :)

@kennykerr
Copy link
Contributor

do you support AlsoUsableFor in this way?

Yes.

@AArnott
Copy link
Member

AArnott commented Apr 6, 2023

CsWin32 doesn't support AlsoUsableFor yet. But when it does, I don't anticipate any problems for C# if relationships were cyclical.

@mikebattista
Copy link
Contributor

Thanks. So if we make this change, C# users will need to cast HMODULEs to HINSTANCEs in the meantime if they need to convert?

@AArnott
Copy link
Member

AArnott commented Apr 6, 2023

I don't think a cast would work. They would have to do something like new HMODULE(hinstance.Value).

@mikebattista
Copy link
Contributor

Ok. I'd prefer you support the implicit conversion before we make this change.

@AArnott
Copy link
Member

AArnott commented Apr 6, 2023

Thanks. I'll bump the priority of adding that feature.

@mikebattista
Copy link
Contributor

Thanks!

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

No branches or pull requests

7 participants