microsoft / microsoft/win32metadata

LoadImage's returned HANDLE must be released in ONE of THREE ways

Open
#611 14 comments 0 reactions 2 assignees Claimed by @sotteson1 View on GitHub
broken api special case
Dominant language
C++
Stars
1.5k
Forks
149
Avg merge
5d 16h
Merged PRs (30d)
4

Description

`LoadImageW`/`LoadImageA` in the metadata currently return a `HANDLE` type, which would be closed with `CloseHandle`.
However [the docs](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagea#return-value) state that one of `DeleteObject`, `DeleteCursor` or `DeleteIcon` should be used to release the handle, and only if the `LR_SHARED` flag was not passed in. The metadata returning `HANDLE` means `CloseHandle` will *always* be called, which is the wrong method and the wrong conditions.

How can we model this in the metadata?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.