Is anyone familiar with these two Win32 functions, GetImageInfo() and GetIconInfo() ?

Both return a POD struct of data, which includes HBITMAP handles. So, I assume they don't call a destructor when they go out of scope.

typedef struct _IMAGEINFO {
HBITMAP hbmImage;
HBITMAP hbmMask;
int Unused1;
int Unused2;
RECT rcImage;
} IMAGEINFO, *LPIMAGEINFO;

typedef struct _ICONINFO {
BOOL fIcon;
DWORD xHotspot;
DWORD yHotspot;
HBITMAP hbmMask;
HBITMAP hbmColor;
} ICONINFO;

Microsoft documentation does not explicitly state whether these bitmap handles should be released or not. Nor does it explicitly state whether these bitmap handles are shared or not.

In other words, is this copied data? If so, should one call DeleteObject() on these handles, in every case? Or is this data someone shared with the ImageList they come from? So, if we delete them, it would corrupt the ImageList bitmaps?

I would like to avoid memory leaks after calling these functions, if possible.