diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index aa1bdf5b7e4..df6a40879fa 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) {