New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SHELL32][USER32] Fix icon regression and one test #5207
Conversation
The bug that you do intend to fix here... does that happen also on Wine? If not, why not? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also have tests (maybe in an apitest or winetest for user32) for the PrivateExtractIconsW and PrivateExtractIconExW (undocumented) functions?
@@ -307,7 +307,7 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE | |||
ILGetDisplayNameExW(psf, pidl, wTemp, ILGDN_FORPARSING); | |||
icon_idx = 0; | |||
|
|||
INT ret = ExtractIconExW(wTemp, -1, NULL, NULL, 0); | |||
INT ret = PrivateExtractIconsW(wTemp, 0, 0, 0, NULL, NULL, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other ExtractIconExW()
calls in shell32 (and elsewhere).
Does only this one need to be changed? (Why?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the problem in https://jira.reactos.org/browse/CORE-18897 you can see that some icons are shown correctly and others are shown with the IDI_SHELL_DOCUMENT default icon. I found that the problem icons were those that had a PNG icon embedded in them. So I created a new ROS.ico file with the properties of having one normal BMP icon and one PNG encoded icon in it. Then I looked at the tests for shell32:ExtractIconEx and user32:PrivateExtractIcons.
I wrote more tests to include the new ROS.ico in PR #5169 and PR #5209. My findings were that the expected result from this function needed to be more in line with PrivateExtractIcons because it returned "1" on the problematic icons (ROS.ico) which kept the default document icon from being applied in the code just below. (Backed by Tests)
win32ss/user/user32/misc/exticon.c
Outdated
* is zero (0) for PNG ones using ExtractIconEx and | ||
* one (1) for PNG icons using PrivateExtractIcons. | ||
* We can handle the difference using the fUser32 flag.*/ | ||
BOOL fUser32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation does not look fully clear to me:
your code difference seems to be between PrivateExtractIconsW()
and PrivateExtractIconsExW()
,
not ExtractIconExW()
and PrivateExtractIconsW()
.
Then, param name looks somewhat odd too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review comments elsewhere from you regarding:
There are other ExtractIconExW() calls in shell32 (and elsewhere).
Does only this one need to be changed? (Why?)
and from @HBeluse regarding:
Do we also have tests (maybe in an apitest or winetest for user32) for the PrivateExtractIconsW and PrivateExtractIconExW (undocumented) functions?
You can let me know if you still have questions. Thanks.
I am not sure how to know if it happens on Wine. When I run explorer.exe on wine, I see the following on my 'icon' directory. It seems that nothing is shown at all for the icon image other than a default. On second thought, I think that with the present code, that is what is expected before these fixes. |
We do have user32_apitest.exe for PrivateExtractIconsEx(W) and soon I will have a PR for additional tests for this. This is a documented API. For the PrivateExtractIconExW this is not a documented API, but only a ReactOS function, so there is probably no need for tests on it. It is actually the endpoint for the documented API for ExtractIconEx which is tested by our shell32_apitest:ExtractIconEx with more recent tests after the merge of my PR. The calls for ExtractIconEx are as follows: Shell32 has ExtractIconExW in dll/win32/shell32/iconcache.cpp at about Line # 866. This calls PrivateExtractIconExW in win32/user/user32/misc/exticon.c at about Line# 884 using a GetProcAddress on User32.dll. PrivateExtractIconExW then calls ICO_ExtractIconExW at about existing Line# 838 in exticon.c. The common function that is called from both Shell32 and User32 is ICO_ExtractIconExW in exticon.c. It either gets called from the API functions of ExtractIconEx(W) (in Shell32) or PrivateExtractIcons(W) (in User32). This was the reason for the 'fUser32' flag name. I am open to any suggestion for a new name for it if you please. Thanks. |
Co-authored-by: Joachim Henze <joachim.henze@reactos.org>
Thanks for your contribution! |
…RE-18897 by porting back: 0.4.15-dev-6030-g 8a7b5a9 [SHELL32][USER32] Fix icon regression and one test (#5207) CORE-18897 It regressed by 0.4.14-dev-459-g cfdbccf I actually am not a huge fan of the code-flow-splitup and all those ifdefs, but it fixes the regression. Therefore I will not port that back further than releases/0.4.14 for now. ------------ Also partially pick 0.4.15-dev-3642-g 83be315 [SHELL32] Use wide char string literals. (only the part in CFSFolder.cpp) I might pick the other parts later. ------------ Binary size remains under control: 0.4.14 shell32.dll GCC4.7.2 RosBE2.1.6 dbg-cfg 9.345.024 -> 9.345.024 0.4.14 user32.dll GCC4.7.2 RosBE2.1.6 dbg-cfg 1.448.448 -> 1.448.448
Fix icon regression of cfdbccf and fix a shell32:ExtractIconEx test.
Even more failing tests will be fixed after #5169 is committed.
Modify some return values in exticon.c based on from where they are called.
JIRA issue: CORE-18897
Allow different icon count return values from shell32:ExtractIconEx and user32:PrivateExtractIcons.
Change some return values in common function ICO_ExtractIconExW based on from where they are called.