dotnet / pinvoke

A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.
MIT License
2.12k stars 222 forks source link

Need test for ChangeServiceConfig2 with ServiceFailureActions #425

Closed icnocop closed 5 years ago

icnocop commented 5 years ago

Hi.

Thank you for the PInvoke libraries.

The ServiceFailureActions structure has an array of ServiceControlActions and this seems to cause issues when trying to pass it to ChangeServiceConfig2.

When I try, I get the following exception: "PInvoke.Win32Exception (0x80004005): The parameter is incorrect".

All the code examples I've seen that use IntPtr instead of an array work without issues.

Thank you.

AArnott commented 5 years ago

How would we test it? Can this method be called outside of a Windows Service?

AArnott commented 5 years ago

I suspect the problem here isn't the array -- it's probably the string fields. But anyway this struct doesn't follow any of our current guidelines so I'm rewriting them...