-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[USER32_APTEST][USER32] CopyImage improve regression test and function. #7524
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
Conversation
ZeroMemory(&bmi, sizeof(bmi)); | ||
bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); | ||
|
||
hDC = GetDC(NULL); // Screen hdc |
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.
In principle this call shouldn't fail, but....
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.
But does it matter for DIB_RGB_COLORS? It might be a palette thing?
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.
@HBelusca, I did a non-exhaustive search of the ReactOS code base and in most cases where we use this code:
GetDC(NULL);
there is no error checking, but since you pointed this out, now I check if hDC
is NULL.
If so, we will output an error message and skip the GetDIBits call that used this value.
We needed to free the iconinfo
items, so we could not return here, but eventually after the failing "IF" test below, we will return "NULL".
@whindsaks, Sorry I do not understand your question about DIB_RGB_COLORS. Can you be more specific. Thanks.
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.
My question was, does GetDIBits need a hdc with DIB_RGB_COLORS or is it only really needed for DIB_PAL_COLORS (palette).
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.
@whindsaks, I do not really know the answer to your question, but it was a good one. In researching it, I found a much simpler way to get the width and height from an HBITMAP. So instead of using GetDIBits, I now use GetObject. So there is no longer any use of the DIB_PAL_COLORS of DIB_RGB_COLORS involved here. Thanks.
Thanks for everyone's help with this and for approvals from @HBelusca, @oleg-dubinskiy and @DarkFire01. |
Purpose
Improve CopyImage funciton by adding fast return when HANDLE is NULL and remove previous HACK.
JIRA issue: CORE-19806
CORE-17902
Proposed changes
Test for HANDLE == NULL and set LastError and do fast return if true.
Improve previous HACK in PR #6886 and commit d3ec7cd.