Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18382
If an imagelist is created and stored to a file on windows using WriteEx(ImageList_WriteEx is not implemented in WINE), and it is read using ImageList_Read(), it should still read just fine on Windows. On WINE we see the version mismatch as it was made using V6 Comctl32 and WriteEx and return -1 instead.
From: Jacob Czekalla jczekalla@codeweavers.com
--- dlls/comctl32/tests/imagelist.c | 22 ++++++++++++++++++++++ dlls/comctl32/tests/imglist.img | Bin 0 -> 17068 bytes dlls/comctl32/tests/resources.h | 2 ++ dlls/comctl32/tests/rsrc.rc | 2 ++ 4 files changed, 26 insertions(+) create mode 100644 dlls/comctl32/tests/imglist.img
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index de0b0dd4c08..2417a535a31 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -2640,6 +2640,27 @@ static void test_ImageList_WriteEx(void) pImageList_Destroy(himl); }
+static void test_ImageList_read_version(void) +{ + HRSRC resource = FindResourceA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(IDR_IMAGELIST_DATA), MAKEINTRESOURCEA(RT_RCDATA)); + HGLOBAL resource_data = LoadResource(GetModuleHandleA(NULL), resource); + DWORD data_size = SizeofResource(GetModuleHandleA(NULL), resource); + IStream* stream = NULL; + ULONG bytes_written = 0; + LARGE_INTEGER large_int = {0}; + HIMAGELIST hImageList = NULL; + + ok(resource != 0, "Failed to find IDR_IMAGELIST_DATA.\n"); + ok(CreateStreamOnHGlobal(NULL, TRUE, &stream) >= 0, "Faile to create IStream.\n"); + ok(stream->lpVtbl->Write(stream, LockResource(resource_data), data_size, &bytes_written) >= 0 + || bytes_written == data_size, "Failed to write bytes to IStream.\n"); + stream->lpVtbl->Seek(stream, large_int, 0, NULL); + hImageList = pImageList_Read(stream); + IStream_Release(stream); + todo_wine ok(hImageList != 0, "Failed to read imagelist from stream.\n"); + pImageList_Destroy(hImageList); +} + static void init_functions(void) { HMODULE hComCtl32 = LoadLibraryA("comctl32.dll"); @@ -2737,6 +2758,7 @@ START_TEST(imagelist) test_IImageList_GetImageCount(); test_IImageList_GetIconSize(); test_ImageList_WriteEx(); + test_ImageList_read_version();
CoUninitialize();
diff --git a/dlls/comctl32/tests/imglist.img b/dlls/comctl32/tests/imglist.img new file mode 100644 index 0000000000000000000000000000000000000000..3eb9cdb60cc3b2aef1570c6fa2a128db658cc981 GIT binary patch literal 17068 zcmeI4L2gq)5JbOGgg68Xv*QFT5y}pU+=-jRw4)~;t(oyRVuPq}jjOw>y2dGa>wNuo zeS0~c#_Kv>KgRRn_FmQV%ctY@Df~Fjb)4_xTyE7UzKoM62_%6ekOY!I5=a6`APFRa zB#;D>KoUp-NgxR%fh3Rwl0Xtj0!bhVB!MK51d>1!NCHV92_%6ekOY!I5=a6`APFRa zB#;D>Koa=p5*R-ms9zA=&T;(0s#mA<GY%gko}R60dzQxis<v+Cd+&aH@v#RS9_~G3 z$2_x{?~L>Ay_$V=^hR@4n{$m0+;P^}({t}vz2nSxoqOuDc=j{w{P=8OX{ozE^PS&} z^PX#KS95EqOUq&QD4yNtbD^K%*}L&7JwCneUb7u`&3Vr}HN1CR!><r6e!CuzuB|zH zXqb8K+B$0ZLLYl|4Z9$`cg&e*-qClXpUqZx*pL0L^&I_f*6&Bl91reUA$!(a>$$bu z1EQPt_|3SQv1=W(84qVfH@m~Worl8<9`u|VL{sQl)t=G!*=%l4YP>tbgYdm)UTCgr zW@zAza7K37-}Tnui<kF2vyK|Hj`|F;Ux=O=eMfj>Y3woUyU(M&@9THrHJf`69k}Dr zJc@X-M-MVLcCPm`Et<mO>8<sA#dm%0y+_?~c2C#P+rMV+UBj_A>*4O*Z(p>1w(GfP z^%?NAj=FQc2Mq{UJ#|Moc4oafc>6Hh>8$bYy?W-!tahpG-)FwVT(7NL)!zA&`}>al zs8@IQ-C4ie{Ttl#%jfZ3s;BVx{~B<)&5t*)(BJE?%kzIHP~VVu;}kxP^L`wjpOCqC AI{*Lx
literal 0 HcmV?d00001
diff --git a/dlls/comctl32/tests/resources.h b/dlls/comctl32/tests/resources.h index c4692654aed..06055c045f0 100644 --- a/dlls/comctl32/tests/resources.h +++ b/dlls/comctl32/tests/resources.h @@ -50,4 +50,6 @@ #define IDC_PS_COMBO1 1020 #define IDC_PS_PUSHBUTTON1 1021
+#define IDR_IMAGELIST_DATA 1022 + #endif /* __WINE_COMCTL32_TEST_RESOURCES_H */ diff --git a/dlls/comctl32/tests/rsrc.rc b/dlls/comctl32/tests/rsrc.rc index df22053d4cc..2c6dd9e29b8 100644 --- a/dlls/comctl32/tests/rsrc.rc +++ b/dlls/comctl32/tests/rsrc.rc @@ -171,3 +171,5 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Cancel", IDCANCEL, 100, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP EDITTEXT 1000, 5, 5, 150, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_AUTOVSCROLL | ES_WANTRETURN } + +IDR_IMAGELIST_DATA RCDATA "imglist.img" \ No newline at end of file
From: Jacob Czekalla jczekalla@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18382 --- dlls/comctl32/imagelist.c | 2 -- dlls/comctl32/tests/imagelist.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 49155e8d2c1..58de0befd7c 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -2196,8 +2196,6 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm) return NULL; if (ilHead.usMagic != (('L' << 8) | 'I')) return NULL; - if (ilHead.usVersion != 0x101) /* probably version? */ - return NULL;
TRACE("cx %u, cy %u, flags 0x%04x, cCurImage %u, cMaxImage %u\n", ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage); diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 2417a535a31..a41a326b08e 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -2657,7 +2657,7 @@ static void test_ImageList_read_version(void) stream->lpVtbl->Seek(stream, large_int, 0, NULL); hImageList = pImageList_Read(stream); IStream_Release(stream); - todo_wine ok(hImageList != 0, "Failed to read imagelist from stream.\n"); + ok(hImageList != 0, "Failed to read imagelist from stream.\n"); pImageList_Destroy(hImageList); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147940
Your paranoid android.
=== w10pro64_zh_CN (64 bit report) ===
comctl32: treeview.c:3116: Test failed: right click sequence: the msg sequence is not complete: expected 0000 - actual 0282
I don't think you can do that. As I recall storage format was different for newer version.
On Thu Aug 22 21:16:10 2024 +0000, Nikolay Sivov wrote:
I don't think you can do that. As I recall storage format was different for newer version.
It worked when I brought over the exe from windows with the stored imagelist in it and got rid of the version check. It still read and displayed it.
On Thu Aug 22 21:16:10 2024 +0000, Jacob Czekalla wrote:
It worked when I brought over the exe from windows with the stored imagelist in it and got rid of the version check. It still read and displayed it.
We have tests for how it's written to the stream.
This merge request was closed by Jacob Czekalla.