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

SetWindowLongPtr on 32-bit #387

Closed ghost closed 6 years ago

ghost commented 6 years ago

According to the documentation for SetWindowLongPtr,

When compiling for 32-bit Windows, SetWindowLongPtr is defined as a call to the SetWindowLong function.

What this really means is that calls to PInvoke.User32.SetWindowLongPtr on 32-bit processes will (and do) result in an EntryPointNotFoundException

This fix exposes SetWindowLongPtr through User32.Helpers.cs by conditionally calling SetWindowLongPtr on 64-bit vs. SetWindowLong on 32-bit.

Also, adding a test.

Fixes #385