microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.02k stars 6.48k forks source link

Use win32metadata for calling win32 apis from c# #9242

Open martinchrzan opened 3 years ago

martinchrzan commented 3 years ago

Multiple PT c# projects are using win32 apis by manualy defining its wrappers.

Win32metadata project provides generation of win32 api wrappers for c# without a need for manually maintaining files with dllimport functions signatures, which are error prone.

More details can be found here:

https://blogs.windows.com/windowsdeveloper/2021/01/21/making-win32-apis-more-accessible-to-more-languages/

https://github.com/microsoft/win32metadata

htcfreek commented 3 years ago

Sounds interesting. But do we add a source for failures of we use this?

royvou commented 3 years ago

It looked like an interesting PR to pickup but while working (checking how it all works) on it the tooling/packages don't 'feel' ready to be implemented. I think the following prerequisites are needed for this PR (at this moment).

Otherwise there are still a few nice to haves 'issues'/PRS open within that repo :)

Should we also wait until a RC/'Official' release is provided? Currently they all have the 'Beta' flag. Install-Package Microsoft.Windows.CsWin32 -Version 0.1.422-beta

Still think its a great task to have on the backlog, just not for now.

enricogior commented 3 years ago

@royvou thank you for looking into this one, but we don't really need it right now, the team is focused to bring stability and adding more dependencies is not something that will help.

royvou commented 3 years ago

I just wanted to add that information because it has the "Help Wanted" tag :) So if someone thinks "I want to pickup something with the 'help wanted' tag, they should prefer another task over this one .

enricogior commented 3 years ago

@royvou thanks again for looking into this ;)