This repository was archived by the owner on Jul 26, 2023. It is now read-only.
This repository was archived by the owner on Jul 26, 2023. It is now read-only.
Kernel32.GetModuleHandle should return IntPtr instead of SafeHandle #563
Closed
Description
The GetModuleHandle function returns a handle to a mapped module without incrementing its reference count. However, if this handle is passed to the FreeLibrary function, the reference count of the mapped module will be decremented. Therefore, do not pass a handle returned by GetModuleHandle to the FreeLibrary function. Doing so can cause a DLL module to be unmapped prematurely.