You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to call the method LoadIcon. The first parameter is documented to be null if you want a system resource.
However if I call it with the following:
var handle = PInvoke.LoadIcon(FreeLibrarySafeHandle.Null, resource_name);
I'll get an access violation exception, because it sets the pointer to -1 which becomes 0xffffffff.
The workaround is to set it to the correct pointer value for a null:
var handle = PInvoke.LoadIcon(new FreeLibrarySafeHandle(IntPtr.Zero), resource_name);
It seems to me the Null should be using 0 instead of -1.
The text was updated successfully, but these errors were encountered:
That confirms my suspicion that the same problem was appearing with CloseHandleSafeHandle and DestroyMenuSafeHandle, since you fixed it on their common baseclass.
I'm trying to call the method
LoadIcon
. The first parameter is documented to be null if you want a system resource.However if I call it with the following:
I'll get an access violation exception, because it sets the pointer to
-1
which becomes0xffffffff
.The workaround is to set it to the correct pointer value for a null:
It seems to me the
Null
should be using 0 instead of -1.The text was updated successfully, but these errors were encountered: