Module: wine Branch: master Commit: 927875390de7e5338762eac97879aba178b1bbfa URL: http://source.winehq.org/git/wine.git/?a=commit;h=927875390de7e5338762eac978... Author: Andrew Riedi <andrewriedi(a)gmail.com> Date: Mon Mar 17 00:56:29 2008 -0700 user32: Move the bitmap header check as far up as possible. Based on a patchset by Henri Verbeet. --- dlls/user32/cursoricon.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index aa1bdf5..df6a408 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -701,12 +701,6 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize, hotspot = *pt; bmi = (BITMAPINFO *)(pt + 1); } - size = bitmap_info_size( bmi, DIB_RGB_COLORS ); - - if (!width) width = bmi->bmiHeader.biWidth; - if (!height) height = bmi->bmiHeader.biHeight/2; - DoStretch = (bmi->bmiHeader.biHeight/2 != height) || - (bmi->bmiHeader.biWidth != width); /* Check bitmap header */ @@ -718,6 +712,13 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize, return 0; } + size = bitmap_info_size( bmi, DIB_RGB_COLORS ); + + if (!width) width = bmi->bmiHeader.biWidth; + if (!height) height = bmi->bmiHeader.biHeight/2; + DoStretch = (bmi->bmiHeader.biHeight/2 != height) || + (bmi->bmiHeader.biWidth != width); + if (!screen_dc) screen_dc = CreateDCW( DISPLAYW, NULL, NULL, NULL ); if (screen_dc) {