In the function ImagingFactory_CreateBitmapFromHBITMAP, the hpal can be given NULL by application. In current wine, the color calculation is wrong for the format GUID_WICPixelFormat1bppIndexed, GUID_WICPixelFormat4bppIndexed and GUID_WICPixelFormat8bppIndexed if the application does not pass palette argument. WIC bitmap can not be used in the later WIC operation, such as FormatConverter_CopyPixels. After testing the code on the Windows system, I believe it should be handled as follows: If palette is NULL, and the format needs a palette to build color. It is necessary to obtain the bmiColors of the hbitmap at the time of its creation, such as CreateDIBSection.
This is an 8bpp WIC program that does not run correctly under the current Wine.
[wincodecs_test.c](/uploads/ad8051925814bb1d92d936134c8c3c9c/wincodecs_test.c)
[wincodecs_test.exe](/uploads/53c8e520cfc415282c4221ac8789e7e6/wincodecs_test.exe)