[FORMATTING]

Remove trailing whitespaces. No code change.

svn path=/trunk/; revision=69781
This commit is contained in:
Timo Kreuzer 2015-11-01 20:03:31 +00:00
parent 3a7bc4c929
commit ee7e189a4e

View file

@ -51,7 +51,7 @@ User32SetupDefaultCursors(PVOID Arguments,
ULONG ArgumentLength) ULONG ArgumentLength)
{ {
BOOL *DefaultCursor = (BOOL*)Arguments; BOOL *DefaultCursor = (BOOL*)Arguments;
HCURSOR hCursor; HCURSOR hCursor;
/* Load system cursors first */ /* Load system cursors first */
LoadSystemCursors(); LoadSystemCursors();
@ -299,12 +299,12 @@ create_alpha_bitmap(
BITMAPINFO *info = NULL; BITMAPINFO *info = NULL;
TRACE("Creating alpha bitmap from existing bitmap.\n"); TRACE("Creating alpha bitmap from existing bitmap.\n");
if (!GetObjectW( color, sizeof(bm), &bm )) if (!GetObjectW( color, sizeof(bm), &bm ))
goto done; goto done;
if (bm.bmBitsPixel != 32) if (bm.bmBitsPixel != 32)
goto done; goto done;
size = get_dib_image_size(bm.bmWidth, bm.bmHeight, 32); size = get_dib_image_size(bm.bmWidth, bm.bmHeight, 32);
info = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256])); info = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256]));
@ -321,7 +321,7 @@ create_alpha_bitmap(
info->bmiHeader.biYPelsPerMeter = 0; info->bmiHeader.biYPelsPerMeter = 0;
info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biClrImportant = 0; info->bmiHeader.biClrImportant = 0;
bits = HeapAlloc(GetProcessHeap(), 0, size); bits = HeapAlloc(GetProcessHeap(), 0, size);
if(!bits) if(!bits)
{ {
@ -435,8 +435,8 @@ done:
DeleteDC(hdcScreen); DeleteDC(hdcScreen);
DeleteDC( hdc ); DeleteDC( hdc );
if(bits) HeapFree(GetProcessHeap(), 0, bits); if(bits) HeapFree(GetProcessHeap(), 0, bits);
TRACE("Returning 0x%08x.\n", alpha); TRACE("Returning 0x%08x.\n", alpha);
return alpha; return alpha;
} }
@ -485,7 +485,7 @@ get_best_icon_file_entry(
if (dwFileSize < FIELD_OFFSET(CURSORICONFILEDIR, idEntries[dir->idCount])) if (dwFileSize < FIELD_OFFSET(CURSORICONFILEDIR, idEntries[dir->idCount]))
return NULL; return NULL;
/* /*
* Cute little hack: * Cute little hack:
* We allocate a buffer, fake it as if it was a pointer to a resource in a module, * We allocate a buffer, fake it as if it was a pointer to a resource in a module,
* pass it to LookupIconIdFromDirectoryEx and get back the index we have to use * pass it to LookupIconIdFromDirectoryEx and get back the index we have to use
@ -534,7 +534,7 @@ get_best_icon_file_entry(
fakeEntry->dwBytesInRes = entry->dwDIBSize; fakeEntry->dwBytesInRes = entry->dwDIBSize;
fakeEntry->wResId = i + 1; fakeEntry->wResId = i + 1;
} }
/* Now call LookupIconIdFromResourceEx */ /* Now call LookupIconIdFromResourceEx */
i = LookupIconIdFromDirectoryEx((PBYTE)fakeDir, bIcon, cxDesired, cyDesired, fuLoad & LR_MONOCHROME); i = LookupIconIdFromDirectoryEx((PBYTE)fakeDir, bIcon, cxDesired, cyDesired, fuLoad & LR_MONOCHROME);
/* We don't need this anymore */ /* We don't need this anymore */
@ -575,8 +575,8 @@ get_best_icon_file_offset(
return 0; return 0;
} }
/************* IMPLEMENTATION CORE ****************/ /************* IMPLEMENTATION CORE ****************/
@ -596,20 +596,20 @@ static BOOL CURSORICON_GetCursorDataFromBMI(
HBITMAP hbmpOld = NULL; HBITMAP hbmpOld = NULL;
BOOL bResult = FALSE; BOOL bResult = FALSE;
const VOID *pvColor, *pvMask; const VOID *pvColor, *pvMask;
ibmpType = DIB_GetBitmapInfo(&pbmi->bmiHeader, &width, &height, &bpp, &compr); ibmpType = DIB_GetBitmapInfo(&pbmi->bmiHeader, &width, &height, &bpp, &compr);
/* Invalid data */ /* Invalid data */
if(ibmpType < 0) if(ibmpType < 0)
return FALSE; return FALSE;
/* No compression for icons */ /* No compression for icons */
if(compr != BI_RGB) if(compr != BI_RGB)
return FALSE; return FALSE;
/* If no dimensions were set, use the one from the icon */ /* If no dimensions were set, use the one from the icon */
if(!pdata->cx) pdata->cx = width; if(!pdata->cx) pdata->cx = width;
if(!pdata->cy) pdata->cy = height < 0 ? -height/2 : height/2; if(!pdata->cy) pdata->cy = height < 0 ? -height/2 : height/2;
/* Fix the hotspot coords */ /* Fix the hotspot coords */
if(pdata->rt == (USHORT)((ULONG_PTR)RT_CURSOR)) if(pdata->rt == (USHORT)((ULONG_PTR)RT_CURSOR))
{ {
@ -623,7 +623,7 @@ static BOOL CURSORICON_GetCursorDataFromBMI(
pdata->xHotspot = pdata->cx/2; pdata->xHotspot = pdata->cx/2;
pdata->yHotspot = pdata->cy/2; pdata->yHotspot = pdata->cy/2;
} }
hdcScreen = CreateDCW(DISPLAYW, NULL, NULL, NULL); hdcScreen = CreateDCW(DISPLAYW, NULL, NULL, NULL);
if(!hdcScreen) if(!hdcScreen)
return FALSE; return FALSE;
@ -633,23 +633,23 @@ static BOOL CURSORICON_GetCursorDataFromBMI(
DeleteDC(hdcScreen); DeleteDC(hdcScreen);
return FALSE; return FALSE;
} }
pbmiCopy = HeapAlloc(GetProcessHeap(), 0, max(ubmiSize, FIELD_OFFSET(BITMAPINFO, bmiColors[3]))); pbmiCopy = HeapAlloc(GetProcessHeap(), 0, max(ubmiSize, FIELD_OFFSET(BITMAPINFO, bmiColors[3])));
if(!pbmiCopy) if(!pbmiCopy)
goto done; goto done;
RtlCopyMemory(pbmiCopy, pbmi, ubmiSize); RtlCopyMemory(pbmiCopy, pbmi, ubmiSize);
/* In an icon/cursor, the BITMAPINFO holds twice the height */ /* In an icon/cursor, the BITMAPINFO holds twice the height */
if(pbmiCopy->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) if(pbmiCopy->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
((BITMAPCOREHEADER*)&pbmiCopy->bmiHeader)->bcHeight /= 2; ((BITMAPCOREHEADER*)&pbmiCopy->bmiHeader)->bcHeight /= 2;
else else
pbmiCopy->bmiHeader.biHeight /= 2; pbmiCopy->bmiHeader.biHeight /= 2;
height /= 2; height /= 2;
pvColor = (const char*)pbmi + ubmiSize; pvColor = (const char*)pbmi + ubmiSize;
pvMask = (const char*)pvColor + pvMask = (const char*)pvColor +
get_dib_image_size(width, height, bpp ); get_dib_image_size(width, height, bpp );
/* Set XOR bits */ /* Set XOR bits */
if(monochrome) if(monochrome)
{ {
@ -661,7 +661,7 @@ static BOOL CURSORICON_GetCursorDataFromBMI(
hbmpOld = SelectObject(hdc, pdata->hbmMask); hbmpOld = SelectObject(hdc, pdata->hbmMask);
if(!hbmpOld) if(!hbmpOld)
goto done; goto done;
if(!StretchDIBits(hdc, 0, pdata->cy, pdata->cx, pdata->cy, if(!StretchDIBits(hdc, 0, pdata->cy, pdata->cx, pdata->cy,
0, 0, width, height, 0, 0, width, height,
pvColor, pbmiCopy, DIB_RGB_COLORS, SRCCOPY)) pvColor, pbmiCopy, DIB_RGB_COLORS, SRCCOPY))
@ -687,7 +687,7 @@ static BOOL CURSORICON_GetCursorDataFromBMI(
goto done; goto done;
pdata->bpp = GetDeviceCaps(hdcScreen, BITSPIXEL); pdata->bpp = GetDeviceCaps(hdcScreen, BITSPIXEL);
pdata->hbmAlpha = create_alpha_bitmap(NULL, pbmiCopy, pvColor, pdata->cx, pdata->cy); pdata->hbmAlpha = create_alpha_bitmap(NULL, pbmiCopy, pvColor, pdata->cx, pdata->cy);
/* Now convert the info to monochrome for the mask bits */ /* Now convert the info to monochrome for the mask bits */
if (pbmiCopy->bmiHeader.biSize != sizeof(BITMAPCOREHEADER)) if (pbmiCopy->bmiHeader.biSize != sizeof(BITMAPCOREHEADER))
{ {
@ -713,8 +713,8 @@ static BOOL CURSORICON_GetCursorDataFromBMI(
goto done; goto done;
bResult = StretchDIBits(hdc, 0, 0, pdata->cx, pdata->cy, bResult = StretchDIBits(hdc, 0, 0, pdata->cx, pdata->cy,
0, 0, width, height, 0, 0, width, height,
pvMask, pbmiCopy, DIB_RGB_COLORS, SRCCOPY) != 0; pvMask, pbmiCopy, DIB_RGB_COLORS, SRCCOPY) != 0;
done: done:
DeleteDC(hdcScreen); DeleteDC(hdcScreen);
if(hbmpOld) SelectObject(hdc, hbmpOld); if(hbmpOld) SelectObject(hdc, hbmpOld);
@ -743,7 +743,7 @@ static BOOL CURSORICON_GetCursorDataFromIconInfo(
/* We must convert the color bitmap to screen format */ /* We must convert the color bitmap to screen format */
HDC hdcScreen, hdcMem; HDC hdcScreen, hdcMem;
HBITMAP hbmpPrev; HBITMAP hbmpPrev;
/* The mask dictates its dimensions */ /* The mask dictates its dimensions */
if (!GetObject(pIconInfo->hbmMask, sizeof(bm), &bm)) if (!GetObject(pIconInfo->hbmMask, sizeof(bm), &bm))
return FALSE; return FALSE;
@ -777,7 +777,7 @@ static BOOL CURSORICON_GetCursorDataFromIconInfo(
pCursorData->hbmMask = CopyImage(pIconInfo->hbmMask, IMAGE_BITMAP, 0, 0, LR_MONOCHROME); pCursorData->hbmMask = CopyImage(pIconInfo->hbmMask, IMAGE_BITMAP, 0, 0, LR_MONOCHROME);
if(!pCursorData->hbmMask) if(!pCursorData->hbmMask)
return FALSE; return FALSE;
/* Now, fill some information */ /* Now, fill some information */
pCursorData->rt = (USHORT)((ULONG_PTR)(pIconInfo->fIcon ? RT_ICON : RT_CURSOR)); pCursorData->rt = (USHORT)((ULONG_PTR)(pIconInfo->fIcon ? RT_ICON : RT_CURSOR));
if(pCursorData->hbmColor) if(pCursorData->hbmColor)
@ -796,7 +796,7 @@ static BOOL CURSORICON_GetCursorDataFromIconInfo(
pCursorData->cx = bm.bmWidth; pCursorData->cx = bm.bmWidth;
pCursorData->cy = bm.bmHeight/2; pCursorData->cy = bm.bmHeight/2;
} }
if(pIconInfo->fIcon) if(pIconInfo->fIcon)
{ {
pCursorData->xHotspot = pCursorData->cx/2; pCursorData->xHotspot = pCursorData->cx/2;
@ -807,7 +807,7 @@ static BOOL CURSORICON_GetCursorDataFromIconInfo(
pCursorData->xHotspot = pIconInfo->xHotspot; pCursorData->xHotspot = pIconInfo->xHotspot;
pCursorData->yHotspot = pIconInfo->yHotspot; pCursorData->yHotspot = pIconInfo->yHotspot;
} }
return TRUE; return TRUE;
} }
@ -859,7 +859,7 @@ static void dump_ani_header( const ani_header *header )
TRACE(" flags: 0x%08x\n", header->flags); TRACE(" flags: 0x%08x\n", header->flags);
} }
/* Find an animated cursor chunk, given its type and ID */ /* Find an animated cursor chunk, given its type and ID */
static void riff_find_chunk( DWORD chunk_id, DWORD chunk_type, const riff_chunk_t *parent_chunk, riff_chunk_t *chunk ) static void riff_find_chunk( DWORD chunk_id, DWORD chunk_type, const riff_chunk_t *parent_chunk, riff_chunk_t *chunk )
{ {
const unsigned char *ptr = parent_chunk->data; const unsigned char *ptr = parent_chunk->data;
@ -958,7 +958,7 @@ static BOOL CURSORICON_GetCursorDataFromANI(
if(pHeader->num_frames > 1) if(pHeader->num_frames > 1)
{ {
/* Allocate frame descriptors, step indices and rates */ /* Allocate frame descriptors, step indices and rates */
pCurData->aspcur = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pCurData->aspcur = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
pHeader->num_frames * sizeof(CURSORDATA) + pHeader->num_steps * (sizeof(DWORD) + sizeof(INT))); pHeader->num_frames * sizeof(CURSORDATA) + pHeader->num_steps * (sizeof(DWORD) + sizeof(INT)));
if(!pCurData->aspcur) if(!pCurData->aspcur)
{ {
@ -981,7 +981,7 @@ static BOOL CURSORICON_GetCursorDataFromANI(
pFrameData = pCurData; pFrameData = pCurData;
pFrameData->rt = pCurData->rt; pFrameData->rt = pCurData->rt;
if (pHeader->flags & ANI_FLAG_ICON) if (pHeader->flags & ANI_FLAG_ICON)
{ {
/* The chunks describe an icon file */ /* The chunks describe an icon file */
@ -1025,8 +1025,8 @@ static BOOL CURSORICON_GetCursorDataFromANI(
pFrameData->CURSORF_flags |= CURSORF_ACONFRAME; pFrameData->CURSORF_flags |= CURSORF_ACONFRAME;
else else
pFrameData->CURSORF_flags &= ~CURSORF_ACON; pFrameData->CURSORF_flags &= ~CURSORF_ACON;
/* Next frame */ /* Next frame */
icon_chunk += chunk_size + (2 * sizeof(DWORD)); icon_chunk += chunk_size + (2 * sizeof(DWORD));
icon_data = icon_chunk + (2 * sizeof(DWORD)); icon_data = icon_chunk + (2 * sizeof(DWORD));
@ -1091,7 +1091,7 @@ BITMAP_LoadImageW(
if(fuLoad & LR_LOADFROMFILE) if(fuLoad & LR_LOADFROMFILE)
{ {
const BITMAPFILEHEADER* pbmfh; const BITMAPFILEHEADER* pbmfh;
pvMapping = map_fileW(lpszName, NULL); pvMapping = map_fileW(lpszName, NULL);
if(!pvMapping) if(!pvMapping)
return NULL; return NULL;
@ -1102,7 +1102,7 @@ BITMAP_LoadImageW(
goto end; goto end;
} }
pbmi = (const BITMAPINFO*)(pbmfh + 1); pbmi = (const BITMAPINFO*)(pbmfh + 1);
/* Get the image bits */ /* Get the image bits */
if(pbmfh->bfOffBits) if(pbmfh->bfOffBits)
dwOffset = pbmfh->bfOffBits - sizeof(BITMAPFILEHEADER); dwOffset = pbmfh->bfOffBits - sizeof(BITMAPFILEHEADER);
@ -1110,7 +1110,7 @@ BITMAP_LoadImageW(
else else
{ {
HRSRC hrsrc; HRSRC hrsrc;
/* Caller wants an OEM bitmap */ /* Caller wants an OEM bitmap */
if(!hinst) if(!hinst)
hinst = User32Instance; hinst = User32Instance;
@ -1124,7 +1124,7 @@ BITMAP_LoadImageW(
if(!pbmi) if(!pbmi)
return NULL; return NULL;
} }
/* Fix up values */ /* Fix up values */
if(DIB_GetBitmapInfo(&pbmi->bmiHeader, &width, &height, &bpp, &compr) == -1) if(DIB_GetBitmapInfo(&pbmi->bmiHeader, &width, &height, &bpp, &compr) == -1)
goto end; goto end;
@ -1136,9 +1136,9 @@ BITMAP_LoadImageW(
cyDesired = height; cyDesired = height;
else if(height < 0) else if(height < 0)
cyDesired = -cyDesired; cyDesired = -cyDesired;
iBMISize = bitmap_info_size(pbmi, DIB_RGB_COLORS); iBMISize = bitmap_info_size(pbmi, DIB_RGB_COLORS);
/* Get a pointer to the image data */ /* Get a pointer to the image data */
pvBits = (char*)pbmi + (dwOffset ? dwOffset : iBMISize); pvBits = (char*)pbmi + (dwOffset ? dwOffset : iBMISize);
@ -1147,7 +1147,7 @@ BITMAP_LoadImageW(
if(!pbmiCopy) if(!pbmiCopy)
goto end; goto end;
CopyMemory(pbmiCopy, pbmi, iBMISize); CopyMemory(pbmiCopy, pbmi, iBMISize);
/* Fix it up, if needed */ /* Fix it up, if needed */
if(fuLoad & (LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS)) if(fuLoad & (LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS))
{ {
@ -1157,7 +1157,7 @@ BITMAP_LoadImageW(
COLORREF crWindow, cr3DShadow, cr3DFace, cr3DLight; COLORREF crWindow, cr3DShadow, cr3DFace, cr3DLight;
BYTE pixel = *((BYTE*)pvBits); BYTE pixel = *((BYTE*)pvBits);
UINT i; UINT i;
if(pbmiCopy->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) if(pbmiCopy->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{ {
bpp = ((BITMAPCOREHEADER*)&pbmiCopy->bmiHeader)->bcBitCount; bpp = ((BITMAPCOREHEADER*)&pbmiCopy->bmiHeader)->bcBitCount;
@ -1174,18 +1174,18 @@ BITMAP_LoadImageW(
if(numColors > 256) numColors = 256; if(numColors > 256) numColors = 256;
if (!numColors && (bpp <= 8)) numColors = 1 << bpp; if (!numColors && (bpp <= 8)) numColors = 1 << bpp;
} }
if(bpp > 8) if(bpp > 8)
goto create_bitmap; goto create_bitmap;
pbmiColors = (char*)pbmiCopy + pbmiCopy->bmiHeader.biSize; pbmiColors = (char*)pbmiCopy + pbmiCopy->bmiHeader.biSize;
/* Get the relevant colors */ /* Get the relevant colors */
crWindow = GetSysColor(COLOR_WINDOW); crWindow = GetSysColor(COLOR_WINDOW);
cr3DShadow = GetSysColor(COLOR_3DSHADOW); cr3DShadow = GetSysColor(COLOR_3DSHADOW);
cr3DFace = GetSysColor(COLOR_3DFACE); cr3DFace = GetSysColor(COLOR_3DFACE);
cr3DLight = GetSysColor(COLOR_3DLIGHT); cr3DLight = GetSysColor(COLOR_3DLIGHT);
/* Fix the transparent palette entry */ /* Fix the transparent palette entry */
if(fuLoad & LR_LOADTRANSPARENT) if(fuLoad & LR_LOADTRANSPARENT)
{ {
@ -1198,16 +1198,16 @@ BITMAP_LoadImageW(
FIXME("Unhandled bit depth %d.\n", bpp); FIXME("Unhandled bit depth %d.\n", bpp);
goto create_bitmap; goto create_bitmap;
} }
if(pixel >= numColors) if(pixel >= numColors)
{ {
ERR("Wrong pixel passed in.\n"); ERR("Wrong pixel passed in.\n");
goto create_bitmap; goto create_bitmap;
} }
/* If both flags are set, we must use COLOR_3DFACE */ /* If both flags are set, we must use COLOR_3DFACE */
if(fuLoad & LR_LOADMAP3DCOLORS) crWindow = cr3DFace; if(fuLoad & LR_LOADMAP3DCOLORS) crWindow = cr3DFace;
/* Define the color */ /* Define the color */
ptr = (RGBTRIPLE*)(pbmiColors + pixel*incr); ptr = (RGBTRIPLE*)(pbmiColors + pixel*incr);
ptr->rgbtBlue = GetBValue(crWindow); ptr->rgbtBlue = GetBValue(crWindow);
@ -1215,7 +1215,7 @@ BITMAP_LoadImageW(
ptr->rgbtRed = GetRValue(crWindow); ptr->rgbtRed = GetRValue(crWindow);
goto create_bitmap; goto create_bitmap;
} }
/* If we are here, then LR_LOADMAP3DCOLORS is set without LR_TRANSPARENT */ /* If we are here, then LR_LOADMAP3DCOLORS is set without LR_TRANSPARENT */
for(i = 0; i<numColors; i++) for(i = 0; i<numColors; i++)
{ {
@ -1252,7 +1252,7 @@ create_bitmap:
if(!pbmiScaled) if(!pbmiScaled)
goto end; goto end;
CopyMemory(pbmiScaled, pbmiCopy, iBMISize); CopyMemory(pbmiScaled, pbmiCopy, iBMISize);
/* Fix it up */ /* Fix it up */
if(pbmiScaled->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) if(pbmiScaled->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{ {
@ -1268,10 +1268,10 @@ create_bitmap:
pbmiScaled->bmiHeader.biCompression = BI_RGB; pbmiScaled->bmiHeader.biCompression = BI_RGB;
} }
} }
/* Top-down image */ /* Top-down image */
if(cyDesired < 0) cyDesired = -cyDesired; if(cyDesired < 0) cyDesired = -cyDesired;
/* We need a device context */ /* We need a device context */
hdcScreen = CreateDCW(DISPLAYW, NULL, NULL, NULL); hdcScreen = CreateDCW(DISPLAYW, NULL, NULL, NULL);
if(!hdcScreen) if(!hdcScreen)
@ -1279,7 +1279,7 @@ create_bitmap:
hdc = CreateCompatibleDC(hdcScreen); hdc = CreateCompatibleDC(hdcScreen);
if(!hdc) if(!hdc)
goto end; goto end;
/* Now create the bitmap */ /* Now create the bitmap */
if(fuLoad & LR_CREATEDIBSECTION) if(fuLoad & LR_CREATEDIBSECTION)
hbmpRet = CreateDIBSection(hdc, pbmiScaled, DIB_RGB_COLORS, NULL, 0, 0); hbmpRet = CreateDIBSection(hdc, pbmiScaled, DIB_RGB_COLORS, NULL, 0, 0);
@ -1290,10 +1290,10 @@ create_bitmap:
else else
hbmpRet = CreateCompatibleBitmap(hdcScreen, cxDesired, cyDesired); hbmpRet = CreateCompatibleBitmap(hdcScreen, cxDesired, cyDesired);
} }
if(!hbmpRet) if(!hbmpRet)
goto end; goto end;
hbmpOld = SelectObject(hdc, hbmpRet); hbmpOld = SelectObject(hdc, hbmpRet);
if(!hbmpOld) if(!hbmpOld)
goto end; goto end;
@ -1362,7 +1362,7 @@ CURSORICON_LoadFromFileW(
entry = get_best_icon_file_entry(dir, filesize, cxDesired, cyDesired, bIcon, fuLoad); entry = get_best_icon_file_entry(dir, filesize, cxDesired, cyDesired, bIcon, fuLoad);
if(!entry) if(!entry)
goto end; goto end;
/* Fix dimensions */ /* Fix dimensions */
if(!cxDesired) cxDesired = entry->bWidth; if(!cxDesired) cxDesired = entry->bWidth;
if(!cyDesired) cyDesired = entry->bHeight; if(!cyDesired) cyDesired = entry->bHeight;
@ -1374,15 +1374,15 @@ CURSORICON_LoadFromFileW(
cursorData.yHotspot = entry->yHotspot; cursorData.yHotspot = entry->yHotspot;
} }
cursorData.rt = (USHORT)((ULONG_PTR)(bIcon ? RT_ICON : RT_CURSOR)); cursorData.rt = (USHORT)((ULONG_PTR)(bIcon ? RT_ICON : RT_CURSOR));
/* Do the dance */ /* Do the dance */
if(!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)(&bits[entry->dwDIBOffset]))) if(!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)(&bits[entry->dwDIBOffset])))
goto end; goto end;
hCurIcon = NtUserxCreateEmptyCurObject(FALSE); hCurIcon = NtUserxCreateEmptyCurObject(FALSE);
if(!hCurIcon) if(!hCurIcon)
goto end; goto end;
/* Tell win32k */ /* Tell win32k */
if(!NtUserSetCursorIconData(hCurIcon, NULL, NULL, &cursorData)) if(!NtUserSetCursorIconData(hCurIcon, NULL, NULL, &cursorData))
{ {
@ -1400,7 +1400,7 @@ end_error:
if(cursorData.hbmColor) DeleteObject(cursorData.hbmColor); if(cursorData.hbmColor) DeleteObject(cursorData.hbmColor);
if(cursorData.hbmAlpha) DeleteObject(cursorData.hbmAlpha); if(cursorData.hbmAlpha) DeleteObject(cursorData.hbmAlpha);
UnmapViewOfFile(bits); UnmapViewOfFile(bits);
return NULL; return NULL;
} }
@ -1589,7 +1589,7 @@ CURSORICON_LoadImageW(
/* Tell win32k */ /* Tell win32k */
bStatus = NtUserSetCursorIconData(hCurIcon, hinst ? &ustrModule : NULL, lpszName ? &ustrRsrc : NULL, &cursorData); bStatus = NtUserSetCursorIconData(hCurIcon, hinst ? &ustrModule : NULL, lpszName ? &ustrRsrc : NULL, &cursorData);
if(!bStatus) if(!bStatus)
{ {
NtUserDestroyCursor(hCurIcon, TRUE); NtUserDestroyCursor(hCurIcon, TRUE);
@ -1633,7 +1633,7 @@ BITMAP_CopyImage(
{ {
FIXME("The flag LR_COPYFROMRESOURCE is not implemented for bitmaps\n"); FIXME("The flag LR_COPYFROMRESOURCE is not implemented for bitmaps\n");
} }
if (flags & LR_COPYRETURNORG) if (flags & LR_COPYRETURNORG)
{ {
FIXME("The flag LR_COPYRETURNORG is not implemented for bitmaps\n"); FIXME("The flag LR_COPYRETURNORG is not implemented for bitmaps\n");
@ -1696,7 +1696,7 @@ BITMAP_CopyImage(
{ {
/* Look if the colors of the DIB are black and white */ /* Look if the colors of the DIB are black and white */
monochrome = monochrome =
(bi->bmiColors[0].rgbRed == 0xff (bi->bmiColors[0].rgbRed == 0xff
&& bi->bmiColors[0].rgbGreen == 0xff && bi->bmiColors[0].rgbGreen == 0xff
&& bi->bmiColors[0].rgbBlue == 0xff && bi->bmiColors[0].rgbBlue == 0xff
@ -1814,17 +1814,17 @@ CURSORICON_CopyImage(
HICON ret = NULL; HICON ret = NULL;
ICONINFO ii; ICONINFO ii;
CURSORDATA CursorData; CURSORDATA CursorData;
if (fuFlags & LR_COPYFROMRESOURCE) if (fuFlags & LR_COPYFROMRESOURCE)
{ {
/* Get the icon module/resource names */ /* Get the icon module/resource names */
UNICODE_STRING ustrModule; UNICODE_STRING ustrModule;
UNICODE_STRING ustrRsrc; UNICODE_STRING ustrRsrc;
HMODULE hModule; HMODULE hModule;
ustrModule.MaximumLength = 0; ustrModule.MaximumLength = 0;
ustrRsrc.MaximumLength = 0; ustrRsrc.MaximumLength = 0;
/* Get the buffer size */ /* Get the buffer size */
if (!NtUserGetIconInfo(hicon, NULL, &ustrModule, &ustrRsrc, NULL, FALSE)) if (!NtUserGetIconInfo(hicon, NULL, &ustrModule, &ustrRsrc, NULL, FALSE))
{ {
@ -1837,7 +1837,7 @@ CURSORICON_CopyImage(
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
if (ustrRsrc.MaximumLength) if (ustrRsrc.MaximumLength)
{ {
ustrRsrc.Buffer = HeapAlloc(GetProcessHeap(), 0, ustrRsrc.MaximumLength); ustrRsrc.Buffer = HeapAlloc(GetProcessHeap(), 0, ustrRsrc.MaximumLength);
@ -1856,12 +1856,12 @@ CURSORICON_CopyImage(
HeapFree(GetProcessHeap(), 0, ustrRsrc.Buffer); HeapFree(GetProcessHeap(), 0, ustrRsrc.Buffer);
return NULL; return NULL;
} }
/* NULL-terminate our strings */ /* NULL-terminate our strings */
ustrModule.Buffer[ustrModule.Length/sizeof(WCHAR)] = UNICODE_NULL; ustrModule.Buffer[ustrModule.Length/sizeof(WCHAR)] = UNICODE_NULL;
if (!IS_INTRESOURCE(ustrRsrc.Buffer)) if (!IS_INTRESOURCE(ustrRsrc.Buffer))
ustrRsrc.Buffer[ustrRsrc.Length/sizeof(WCHAR)] = UNICODE_NULL; ustrRsrc.Buffer[ustrRsrc.Length/sizeof(WCHAR)] = UNICODE_NULL;
TRACE("Got module %wZ, resource %p (%S).\n", &ustrModule, TRACE("Got module %wZ, resource %p (%S).\n", &ustrModule,
ustrRsrc.Buffer, IS_INTRESOURCE(ustrRsrc.Buffer) ? L"" : ustrRsrc.Buffer); ustrRsrc.Buffer, IS_INTRESOURCE(ustrRsrc.Buffer) ? L"" : ustrRsrc.Buffer);
@ -1873,7 +1873,7 @@ CURSORICON_CopyImage(
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
goto leave; goto leave;
} }
/* Call the relevant function */ /* Call the relevant function */
ret = CURSORICON_LoadImageW( ret = CURSORICON_LoadImageW(
hModule, hModule,
@ -1882,24 +1882,24 @@ CURSORICON_CopyImage(
cyDesired, cyDesired,
fuFlags & (LR_DEFAULTSIZE | LR_SHARED), fuFlags & (LR_DEFAULTSIZE | LR_SHARED),
bIcon); bIcon);
FreeLibrary(hModule); FreeLibrary(hModule);
/* If we're here, that means that the passed icon is shared. Don't destroy it, even if LR_COPYDELETEORG is specified */ /* If we're here, that means that the passed icon is shared. Don't destroy it, even if LR_COPYDELETEORG is specified */
leave: leave:
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer); HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
if (!IS_INTRESOURCE(ustrRsrc.Buffer)) if (!IS_INTRESOURCE(ustrRsrc.Buffer))
HeapFree(GetProcessHeap(), 0, ustrRsrc.Buffer); HeapFree(GetProcessHeap(), 0, ustrRsrc.Buffer);
TRACE("Returning 0x%08x.\n", ret); TRACE("Returning 0x%08x.\n", ret);
return ret; return ret;
} }
/* This is a regular copy */ /* This is a regular copy */
if (fuFlags & ~(LR_COPYDELETEORG | LR_SHARED)) if (fuFlags & ~(LR_COPYDELETEORG | LR_SHARED))
FIXME("Unimplemented flags: 0x%08x\n", fuFlags); FIXME("Unimplemented flags: 0x%08x\n", fuFlags);
if (!GetIconInfo(hicon, &ii)) if (!GetIconInfo(hicon, &ii))
{ {
ERR("GetIconInfo failed.\n"); ERR("GetIconInfo failed.\n");
@ -1922,14 +1922,14 @@ CURSORICON_CopyImage(
NtUserDestroyCursor(ret, TRUE); NtUserDestroyCursor(ret, TRUE);
goto Leave; goto Leave;
} }
Leave: Leave:
DeleteObject(ii.hbmMask); DeleteObject(ii.hbmMask);
if (ii.hbmColor) DeleteObject(ii.hbmColor); if (ii.hbmColor) DeleteObject(ii.hbmColor);
if (ret && (fuFlags & LR_COPYDELETEORG)) if (ret && (fuFlags & LR_COPYDELETEORG))
DestroyIcon(hicon); DestroyIcon(hicon);
return ret; return ret;
} }
@ -2090,7 +2090,7 @@ HCURSOR WINAPI LoadCursorFromFileA(
) )
{ {
TRACE("%s\n", debugstr_a(lpFileName)); TRACE("%s\n", debugstr_a(lpFileName));
return LoadImageA(NULL, return LoadImageA(NULL,
lpFileName, lpFileName,
IMAGE_CURSOR, IMAGE_CURSOR,
@ -2104,7 +2104,7 @@ HCURSOR WINAPI LoadCursorFromFileW(
) )
{ {
TRACE("%s\n", debugstr_w(lpFileName)); TRACE("%s\n", debugstr_w(lpFileName));
return LoadImageW(NULL, return LoadImageW(NULL,
lpFileName, lpFileName,
IMAGE_CURSOR, IMAGE_CURSOR,
@ -2221,7 +2221,7 @@ int WINAPI LookupIconIdFromDirectoryEx(
ULONG bestScore = 0xFFFFFFFF, score; ULONG bestScore = 0xFFFFFFFF, score;
TRACE("%p, %x, %i, %i, %x.\n", presbits, fIcon, cxDesired, cyDesired, Flags); TRACE("%p, %x, %i, %i, %x.\n", presbits, fIcon, cxDesired, cyDesired, Flags);
if(!(dir && !dir->idReserved && (dir->idType & 3))) if(!(dir && !dir->idReserved && (dir->idType & 3)))
{ {
WARN("Invalid resource.\n"); WARN("Invalid resource.\n");
@ -2236,11 +2236,11 @@ int WINAPI LookupIconIdFromDirectoryEx(
icScreen = CreateICW(DISPLAYW, NULL, NULL, NULL); icScreen = CreateICW(DISPLAYW, NULL, NULL, NULL);
if(!icScreen) if(!icScreen)
return FALSE; return FALSE;
bppDesired = GetDeviceCaps(icScreen, BITSPIXEL); bppDesired = GetDeviceCaps(icScreen, BITSPIXEL);
DeleteDC(icScreen); DeleteDC(icScreen);
} }
if(!cxDesired) if(!cxDesired)
cxDesired = Flags & LR_DEFAULTSIZE ? GetSystemMetrics(fIcon ? SM_CXICON : SM_CXCURSOR) : 256; cxDesired = Flags & LR_DEFAULTSIZE ? GetSystemMetrics(fIcon ? SM_CXICON : SM_CXCURSOR) : 256;
if(!cyDesired) if(!cyDesired)
@ -2279,7 +2279,7 @@ int WINAPI LookupIconIdFromDirectoryEx(
bestScore = score; bestScore = score;
BitCount = entry->wBitCount; BitCount = entry->wBitCount;
} }
if(numMatch == 1) if(numMatch == 1)
{ {
/* Only one entry fits the asked dimensions */ /* Only one entry fits the asked dimensions */
@ -2288,8 +2288,8 @@ int WINAPI LookupIconIdFromDirectoryEx(
/* Avoid paletted icons on non-paletted device */ /* Avoid paletted icons on non-paletted device */
if (bppDesired > 8 && BitCount > 8) if (bppDesired > 8 && BitCount > 8)
notPaletted = TRUE; notPaletted = TRUE;
BitCount = 0; BitCount = 0;
iIndex = -1; iIndex = -1;
/* Now find the entry with the best depth */ /* Now find the entry with the best depth */
@ -2325,7 +2325,7 @@ int WINAPI LookupIconIdFromDirectoryEx(
if(iIndex >= 0) if(iIndex >= 0)
return dir->idEntries[iIndex].wResId; return dir->idEntries[iIndex].wResId;
/* No inferior or equal depth available. Get the smallest bigger one */ /* No inferior or equal depth available. Get the smallest bigger one */
BitCount = 0xFFFF; BitCount = 0xFFFF;
iIndex = -1; iIndex = -1;
@ -2356,7 +2356,7 @@ int WINAPI LookupIconIdFromDirectoryEx(
} }
if (iIndex >= 0) if (iIndex >= 0)
return dir->idEntries[iIndex].wResId; return dir->idEntries[iIndex].wResId;
return 0; return 0;
} }
@ -2421,9 +2421,9 @@ HICON WINAPI CreateIconFromResourceEx(
CURSORDATA cursorData; CURSORDATA cursorData;
HICON hIcon; HICON hIcon;
BOOL isAnimated; BOOL isAnimated;
TRACE("%p, %lu, %lu, %lu, %i, %i, %lu.\n", pbIconBits, cbIconBits, fIcon, dwVersion, cxDesired, cyDesired, uFlags); TRACE("%p, %lu, %lu, %lu, %i, %i, %lu.\n", pbIconBits, cbIconBits, fIcon, dwVersion, cxDesired, cyDesired, uFlags);
if(uFlags & LR_DEFAULTSIZE) if(uFlags & LR_DEFAULTSIZE)
{ {
if(!cxDesired) cxDesired = GetSystemMetrics(fIcon ? SM_CXICON : SM_CXCURSOR); if(!cxDesired) cxDesired = GetSystemMetrics(fIcon ? SM_CXICON : SM_CXCURSOR);
@ -2499,7 +2499,7 @@ HICON WINAPI CreateIconFromResourceEx(
cursorData.yHotspot = *pt++; cursorData.yHotspot = *pt++;
pbIconBits = (PBYTE)pt; pbIconBits = (PBYTE)pt;
} }
if (!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)pbIconBits)) if (!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)pbIconBits))
{ {
ERR("Couldn't fill the CURSORDATA structure.\n"); ERR("Couldn't fill the CURSORDATA structure.\n");
@ -2514,11 +2514,11 @@ HICON WINAPI CreateIconFromResourceEx(
if (uFlags & LR_SHARED) if (uFlags & LR_SHARED)
cursorData.CURSORF_flags |= CURSORF_LRSHARED; cursorData.CURSORF_flags |= CURSORF_LRSHARED;
hIcon = NtUserxCreateEmptyCurObject(isAnimated); hIcon = NtUserxCreateEmptyCurObject(isAnimated);
if (!hIcon) if (!hIcon)
goto end_error; goto end_error;
if(!NtUserSetCursorIconData(hIcon, NULL, NULL, &cursorData)) if(!NtUserSetCursorIconData(hIcon, NULL, NULL, &cursorData))
{ {
ERR("NtUserSetCursorIconData failed.\n"); ERR("NtUserSetCursorIconData failed.\n");
@ -2528,7 +2528,7 @@ HICON WINAPI CreateIconFromResourceEx(
if(isAnimated) if(isAnimated)
HeapFree(GetProcessHeap(), 0, cursorData.aspcur); HeapFree(GetProcessHeap(), 0, cursorData.aspcur);
return hIcon; return hIcon;
/* Clean up */ /* Clean up */
@ -2538,7 +2538,7 @@ end_error:
DeleteObject(cursorData.hbmMask); DeleteObject(cursorData.hbmMask);
if(cursorData.hbmColor) DeleteObject(cursorData.hbmColor); if(cursorData.hbmColor) DeleteObject(cursorData.hbmColor);
if(cursorData.hbmAlpha) DeleteObject(cursorData.hbmAlpha); if(cursorData.hbmAlpha) DeleteObject(cursorData.hbmAlpha);
return NULL; return NULL;
} }
@ -2549,26 +2549,26 @@ HICON WINAPI CreateIconIndirect(
/* As simple as creating a handle, and let win32k deal with the bitmaps */ /* As simple as creating a handle, and let win32k deal with the bitmaps */
HICON hiconRet; HICON hiconRet;
CURSORDATA cursorData; CURSORDATA cursorData;
TRACE("%p.\n", piconinfo); TRACE("%p.\n", piconinfo);
ZeroMemory(&cursorData, sizeof(cursorData)); ZeroMemory(&cursorData, sizeof(cursorData));
if(!CURSORICON_GetCursorDataFromIconInfo(&cursorData, piconinfo)) if(!CURSORICON_GetCursorDataFromIconInfo(&cursorData, piconinfo))
return NULL; return NULL;
hiconRet = NtUserxCreateEmptyCurObject(FALSE); hiconRet = NtUserxCreateEmptyCurObject(FALSE);
if(!hiconRet) if(!hiconRet)
goto end_error; goto end_error;
if(!NtUserSetCursorIconData(hiconRet, NULL, NULL, &cursorData)) if(!NtUserSetCursorIconData(hiconRet, NULL, NULL, &cursorData))
{ {
NtUserDestroyCursor(hiconRet, FALSE); NtUserDestroyCursor(hiconRet, FALSE);
goto end_error; goto end_error;
} }
TRACE("Returning 0x%08x.\n", hiconRet); TRACE("Returning 0x%08x.\n", hiconRet);
return hiconRet; return hiconRet;
end_error: end_error:
@ -2576,7 +2576,7 @@ end_error:
DeleteObject(cursorData.hbmMask); DeleteObject(cursorData.hbmMask);
if(cursorData.hbmColor) DeleteObject(cursorData.hbmColor); if(cursorData.hbmColor) DeleteObject(cursorData.hbmColor);
if(cursorData.hbmAlpha) DeleteObject(cursorData.hbmAlpha); if(cursorData.hbmAlpha) DeleteObject(cursorData.hbmAlpha);
return NULL; return NULL;
} }