diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c index f8ee23599c2..bd50ea54bf6 100644 --- a/dlls/shlwapi/path.c +++ b/dlls/shlwapi/path.c @@ -2773,13 +2773,13 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx) strcpyW(sPath, szEllipses); strcpyW(sPath+3, buff); } - if (hdc) - ReleaseDC(0, hdc); - return TRUE; + bRet = TRUE; + goto end; } strcpyW(lpszPath, szEllipses); strcpyW(lpszPath+3, buff); - return FALSE; + bRet = FALSE; + goto end; } /* Trim the path by adding ellipses to the end, e.g: @@ -2819,6 +2819,7 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx) } } +end: if (hdc) ReleaseDC(0, hdc); diff --git a/windows/cursoricon.c b/windows/cursoricon.c index 67d887c86d5..4205b4be3dd 100644 --- a/windows/cursoricon.c +++ b/windows/cursoricon.c @@ -1725,7 +1725,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon, HBRUSH hbr, UINT flags ) { CURSORICONINFO *ptr = (CURSORICONINFO *)GlobalLock16(HICON_16(hIcon)); - HDC hDC_off = 0, hMemDC = CreateCompatibleDC (hdc); + HDC hDC_off = 0, hMemDC; BOOL result = FALSE, DoOffscreen; HBITMAP hB_off = 0, hOld = 0; @@ -1734,6 +1734,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon, hdc,x0,y0,hIcon,cxWidth,cyWidth,istep,hbr,flags ); + hMemDC = CreateCompatibleDC (hdc); if (istep) FIXME_(icon)("Ignoring istep=%d\n", istep); if (flags & DI_COMPAT) diff --git a/windows/nonclient.c b/windows/nonclient.c index 707ebf1cb08..62d4b7abe18 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -2208,7 +2208,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) BOOL NC_DrawGrayButton(HDC hdc, int x, int y) { HBITMAP hMaskBmp; - HDC hdcMask = CreateCompatibleDC (0); + HDC hdcMask; HBRUSH hOldBrush; hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask); @@ -2216,6 +2216,7 @@ BOOL NC_DrawGrayButton(HDC hdc, int x, int y) if(hMaskBmp == 0) return FALSE; + hdcMask = CreateCompatibleDC (0); SelectObject (hdcMask, hMaskBmp); /* Draw the grayed bitmap using the mask */